Message ID | CAEb_=DHXL8OWD8j3_BzoDJPGiL_iGYQox209GGG-TpLJt=N-gQ@mail.gmail.com |
---|---|
State | New |
Headers | show |
Series | Output .lrc with correct end time | expand |
Context | Check | Description |
---|---|---|
yinshiyou/configure_loongarch64 | warning | Failed to apply patch |
On Wed, Oct 23, 2024 at 03:50:54PM +0800, Lu Renjia wrote: [...] > @@ -91,6 +101,8 @@ static int lrc_write_packet(AVFormatContext *s, > AVPacket *pkt) > while(line) { patch corrupted by a linebreak: Applying: Output .lrc with correct end time error: corrupt patch at line 38 error: could not build fake ancestor Patch failed at 0001 Output .lrc with correct end time thx [...]
I put the patch in the attachment of the email, please get it out of the attachment and try again. Michael Niedermayer <michael@niedermayer.cc> 于2024年10月23日周三 19:24写道: > > On Wed, Oct 23, 2024 at 03:50:54PM +0800, Lu Renjia wrote: > [...] > > @@ -91,6 +101,8 @@ static int lrc_write_packet(AVFormatContext *s, > > AVPacket *pkt) > > while(line) { > > patch corrupted by a linebreak: > > Applying: Output .lrc with correct end time > error: corrupt patch at line 38 > error: could not build fake ancestor > Patch failed at 0001 Output .lrc with correct end time > > thx > > [...] > > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > No human being will ever know the Truth, for even if they happen to say it > by chance, they would not even known they had done so. -- Xenophanes > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff --git a/libavformat/lrcenc.c b/libavformat/lrcenc.c index 7570529..37380cf 100644 --- a/libavformat/lrcenc.c +++ b/libavformat/lrcenc.c @@ -33,10 +33,19 @@ #include "libavutil/log.h" #include "libavutil/macros.h" +typedef struct LrcContext { + /** + * Look ahead timestamp pts + duration + */ + int64_t lookahead_te; +} LrcContext; + static int lrc_write_header(AVFormatContext *s) { const AVDictionaryEntry *metadata_item; + LrcContext *lc = s->priv_data; + lc->lookahead_te = 0; if(s->streams[0]->codecpar->codec_id != AV_CODEC_ID_SUBRIP && s->streams[0]->codecpar->codec_id != AV_CODEC_ID_TEXT) { av_log(s, AV_LOG_ERROR, "Unsupported subtitle codec: %s\n", @@ -77,6 +86,7 @@ static int lrc_write_header(AVFormatContext *s) static int lrc_write_packet(AVFormatContext *s, AVPacket *pkt) { + LrcContext *lc = s->priv_data; if(pkt->pts != AV_NOPTS_VALUE) { const uint8_t *line = pkt->data; const uint8_t *end = pkt->data + pkt->size; @@ -91,6 +101,8 @@ static int lrc_write_packet(AVFormatContext *s, AVPacket *pkt) while(line) { const uint8_t *next_line = memchr(line, '\n', end - line); size_t size = end - line; + const int64_t te = lc->lookahead_te; + lc->lookahead_te = pkt->pts + pkt->duration; if (next_line) {