summaryrefslogtreecommitdiff
path: root/libavfilter/vf_showinfo.c
diff options
context:
space:
mode:
authorLimin Wang <lance.lmwang@gmail.com>2020-07-04 20:32:59 +0800
committerLimin Wang <lance.lmwang@gmail.com>2020-07-08 23:14:04 +0800
commitf9277cd796575c075cbf7c5bacd1c25ab86f5758 (patch)
tree698f37cc223d42b43e4ac77c728323b08e3e6ba0 /libavfilter/vf_showinfo.c
parent3ede8acba6270e46080f14caa6d91963ff3c01d2 (diff)
downloadffmpeg-f9277cd796575c075cbf7c5bacd1c25ab86f5758.tar.gz
avfilter/vf_showinfo: add dump_s12m_timecode() helper function
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Diffstat (limited to 'libavfilter/vf_showinfo.c')
-rw-r--r--libavfilter/vf_showinfo.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 1634f68a78..1be939614d 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -114,6 +114,22 @@ static void dump_stereo3d(AVFilterContext *ctx, AVFrameSideData *sd)
av_log(ctx, AV_LOG_INFO, " (inverted)");
}
+static void dump_s12m_timecode(AVFilterContext *ctx, AVFrameSideData *sd)
+{
+ const uint32_t *tc = (const uint32_t *)sd->data;
+
+ if ((sd->size != sizeof(uint32_t) * 4) || (tc[0] > 3)) {
+ av_log(ctx, AV_LOG_ERROR, "invalid data\n");
+ return;
+ }
+
+ 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_log(ctx, AV_LOG_INFO, "timecode - %s%s", tcbuf, j != tc[0] ? ", " : "");
+ }
+}
+
static void dump_roi(AVFilterContext *ctx, AVFrameSideData *sd)
{
int nb_rois;
@@ -364,17 +380,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
dump_stereo3d(ctx, sd);
break;
case AV_FRAME_DATA_S12M_TIMECODE: {
- uint32_t *tc = (uint32_t*)sd->data;
-
- if ((sd->size != sizeof(uint32_t) * 4) || (tc[0] > 3)) {
- av_log(ctx, AV_LOG_ERROR, "invalid data\n");
- break;
- }
- 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_log(ctx, AV_LOG_INFO, "timecode - %s%s", tcbuf, j != tc[0] ? ", " : "");
- }
+ dump_s12m_timecode(ctx, sd);
break;
}
case AV_FRAME_DATA_DISPLAYMATRIX: