API: add AV_PKT_DATA_S12M_TIMECODE to AVPacketSideDataType

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
pull/345/head
Limin Wang 5 years ago
parent c24c6a1bee
commit 448a9aaa78
  1. 3
      doc/APIchanges
  2. 1
      libavcodec/avpacket.c
  3. 1
      libavcodec/decode.c
  4. 8
      libavcodec/packet.h
  5. 2
      libavcodec/version.h
  6. 21
      libavformat/dump.c

@ -15,6 +15,9 @@ libavutil: 2017-10-21
API changes, most recent first:
2020-07-xx - xxxxxxxxxx - lavc 58.96.100 - packet.h
Add AV_PKT_DATA_S12M_TIMECODE.
2020-06-12 - b09fb030c1 - lavu 56.55.100 - pixdesc.h
Add AV_PIX_FMT_X2RGB10.

@ -400,6 +400,7 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type)
case AV_PKT_DATA_PRFT: return "Producer Reference Time";
case AV_PKT_DATA_ICC_PROFILE: return "ICC Profile";
case AV_PKT_DATA_DOVI_CONF: return "DOVI configuration record";
case AV_PKT_DATA_S12M_TIMECODE: return "SMPTE ST 12-1:2014 timecode";
}
return NULL;
}

@ -1699,6 +1699,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
{ AV_PKT_DATA_CONTENT_LIGHT_LEVEL, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
{ AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC },
{ AV_PKT_DATA_ICC_PROFILE, AV_FRAME_DATA_ICC_PROFILE },
{ AV_PKT_DATA_S12M_TIMECODE, AV_FRAME_DATA_S12M_TIMECODE },
};
if (pkt) {

@ -282,6 +282,14 @@ enum AVPacketSideDataType {
*/
AV_PKT_DATA_DOVI_CONF,
/**
* Timecode which conforms to SMPTE ST 12-1:2014. The data is an array of 4 uint32_t
* where the first uint32_t describes how many (1-3) of the other timecodes are used.
* The timecode format is described in the documentation of av_timecode_get_smpte_from_framenum()
* function in libavutil/timecode.h.
*/
AV_PKT_DATA_S12M_TIMECODE,
/**
* The number of side data types.
* This is not part of the public API/ABI in the sense that it may

@ -28,7 +28,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 58
#define LIBAVCODEC_VERSION_MINOR 95
#define LIBAVCODEC_VERSION_MINOR 96
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

@ -34,6 +34,7 @@
#include "libavutil/replaygain.h"
#include "libavutil/spherical.h"
#include "libavutil/stereo3d.h"
#include "libavutil/timecode.h"
#include "avformat.h"
@ -407,6 +408,22 @@ 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)
{
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_sidedata(void *ctx, const AVStream *st, const char *indent)
{
int i;
@ -473,6 +490,10 @@ static void dump_sidedata(void *ctx, const AVStream *st, const char *indent)
av_log(ctx, AV_LOG_INFO, "DOVI configuration record: ");
dump_dovi_conf(ctx, sd);
break;
case AV_PKT_DATA_S12M_TIMECODE:
av_log(ctx, AV_LOG_INFO, "SMPTE ST 12-1:2014: ");
dump_s12m_timecode(ctx, sd);
break;
default:
av_log(ctx, AV_LOG_INFO,
"unknown side data type %d (%d bytes)", sd->type, sd->size);

Loading…
Cancel
Save