ffmpeg3.patch 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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. -#include <libavutil/audioconvert.h>
  51. #include "avcodec.h"
  52. diff -ruNp vlc-2.2.3.orig/modules/codec/avcodec/encoder.c vlc-2.2.3/modules/codec/avcodec/encoder.c
  53. --- vlc-2.2.3.orig/modules/codec/avcodec/encoder.c 2015-10-21 18:36:45.000000000 +0200
  54. +++ vlc-2.2.3/modules/codec/avcodec/encoder.c 2016-05-21 19:19:07.451194268 +0200
  55. @@ -41,7 +41,6 @@
  56. #include <vlc_cpu.h>
  57. #include <libavcodec/avcodec.h>
  58. -#include <libavutil/audioconvert.h>
  59. #include "avcodec.h"
  60. #include "avcommon.h"
  61. @@ -311,7 +310,7 @@ int OpenEncoder( vlc_object_t *p_this )
  62. else if( !GetFfmpegCodec( p_enc->fmt_out.i_codec, &i_cat, &i_codec_id,
  63. &psz_namecodec ) )
  64. {
  65. - if( FindFfmpegChroma( p_enc->fmt_out.i_codec ) == PIX_FMT_NONE )
  66. + if( FindFfmpegChroma( p_enc->fmt_out.i_codec ) == AV_PIX_FMT_NONE )
  67. return VLC_EGENERIC; /* handed chroma output */
  68. i_cat = VIDEO_ES;
  69. @@ -555,7 +554,7 @@ int OpenEncoder( vlc_object_t *p_this )
  70. if( p_codec->pix_fmts )
  71. {
  72. - const enum PixelFormat *p = p_codec->pix_fmts;
  73. + const enum AVPixelFormat *p = p_codec->pix_fmts;
  74. for( ; *p != -1; p++ )
  75. {
  76. if( *p == p_context->pix_fmt ) break;
  77. @@ -1017,7 +1016,7 @@ errmsg:
  78. }
  79. }
  80. - p_sys->frame = avcodec_alloc_frame();
  81. + p_sys->frame = av_frame_alloc();
  82. if( !p_sys->frame )
  83. {
  84. goto error;
  85. @@ -1088,7 +1087,7 @@ static block_t *EncodeVideo( encoder_t *
  86. AVFrame *frame = NULL;
  87. if( likely(p_pict) ) {
  88. frame = p_sys->frame;
  89. - avcodec_get_frame_defaults( frame );
  90. + av_frame_unref( frame );
  91. for( i_plane = 0; i_plane < p_pict->i_planes; i_plane++ )
  92. {
  93. p_sys->frame->data[i_plane] = p_pict->p[i_plane].p_pixels;
  94. @@ -1329,7 +1328,7 @@ static block_t *handle_delay_buffer( enc
  95. //How much we need to copy from new packet
  96. const int leftover = leftover_samples * p_sys->p_context->channels * p_sys->i_sample_bytes;
  97. - avcodec_get_frame_defaults( p_sys->frame );
  98. + av_frame_unref( p_sys->frame );
  99. p_sys->frame->format = p_sys->p_context->sample_fmt;
  100. p_sys->frame->nb_samples = leftover_samples + p_sys->i_samples_delay;
  101. @@ -1451,7 +1450,7 @@ static block_t *EncodeAudio( encoder_t *
  102. while( ( p_aout_buf->i_nb_samples >= p_sys->i_frame_size ) ||
  103. ( p_sys->b_variable && p_aout_buf->i_nb_samples ) )
  104. {
  105. - avcodec_get_frame_defaults( p_sys->frame );
  106. + av_frame_unref( p_sys->frame );
  107. if( p_sys->b_variable )
  108. p_sys->frame->nb_samples = p_aout_buf->i_nb_samples;
  109. else
  110. @@ -1514,7 +1513,7 @@ void CloseEncoder( vlc_object_t *p_this
  111. encoder_t *p_enc = (encoder_t *)p_this;
  112. encoder_sys_t *p_sys = p_enc->p_sys;
  113. - /*FIXME: we should use avcodec_free_frame, but we don't require so new avcodec that has it*/
  114. + /*FIXME: we should use av_frame_free, but we don't require so new avcodec that has it*/
  115. av_freep( &p_sys->frame );
  116. vlc_avcodec_lock();
  117. diff -ruNp vlc-2.2.3.orig/modules/codec/avcodec/vaapi.c vlc-2.2.3/modules/codec/avcodec/vaapi.c
  118. --- vlc-2.2.3.orig/modules/codec/avcodec/vaapi.c 2014-11-16 19:57:58.000000000 +0100
  119. +++ vlc-2.2.3/modules/codec/avcodec/vaapi.c 2016-05-21 19:19:07.452194264 +0200
  120. @@ -595,7 +595,7 @@ static int Create( vlc_va_t *p_va, AVCod
  121. return err;
  122. /* Only VLD supported */
  123. - p_va->pix_fmt = PIX_FMT_VAAPI_VLD;
  124. + p_va->pix_fmt = AV_PIX_FMT_VAAPI_VLD;
  125. p_va->setup = Setup;
  126. p_va->get = Get;
  127. p_va->release = Release;
  128. diff -ruNp vlc-2.2.3.orig/modules/codec/avcodec/video.c vlc-2.2.3/modules/codec/avcodec/video.c
  129. --- vlc-2.2.3.orig/modules/codec/avcodec/video.c 2016-04-05 02:45:24.000000000 +0200
  130. +++ vlc-2.2.3/modules/codec/avcodec/video.c 2016-05-21 19:19:07.453194260 +0200
  131. @@ -108,8 +108,8 @@ static int lavc_GetFrame(struct AVCodecC
  132. static int ffmpeg_GetFrameBuf ( struct AVCodecContext *, AVFrame * );
  133. static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *, AVFrame * );
  134. #endif
  135. -static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *,
  136. - const enum PixelFormat * );
  137. +static enum AVPixelFormat ffmpeg_GetFormat( AVCodecContext *,
  138. + const enum AVPixelFormat * );
  139. static uint32_t ffmpeg_CodecTag( vlc_fourcc_t fcc )
  140. {
  141. @@ -234,7 +234,7 @@ int InitVideoDec( decoder_t *p_dec, AVCo
  142. p_sys->p_codec = p_codec;
  143. p_sys->i_codec_id = i_codec_id;
  144. p_sys->psz_namecodec = psz_namecodec;
  145. - p_sys->p_ff_pic = avcodec_alloc_frame();
  146. + p_sys->p_ff_pic = av_frame_alloc();
  147. p_sys->b_delayed_open = true;
  148. p_sys->p_va = NULL;
  149. vlc_sem_init( &p_sys->sem_mt, 0 );
  150. @@ -446,7 +446,7 @@ int InitVideoDec( decoder_t *p_dec, AVCo
  151. if( ffmpeg_OpenCodec( p_dec ) < 0 )
  152. {
  153. msg_Err( p_dec, "cannot open codec (%s)", p_sys->psz_namecodec );
  154. - avcodec_free_frame( &p_sys->p_ff_pic );
  155. + av_frame_free( &p_sys->p_ff_pic );
  156. vlc_sem_destroy( &p_sys->sem_mt );
  157. free( p_sys );
  158. return VLC_EGENERIC;
  159. @@ -826,7 +826,7 @@ void EndVideoDec( decoder_t *p_dec )
  160. wait_mt( p_sys );
  161. if( p_sys->p_ff_pic )
  162. - avcodec_free_frame( &p_sys->p_ff_pic );
  163. + av_frame_free( &p_sys->p_ff_pic );
  164. if( p_sys->p_va )
  165. vlc_va_Delete( p_sys->p_va );
  166. @@ -1313,8 +1313,8 @@ static void ffmpeg_ReleaseFrameBuf( stru
  167. }
  168. #endif
  169. -static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
  170. - const enum PixelFormat *pi_fmt )
  171. +static enum AVPixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
  172. + const enum AVPixelFormat *pi_fmt )
  173. {
  174. decoder_t *p_dec = p_context->opaque;
  175. decoder_sys_t *p_sys = p_dec->p_sys;
  176. @@ -1341,6 +1341,15 @@ static enum PixelFormat ffmpeg_GetFormat
  177. if (!can_hwaccel)
  178. goto end;
  179. +#if (LIBAVCODEC_VERSION_MICRO >= 100) /* FFmpeg only */
  180. + if (p_context->active_thread_type)
  181. + {
  182. + msg_Warn(p_dec, "thread type %d: disabling hardware acceleration",
  183. + p_context->active_thread_type);
  184. + goto end;
  185. + }
  186. +#endif
  187. +
  188. /* Profile and level information is needed now.
  189. * TODO: avoid code duplication with avcodec.c */
  190. if( p_context->profile != FF_PROFILE_UNKNOWN)