[FFmpeg-cvslog] avfilter/af_crystalizer: add support for more sample formats

2017-04-30 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Sun Apr 30 12:56:23 
2017 +0200| [8dd3a53dbf7dfbca4f8a750936f0ba3849a3f0b8] | committer: Paul B Mahol

avfilter/af_crystalizer: add support for more sample formats

Signed-off-by: Paul B Mahol 

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

 libavfilter/af_crystalizer.c | 148 ---
 1 file changed, 126 insertions(+), 22 deletions(-)

diff --git a/libavfilter/af_crystalizer.c b/libavfilter/af_crystalizer.c
index 086549a93d..dec30aa5f4 100644
--- a/libavfilter/af_crystalizer.c
+++ b/libavfilter/af_crystalizer.c
@@ -29,6 +29,8 @@ typedef struct CrystalizerContext {
 float mult;
 int clip;
 AVFrame *prev;
+void (*filter)(void **dst, void **prv, const void **src,
+   int nb_samples, int channels, float mult, int clip);
 } CrystalizerContext;
 
 #define OFFSET(x) offsetof(CrystalizerContext, x)
@@ -46,10 +48,18 @@ static int query_formats(AVFilterContext *ctx)
 {
 AVFilterFormats *formats = NULL;
 AVFilterChannelLayouts *layouts = NULL;
+static const enum AVSampleFormat sample_fmts[] = {
+AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
+AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP,
+AV_SAMPLE_FMT_NONE
+};
 int ret;
 
-if ((ret = ff_add_format(&formats, AV_SAMPLE_FMT_FLT )) < 0 ||
-(ret = ff_set_common_formats(ctx , formats   )) < 0)
+formats = ff_make_format_list(sample_fmts);
+if (!formats)
+return AVERROR(ENOMEM);
+ret = ff_set_common_formats(ctx, formats);
+if (ret < 0)
 return ret;
 
 layouts = ff_all_channel_counts();
@@ -64,16 +74,123 @@ static int query_formats(AVFilterContext *ctx)
 return ff_set_common_samplerates(ctx, formats);
 }
 
+static void filter_flt(void **d, void **p, const void **s,
+   int nb_samples, int channels,
+   float mult, int clip)
+{
+const float *src = s[0];
+float *dst = d[0];
+float *prv = p[0];
+int n, c;
+
+for (n = 0; n < nb_samples; n++) {
+for (c = 0; c < channels; c++) {
+float current = src[c];
+
+dst[c] = current + (current - prv[c]) * mult;
+prv[c] = current;
+if (clip) {
+dst[c] = av_clipf(dst[c], -1, 1);
+}
+}
+
+dst += c;
+src += c;
+}
+}
+
+static void filter_dbl(void **d, void **p, const void **s,
+   int nb_samples, int channels,
+   float mult, int clip)
+{
+const double *src = s[0];
+double *dst = d[0];
+double *prv = p[0];
+int n, c;
+
+for (n = 0; n < nb_samples; n++) {
+for (c = 0; c < channels; c++) {
+double current = src[c];
+
+dst[c] = current + (current - prv[c]) * mult;
+prv[c] = current;
+if (clip) {
+dst[c] = av_clipd(dst[c], -1, 1);
+}
+}
+
+dst += c;
+src += c;
+}
+}
+
+static void filter_fltp(void **d, void **p, const void **s,
+int nb_samples, int channels,
+float mult, int clip)
+{
+int n, c;
+
+for (c = 0; c < channels; c++) {
+const float *src = s[c];
+float *dst = d[c];
+float *prv = p[c];
+
+for (n = 0; n < nb_samples; n++) {
+float current = src[n];
+
+dst[n] = current + (current - prv[0]) * mult;
+prv[0] = current;
+if (clip) {
+dst[n] = av_clipf(dst[n], -1, 1);
+}
+}
+}
+}
+
+static void filter_dblp(void **d, void **p, const void **s,
+int nb_samples, int channels,
+float mult, int clip)
+{
+int n, c;
+
+for (c = 0; c < channels; c++) {
+const double *src = s[c];
+double *dst = d[c];
+double *prv = p[c];
+
+for (n = 0; n < nb_samples; n++) {
+double current = src[n];
+
+dst[n] = current + (current - prv[0]) * mult;
+prv[0] = current;
+if (clip) {
+dst[n] = av_clipd(dst[n], -1, 1);
+}
+}
+}
+}
+
+static int config_input(AVFilterLink *inlink)
+{
+AVFilterContext *ctx = inlink->dst;
+CrystalizerContext *s= ctx->priv;
+
+switch (inlink->format) {
+case AV_SAMPLE_FMT_FLT:  s->filter = filter_flt;  break;
+case AV_SAMPLE_FMT_DBL:  s->filter = filter_dbl;  break;
+case AV_SAMPLE_FMT_FLTP: s->filter = filter_fltp; break;
+case AV_SAMPLE_FMT_DBLP: s->filter = filter_dblp; break;
+}
+
+return 0;
+}
+
 static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 {
 AVFilterContext *ctx = inlink->dst;
 AVFilterLink *outlink = ctx->outputs[0];
 CrystalizerContext *s = ctx->priv;
-const float *src = (const float *)in->data[0];
-const float mult = 

[FFmpeg-cvslog] libswscale/tests/swscale: Fix uninitialized variables

2017-04-30 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Apr 29 18:46:48 2017 +0200| [7796f290653349a4126f2d448d11bb4440b9f257] | 
committer: Michael Niedermayer

libswscale/tests/swscale: Fix uninitialized variables

Signed-off-by: Michael Niedermayer 

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

 libswscale/tests/swscale.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libswscale/tests/swscale.c b/libswscale/tests/swscale.c
index bd8d098a3d..b4b8173a31 100644
--- a/libswscale/tests/swscale.c
+++ b/libswscale/tests/swscale.c
@@ -309,10 +309,10 @@ static int fileTest(uint8_t *ref[4], int refStride[4], 
int w, int h, FILE *fp,
 struct Results r;
 enum AVPixelFormat srcFormat;
 char srcStr[12];
-int srcW, srcH;
+int srcW = 0, srcH = 0;
 enum AVPixelFormat dstFormat;
 char dstStr[12];
-int dstW, dstH;
+int dstW = 0, dstH = 0;
 int flags;
 int ret;
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] tools: Eliminate codec_type complexity from fuzzer

2017-04-30 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun 
Apr 30 11:44:51 2017 +0200| [a9b5b6a97f4f4c0a9e06ea1485c02e3de58cc0b1] | 
committer: Michael Niedermayer

tools: Eliminate codec_type complexity from fuzzer

Signed-off-by: Michael Niedermayer 

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

 tools/Makefile| 11 ++-
 tools/target_dec_fuzzer.c | 19 +--
 2 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/tools/Makefile b/tools/Makefile
index 2b9432bcc2..c4d9e90dea 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -1,15 +1,8 @@
 TOOLS = qt-faststart trasher uncoded_frame
 TOOLS-$(CONFIG_ZLIB) += cws2fws
 
-tools/target_dec_video_%_fuzzer.o: tools/target_dec_fuzzer.c
-   $(COMPILE_C) -DFFMPEG_CODEC=AV_CODEC_ID_$* -DFUZZ_FFMPEG_VIDEO
-
-tools/target_dec_audio_%_fuzzer.o: tools/target_dec_fuzzer.c
-   $(COMPILE_C) -DFFMPEG_CODEC=AV_CODEC_ID_$* -DFUZZ_FFMPEG_AUDIO
-
-tools/target_dec_subtitle_%_fuzzer.o: tools/target_dec_fuzzer.c
-   $(COMPILE_C) -DFFMPEG_CODEC=AV_CODEC_ID_$* -DFUZZ_FFMPEG_SUBTITLE
-
+tools/target_dec_%_fuzzer.o: tools/target_dec_fuzzer.c
+   $(COMPILE_C) -DFFMPEG_CODEC=AV_CODEC_ID_$*
 
 OBJDIRS += tools
 
diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index e6a942cb30..ce58fe5eaf 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -74,11 +74,6 @@ static AVCodec *AVCodecInitialize(enum AVCodecID codec_id)
 return res;
 }
 
-#if defined(FUZZ_FFMPEG_VIDEO)
-#define decode_handler avcodec_decode_video2
-#elif defined(FUZZ_FFMPEG_AUDIO)
-#define decode_handler avcodec_decode_audio4
-#elif defined(FUZZ_FFMPEG_SUBTITLE)
 static int subtitle_handler(AVCodecContext *avctx, void *frame,
 int *got_sub_ptr, AVPacket *avpkt)
 {
@@ -89,11 +84,6 @@ static int subtitle_handler(AVCodecContext *avctx, void 
*frame,
 return ret;
 }
 
-#define decode_handler subtitle_handler
-#else
-#error "Specify encoder type"  // To catch mistakes
-#endif
-
 // Class to handle buffer allocation and resize for each frame
 typedef struct FuzzDataBuffer {
 size_t size_;
@@ -146,10 +136,19 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 const uint8_t *last = data;
 const uint8_t *end = data + size;
 uint32_t it = 0;
+int (*decode_handler)(AVCodecContext *avctx, AVFrame *picture,
+  int *got_picture_ptr,
+  const AVPacket *avpkt) = NULL;
 
 if (!c)
 c = AVCodecInitialize(FFMPEG_CODEC);  // Done once.
 
+switch (c->type) {
+case AVMEDIA_TYPE_AUDIO   : decode_handler = avcodec_decode_audio4; break;
+case AVMEDIA_TYPE_VIDEO   : decode_handler = avcodec_decode_video2; break;
+case AVMEDIA_TYPE_SUBTITLE: decode_handler = subtitle_handler ; break;
+}
+
 AVCodecContext* ctx = avcodec_alloc_context3(NULL);
 if (!ctx)
 error("Failed memory allocation");

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] mpeg12dec: move setting first_field to mpeg_field_start()

2017-04-30 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Sat Dec 17 
17:04:55 2016 +0100| [c2fa6bb0e8703a7a6aa10e11f9ab36094416d83f] | committer: 
Anton Khirnov

mpeg12dec: move setting first_field to mpeg_field_start()

For field picture, the first_field is set based on its previous value.
Before this commit, first_field is set when reading the picture
coding extension. However, in corrupted files there may be multiple
picture coding extension headers, so the final value of first_field that
is actually used during decoding can be wrong. That can lead to various
undefined behaviour, like predicting from a non-existing field.

Fix this problem, by setting first_field in mpeg_field_start(), which
should be called exactly once per field.

CC: libav-sta...@libav.org
Bug-ID: 999

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

 libavcodec/mpeg12dec.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 310169becc..afdd652b6a 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1536,10 +1536,8 @@ static void 
mpeg_decode_picture_coding_extension(Mpeg1Context *s1)
 av_log(s->avctx, AV_LOG_WARNING, "invalid frame_pred_frame_dct\n");
 
 if (s->picture_structure == PICT_FRAME) {
-s->first_field = 0;
 s->v_edge_pos  = 16 * s->mb_height;
 } else {
-s->first_field ^= 1;
 s->v_edge_pos   = 8 * s->mb_height;
 memset(s->mbskip_table, 0, s->mb_stride * s->mb_height);
 }
@@ -1570,6 +1568,11 @@ static int mpeg_field_start(MpegEncContext *s, const 
uint8_t *buf, int buf_size)
 Mpeg1Context *s1  = (Mpeg1Context *) s;
 int ret;
 
+if (s->picture_structure == PICT_FRAME)
+s->first_field = 0;
+else
+s->first_field ^= 1;
+
 /* start frame decoding */
 if (s->first_field || s->picture_structure == PICT_FRAME) {
 AVFrameSideData *pan_scan;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit 'c2fa6bb0e8703a7a6aa10e11f9ab36094416d83f'

2017-04-30 Thread James Almer
ffmpeg | branch: master | James Almer  | Sun Apr 30 10:23:50 
2017 -0300| [d61f93bf04eb90d3998d654e233fcaa87e86768a] | committer: James Almer

Merge commit 'c2fa6bb0e8703a7a6aa10e11f9ab36094416d83f'

* commit 'c2fa6bb0e8703a7a6aa10e11f9ab36094416d83f':
  mpeg12dec: move setting first_field to mpeg_field_start()

This commit is a noop, see 2f6f2f4f73c068979829e785d08cb1dd345c7fc8

Merged-by: James Almer 

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



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/matroskadec: export Content Light Level metadata

2017-04-30 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr 25 15:04:00 
2017 -0300| [095147ae0650799437390c81ae66d1151ceb9b31] | committer: James Almer

avformat/matroskadec: export Content Light Level metadata

Based on a patch by Hendrik Leppkes

Signed-off-by: James Almer 

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

 libavformat/matroskadec.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 47873cccd8..9e2c9bd2e2 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1869,6 +1869,21 @@ static int mkv_parse_video_color(AVStream *st, const 
MatroskaTrack *track) {
 avcodec_chroma_pos_to_enum((color->chroma_siting_horz - 1) << 7,
(color->chroma_siting_vert - 1) << 7);
 }
+if (color->max_cll && color->max_fall) {
+size_t size = 0;
+int ret;
+AVContentLightMetadata *metadata = 
av_content_light_metadata_alloc(&size);
+if (!metadata)
+return AVERROR(ENOMEM);
+ret = av_stream_add_side_data(st, AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
+  (uint8_t *)metadata, size);
+if (ret < 0) {
+av_freep(&metadata);
+return ret;
+}
+metadata->MaxCLL  = color->max_cll;
+metadata->MaxFALL = color->max_fall;
+}
 
 if (has_mastering_primaries || has_mastering_luminance) {
 // Use similar rationals as other standards.

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/matroskaenc: add support for writing Content Light Level elements

2017-04-30 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Apr 25 15:42:51 
2017 -0300| [37cc1c1e9137fe72354945b1cd2851ffc972661d] | committer: James Almer

avformat/matroskaenc: add support for writing Content Light Level elements

Signed-off-by: James Almer 

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

 libavformat/matroskaenc.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 9c7a213db9..f14936e3d2 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -844,8 +844,7 @@ static int mkv_write_video_color(AVIOContext *pb, 
AVCodecParameters *par, AVStre
 uint8_t *colorinfo_ptr;
 int side_data_size = 0;
 int ret, colorinfo_size;
-const uint8_t *side_data = av_stream_get_side_data(
-st, AV_PKT_DATA_MASTERING_DISPLAY_METADATA, &side_data_size);
+const uint8_t *side_data;
 
 ret = avio_open_dyn_buf(&dyn_cp);
 if (ret < 0)
@@ -876,6 +875,18 @@ static int mkv_write_video_color(AVIOContext *pb, 
AVCodecParameters *par, AVStre
 put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORCHROMASITINGHORZ, (xpos >> 
7) + 1);
 put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORCHROMASITINGVERT, (ypos >> 
7) + 1);
 }
+
+side_data = av_stream_get_side_data(st, AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
+&side_data_size);
+if (side_data_size) {
+const AVContentLightMetadata *metadata =
+(const AVContentLightMetadata*)side_data;
+put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORMAXCLL,  metadata->MaxCLL);
+put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORMAXFALL, 
metadata->MaxFALL);
+}
+
+side_data = av_stream_get_side_data(st, 
AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
+&side_data_size);
 if (side_data_size == sizeof(AVMasteringDisplayMetadata)) {
 ebml_master meta_element = start_ebml_master(
 dyn_cp, MATROSKA_ID_VIDEOCOLORMASTERINGMETA, 0);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/options: factorize avcodec_copy_context() cleanup code

2017-04-30 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Apr 22 13:25:32 
2017 -0300| [54a4c9b4e9a1524b1ac5d2be97c8042272402d0a] | committer: James Almer

avcodec/options: factorize avcodec_copy_context() cleanup code

Reviewed-by: Aaron Levinson 
Tested-by: Michael Niedermayer 
Signed-off-by: James Almer 

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

 libavcodec/options.c | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/libavcodec/options.c b/libavcodec/options.c
index 7bdb0be5af..b98da9378a 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -188,6 +188,19 @@ void avcodec_free_context(AVCodecContext **pavctx)
 }
 
 #if FF_API_COPY_CONTEXT
+static void copy_context_reset(AVCodecContext *avctx)
+{
+av_opt_free(avctx);
+av_freep(&avctx->rc_override);
+av_freep(&avctx->intra_matrix);
+av_freep(&avctx->inter_matrix);
+av_freep(&avctx->extradata);
+av_freep(&avctx->subtitle_header);
+av_buffer_unref(&avctx->hw_frames_ctx);
+avctx->subtitle_header_size = 0;
+avctx->extradata_size = 0;
+}
+
 int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
 {
 const AVCodec *orig_codec = dest->codec;
@@ -200,12 +213,7 @@ int avcodec_copy_context(AVCodecContext *dest, const 
AVCodecContext *src)
 return AVERROR(EINVAL);
 }
 
-av_opt_free(dest);
-av_freep(&dest->rc_override);
-av_freep(&dest->intra_matrix);
-av_freep(&dest->inter_matrix);
-av_freep(&dest->extradata);
-av_freep(&dest->subtitle_header);
+copy_context_reset(dest);
 
 memcpy(dest, src, sizeof(*dest));
 av_opt_copy(dest, src);
@@ -264,15 +272,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 return 0;
 
 fail:
-av_freep(&dest->subtitle_header);
-av_freep(&dest->rc_override);
-av_freep(&dest->intra_matrix);
-av_freep(&dest->inter_matrix);
-av_freep(&dest->extradata);
-av_buffer_unref(&dest->hw_frames_ctx);
-dest->subtitle_header_size = 0;
-dest->extradata_size = 0;
-av_opt_free(dest);
+copy_context_reset(dest);
 return AVERROR(ENOMEM);
 }
 #endif

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/options: do a more thorough clean up in avcodec_copy_context()

2017-04-30 Thread James Almer
ffmpeg | branch: master | James Almer  | Mon Apr 24 14:53:47 
2017 -0300| [cac8de2da5c4935773128335c11b806faa73e19d] | committer: James Almer

avcodec/options: do a more thorough clean up in avcodec_copy_context()

Free coded_frame, coded_side_data and unref hw_device_ctx to prevent
potential leaks.

Reviewed-by: Aaron Levinson 
Tested-by: Michael Niedermayer 
Signed-off-by: James Almer 

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

 libavcodec/options.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/libavcodec/options.c b/libavcodec/options.c
index b98da9378a..82e12179a6 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -190,14 +190,26 @@ void avcodec_free_context(AVCodecContext **pavctx)
 #if FF_API_COPY_CONTEXT
 static void copy_context_reset(AVCodecContext *avctx)
 {
+int i;
+
 av_opt_free(avctx);
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+av_frame_free(&avctx->coded_frame);
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 av_freep(&avctx->rc_override);
 av_freep(&avctx->intra_matrix);
 av_freep(&avctx->inter_matrix);
 av_freep(&avctx->extradata);
 av_freep(&avctx->subtitle_header);
 av_buffer_unref(&avctx->hw_frames_ctx);
+av_buffer_unref(&avctx->hw_device_ctx);
+for (i = 0; i < avctx->nb_coded_side_data; i++)
+av_freep(&avctx->coded_side_data[i].data);
+av_freep(&avctx->coded_side_data);
 avctx->subtitle_header_size = 0;
+avctx->nb_coded_side_data = 0;
 avctx->extradata_size = 0;
 }
 
@@ -238,11 +250,14 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
 /* reallocate values that should be allocated separately */
 dest->extradata   = NULL;
+dest->coded_side_data = NULL;
 dest->intra_matrix= NULL;
 dest->inter_matrix= NULL;
 dest->rc_override = NULL;
 dest->subtitle_header = NULL;
 dest->hw_frames_ctx   = NULL;
+dest->hw_device_ctx   = NULL;
+dest->nb_coded_side_data = 0;
 
 #define alloc_and_copy_or_fail(obj, size, pad) \
 if (src->obj && size > 0) { \

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog