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

Nicolas Gaullier nicolas.gaullier at cji.paris
Thu Dec 19 18:43:25 EET 2019


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 9af2bc2fb5..232c8f5fd8 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3537,19 +3537,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