Message ID | 1688161135-11774-7-git-send-email-dheitmueller@ltnglobal.com |
---|---|
State | New |
Headers | show |
Series | Misc AFD improvements and support for Bar Data | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
On Fri, 30 Jun 2023 at 21:42, Devin Heitmueller < devin.heitmueller@ltnglobal.com> wrote: > When encoding to V210, make sure the bar side data makes it through > in the resulting AVPacket. This is needed so the decklink output > module can put out bar data as VANC when in 10-bit mode. > ff_decode_frame_props_from_pkt surely does this better than the mess of ifs in v210enc? Kieran
Hi Kieran, On Fri, Jun 30, 2023 at 6:41 PM Kieran Kunhya <kierank@obe.tv> wrote: > > On Fri, 30 Jun 2023 at 21:42, Devin Heitmueller <devin.heitmueller@ltnglobal.com> wrote: >> >> When encoding to V210, make sure the bar side data makes it through >> in the resulting AVPacket. This is needed so the decklink output >> module can put out bar data as VANC when in 10-bit mode. > > > ff_decode_frame_props_from_pkt surely does this better than the mess of ifs in v210enc? The ff_decode_frame_props_from_pkt() function is used when going from AVPackets to AVFrames. The v210enc codec goes in the other direction - from AVFrames to AVPackets. In fact ff_decode_frame_props_from_pkt() does get used by v210dec. Now I wouldn't necessarily be against somebody introducing a new function which goes in the opposite direction and could potentially be shared by other encoders. But my intent was just to implement it the same way as the other conversions were done, not to refactor the code and design some new approach. Devin
diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c index 2a30ed7..69a2d72 100644 --- a/libavcodec/v210enc.c +++ b/libavcodec/v210enc.c @@ -103,6 +103,14 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, memcpy(buf, side_data->data, side_data->size); } + side_data = av_frame_get_side_data(pic, AV_FRAME_DATA_BARDATA); + if (side_data && side_data->size) { + uint8_t *buf = av_packet_new_side_data(pkt, AV_PKT_DATA_BARDATA, side_data->size); + if (!buf) + return AVERROR(ENOMEM); + memcpy(buf, side_data->data, side_data->size); + } + *got_packet = 1; return 0; }
When encoding to V210, make sure the bar side data makes it through in the resulting AVPacket. This is needed so the decklink output module can put out bar data as VANC when in 10-bit mode. Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com> --- libavcodec/v210enc.c | 8 ++++++++ 1 file changed, 8 insertions(+)