History

API: add AV_PKT_DATA_S12M_TIMECODE to AVPacketSideDataType

Limin Wang committed 6 years ago

Commit 448a9aa1 parent c24c6a16 files · +35 −1Browse files

Unified · Split

6 files
  1. doc/APIchanges +3 −0
  2. libavcodec/avpacket.c +1 −0
  3. libavcodec/decode.c +1 −0
  4. libavcodec/packet.h +8 −0
  5. libavcodec/version.h +1 −1
  6. libavformat/dump.c +21 −0
doc/APIchanges+3−0
@@ -15,6 +15,9 @@ libavutil: 2017-10-21 · 14 unmodified lines
1515
1616 API changes, most recent first:
1717
18+2020-07-xx - xxxxxxxxxx - lavc 58.96.100 - packet.h
19+ Add AV_PKT_DATA_S12M_TIMECODE.
20+
1821 2020-06-12 - b09fb030c1 - lavu 56.55.100 - pixdesc.h
1922 Add AV_PIX_FMT_X2RGB10.
2023
libavcodec/avpacket.c+1−0
@@ -400,6 +400,7 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type) · 399 unmodified lines
400400 case AV_PKT_DATA_PRFT: return "Producer Reference Time";
401401 case AV_PKT_DATA_ICC_PROFILE: return "ICC Profile";
402402 case AV_PKT_DATA_DOVI_CONF: return "DOVI configuration record";
403+ case AV_PKT_DATA_S12M_TIMECODE: return "SMPTE ST 12-1:2014 timecode";
403404 }
404405 return NULL;
405406 }
libavcodec/decode.c+1−0
@@ -1699,6 +1699,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame) · 1698 unmodified lines
16991699 { AV_PKT_DATA_CONTENT_LIGHT_LEVEL, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
17001700 { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC },
17011701 { AV_PKT_DATA_ICC_PROFILE, AV_FRAME_DATA_ICC_PROFILE },
1702+ { AV_PKT_DATA_S12M_TIMECODE, AV_FRAME_DATA_S12M_TIMECODE },
17021703 };
17031704
17041705 if (pkt) {
libavcodec/packet.h+8−0
@@ -282,6 +282,14 @@ enum AVPacketSideDataType { · 281 unmodified lines
282282 */
283283 AV_PKT_DATA_DOVI_CONF,
284284
285+ /**
286+ * Timecode which conforms to SMPTE ST 12-1:2014. The data is an array of 4 uint32_t
287+ * where the first uint32_t describes how many (1-3) of the other timecodes are used.
288+ * The timecode format is described in the documentation of av_timecode_get_smpte_from_framenum()
289+ * function in libavutil/timecode.h.
290+ */
291+ AV_PKT_DATA_S12M_TIMECODE,
292+
285293 /**
286294 * The number of side data types.
287295 * This is not part of the public API/ABI in the sense that it may
libavcodec/version.h+1−1
@@ -28,7 +28,7 @@ · 27 unmodified lines
2828 #include "libavutil/version.h"
2929
3030 #define LIBAVCODEC_VERSION_MAJOR 58
31−#define LIBAVCODEC_VERSION_MINOR 95
31+#define LIBAVCODEC_VERSION_MINOR 96
3232 #define LIBAVCODEC_VERSION_MICRO 100
3333
3434 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
libavformat/dump.c+21−0
@@ -34,6 +34,7 @@ · 33 unmodified lines
3434 #include "libavutil/replaygain.h"
3535 #include "libavutil/spherical.h"
3636 #include "libavutil/stereo3d.h"
37+#include "libavutil/timecode.h"
3738
3839 #include "avformat.h"
3940
@@ -407,6 +408,22 @@ static void dump_dovi_conf(void *ctx, const AVPacketSideData *sd) · 367 unmodified lines
407408 dovi->dv_bl_signal_compatibility_id);
408409 }
409410
411+static void dump_s12m_timecode(void *ctx, const AVPacketSideData *sd)
412+{
413+ const uint32_t *tc = (const uint32_t *)sd->data;
414+
415+ if ((sd->size != sizeof(uint32_t) * 4) || (tc[0] > 3)) {
416+ av_log(ctx, AV_LOG_ERROR, "invalid data\n");
417+ return;
418+ }
419+
420+ for (int j = 1; j <= tc[0]; j++) {
421+ char tcbuf[AV_TIMECODE_STR_SIZE];
422+ av_timecode_make_smpte_tc_string(tcbuf, tc[j], 0);
423+ av_log(ctx, AV_LOG_INFO, "timecode - %s%s", tcbuf, j != tc[0] ? ", " : "");
424+ }
425+}
426+
410427 static void dump_sidedata(void *ctx, const AVStream *st, const char *indent)
411428 {
412429 int i;
@@ -473,6 +490,10 @@ static void dump_sidedata(void *ctx, const AVStream *st, const char *indent) · 60 unmodified lines
473490 av_log(ctx, AV_LOG_INFO, "DOVI configuration record: ");
474491 dump_dovi_conf(ctx, sd);
475492 break;
493+ case AV_PKT_DATA_S12M_TIMECODE:
494+ av_log(ctx, AV_LOG_INFO, "SMPTE ST 12-1:2014: ");
495+ dump_s12m_timecode(ctx, sd);
496+ break;
476497 default:
477498 av_log(ctx, AV_LOG_INFO,
478499 "unknown side data type %d (%d bytes)", sd->type, sd->size);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t