0009-Changes-for-ffmpeg-3.0.patch 12 KB

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