summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@ltnglobal.com>2018-09-07 15:40:24 -0400
committerMarton Balint <cus@passwd.hu>2018-09-09 22:42:26 +0200
commit6a9abe9ec333638b7818dac8ab60d006d5533c4a (patch)
tree2c93ce0957e81f2b9f423ae14529c36b0b815dcb
parentedafb9f529911438978ce025d45d11e3d8f57eb0 (diff)
avcodec/v210enc: Pass through A53 CC data
When encoding to V210, make sure the CC side data makes it through in the resulting AVPacket. This is needed so the decklink output module can put out captions when in 10-bit mode. Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com> Signed-off-by: Marton Balint <cus@passwd.hu>
-rw-r--r--libavcodec/v210enc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c
index a6afbbfc41..b9dcf9a672 100644
--- a/libavcodec/v210enc.c
+++ b/libavcodec/v210enc.c
@@ -123,6 +123,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
int aligned_width = ((avctx->width + 47) / 48) * 48;
int stride = aligned_width * 8 / 3;
int line_padding = stride - ((avctx->width * 8 + 11) / 12) * 4;
+ AVFrameSideData *side_data;
int h, w, ret;
uint8_t *dst;
@@ -233,6 +234,14 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
}
}
+ side_data = av_frame_get_side_data(pic, AV_FRAME_DATA_A53_CC);
+ if (side_data && side_data->size) {
+ uint8_t *buf = av_packet_new_side_data(pkt, AV_PKT_DATA_A53_CC, side_data->size);
+ if (!buf)
+ return AVERROR(ENOMEM);
+ memcpy(buf, side_data->data, side_data->size);
+ }
+
pkt->flags |= AV_PKT_FLAG_KEY;
*got_packet = 1;
return 0;