[FFmpeg-devel] [PATCH v6 3/5] fftools/ffmpeg: Use the new av_stream_add_coded_side_data()

Nicolas Gaullier nicolas.gaullier at cji.paris
Mon Jan 13 20:54:57 EET 2020


This code is now shared with avformat_find_stream_info().
---
 fftools/ffmpeg.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 6bcd7b94d2..a513e9f3cc 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3534,19 +3534,9 @@ static int init_output_stream(OutputStream *ost, char *error, int error_len)
         if (ret < 0)
             return ret;
 
-        if (ost->enc_ctx->nb_coded_side_data) {
-            int i;
-
-            for (i = 0; i < ost->enc_ctx->nb_coded_side_data; i++) {
-                const AVPacketSideData *sd_src = &ost->enc_ctx->coded_side_data[i];
-                uint8_t *dst_data;
-
-                dst_data = av_stream_new_side_data(ost->st, sd_src->type, sd_src->size);
-                if (!dst_data)
-                    return AVERROR(ENOMEM);
-                memcpy(dst_data, sd_src->data, sd_src->size);
-            }
-        }
+        ret = av_stream_add_coded_side_data(ost->st, ost->enc_ctx);
+        if (ret < 0)
+            return ret;
 
         /*
          * Add global input side data. For now this is naive, and copies it
-- 
2.14.1.windows.1



More information about the ffmpeg-devel mailing list