Merge commit '24b5cff01bbac4e08acfd6d19c499e880988f520'
authorHendrik Leppkes <h.leppkes@gmail.com>
Sun, 26 Jun 2016 13:18:56 +0000 (15:18 +0200)
committerHendrik Leppkes <h.leppkes@gmail.com>
Sun, 26 Jun 2016 13:20:43 +0000 (15:20 +0200)
* commit '24b5cff01bbac4e08acfd6d19c499e880988f520':
  lavc: handle hw_frames_ctx where necessary

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
1  2 
libavcodec/options.c

@@@ -233,6 -190,17 +233,7 @@@ FF_ENABLE_DEPRECATION_WARNING
      dest->inter_matrix    = NULL;
      dest->rc_override     = NULL;
      dest->subtitle_header = NULL;
 -#if FF_API_MPV_OPT
 -    FF_DISABLE_DEPRECATION_WARNINGS
 -    dest->rc_eq           = NULL;
 -    if (src->rc_eq) {
 -        dest->rc_eq = av_strdup(src->rc_eq);
 -        if (!dest->rc_eq)
 -            return AVERROR(ENOMEM);
 -    }
 -    FF_ENABLE_DEPRECATION_WARNINGS
 -#endif
+     dest->hw_frames_ctx   = NULL;
  
  #define alloc_and_copy_or_fail(obj, size, pad) \
      if (src->obj && size > 0) { \
      alloc_and_copy_or_fail(intra_matrix, 64 * sizeof(int16_t), 0);
      alloc_and_copy_or_fail(inter_matrix, 64 * sizeof(int16_t), 0);
      alloc_and_copy_or_fail(rc_override,  src->rc_override_count * sizeof(*src->rc_override), 0);
 -    alloc_and_copy_or_fail(subtitle_header, src->subtitle_header_size, 0);
 -    dest->subtitle_header_size = src->subtitle_header_size;
 +    alloc_and_copy_or_fail(subtitle_header, src->subtitle_header_size, 1);
 +    av_assert0(dest->subtitle_header_size == src->subtitle_header_size);
  #undef alloc_and_copy_or_fail
  
+     if (src->hw_frames_ctx) {
+         dest->hw_frames_ctx = av_buffer_ref(src->hw_frames_ctx);
+         if (!dest->hw_frames_ctx)
+             goto fail;
+     }
      return 0;
  
  fail:
      av_freep(&dest->intra_matrix);
      av_freep(&dest->inter_matrix);
      av_freep(&dest->extradata);
-     av_freep(&dest->subtitle_header);
+     av_buffer_unref(&dest->hw_frames_ctx);
 -#if FF_API_MPV_OPT
 -    FF_DISABLE_DEPRECATION_WARNINGS
 -    av_freep(&dest->rc_eq);
 -    FF_ENABLE_DEPRECATION_WARNINGS
 -#endif
 +    dest->subtitle_header_size = 0;
 +    dest->extradata_size = 0;
 +    av_opt_free(dest);
      return AVERROR(ENOMEM);
  }
  #endif