mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
avformat/subtitles: forward log context in ff_subtitles_queue_finalize() for logging
This commit is contained in:
parent
a634649a36
commit
af924fd9e4
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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)) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user