diff --git a/libavformat/aqtitledec.c b/libavformat/aqtitledec.c index 95087665aa..7c864c8e10 100644 --- a/libavformat/aqtitledec.c +++ b/libavformat/aqtitledec.c @@ -95,7 +95,7 @@ static int aqt_read_header(AVFormatContext *s) } } - ff_subtitles_queue_finalize(&aqt->q); + ff_subtitles_queue_finalize(s, &aqt->q); return 0; } diff --git a/libavformat/assdec.c b/libavformat/assdec.c index c62e76f0dd..5423c03f14 100644 --- a/libavformat/assdec.c +++ b/libavformat/assdec.c @@ -152,7 +152,7 @@ static int ass_read_header(AVFormatContext *s) if (res < 0) goto end; - ff_subtitles_queue_finalize(&ass->q); + ff_subtitles_queue_finalize(s, &ass->q); end: av_bprint_finalize(&header, NULL); diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c index 63895d7efe..5e543634fd 100644 --- a/libavformat/jacosubdec.c +++ b/libavformat/jacosubdec.c @@ -240,7 +240,7 @@ static int jacosub_read_header(AVFormatContext *s) AVPacket *sub = &jacosub->q.subs[i]; read_ts(jacosub, sub->data, &sub->pts, &sub->duration); } - ff_subtitles_queue_finalize(&jacosub->q); + ff_subtitles_queue_finalize(s, &jacosub->q); return 0; fail: diff --git a/libavformat/lrcdec.c b/libavformat/lrcdec.c index df61853d2b..d3655fccd5 100644 --- a/libavformat/lrcdec.c +++ b/libavformat/lrcdec.c @@ -210,7 +210,7 @@ static int lrc_read_header(AVFormatContext *s) } } } - ff_subtitles_queue_finalize(&lrc->q); + ff_subtitles_queue_finalize(s, &lrc->q); ff_metadata_conv_ctx(s, NULL, ff_lrc_metadata_conv); return 0; } diff --git a/libavformat/microdvddec.c b/libavformat/microdvddec.c index a3839051a4..727ff947e7 100644 --- a/libavformat/microdvddec.c +++ b/libavformat/microdvddec.c @@ -141,7 +141,7 @@ static int microdvd_read_header(AVFormatContext *s) sub->pts = get_pts(line); sub->duration = get_duration(line); } - ff_subtitles_queue_finalize(µdvd->q); + ff_subtitles_queue_finalize(s, µdvd->q); if (has_real_fps) { /* export the FPS info only if set in the file */ microdvd->frame_rate = pts_info; diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 787d5f0033..223b6906d6 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -857,7 +857,7 @@ static int vobsub_read_header(AVFormatContext *s) for (i = 0; i < s->nb_streams; i++) { vobsub->q[i].sort = SUB_SORT_POS_TS; - ff_subtitles_queue_finalize(&vobsub->q[i]); + ff_subtitles_queue_finalize(s, &vobsub->q[i]); } if (!av_bprint_is_complete(&header)) { diff --git a/libavformat/mpl2dec.c b/libavformat/mpl2dec.c index 260b7be0ec..81cc0bbb2d 100644 --- a/libavformat/mpl2dec.c +++ b/libavformat/mpl2dec.c @@ -108,7 +108,7 @@ static int mpl2_read_header(AVFormatContext *s) } } - ff_subtitles_queue_finalize(&mpl2->q); + ff_subtitles_queue_finalize(s, &mpl2->q); return res; } diff --git a/libavformat/mpsubdec.c b/libavformat/mpsubdec.c index 7c26d4f42c..c5a50ecb5c 100644 --- a/libavformat/mpsubdec.c +++ b/libavformat/mpsubdec.c @@ -103,7 +103,7 @@ static int mpsub_read_header(AVFormatContext *s) st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_id = AV_CODEC_ID_TEXT; - ff_subtitles_queue_finalize(&mpsub->q); + ff_subtitles_queue_finalize(s, &mpsub->q); end: av_bprint_finalize(&buf, NULL); diff --git a/libavformat/pjsdec.c b/libavformat/pjsdec.c index 5129b70e5f..a88d533192 100644 --- a/libavformat/pjsdec.c +++ b/libavformat/pjsdec.c @@ -100,7 +100,7 @@ static int pjs_read_header(AVFormatContext *s) } } - ff_subtitles_queue_finalize(&pjs->q); + ff_subtitles_queue_finalize(s, &pjs->q); return res; } diff --git a/libavformat/realtextdec.c b/libavformat/realtextdec.c index fff85d6ba9..f13321c91a 100644 --- a/libavformat/realtextdec.c +++ b/libavformat/realtextdec.c @@ -115,7 +115,7 @@ static int realtext_read_header(AVFormatContext *s) } av_bprint_clear(&buf); } - ff_subtitles_queue_finalize(&rt->q); + ff_subtitles_queue_finalize(s, &rt->q); end: av_bprint_finalize(&buf, NULL); diff --git a/libavformat/samidec.c b/libavformat/samidec.c index bc9b745e9c..11c674ce19 100644 --- a/libavformat/samidec.c +++ b/libavformat/samidec.c @@ -105,7 +105,7 @@ static int sami_read_header(AVFormatContext *s) if (res < 0) goto end; - ff_subtitles_queue_finalize(&sami->q); + ff_subtitles_queue_finalize(s, &sami->q); end: av_bprint_finalize(&buf, NULL); diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c index b35e50fc36..60d2f48517 100644 --- a/libavformat/srtdec.c +++ b/libavformat/srtdec.c @@ -134,7 +134,7 @@ static int srt_read_header(AVFormatContext *s) } } - ff_subtitles_queue_finalize(&srt->q); + ff_subtitles_queue_finalize(s, &srt->q); end: av_bprint_finalize(&buf, NULL); diff --git a/libavformat/stldec.c b/libavformat/stldec.c index b84c7e9eb0..8b1f0a6d5b 100644 --- a/libavformat/stldec.c +++ b/libavformat/stldec.c @@ -104,7 +104,7 @@ static int stl_read_header(AVFormatContext *s) sub->duration = duration; } } - ff_subtitles_queue_finalize(&stl->q); + ff_subtitles_queue_finalize(s, &stl->q); return 0; } static int stl_read_packet(AVFormatContext *s, AVPacket *pkt) diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c index 2f8b066cd9..192043f917 100644 --- a/libavformat/subtitles.c +++ b/libavformat/subtitles.c @@ -166,7 +166,7 @@ static int cmp_pkt_sub_pos_ts(const void *a, const void *b) return s1->pos > s2->pos ? 1 : -1; } -static void drop_dups(FFDemuxSubtitlesQueue *q) +static void drop_dups(void *log_ctx, FFDemuxSubtitlesQueue *q) { int i, drop = 0; @@ -189,13 +189,11 @@ static void drop_dups(FFDemuxSubtitlesQueue *q) if (drop) { q->nb_subs -= drop; - - // TODO: forward log context down here - av_log(NULL, AV_LOG_WARNING, "Dropping %d duplicated subtitle events\n", drop); + av_log(log_ctx, AV_LOG_WARNING, "Dropping %d duplicated subtitle events\n", drop); } } -void ff_subtitles_queue_finalize(FFDemuxSubtitlesQueue *q) +void ff_subtitles_queue_finalize(void *log_ctx, FFDemuxSubtitlesQueue *q) { int i; @@ -205,7 +203,8 @@ void ff_subtitles_queue_finalize(FFDemuxSubtitlesQueue *q) for (i = 0; i < q->nb_subs; i++) if (q->subs[i].duration == -1 && i < q->nb_subs - 1) q->subs[i].duration = q->subs[i + 1].pts - q->subs[i].pts; - drop_dups(q); + + drop_dups(log_ctx, q); } int ff_subtitles_queue_read_packet(FFDemuxSubtitlesQueue *q, AVPacket *pkt) diff --git a/libavformat/subtitles.h b/libavformat/subtitles.h index 885285cc47..8b94d9912f 100644 --- a/libavformat/subtitles.h +++ b/libavformat/subtitles.h @@ -121,7 +121,7 @@ AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q, /** * Set missing durations and sort subtitles by PTS, and then byte position. */ -void ff_subtitles_queue_finalize(FFDemuxSubtitlesQueue *q); +void ff_subtitles_queue_finalize(void *log_ctx, FFDemuxSubtitlesQueue *q); /** * Generic read_packet() callback for subtitles demuxers using this queue diff --git a/libavformat/subviewer1dec.c b/libavformat/subviewer1dec.c index 6b38533a88..93db4ebf21 100644 --- a/libavformat/subviewer1dec.c +++ b/libavformat/subviewer1dec.c @@ -86,7 +86,7 @@ static int subviewer1_read_header(AVFormatContext *s) } } - ff_subtitles_queue_finalize(&subviewer1->q); + ff_subtitles_queue_finalize(s, &subviewer1->q); return 0; } diff --git a/libavformat/subviewerdec.c b/libavformat/subviewerdec.c index f1b0fdf0a5..d4b2fdf456 100644 --- a/libavformat/subviewerdec.c +++ b/libavformat/subviewerdec.c @@ -153,7 +153,7 @@ static int subviewer_read_header(AVFormatContext *s) } } - ff_subtitles_queue_finalize(&subviewer->q); + ff_subtitles_queue_finalize(s, &subviewer->q); end: av_bprint_finalize(&header, NULL); diff --git a/libavformat/tedcaptionsdec.c b/libavformat/tedcaptionsdec.c index d6020d9e35..b6dc517073 100644 --- a/libavformat/tedcaptionsdec.c +++ b/libavformat/tedcaptionsdec.c @@ -287,7 +287,7 @@ static av_cold int tedcaptions_read_header(AVFormatContext *avf) ff_subtitles_queue_clean(&tc->subs); return ret; } - ff_subtitles_queue_finalize(&tc->subs); + ff_subtitles_queue_finalize(avf, &tc->subs); for (i = 0; i < tc->subs.nb_subs; i++) tc->subs.subs[i].pts += tc->start_time; diff --git a/libavformat/vplayerdec.c b/libavformat/vplayerdec.c index 619ccfd4f0..860b7785c9 100644 --- a/libavformat/vplayerdec.c +++ b/libavformat/vplayerdec.c @@ -90,7 +90,7 @@ static int vplayer_read_header(AVFormatContext *s) } } - ff_subtitles_queue_finalize(&vplayer->q); + ff_subtitles_queue_finalize(s, &vplayer->q); return 0; } diff --git a/libavformat/webvttdec.c b/libavformat/webvttdec.c index e457e8f6d2..43c2a639ad 100644 --- a/libavformat/webvttdec.c +++ b/libavformat/webvttdec.c @@ -161,7 +161,7 @@ static int webvtt_read_header(AVFormatContext *s) SET_SIDE_DATA(settings, AV_PKT_DATA_WEBVTT_SETTINGS); } - ff_subtitles_queue_finalize(&webvtt->q); + ff_subtitles_queue_finalize(s, &webvtt->q); end: av_bprint_finalize(&cue, NULL);