0009-ffmpeg-3.0.patch 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. Changes for ffmpeg 3.0
  2. This file is a copy of debian/patches/04_ffmpeg-3.0.diff, to be found in
  3. http://www.deb-multimedia.org/pool/main/v/vlc-dmo/vlc-dmo_2.2.4.orig.tar.gz
  4. Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  5. --- a/configure.ac
  6. +++ b/configure.ac
  7. @@ -2324,7 +2324,7 @@ AC_ARG_ENABLE(avcodec,
  8. AS_IF([test "${enable_avcodec}" != "no"], [
  9. PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 53.34.0 libavutil >= 51.22.0], [
  10. PKG_CHECK_EXISTS([libavutil < 55],, [
  11. - AC_MSG_ERROR([libavutil versions 55 and later are not supported.])
  12. + AC_MSG_WARN([libavutil versions 55 and later are not supported.])
  13. ])
  14. VLC_SAVE_FLAGS
  15. CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
  16. @@ -2334,7 +2334,7 @@ AS_IF([test "${enable_avcodec}" != "no"]
  17. VLC_RESTORE_FLAGS
  18. have_avcodec="yes"
  19. ],[
  20. - AC_MSG_ERROR([${AVCODEC_PKG_ERRORS}. Pass --disable-avcodec to ignore this error.])
  21. + AC_MSG_WARN([${AVCODEC_PKG_ERRORS}. Pass --disable-avcodec to ignore this error.])
  22. ])
  23. ], [
  24. have_avcodec="no"
  25. @@ -2383,7 +2383,7 @@ AS_IF([test "${have_vaapi}" = "yes" -a "
  26. case "${avfork}" in
  27. ffmpeg)
  28. PKG_CHECK_EXISTS([libavcodec >= 57.10.100], [
  29. - AC_MSG_ERROR([VA API requires FFmpeg libavcodec < 57.10 or libav.])
  30. + AC_MSG_WARN([VA API requires FFmpeg libavcodec < 57.10 or libav.])
  31. ])
  32. ;;
  33. esac
  34. @@ -2417,7 +2417,7 @@ AS_IF([test "${enable_dxva2}" != "no"],
  35. case "${avfork}" in
  36. ffmpeg)
  37. PKG_CHECK_EXISTS([libavcodec >= 57.10.100], [
  38. - AC_MSG_ERROR([DXVA2 requires FFmpeg libavcodec < 57.10 or libav.])
  39. + AC_MSG_WARN([DXVA2 requires FFmpeg libavcodec < 57.10 or libav.])
  40. ])
  41. ;;
  42. esac
  43. @@ -2509,7 +2509,7 @@ AS_IF([test "${enable_avformat}" != "no"
  44. ])
  45. VLC_RESTORE_FLAGS
  46. ],[
  47. - AC_MSG_ERROR([${AVFORMAT_PKG_ERRORS}. Pass --disable-avformat to ignore this error.])
  48. + AC_MSG_WARN([${AVFORMAT_PKG_ERRORS}. Pass --disable-avformat to ignore this error.])
  49. ])
  50. ])
  51. AM_CONDITIONAL([HAVE_AVFORMAT], [test "${enable_avformat}" != "no"])
  52. @@ -2538,7 +2538,7 @@ then
  53. ])
  54. VLC_RESTORE_FLAGS
  55. ],[
  56. - AC_MSG_ERROR([${SWSCALE_PKG_ERRORS}. Pass --disable-swscale to ignore this error. Proper software scaling and some video chroma conversion will be missing.])
  57. + AC_MSG_WARN([${SWSCALE_PKG_ERRORS}. Pass --disable-swscale to ignore this error. Proper software scaling and some video chroma conversion will be missing.])
  58. ])
  59. fi
  60. @@ -3181,7 +3181,7 @@ AS_IF([test "${have_vdpau}" = "yes" -a "
  61. libav) av_vdpau_ver="55.26.0" ;;
  62. ffmpeg) av_vdpau_ver="55.42.100"
  63. PKG_CHECK_EXISTS([libavcodec >= 57.10.100], [
  64. - AC_MSG_ERROR([VDPAU requires FFmpeg libavcodec < 57.10 or libav.])
  65. + AC_MSG_WARN([VDPAU requires FFmpeg libavcodec < 57.10 or libav.])
  66. ])
  67. ;;
  68. esac
  69. --- a/modules/codec/avcodec/audio.c
  70. +++ b/modules/codec/avcodec/audio.c
  71. @@ -39,7 +39,7 @@
  72. #include <libavcodec/avcodec.h>
  73. #include <libavutil/mem.h>
  74. -#include <libavutil/audioconvert.h>
  75. +#include <libavutil/channel_layout.h>
  76. #include "avcodec.h"
  77. --- a/modules/codec/avcodec/video.c
  78. +++ b/modules/codec/avcodec/video.c
  79. @@ -108,8 +108,8 @@ static int lavc_GetFrame(struct AVCodecC
  80. static int ffmpeg_GetFrameBuf ( struct AVCodecContext *, AVFrame * );
  81. static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *, AVFrame * );
  82. #endif
  83. -static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *,
  84. - const enum PixelFormat * );
  85. +static enum AVPixelFormat ffmpeg_GetFormat( AVCodecContext *,
  86. + const enum AVPixelFormat * );
  87. static uint32_t ffmpeg_CodecTag( vlc_fourcc_t fcc )
  88. {
  89. @@ -234,7 +234,7 @@ int InitVideoDec( decoder_t *p_dec, AVCo
  90. p_sys->p_codec = p_codec;
  91. p_sys->i_codec_id = i_codec_id;
  92. p_sys->psz_namecodec = psz_namecodec;
  93. - p_sys->p_ff_pic = avcodec_alloc_frame();
  94. + p_sys->p_ff_pic = av_frame_alloc();
  95. p_sys->b_delayed_open = true;
  96. p_sys->p_va = NULL;
  97. vlc_sem_init( &p_sys->sem_mt, 0 );
  98. @@ -446,7 +446,7 @@ int InitVideoDec( decoder_t *p_dec, AVCo
  99. if( ffmpeg_OpenCodec( p_dec ) < 0 )
  100. {
  101. msg_Err( p_dec, "cannot open codec (%s)", p_sys->psz_namecodec );
  102. - avcodec_free_frame( &p_sys->p_ff_pic );
  103. + av_frame_free( &p_sys->p_ff_pic );
  104. vlc_sem_destroy( &p_sys->sem_mt );
  105. free( p_sys );
  106. return VLC_EGENERIC;
  107. @@ -826,7 +826,7 @@ void EndVideoDec( decoder_t *p_dec )
  108. wait_mt( p_sys );
  109. if( p_sys->p_ff_pic )
  110. - avcodec_free_frame( &p_sys->p_ff_pic );
  111. + av_frame_free( &p_sys->p_ff_pic );
  112. if( p_sys->p_va )
  113. vlc_va_Delete( p_sys->p_va );
  114. @@ -1313,8 +1313,8 @@ static void ffmpeg_ReleaseFrameBuf( stru
  115. }
  116. #endif
  117. -static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
  118. - const enum PixelFormat *pi_fmt )
  119. +static enum AVPixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
  120. + const enum AVPixelFormat *pi_fmt )
  121. {
  122. decoder_t *p_dec = p_context->opaque;
  123. decoder_sys_t *p_sys = p_dec->p_sys;
  124. --- a/modules/codec/avcodec/encoder.c
  125. +++ b/modules/codec/avcodec/encoder.c
  126. @@ -41,7 +41,7 @@
  127. #include <vlc_cpu.h>
  128. #include <libavcodec/avcodec.h>
  129. -#include <libavutil/audioconvert.h>
  130. +#include <libavutil/channel_layout.h>
  131. #include "avcodec.h"
  132. #include "avcommon.h"
  133. @@ -311,7 +311,7 @@ int OpenEncoder( vlc_object_t *p_this )
  134. else if( !GetFfmpegCodec( p_enc->fmt_out.i_codec, &i_cat, &i_codec_id,
  135. &psz_namecodec ) )
  136. {
  137. - if( FindFfmpegChroma( p_enc->fmt_out.i_codec ) == PIX_FMT_NONE )
  138. + if( FindFfmpegChroma( p_enc->fmt_out.i_codec ) == AV_PIX_FMT_NONE )
  139. return VLC_EGENERIC; /* handed chroma output */
  140. i_cat = VIDEO_ES;
  141. @@ -555,7 +555,7 @@ int OpenEncoder( vlc_object_t *p_this )
  142. if( p_codec->pix_fmts )
  143. {
  144. - const enum PixelFormat *p = p_codec->pix_fmts;
  145. + const enum AVPixelFormat *p = p_codec->pix_fmts;
  146. for( ; *p != -1; p++ )
  147. {
  148. if( *p == p_context->pix_fmt ) break;
  149. @@ -1017,7 +1017,7 @@ errmsg:
  150. }
  151. }
  152. - p_sys->frame = avcodec_alloc_frame();
  153. + p_sys->frame = av_frame_alloc();
  154. if( !p_sys->frame )
  155. {
  156. goto error;
  157. @@ -1048,7 +1048,7 @@ static void vlc_av_packet_Release(block_
  158. {
  159. vlc_av_packet_t *b = (void *) block;
  160. - av_free_packet(&b->packet);
  161. + av_packet_unref(&b->packet);
  162. free(b);
  163. }
  164. @@ -1088,7 +1088,7 @@ static block_t *EncodeVideo( encoder_t *
  165. AVFrame *frame = NULL;
  166. if( likely(p_pict) ) {
  167. frame = p_sys->frame;
  168. - avcodec_get_frame_defaults( frame );
  169. + av_frame_unref( frame );
  170. for( i_plane = 0; i_plane < p_pict->i_planes; i_plane++ )
  171. {
  172. p_sys->frame->data[i_plane] = p_pict->p[i_plane].p_pixels;
  173. @@ -1188,7 +1188,7 @@ static block_t *EncodeVideo( encoder_t *
  174. av_pkt.duration / p_sys->p_context->time_base.den, p_sys->p_context );
  175. if( unlikely(p_block == NULL) )
  176. {
  177. - av_free_packet( &av_pkt );
  178. + av_packet_unref( &av_pkt );
  179. return NULL;
  180. }
  181. @@ -1329,7 +1329,7 @@ static block_t *handle_delay_buffer( enc
  182. //How much we need to copy from new packet
  183. const int leftover = leftover_samples * p_sys->p_context->channels * p_sys->i_sample_bytes;
  184. - avcodec_get_frame_defaults( p_sys->frame );
  185. + av_frame_unref( p_sys->frame );
  186. p_sys->frame->format = p_sys->p_context->sample_fmt;
  187. p_sys->frame->nb_samples = leftover_samples + p_sys->i_samples_delay;
  188. @@ -1451,7 +1451,7 @@ static block_t *EncodeAudio( encoder_t *
  189. while( ( p_aout_buf->i_nb_samples >= p_sys->i_frame_size ) ||
  190. ( p_sys->b_variable && p_aout_buf->i_nb_samples ) )
  191. {
  192. - avcodec_get_frame_defaults( p_sys->frame );
  193. + av_frame_unref( p_sys->frame );
  194. if( p_sys->b_variable )
  195. p_sys->frame->nb_samples = p_aout_buf->i_nb_samples;
  196. else
  197. @@ -1514,7 +1514,7 @@ void CloseEncoder( vlc_object_t *p_this
  198. encoder_t *p_enc = (encoder_t *)p_this;
  199. encoder_sys_t *p_sys = p_enc->p_sys;
  200. - /*FIXME: we should use avcodec_free_frame, but we don't require so new avcodec that has it*/
  201. + /*FIXME: we should use av_frame_free, but we don't require so new avcodec that has it*/
  202. av_freep( &p_sys->frame );
  203. vlc_avcodec_lock();
  204. --- a/modules/demux/avformat/demux.c
  205. +++ b/modules/demux/avformat/demux.c
  206. @@ -734,14 +734,14 @@ static int Demux( demux_t *p_demux )
  207. }
  208. if( pkt.stream_index < 0 || pkt.stream_index >= p_sys->i_tk )
  209. {
  210. - av_free_packet( &pkt );
  211. + av_packet_unref( &pkt );
  212. return 1;
  213. }
  214. const AVStream *p_stream = p_sys->ic->streams[pkt.stream_index];
  215. if( p_stream->time_base.den <= 0 )
  216. {
  217. msg_Warn( p_demux, "Invalid time base for the stream %d", pkt.stream_index );
  218. - av_free_packet( &pkt );
  219. + av_packet_unref( &pkt );
  220. return 1;
  221. }
  222. if( p_stream->codec->codec_id == AV_CODEC_ID_SSA )
  223. @@ -749,7 +749,7 @@ static int Demux( demux_t *p_demux )
  224. p_frame = BuildSsaFrame( &pkt, p_sys->i_ssa_order++ );
  225. if( !p_frame )
  226. {
  227. - av_free_packet( &pkt );
  228. + av_packet_unref( &pkt );
  229. return 1;
  230. }
  231. }
  232. @@ -757,7 +757,7 @@ static int Demux( demux_t *p_demux )
  233. {
  234. if( ( p_frame = block_Alloc( pkt.size ) ) == NULL )
  235. {
  236. - av_free_packet( &pkt );
  237. + av_packet_unref( &pkt );
  238. return 0;
  239. }
  240. memcpy( p_frame->p_buffer, pkt.data, pkt.size );
  241. @@ -838,7 +838,7 @@ static int Demux( demux_t *p_demux )
  242. else
  243. block_Release( p_frame );
  244. - av_free_packet( &pkt );
  245. + av_packet_unref( &pkt );
  246. return 1;
  247. }
  248. --- a/modules/codec/avcodec/vaapi.c
  249. +++ b/modules/codec/avcodec/vaapi.c
  250. @@ -595,7 +595,7 @@ static int Create( vlc_va_t *p_va, AVCod
  251. return err;
  252. /* Only VLD supported */
  253. - p_va->pix_fmt = PIX_FMT_VAAPI_VLD;
  254. + p_va->pix_fmt = AV_PIX_FMT_VAAPI_VLD;
  255. p_va->setup = Setup;
  256. p_va->get = Get;
  257. p_va->release = Release;