]> git.pld-linux.org Git - packages/vlc.git/blob - ffmpeg3.patch
2ca88b7b9a0e9df618e7ac43f4eab7eb2ebdfe1a
[packages/vlc.git] / ffmpeg3.patch
1 diff -ruNp vlc-2.2.3.orig/configure.ac vlc-2.2.3/configure.ac
2 --- vlc-2.2.3.orig/configure.ac 2016-04-05 02:45:40.000000000 +0200
3 +++ vlc-2.2.3/configure.ac      2016-05-21 19:19:05.527202127 +0200
4 @@ -2323,9 +2323,6 @@ AC_ARG_ENABLE(avcodec,
5  [  --enable-avcodec        libavcodec codec (default enabled)])
6  AS_IF([test "${enable_avcodec}" != "no"], [
7    PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 53.34.0 libavutil >= 51.22.0], [
8 -    PKG_CHECK_EXISTS([libavutil < 55],, [
9 -      AC_MSG_ERROR([libavutil versions 55 and later are not supported.])
10 -    ])
11      VLC_SAVE_FLAGS
12      CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
13      CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
14 @@ -2382,9 +2379,6 @@ have_avcodec_vaapi="no"
15  AS_IF([test "${have_vaapi}" = "yes" -a "${have_avcodec}" = "yes"], [
16    case "${avfork}" in
17      ffmpeg)
18 -      PKG_CHECK_EXISTS([libavcodec >= 57.10.100], [
19 -        AC_MSG_ERROR([VA API requires FFmpeg libavcodec < 57.10 or libav.])
20 -      ])
21        ;;
22    esac
23    VLC_SAVE_FLAGS
24 @@ -2416,9 +2410,6 @@ AS_IF([test "${enable_dxva2}" != "no"],
25    AS_IF([test "x${have_avcodec}" = "xyes"], [
26      case "${avfork}" in
27        ffmpeg)
28 -        PKG_CHECK_EXISTS([libavcodec >= 57.10.100], [
29 -          AC_MSG_ERROR([DXVA2 requires FFmpeg libavcodec < 57.10 or libav.])
30 -        ])
31          ;;
32      esac
33      AC_CHECK_HEADERS(dxva2api.h,
34 @@ -3180,9 +3171,6 @@ AS_IF([test "${have_vdpau}" = "yes" -a "
35    case "${avfork}" in
36      libav) av_vdpau_ver="55.26.0" ;;
37      ffmpeg) av_vdpau_ver="55.42.100"
38 -      PKG_CHECK_EXISTS([libavcodec >= 57.10.100], [
39 -        AC_MSG_ERROR([VDPAU requires FFmpeg libavcodec < 57.10 or libav.])
40 -      ])
41        ;;
42    esac
43    PKG_CHECK_EXISTS([libavutil >= 52.4.0 libavcodec >= ${av_vdpau_ver}], [
44 diff -ruNp vlc-2.2.3.orig/modules/codec/avcodec/audio.c vlc-2.2.3/modules/codec/avcodec/audio.c
45 --- vlc-2.2.3.orig/modules/codec/avcodec/audio.c        2015-12-08 17:18:56.000000000 +0100
46 +++ vlc-2.2.3/modules/codec/avcodec/audio.c     2016-05-21 19:19:05.527202127 +0200
47 @@ -39,7 +39,6 @@
48  #include <libavcodec/avcodec.h>
49  #include <libavutil/mem.h>
50  
51 -#include <libavutil/audioconvert.h>
52  
53  #include "avcodec.h"
54  
55 diff -ruNp vlc-2.2.3.orig/modules/codec/avcodec/encoder.c vlc-2.2.3/modules/codec/avcodec/encoder.c
56 --- vlc-2.2.3.orig/modules/codec/avcodec/encoder.c      2015-10-21 18:36:45.000000000 +0200
57 +++ vlc-2.2.3/modules/codec/avcodec/encoder.c   2016-05-21 19:19:07.451194268 +0200
58 @@ -41,7 +41,6 @@
59  #include <vlc_cpu.h>
60  
61  #include <libavcodec/avcodec.h>
62 -#include <libavutil/audioconvert.h>
63  
64  #include "avcodec.h"
65  #include "avcommon.h"
66 @@ -311,7 +310,7 @@ int OpenEncoder( vlc_object_t *p_this )
67      else if( !GetFfmpegCodec( p_enc->fmt_out.i_codec, &i_cat, &i_codec_id,
68                               &psz_namecodec ) )
69      {
70 -        if( FindFfmpegChroma( p_enc->fmt_out.i_codec ) == PIX_FMT_NONE )
71 +        if( FindFfmpegChroma( p_enc->fmt_out.i_codec ) == AV_PIX_FMT_NONE )
72              return VLC_EGENERIC; /* handed chroma output */
73  
74          i_cat      = VIDEO_ES;
75 @@ -555,7 +554,7 @@ int OpenEncoder( vlc_object_t *p_this )
76  
77          if( p_codec->pix_fmts )
78          {
79 -            const enum PixelFormat *p = p_codec->pix_fmts;
80 +            const enum AVPixelFormat *p = p_codec->pix_fmts;
81              for( ; *p != -1; p++ )
82              {
83                  if( *p == p_context->pix_fmt ) break;
84 @@ -1017,7 +1016,7 @@ errmsg:
85          }
86      }
87  
88 -    p_sys->frame = avcodec_alloc_frame();
89 +    p_sys->frame = av_frame_alloc();
90      if( !p_sys->frame )
91      {
92          goto error;
93 @@ -1088,7 +1087,7 @@ static block_t *EncodeVideo( encoder_t *
94      AVFrame *frame = NULL;
95      if( likely(p_pict) ) {
96          frame = p_sys->frame;
97 -        avcodec_get_frame_defaults( frame );
98 +        av_frame_unref( frame );
99          for( i_plane = 0; i_plane < p_pict->i_planes; i_plane++ )
100          {
101              p_sys->frame->data[i_plane] = p_pict->p[i_plane].p_pixels;
102 @@ -1329,7 +1328,7 @@ static block_t *handle_delay_buffer( enc
103      //How much we need to copy from new packet
104      const int leftover = leftover_samples * p_sys->p_context->channels * p_sys->i_sample_bytes;
105  
106 -    avcodec_get_frame_defaults( p_sys->frame );
107 +    av_frame_unref( p_sys->frame );
108      p_sys->frame->format     = p_sys->p_context->sample_fmt;
109      p_sys->frame->nb_samples = leftover_samples + p_sys->i_samples_delay;
110  
111 @@ -1451,7 +1450,7 @@ static block_t *EncodeAudio( encoder_t *
112      while( ( p_aout_buf->i_nb_samples >= p_sys->i_frame_size ) ||
113             ( p_sys->b_variable && p_aout_buf->i_nb_samples ) )
114      {
115 -        avcodec_get_frame_defaults( p_sys->frame );
116 +        av_frame_unref( p_sys->frame );
117          if( p_sys->b_variable )
118              p_sys->frame->nb_samples = p_aout_buf->i_nb_samples;
119          else
120 @@ -1514,7 +1513,7 @@ void CloseEncoder( vlc_object_t *p_this
121      encoder_t *p_enc = (encoder_t *)p_this;
122      encoder_sys_t *p_sys = p_enc->p_sys;
123  
124 -    /*FIXME: we should use avcodec_free_frame, but we don't require so new avcodec that has it*/
125 +    /*FIXME: we should use av_frame_free, but we don't require so new avcodec that has it*/
126      av_freep( &p_sys->frame );
127  
128      vlc_avcodec_lock();
129 diff -ruNp vlc-2.2.3.orig/modules/codec/avcodec/vaapi.c vlc-2.2.3/modules/codec/avcodec/vaapi.c
130 --- vlc-2.2.3.orig/modules/codec/avcodec/vaapi.c        2014-11-16 19:57:58.000000000 +0100
131 +++ vlc-2.2.3/modules/codec/avcodec/vaapi.c     2016-05-21 19:19:07.452194264 +0200
132 @@ -595,7 +595,7 @@ static int Create( vlc_va_t *p_va, AVCod
133          return err;
134  
135      /* Only VLD supported */
136 -    p_va->pix_fmt = PIX_FMT_VAAPI_VLD;
137 +    p_va->pix_fmt = AV_PIX_FMT_VAAPI_VLD;
138      p_va->setup = Setup;
139      p_va->get = Get;
140      p_va->release = Release;
141 diff -ruNp vlc-2.2.3.orig/modules/codec/avcodec/video.c vlc-2.2.3/modules/codec/avcodec/video.c
142 --- vlc-2.2.3.orig/modules/codec/avcodec/video.c        2016-04-05 02:45:24.000000000 +0200
143 +++ vlc-2.2.3/modules/codec/avcodec/video.c     2016-05-21 19:19:07.453194260 +0200
144 @@ -108,8 +108,8 @@ static int lavc_GetFrame(struct AVCodecC
145  static int  ffmpeg_GetFrameBuf    ( struct AVCodecContext *, AVFrame * );
146  static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *, AVFrame * );
147  #endif
148 -static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *,
149 -                                          const enum PixelFormat * );
150 +static enum AVPixelFormat ffmpeg_GetFormat( AVCodecContext *,
151 +                                            const enum AVPixelFormat * );
152  
153  static uint32_t ffmpeg_CodecTag( vlc_fourcc_t fcc )
154  {
155 @@ -234,7 +234,7 @@ int InitVideoDec( decoder_t *p_dec, AVCo
156      p_sys->p_codec = p_codec;
157      p_sys->i_codec_id = i_codec_id;
158      p_sys->psz_namecodec = psz_namecodec;
159 -    p_sys->p_ff_pic = avcodec_alloc_frame();
160 +    p_sys->p_ff_pic = av_frame_alloc();
161      p_sys->b_delayed_open = true;
162      p_sys->p_va = NULL;
163      vlc_sem_init( &p_sys->sem_mt, 0 );
164 @@ -446,7 +446,7 @@ int InitVideoDec( decoder_t *p_dec, AVCo
165      if( ffmpeg_OpenCodec( p_dec ) < 0 )
166      {
167          msg_Err( p_dec, "cannot open codec (%s)", p_sys->psz_namecodec );
168 -        avcodec_free_frame( &p_sys->p_ff_pic );
169 +        av_frame_free( &p_sys->p_ff_pic );
170          vlc_sem_destroy( &p_sys->sem_mt );
171          free( p_sys );
172          return VLC_EGENERIC;
173 @@ -826,7 +826,7 @@ void EndVideoDec( decoder_t *p_dec )
174      wait_mt( p_sys );
175  
176      if( p_sys->p_ff_pic )
177 -        avcodec_free_frame( &p_sys->p_ff_pic );
178 +        av_frame_free( &p_sys->p_ff_pic );
179  
180      if( p_sys->p_va )
181          vlc_va_Delete( p_sys->p_va );
182 @@ -1313,8 +1313,8 @@ static void ffmpeg_ReleaseFrameBuf( stru
183  }
184  #endif
185  
186 -static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
187 -                                          const enum PixelFormat *pi_fmt )
188 +static enum AVPixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
189 +                                            const enum AVPixelFormat *pi_fmt )
190  {
191      decoder_t *p_dec = p_context->opaque;
192      decoder_sys_t *p_sys = p_dec->p_sys;
193 @@ -1341,6 +1341,16 @@ static enum PixelFormat ffmpeg_GetFormat
194      if (!can_hwaccel)
195          goto end;
196  
197 +#if (LIBAVCODEC_VERSION_MICRO >= 100) \
198 +  && (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 83, 101))
199 +    if (p_context->active_thread_type)
200 +    {
201 +        msg_Warn(p_dec, "thread type %d: disabling hardware acceleration",
202 +                 p_context->active_thread_type);
203 +        goto end;
204 +    }
205 +#endif
206 +
207      /* Profile and level information is needed now.
208       * TODO: avoid code duplication with avcodec.c */
209      if( p_context->profile != FF_PROFILE_UNKNOWN)
This page took 0.067812 seconds and 2 git commands to generate.