Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Devin Heitmueller <devin.heitmueller@ltnglobal.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Devin Heitmueller <dheitmueller@ltnglobal.com>
Subject: [FFmpeg-devel] [PATCH 7/7] avdevice/decklink_enc: Add support for output of bar data as VANC
Date: Wed,  7 Jun 2023 16:22:27 -0400
Message-ID: <1686169347-28987-8-git-send-email-dheitmueller@ltnglobal.com> (raw)
In-Reply-To: <1686169347-28987-1-git-send-email-dheitmueller@ltnglobal.com>

SMPTE ST2016-3 supports both AFD and bar data within the VANC message.
Extend the existing support to pass through both.

Example usage:

ffmpeg -i input.ts -vf setafd=afd=1:code=0x00:bardata=1:top=100:bottom=120 -f decklink -vcodec v210 'DeckLink Duo (4)'

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
---
 libavdevice/decklink_enc.cpp | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp
index 6906cb0..5d85d6b 100644
--- a/libavdevice/decklink_enc.cpp
+++ b/libavdevice/decklink_enc.cpp
@@ -447,23 +447,39 @@ static void construct_afd(AVFormatContext *avctx, struct decklink_ctx *ctx,
     struct klvanc_packet_afd_s *afd = NULL;
     uint16_t *afd_words = NULL;
     uint16_t len;
-    size_t size;
+    size_t size, bardata_size;
     int f1_line = 12, f2_line = 0, ret;
 
     const uint8_t *data = av_packet_get_side_data(pkt, AV_PKT_DATA_AFD, &size);
-    if (!data || size == 0)
+    const AVBarData *bardata = (AVBarData *) av_packet_get_side_data(pkt, AV_PKT_DATA_BARDATA, &bardata_size);
+
+    if ((!data || size == 0) && (!bardata || bardata_size != sizeof(AVBarData)))
         return;
 
     ret = klvanc_create_AFD(&afd);
     if (ret)
         return;
 
-    ret = klvanc_set_AFD_val(afd, data[0]);
-    if (ret) {
-        av_log(avctx, AV_LOG_ERROR, "Invalid AFD value specified: %d\n",
-               data[0]);
-        klvanc_destroy_AFD(afd);
-        return;
+    if (data) {
+        ret = klvanc_set_AFD_val(afd, data[0]);
+        if (ret) {
+            av_log(avctx, AV_LOG_ERROR, "Invalid AFD value specified: %d\n",
+                   data[0]);
+            klvanc_destroy_AFD(afd);
+            return;
+        }
+    }
+
+    if (bardata) {
+        if (bardata->top_bottom) {
+            afd->barDataFlags = BARS_TOPBOTTOM;
+            afd->top = bardata->top;
+            afd->bottom = bardata->bottom;
+        } else {
+            afd->barDataFlags = BARS_LEFTRIGHT;
+            afd->left = bardata->left;
+            afd->right = bardata->right;
+        }
     }
 
     /* Compute the AR flag based on the DAR (see ST 2016-1:2009 Sec 9.1).  Note, we treat
-- 
1.8.3.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  parent reply	other threads:[~2023-06-07 19:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07 20:22 [FFmpeg-devel] [PATCH 0/7] Misc AFD improvements and support for Bar Data Devin Heitmueller
2023-06-07 20:22 ` [FFmpeg-devel] [PATCH 1/7] Preserve AFD side data when going from AVPacket to AVFrame Devin Heitmueller
2023-06-07 20:22 ` [FFmpeg-devel] [PATCH 2/7] vf_drawtext: Add ability to show AFD value Devin Heitmueller
2023-06-07 20:22 ` [FFmpeg-devel] [PATCH 3/7] avcodec/avframe: add new side data types for Bar Data Devin Heitmueller
2023-06-07 20:22 ` [FFmpeg-devel] [PATCH 4/7] libavfilter: Add filter to insert AFD/bar data Devin Heitmueller
2023-06-07 20:22 ` [FFmpeg-devel] [PATCH 5/7] Provide a side data description for newly introduced bar data Devin Heitmueller
2023-06-07 20:22 ` [FFmpeg-devel] [PATCH 6/7] avcodec/v210enc: Pass through " Devin Heitmueller
2023-06-07 20:22 ` Devin Heitmueller [this message]
2023-06-15 14:54 ` [FFmpeg-devel] [PATCH 0/7] Misc AFD improvements and support for Bar Data Devin Heitmueller
2023-06-15 14:57   ` Paul B Mahol
2023-06-15 15:21     ` Devin Heitmueller
2023-06-22 11:52       ` Devin Heitmueller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1686169347-28987-8-git-send-email-dheitmueller@ltnglobal.com \
    --to=devin.heitmueller@ltnglobal.com \
    --cc=dheitmueller@ltnglobal.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git