[FFmpeg-cvslog] avdevice/decklink_dec: use av_packet_add_side_data()

James Almer git at videolan.org
Mon Oct 2 21:05:51 EEST 2017


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sun Oct  1 23:31:12 2017 -0300| [0c1ffd0aa55c6cef6dffe2b736786c6cb86d8a3d] | committer: James Almer

avdevice/decklink_dec: use av_packet_add_side_data()

It uses the existing buffer instead of allocating a new one.

Reviewed-by: Marton Balint <cus at passwd.hu>
Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0c1ffd0aa55c6cef6dffe2b736786c6cb86d8a3d
---

 libavdevice/decklink_dec.cpp | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 8a14094474..9d12d0fed0 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -390,10 +390,8 @@ uint8_t *get_metadata(AVFormatContext *avctx, uint16_t *buf, size_t width,
             clear_parity_bits(buf, len);
             data = vanc_to_cc(avctx, buf, width, data_len);
             if (data) {
-                uint8_t *pkt_cc = av_packet_new_side_data(pkt, AV_PKT_DATA_A53_CC, data_len);
-                if (pkt_cc)
-                    memcpy(pkt_cc, data, data_len);
-                av_free(data);
+                if (av_packet_add_side_data(pkt, AV_PKT_DATA_A53_CC, data, data_len) < 0)
+                    av_free(data);
             }
         } else {
             av_log(avctx, AV_LOG_DEBUG, "Unknown meta data DID = 0x%.2x SDID = 0x%.2x\n",



More information about the ffmpeg-cvslog mailing list