[FFmpeg-cvslog] avformat/subtitles: forward log context in ff_subtitles_queue_finalize() for logging

Clément Bœsch git at videolan.org
Thu Sep 10 21:38:20 CEST 2015


ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Thu Sep 10 21:40:07 2015 +0200| [af924fd9e469064707fc00212456952b3e62ee5e] | committer: Clément Bœsch

avformat/subtitles: forward log context in ff_subtitles_queue_finalize() for logging

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=af924fd9e469064707fc00212456952b3e62ee5e
---

 libavformat/aqtitledec.c     |    2 +-
 libavformat/assdec.c         |    2 +-
 libavformat/jacosubdec.c     |    2 +-
 libavformat/lrcdec.c         |    2 +-
 libavformat/microdvddec.c    |    2 +-
 libavformat/mpeg.c           |    2 +-
 libavformat/mpl2dec.c        |    2 +-
 libavformat/mpsubdec.c       |    2 +-
 libavformat/pjsdec.c         |    2 +-
 libavformat/realtextdec.c    |    2 +-
 libavformat/samidec.c        |    2 +-
 libavformat/srtdec.c         |    2 +-
 libavformat/stldec.c         |    2 +-
 libavformat/subtitles.c      |   11 +++++------
 libavformat/subtitles.h      |    2 +-
 libavformat/subviewer1dec.c  |    2 +-
 libavformat/subviewerdec.c   |    2 +-
 libavformat/tedcaptionsdec.c |    2 +-
 libavformat/vplayerdec.c     |    2 +-
 libavformat/webvttdec.c      |    2 +-
 20 files changed, 24 insertions(+), 25 deletions(-)

diff --git a/libavformat/aqtitledec.c b/libavformat/aqtitledec.c
index 9508766..7c864c8 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 c62e76f..5423c03 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 63895d7..5e54363 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 df61853..d3655fc 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 a383905..727ff94 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(&microdvd->q);
+    ff_subtitles_queue_finalize(s, &microdvd->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 787d5f0..223b690 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 260b7be..81cc0bb 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 7c26d4f..c5a50ec 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 5129b70..a88d533 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 fff85d6..f13321c 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 bc9b745..11c674c 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 b35e50f..60d2f48 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 b84c7e9..8b1f0a6 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 2f8b066..192043f 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 885285c..8b94d99 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 6b38533..93db4eb 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 f1b0fdf..d4b2fdf 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 d6020d9..b6dc517 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 619ccfd..860b778 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 e457e8f..43c2a63 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);



More information about the ffmpeg-cvslog mailing list