@@ -364,6 +364,11 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame);
AVCPBProperties *ff_add_cpb_side_data(AVCodecContext *avctx);
/**
+ * Add a S12M timecode side data to an codec context.
+ */
+uint32_t *ff_add_s12m_timecode_side_data(AVCodecContext *avctx);
+
+/**
* Check AVFrame for A53 side data and allocate and fill SEI message with A53 info
*
* @param frame Raw frame to get A53 side data from
@@ -2029,6 +2029,36 @@ AVCPBProperties *ff_add_cpb_side_data(AVCodecContext *avctx)
return props;
}
+uint32_t *ff_add_s12m_timecode_side_data(AVCodecContext *avctx)
+{
+ AVPacketSideData *tmp;
+ uint32_t *data;
+ int size = sizeof(uint32_t) * 4;
+ int i;
+
+ for (i = 0; i < avctx->nb_coded_side_data; i++)
+ if (avctx->coded_side_data[i].type == AV_PKT_DATA_S12M_TIMECODE)
+ return (uint32_t*)avctx->coded_side_data[i].data;
+
+ data = av_mallocz(size);
+ if (!data)
+ return NULL;
+
+ tmp = av_realloc_array(avctx->coded_side_data, avctx->nb_coded_side_data + 1, sizeof(*tmp));
+ if (!tmp) {
+ av_freep(&data);
+ return NULL;
+ }
+ avctx->coded_side_data = tmp;
+
+ avctx->coded_side_data[avctx->nb_coded_side_data].type = AV_PKT_DATA_S12M_TIMECODE;
+ avctx->coded_side_data[avctx->nb_coded_side_data].data = (uint8_t *)data;
+ avctx->coded_side_data[avctx->nb_coded_side_data].size = size;
+ avctx->nb_coded_side_data++;
+
+ return data;
+}
+
static void codec_parameters_reset(AVCodecParameters *par)
{
av_freep(&par->extradata);