[FFmpeg-cvslog] ffmpeg: use av_stream_new_side_data() in init_output_stream

James Almer git at videolan.org
Sat Apr 8 07:16:29 EEST 2017


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sat Apr  8 01:12:57 2017 -0300| [b438a7868c8a672f103a6b50e9572f5d31f23ce3] | committer: James Almer

ffmpeg: use av_stream_new_side_data() in init_output_stream

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

 ffmpeg.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 55467c0..e4b94b2 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3458,22 +3458,14 @@ static int init_output_stream(OutputStream *ost, char *error, int error_len)
         if (ost->enc_ctx->nb_coded_side_data) {
             int i;
 
-            ost->st->side_data = av_realloc_array(NULL, ost->enc_ctx->nb_coded_side_data,
-                                                  sizeof(*ost->st->side_data));
-            if (!ost->st->side_data)
-                return AVERROR(ENOMEM);
-
             for (i = 0; i < ost->enc_ctx->nb_coded_side_data; i++) {
                 const AVPacketSideData *sd_src = &ost->enc_ctx->coded_side_data[i];
-                AVPacketSideData *sd_dst = &ost->st->side_data[i];
+                uint8_t *dst_data;
 
-                sd_dst->data = av_malloc(sd_src->size);
-                if (!sd_dst->data)
+                dst_data = av_stream_new_side_data(ost->st, sd_src->type, sd_src->size);
+                if (!dst_data)
                     return AVERROR(ENOMEM);
-                memcpy(sd_dst->data, sd_src->data, sd_src->size);
-                sd_dst->size = sd_src->size;
-                sd_dst->type = sd_src->type;
-                ost->st->nb_side_data++;
+                memcpy(dst_data, sd_src->data, sd_src->size);
             }
         }
 



More information about the ffmpeg-cvslog mailing list