summaryrefslogtreecommitdiff
path: root/package/vlc/patches/patch-modules_codec_avcodec_encoder_c
diff options
context:
space:
mode:
Diffstat (limited to 'package/vlc/patches/patch-modules_codec_avcodec_encoder_c')
-rw-r--r--package/vlc/patches/patch-modules_codec_avcodec_encoder_c92
1 files changed, 92 insertions, 0 deletions
diff --git a/package/vlc/patches/patch-modules_codec_avcodec_encoder_c b/package/vlc/patches/patch-modules_codec_avcodec_encoder_c
new file mode 100644
index 000000000..3766addf8
--- /dev/null
+++ b/package/vlc/patches/patch-modules_codec_avcodec_encoder_c
@@ -0,0 +1,92 @@
+--- vlc-2.2.4.orig/modules/codec/avcodec/encoder.c 2015-10-21 19:48:45.000000000 +0200
++++ vlc-2.2.4/modules/codec/avcodec/encoder.c 2016-09-24 20:35:02.681191261 +0200
+@@ -41,7 +41,7 @@
+ #include <vlc_cpu.h>
+
+ #include <libavcodec/avcodec.h>
+-#include <libavutil/audioconvert.h>
++#include <libavutil/channel_layout.h>
+
+ #include "avcodec.h"
+ #include "avcommon.h"
+@@ -311,7 +311,7 @@ int OpenEncoder( vlc_object_t *p_this )
+ else if( !GetFfmpegCodec( p_enc->fmt_out.i_codec, &i_cat, &i_codec_id,
+ &psz_namecodec ) )
+ {
+- if( FindFfmpegChroma( p_enc->fmt_out.i_codec ) == PIX_FMT_NONE )
++ if( FindFfmpegChroma( p_enc->fmt_out.i_codec ) == AV_PIX_FMT_NONE )
+ return VLC_EGENERIC; /* handed chroma output */
+
+ i_cat = VIDEO_ES;
+@@ -555,7 +555,7 @@ int OpenEncoder( vlc_object_t *p_this )
+
+ if( p_codec->pix_fmts )
+ {
+- const enum PixelFormat *p = p_codec->pix_fmts;
++ const enum AVPixelFormat *p = p_codec->pix_fmts;
+ for( ; *p != -1; p++ )
+ {
+ if( *p == p_context->pix_fmt ) break;
+@@ -1017,7 +1017,7 @@ errmsg:
+ }
+ }
+
+- p_sys->frame = avcodec_alloc_frame();
++ p_sys->frame = av_frame_alloc();
+ if( !p_sys->frame )
+ {
+ goto error;
+@@ -1048,7 +1048,7 @@ static void vlc_av_packet_Release(block_
+ {
+ vlc_av_packet_t *b = (void *) block;
+
+- av_free_packet(&b->packet);
++ av_packet_unref(&b->packet);
+ free(b);
+ }
+
+@@ -1088,7 +1088,7 @@ static block_t *EncodeVideo( encoder_t *
+ AVFrame *frame = NULL;
+ if( likely(p_pict) ) {
+ frame = p_sys->frame;
+- avcodec_get_frame_defaults( frame );
++ av_frame_unref( frame );
+ for( i_plane = 0; i_plane < p_pict->i_planes; i_plane++ )
+ {
+ p_sys->frame->data[i_plane] = p_pict->p[i_plane].p_pixels;
+@@ -1188,7 +1188,7 @@ static block_t *EncodeVideo( encoder_t *
+ av_pkt.duration / p_sys->p_context->time_base.den, p_sys->p_context );
+ if( unlikely(p_block == NULL) )
+ {
+- av_free_packet( &av_pkt );
++ av_packet_unref( &av_pkt );
+ return NULL;
+ }
+
+@@ -1329,7 +1329,7 @@ static block_t *handle_delay_buffer( enc
+ //How much we need to copy from new packet
+ const int leftover = leftover_samples * p_sys->p_context->channels * p_sys->i_sample_bytes;
+
+- avcodec_get_frame_defaults( p_sys->frame );
++ av_frame_unref( p_sys->frame );
+ p_sys->frame->format = p_sys->p_context->sample_fmt;
+ p_sys->frame->nb_samples = leftover_samples + p_sys->i_samples_delay;
+
+@@ -1451,7 +1451,7 @@ static block_t *EncodeAudio( encoder_t *
+ while( ( p_aout_buf->i_nb_samples >= p_sys->i_frame_size ) ||
+ ( p_sys->b_variable && p_aout_buf->i_nb_samples ) )
+ {
+- avcodec_get_frame_defaults( p_sys->frame );
++ av_frame_unref( p_sys->frame );
+ if( p_sys->b_variable )
+ p_sys->frame->nb_samples = p_aout_buf->i_nb_samples;
+ else
+@@ -1514,7 +1514,7 @@ void CloseEncoder( vlc_object_t *p_this
+ encoder_t *p_enc = (encoder_t *)p_this;
+ encoder_sys_t *p_sys = p_enc->p_sys;
+
+- /*FIXME: we should use avcodec_free_frame, but we don't require so new avcodec that has it*/
++ /*FIXME: we should use av_frame_free, but we don't require so new avcodec that has it*/
+ av_freep( &p_sys->frame );
+
+ vlc_avcodec_lock();