diff mbox

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

Message ID 20191219164327.9900-6-nicolas.gaullier@cji.paris
State Superseded
Headers show

Commit Message

Nicolas Gaullier Dec. 19, 2019, 4:43 p.m. UTC
This code is now shared with avformat_find_stream_info().
---
 fftools/ffmpeg.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)
diff mbox

Patch

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