[FFmpeg-cvslog] avformat: use av_timecode_make_smpte_tc_string2

Marton Balint git at videolan.org
Sun Sep 13 19:50:48 EEST 2020


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Fri Jul 24 16:26:58 2020 +0200| [9b434bea757fd3c41156703326131063f0cbae18] | committer: Marton Balint

avformat: use av_timecode_make_smpte_tc_string2

WSD format has no frames stored for playback time.

Signed-off-by: Marton Balint <cus at passwd.hu>

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

 libavformat/dump.c   | 6 +++---
 libavformat/dv.c     | 2 +-
 libavformat/wsddec.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavformat/dump.c b/libavformat/dump.c
index 6d29d85d1f..fe628010d3 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -408,7 +408,7 @@ static void dump_dovi_conf(void *ctx, const AVPacketSideData *sd)
            dovi->dv_bl_signal_compatibility_id);
 }
 
-static void dump_s12m_timecode(void *ctx, const AVPacketSideData *sd)
+static void dump_s12m_timecode(void *ctx, const AVStream *st, const AVPacketSideData *sd)
 {
     const uint32_t *tc = (const uint32_t *)sd->data;
 
@@ -419,7 +419,7 @@ static void dump_s12m_timecode(void *ctx, const AVPacketSideData *sd)
 
     for (int j = 1; j <= tc[0]; j++) {
         char tcbuf[AV_TIMECODE_STR_SIZE];
-        av_timecode_make_smpte_tc_string(tcbuf, tc[j], 0);
+        av_timecode_make_smpte_tc_string2(tcbuf, st->avg_frame_rate, tc[j], 0, 0);
         av_log(ctx, AV_LOG_INFO, "timecode - %s%s", tcbuf, j != tc[0] ? ", " : "");
     }
 }
@@ -492,7 +492,7 @@ static void dump_sidedata(void *ctx, const AVStream *st, const char *indent)
             break;
         case AV_PKT_DATA_S12M_TIMECODE:
             av_log(ctx, AV_LOG_INFO, "SMPTE ST 12-1:2014: ");
-            dump_s12m_timecode(ctx, sd);
+            dump_s12m_timecode(ctx, st, sd);
             break;
         default:
             av_log(ctx, AV_LOG_INFO,
diff --git a/libavformat/dv.c b/libavformat/dv.c
index d25641daac..3e0d12c0e3 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -315,7 +315,7 @@ static int dv_extract_timecode(DVDemuxContext* c, const uint8_t* frame, char *tc
     tc_pack = dv_extract_pack(frame, dv_timecode);
     if (!tc_pack)
         return 0;
-    av_timecode_make_smpte_tc_string(tc, AV_RB32(tc_pack + 1), prevent_df);
+    av_timecode_make_smpte_tc_string2(tc, av_inv_q(c->sys->time_base), AV_RB32(tc_pack + 1), prevent_df, 1);
     return 1;
 }
 
diff --git a/libavformat/wsddec.c b/libavformat/wsddec.c
index 2313b0ec4b..74db6acdab 100644
--- a/libavformat/wsddec.c
+++ b/libavformat/wsddec.c
@@ -120,7 +120,7 @@ static int wsd_read_header(AVFormatContext *s)
     }
 
     avio_skip(pb, 4);
-    av_timecode_make_smpte_tc_string(playback_time, avio_rb32(pb), 0);
+    av_timecode_make_smpte_tc_string2(playback_time, (AVRational){1,1}, avio_rb32(pb) & 0x00ffffffU, 1, 1);
     av_dict_set(&s->metadata, "playback_time", playback_time, 0);
 
     st->codecpar->codec_type  = AVMEDIA_TYPE_AUDIO;



More information about the ffmpeg-cvslog mailing list