Update API usage to deal with current vs new FFmpeg API.
ndex: Makefile
===================================================================
RCS file: /home/cvs/ports/x11/vlc/Makefile,v
retrieving revision 1.221
diff -u -p -u -p -r1.221 Makefile
--- Makefile 24 Oct 2018 14:28:13 -0000 1.221
+++ Makefile 21 Feb 2019 13:42:21 -0000
@@ -10,7 +10,7 @@ PKGNAME-jack= vlc-jack-${V}
CATEGORIES= x11
MASTER_SITES= https://download.videolan.org/pub/videolan/vlc/${V}/
EXTRACT_SUFX= .tar.xz
-REVISION= 3
+REVISION= 4
SHARED_LIBS= vlc 3.0 \
vlccore 3.0
Index: patches/patch-configure_ac
===================================================================
RCS file: /home/cvs/ports/x11/vlc/patches/patch-configure_ac,v
retrieving revision 1.33
diff -u -p -u -p -r1.33 patch-configure_ac
--- patches/patch-configure_ac 27 May 2017 08:40:14 -0000 1.33
+++ patches/patch-configure_ac 21 Feb 2019 17:02:00 -0000
@@ -1,4 +1,7 @@
$OpenBSD: patch-configure_ac,v 1.33 2017/05/27 08:40:14 ajacoutot Exp $
+
+Update for newer FFmpeg API.
+
Index: configure.ac
--- configure.ac.orig
+++ configure.ac
@@ -56,7 +59,55 @@ Index: configure.ac
], [
LIVE555_PREFIX=${LIVE555_PREFIX-"/usr/lib/live"}
CPPFLAGS_live555="-I${LIVE555_PREFIX}/liveMedia/include
-I${LIVE555_PREFIX}/groupsock/include
-I${LIVE555_PREFIX}/BasicUsageEnvironment/include
-I${LIVE555_PREFIX}/UsageEnvironment/include"
-@@ -3730,47 +3699,18 @@ AC_ARG_ENABLE(qt, [
+@@ -2316,10 +2285,10 @@ dnl
+ AC_ARG_ENABLE(avcodec,
+ [ --enable-avcodec libavcodec codec (default enabled)])
+ AS_IF([test "${enable_avcodec}" != "no"], [
+- PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 53.34.0 libavutil >= 51.22.0], [
+- PKG_CHECK_EXISTS([libavutil < 55],, [
+- AC_MSG_ERROR([libavutil versions 55 and later are not supported.])
+- ])
++ PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 55.0.0 libavutil >= 51.22.0], [
++ dnl PKG_CHECK_EXISTS([libavcodec < 56],, [
++ dnl AC_MSG_ERROR([libavcodec versions 56 and later are not supported
yet.])
++ dnl ])
+ VLC_SAVE_FLAGS
+ CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
+ CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
+@@ -2377,7 +2346,9 @@ AS_IF([test "${have_vaapi}" = "yes" -a "${have_avcodec
+ case "${avfork}" in
+ ffmpeg)
+ PKG_CHECK_EXISTS([libavcodec >= 57.10.100], [
+- AC_MSG_ERROR([VA API requires FFmpeg libavcodec < 57.10 or libav.])
++ PKG_CHECK_EXISTS([libavcodec <= 57.12.100], [
++ AC_MSG_ERROR([VA API requires FFmpeg libavcodec < 57.10 or > 57.12
or libav.])
++ ])
+ ])
+ ;;
+ esac
+@@ -2411,7 +2382,9 @@ AS_IF([test "${enable_dxva2}" != "no"], [
+ case "${avfork}" in
+ ffmpeg)
+ PKG_CHECK_EXISTS([libavcodec >= 57.10.100], [
+- AC_MSG_ERROR([DXVA2 requires FFmpeg libavcodec < 57.10 or libav.])
++ PKG_CHECK_EXISTS([libavcodec <= 57.12.100], [
++ AC_MSG_ERROR([DXVA2 requires FFmpeg libavcodec < 57.10 or > 57.12
or libav.])
++ ])
+ ])
+ ;;
+ esac
+@@ -3175,7 +3148,9 @@ AS_IF([test "${have_vdpau}" = "yes" -a "${have_avcodec
+ libav) av_vdpau_ver="55.26.0" ;;
+ ffmpeg) av_vdpau_ver="55.42.100"
+ PKG_CHECK_EXISTS([libavcodec >= 57.10.100], [
+- AC_MSG_ERROR([VDPAU requires FFmpeg libavcodec < 57.10 or libav.])
++ PKG_CHECK_EXISTS([libavcodec <= 57.12.100], [
++ AC_MSG_ERROR([VDPAU requires FFmpeg libavcodec < 57.10 or > 57.12
or libav.])
++ ])
+ ])
+ ;;
+ esac
+@@ -3730,47 +3705,18 @@ AC_ARG_ENABLE(qt, [
])
])
AS_IF([test "${enable_qt}" != "no"], [
Index: patches/patch-modules_codec_avcodec_audio_c
===================================================================
RCS file: patches/patch-modules_codec_avcodec_audio_c
diff -N patches/patch-modules_codec_avcodec_audio_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-modules_codec_avcodec_audio_c 21 Feb 2019 17:02:16 -0000
@@ -0,0 +1,50 @@
+$OpenBSD$
+
+Update for newer FFmpeg API.
+
+Index: modules/codec/avcodec/audio.c
+--- modules/codec/avcodec/audio.c.orig
++++ modules/codec/avcodec/audio.c
+@@ -39,7 +39,7 @@
+ #include <libavcodec/avcodec.h>
+ #include <libavutil/mem.h>
+
+-#include <libavutil/audioconvert.h>
++#include <libavutil/channel_layout.h>
+
+ #include "avcodec.h"
+
+@@ -96,7 +96,7 @@ static void InitDecoderConfig( decoder_t *p_dec, AVCod
+ if( i_size > 0 )
+ {
+ p_context->extradata =
+- av_malloc( i_size + FF_INPUT_BUFFER_PADDING_SIZE );
++ av_malloc( i_size + AV_INPUT_BUFFER_PADDING_SIZE );
+ if( p_context->extradata )
+ {
+ uint8_t *p_dst = p_context->extradata;
+@@ -104,7 +104,7 @@ static void InitDecoderConfig( decoder_t *p_dec, AVCod
+ p_context->extradata_size = i_size;
+
+ memcpy( &p_dst[0], &p_src[i_offset], i_size );
+- memset( &p_dst[i_size], 0, FF_INPUT_BUFFER_PADDING_SIZE );
++ memset( &p_dst[i_size], 0, AV_INPUT_BUFFER_PADDING_SIZE );
+ }
+ }
+ }
+@@ -302,12 +302,12 @@ block_t * DecodeAudio ( decoder_t *p_dec, block_t **pp
+
+ if( (p_block->i_flags & BLOCK_FLAG_PRIVATE_REALLOCATED) == 0 )
+ {
+- p_block = block_Realloc( p_block, 0, p_block->i_buffer +
FF_INPUT_BUFFER_PADDING_SIZE );
++ p_block = block_Realloc( p_block, 0, p_block->i_buffer +
AV_INPUT_BUFFER_PADDING_SIZE );
+ if( !p_block )
+ return NULL;
+ *pp_block = p_block;
+- p_block->i_buffer -= FF_INPUT_BUFFER_PADDING_SIZE;
+- memset( &p_block->p_buffer[p_block->i_buffer], 0,
FF_INPUT_BUFFER_PADDING_SIZE );
++ p_block->i_buffer -= AV_INPUT_BUFFER_PADDING_SIZE;
++ memset( &p_block->p_buffer[p_block->i_buffer], 0,
AV_INPUT_BUFFER_PADDING_SIZE );
+
+ p_block->i_flags |= BLOCK_FLAG_PRIVATE_REALLOCATED;
+ }
Index: patches/patch-modules_codec_avcodec_avcommon_compat_h
===================================================================
RCS file: patches/patch-modules_codec_avcodec_avcommon_compat_h
diff -N patches/patch-modules_codec_avcodec_avcommon_compat_h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-modules_codec_avcodec_avcommon_compat_h 21 Feb 2019
17:04:13 -0000
@@ -0,0 +1,19 @@
+$OpenBSD$
+
+Update for newer FFmpeg API.
+
+Index: modules/codec/avcodec/avcommon_compat.h
+--- modules/codec/avcodec/avcommon_compat.h.orig
++++ modules/codec/avcodec/avcommon_compat.h
+@@ -36,6 +36,11 @@
+ ( (LIBAVCODEC_VERSION_MICRO < 100 && LIBAVCODEC_VERSION_INT >=
AV_VERSION_INT( a, b, c ) ) || \
+ (LIBAVCODEC_VERSION_MICRO >= 100 && LIBAVCODEC_VERSION_INT >=
AV_VERSION_INT( a, d, e ) ) )
+
++#ifndef FF_MAX_B_FRAMES
++# define FF_MAX_B_FRAMES 16 // FIXME: remove this
++#endif
++
++
+ #if LIBAVCODEC_VERSION_MAJOR < 54
+ # define AV_PICTURE_TYPE_B FF_B_TYPE
+ # define AV_PICTURE_TYPE_I FF_I_TYPE
Index: patches/patch-modules_codec_avcodec_encoder_c
===================================================================
RCS file: patches/patch-modules_codec_avcodec_encoder_c
diff -N patches/patch-modules_codec_avcodec_encoder_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-modules_codec_avcodec_encoder_c 21 Feb 2019 17:04:20
-0000
@@ -0,0 +1,262 @@
+$OpenBSD$
+
+Update for newer FFmpeg API.
+
+Index: modules/codec/avcodec/encoder.c
+--- modules/codec/avcodec/encoder.c.orig
++++ modules/codec/avcodec/encoder.c
+@@ -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"
+@@ -285,6 +285,24 @@ static void probe_video_frame_rate( encoder_t *p_enc,
+ msg_Dbg( p_enc, "Time base set to %d/%d", p_context->time_base.num,
p_context->time_base.den );
+ }
+
++static void add_av_option_int( encoder_t *p_enc, AVDictionary** pp_dict,
const char* psz_name, int i_value )
++{
++ char buff[32];
++ if ( snprintf( buff, sizeof(buff), "%d", i_value ) < 0 )
++ return;
++ if( av_dict_set( pp_dict, psz_name, buff, 0 ) < 0 )
++ msg_Warn( p_enc, "Failed to set encoder option %s", psz_name );
++}
++
++static void add_av_option_float( encoder_t *p_enc, AVDictionary** pp_dict,
const char* psz_name, float f_value )
++{
++ char buff[128];
++ if ( snprintf( buff, sizeof(buff), "%f", f_value ) < 0 )
++ return;
++ if( av_dict_set( pp_dict, psz_name, buff, 0 ) < 0 )
++ msg_Warn( p_enc, "Failed to set encoder option %s", psz_name );
++}
++
+ int OpenEncoder( vlc_object_t *p_this )
+ {
+ encoder_t *p_enc = (encoder_t *)p_this;
+@@ -311,7 +329,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;
+@@ -493,6 +511,7 @@ int OpenEncoder( vlc_object_t *p_this )
+ }
+ }
+ free( psz_val );
++ AVDictionary *options = NULL;
+
+ if( p_enc->fmt_in.i_cat == VIDEO_ES )
+ {
+@@ -522,7 +541,7 @@ int OpenEncoder( vlc_object_t *p_this )
+ p_context->lumi_masking = p_sys->f_lumi_masking;
+ p_context->dark_masking = p_sys->f_dark_masking;
+ p_context->p_masking = p_sys->f_p_masking;
+- p_context->border_masking = p_sys->f_border_masking;
++ add_av_option_float( p_enc, &options, "border_mask",
p_sys->f_border_masking );
+ #if (LIBAVCODEC_VERSION_MAJOR < 55)
+ p_context->luma_elim_threshold = p_sys->i_luma_elim;
+ p_context->chroma_elim_threshold = p_sys->i_chroma_elim;
+@@ -536,7 +555,7 @@ int OpenEncoder( vlc_object_t *p_this )
+ if( !p_context->max_b_frames &&
+ ( p_enc->fmt_out.i_codec == VLC_CODEC_MPGV ||
+ p_enc->fmt_out.i_codec == VLC_CODEC_MP2V ) )
+- p_context->flags |= CODEC_FLAG_LOW_DELAY;
++ p_context->flags |= AV_CODEC_FLAG_LOW_DELAY;
+
+ av_reduce( &p_context->sample_aspect_ratio.num,
+ &p_context->sample_aspect_ratio.den,
+@@ -555,7 +574,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;
+@@ -594,16 +613,16 @@ int OpenEncoder( vlc_object_t *p_this )
+ }
+ else
+ {
+- p_context->flags |= CODEC_FLAG_INTERLACED_DCT;
++ p_context->flags |= AV_CODEC_FLAG_INTERLACED_DCT;
+ if ( p_sys->b_interlace_me )
+- p_context->flags |= CODEC_FLAG_INTERLACED_ME;
++ p_context->flags |= AV_CODEC_FLAG_INTERLACED_ME;
+ }
+ }
+
+ p_context->trellis = p_sys->b_trellis;
+
+ if ( p_sys->i_qmin > 0 && p_sys->i_qmin == p_sys->i_qmax )
+- p_context->flags |= CODEC_FLAG_QSCALE;
++ p_context->flags |= AV_CODEC_FLAG_QSCALE;
+ /* These codecs cause libavcodec to exit if thread_count is > 1.
+ See libavcodec/mpegvideo_enc.c:MPV_encode_init and
+ libavcodec/svq3.c , WMV2 calls MPV_encode_init also.
+@@ -639,12 +658,14 @@ int OpenEncoder( vlc_object_t *p_this )
+ if( p_sys->i_qmin > 0 )
+ {
+ p_context->qmin = p_sys->i_qmin;
+- p_context->mb_lmin = p_context->lmin = p_sys->i_qmin *
FF_QP2LAMBDA;
++ p_context->mb_lmin = p_sys->i_qmin * FF_QP2LAMBDA;
++ add_av_option_int( p_enc, &options, "lmin", p_context->mb_lmin);
+ }
+ if( p_sys->i_qmax > 0 )
+ {
+ p_context->qmax = p_sys->i_qmax;
+- p_context->mb_lmax = p_context->lmax = p_sys->i_qmax *
FF_QP2LAMBDA;
++ p_context->mb_lmax = p_sys->i_qmax * FF_QP2LAMBDA;
++ add_av_option_int( p_enc, &options, "lmax", p_context->mb_lmax);
+ }
+ p_context->max_qdiff = 3;
+
+@@ -652,12 +673,12 @@ int OpenEncoder( vlc_object_t *p_this )
+
+ if( p_sys->i_quality && !p_enc->fmt_out.i_bitrate )
+ {
+- p_context->flags |= CODEC_FLAG_QSCALE;
++ p_context->flags |= AV_CODEC_FLAG_QSCALE;
+ p_context->global_quality = p_sys->i_quality;
+ }
+ else
+ {
+- p_context->rc_qsquish = 1.0;
++ av_dict_set(&options, "qsquish", "1.0", 0);
+ /* Default to 1/2 second buffer for given bitrate unless defined
otherwise*/
+ if( !p_sys->i_rc_buffer_size )
+ {
+@@ -671,7 +692,7 @@ int OpenEncoder( vlc_object_t *p_this )
+ /* This is from ffmpeg's ffmpeg.c : */
+ p_context->rc_initial_buffer_occupancy
+ = p_sys->i_rc_buffer_size * 3/4;
+- p_context->rc_buffer_aggressivity =
p_sys->f_rc_buffer_aggressivity;
++ add_av_option_float( p_enc, &options, "rc_buffer_aggressivity",
p_sys->f_rc_buffer_aggressivity );
+ }
+ }
+ else if( p_enc->fmt_in.i_cat == AUDIO_ES )
+@@ -808,20 +829,23 @@ int OpenEncoder( vlc_object_t *p_this )
+ if( !var_GetInteger( p_enc, ENC_CFG_PREFIX "qmin" ) )
+ {
+ p_context->qmin = 10;
+- p_context->mb_lmin = p_context->lmin = 10 * FF_QP2LAMBDA;
++ p_context->mb_lmin = 10 * FF_QP2LAMBDA;
++ add_av_option_int( p_enc, &options, "lmin",
p_context->mb_lmin );
+ }
+
+ if( !var_GetInteger( p_enc, ENC_CFG_PREFIX "qmax" ) )
+ {
+ p_context->qmax = 42;
+- p_context->mb_lmax = p_context->lmax = 42 * FF_QP2LAMBDA;
++ p_context->mb_lmax = 42 * FF_QP2LAMBDA;
++ add_av_option_int( p_enc, &options, "lmax",
p_context->mb_lmax );
+ }
+
+ } else {
+ if( !var_GetInteger( p_enc, ENC_CFG_PREFIX "qmin" ) )
+ {
+ p_context->qmin = 1;
+- p_context->mb_lmin = p_context->lmin = FF_QP2LAMBDA;
++ p_context->mb_lmin = FF_QP2LAMBDA;
++ add_av_option_int( p_enc, &options, "lmin",
p_context->mb_lmin );
+ }
+ }
+
+@@ -846,7 +870,7 @@ int OpenEncoder( vlc_object_t *p_this )
+ /* Make sure we get extradata filled by the encoder */
+ p_context->extradata_size = 0;
+ p_context->extradata = NULL;
+- p_context->flags |= CODEC_FLAG_GLOBAL_HEADER;
++ p_context->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
+
+ if( p_enc->i_threads >= 1)
+ p_context->thread_count = p_enc->i_threads;
+@@ -855,7 +879,6 @@ int OpenEncoder( vlc_object_t *p_this )
+
+ int ret;
+ char *psz_opts = var_InheritString(p_enc, ENC_CFG_PREFIX "options");
+- AVDictionary *options = NULL;
+ if (psz_opts && *psz_opts)
+ options = vlc_av_get_options(psz_opts);
+ free(psz_opts);
+@@ -983,7 +1006,7 @@ errmsg:
+ }
+ }
+
+- p_context->flags &= ~CODEC_FLAG_GLOBAL_HEADER;
++ p_context->flags &= ~AV_CODEC_FLAG_GLOBAL_HEADER;
+
+ if( p_enc->fmt_in.i_cat == AUDIO_ES )
+ {
+@@ -993,7 +1016,7 @@ errmsg:
+ p_sys->i_sample_bytes = (p_enc->fmt_in.audio.i_bitspersample / 8);
+ p_sys->i_frame_size = p_context->frame_size > 1 ?
+ p_context->frame_size :
+- FF_MIN_BUFFER_SIZE;
++ AV_INPUT_BUFFER_MIN_SIZE;
+ p_sys->i_buffer_out = av_samples_get_buffer_size(NULL,
+ p_sys->p_context->channels, p_sys->i_frame_size,
+ p_sys->p_context->sample_fmt, DEFAULT_ALIGN);
+@@ -1017,7 +1040,7 @@ errmsg:
+ }
+ }
+
+- p_sys->frame = avcodec_alloc_frame();
++ p_sys->frame = av_frame_alloc();
+ if( !p_sys->frame )
+ {
+ goto error;
+@@ -1088,7 +1111,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture
+ 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;
+@@ -1202,7 +1225,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture
+ p_sys->p_context->bits_per_coded_sample ?
+ p_sys->p_context->bits_per_coded_sample :
+ 24;
+- unsigned blocksize = __MAX( FF_MIN_BUFFER_SIZE, ( bitsPerPixel *
p_sys->p_context->height * p_sys->p_context->width ) / 8 + 200 );
++ unsigned blocksize = __MAX( AV_INPUT_BUFFER_MIN_SIZE, ( bitsPerPixel *
p_sys->p_context->height * p_sys->p_context->width ) / 8 + 200 );
+ if( p_enc->fmt_out.i_codec == VLC_CODEC_TIFF )
+ {
+ blocksize = 2 * blocksize +
+@@ -1329,7 +1352,7 @@ static block_t *handle_delay_buffer( encoder_t *p_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;
+
+@@ -1359,7 +1382,7 @@ static block_t *handle_delay_buffer( encoder_t *p_enc,
+ }
+
+ if(unlikely( ( (leftover + buffer_delay) < p_sys->i_buffer_out ) &&
+- !(p_sys->p_codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME
)))
++ !(p_sys->p_codec->capabilities &
AV_CODEC_CAP_SMALL_LAST_FRAME )))
+ {
+ msg_Dbg( p_enc, "No small last frame support, padding");
+ size_t padding_size = p_sys->i_buffer_out - (leftover+buffer_delay);
+@@ -1451,7 +1474,7 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_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
Index: patches/patch-modules_codec_avcodec_subtitle_c
===================================================================
RCS file: patches/patch-modules_codec_avcodec_subtitle_c
diff -N patches/patch-modules_codec_avcodec_subtitle_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-modules_codec_avcodec_subtitle_c 21 Feb 2019 17:04:04
-0000
@@ -0,0 +1,22 @@
+$OpenBSD$
+
+Update for newer FFmpeg API.
+
+Index: modules/codec/avcodec/subtitle.c
+--- modules/codec/avcodec/subtitle.c.orig
++++ modules/codec/avcodec/subtitle.c
+@@ -144,11 +144,11 @@ subpicture_t *DecodeSubtitle(decoder_t *dec, block_t *
+ *block_ptr =
+ block = block_Realloc(block,
+ 0,
+- block->i_buffer +
FF_INPUT_BUFFER_PADDING_SIZE);
++ block->i_buffer +
AV_INPUT_BUFFER_PADDING_SIZE);
+ if (!block)
+ return NULL;
+- block->i_buffer -= FF_INPUT_BUFFER_PADDING_SIZE;
+- memset(&block->p_buffer[block->i_buffer], 0,
FF_INPUT_BUFFER_PADDING_SIZE);
++ block->i_buffer -= AV_INPUT_BUFFER_PADDING_SIZE;
++ memset(&block->p_buffer[block->i_buffer], 0,
AV_INPUT_BUFFER_PADDING_SIZE);
+
+ /* */
+ AVSubtitle subtitle;
Index: patches/patch-modules_codec_avcodec_video_c
===================================================================
RCS file: patches/patch-modules_codec_avcodec_video_c
diff -N patches/patch-modules_codec_avcodec_video_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-modules_codec_avcodec_video_c 21 Feb 2019 17:02:24 -0000
@@ -0,0 +1,156 @@
+$OpenBSD$
+
+Update for newer FFmpeg API.
+
+Index: modules/codec/avcodec/video.c
+--- modules/codec/avcodec/video.c.orig
++++ modules/codec/avcodec/video.c
+@@ -108,8 +108,8 @@ static int lavc_GetFrame(struct AVCodecContext *, AVFr
+ static int ffmpeg_GetFrameBuf ( struct AVCodecContext *, AVFrame * );
+ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *, AVFrame * );
+ #endif
+-static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *,
+- const enum PixelFormat * );
++static enum AVPixelFormat ffmpeg_GetFormat( AVCodecContext *,
++ const enum AVPixelFormat * );
+
+ static uint32_t ffmpeg_CodecTag( vlc_fourcc_t fcc )
+ {
+@@ -236,7 +236,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_
+ p_sys->p_codec = p_codec;
+ p_sys->i_codec_id = i_codec_id;
+ p_sys->psz_namecodec = psz_namecodec;
+- p_sys->p_ff_pic = avcodec_alloc_frame();
++ p_sys->p_ff_pic = av_frame_alloc();
+ p_sys->b_delayed_open = true;
+ p_sys->p_va = NULL;
+ vlc_sem_init( &p_sys->sem_mt, 0 );
+@@ -251,11 +251,11 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_
+ var_InheritInteger( p_dec, "avcodec-error-resilience" );
+
+ if( var_CreateGetBool( p_dec, "grayscale" ) )
+- p_sys->p_context->flags |= CODEC_FLAG_GRAY;
++ p_sys->p_context->flags |= AV_CODEC_FLAG_GRAY;
+
+ /* ***** Output always the frames ***** */
+ #if LIBAVCODEC_VERSION_CHECK(55, 23, 1, 40, 101)
+- p_sys->p_context->flags |= CODEC_FLAG_OUTPUT_CORRUPT;
++ p_sys->p_context->flags |= AV_CODEC_FLAG_OUTPUT_CORRUPT;
+ #endif
+
+ i_val = var_CreateGetInteger( p_dec, "avcodec-vismv" );
+@@ -268,7 +268,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_
+ else if( i_val == 1 ) p_sys->p_context->skip_loop_filter =
AVDISCARD_NONREF;
+
+ if( var_CreateGetBool( p_dec, "avcodec-fast" ) )
+- p_sys->p_context->flags2 |= CODEC_FLAG2_FAST;
++ p_sys->p_context->flags2 |= AV_CODEC_FLAG2_FAST;
+
+ /* ***** libavcodec frame skipping ***** */
+ p_sys->b_hurry_up = var_CreateGetBool( p_dec, "avcodec-hurry-up" );
+@@ -295,7 +295,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_
+ p_sys->b_direct_rendering = false;
+ p_sys->i_direct_rendering_used = -1;
+ if( var_CreateGetBool( p_dec, "avcodec-dr" ) &&
+- (p_sys->p_codec->capabilities & CODEC_CAP_DR1) &&
++ (p_sys->p_codec->capabilities & AV_CODEC_CAP_DR1) &&
+ /* No idea why ... but this fixes flickering on some TSCC streams */
+ p_sys->i_codec_id != AV_CODEC_ID_TSCC && p_sys->i_codec_id !=
AV_CODEC_ID_CSCD &&
+ p_sys->i_codec_id != AV_CODEC_ID_CINEPAK &&
+@@ -311,7 +311,6 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_
+ if( p_sys->b_direct_rendering )
+ {
+ msg_Dbg( p_dec, "trying to use direct rendering" );
+- p_sys->p_context->flags |= CODEC_FLAG_EMU_EDGE;
+ }
+ else
+ {
+@@ -448,7 +447,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_
+ if( ffmpeg_OpenCodec( p_dec ) < 0 )
+ {
+ msg_Err( p_dec, "cannot open codec (%s)", p_sys->psz_namecodec );
+- avcodec_free_frame( &p_sys->p_ff_pic );
++ av_frame_free( &p_sys->p_ff_pic );
+ vlc_sem_destroy( &p_sys->sem_mt );
+ free( p_sys );
+ return VLC_EGENERIC;
+@@ -484,7 +483,7 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp
+ }
+
+ p_block = *pp_block;
+- if(!p_block && !(p_sys->p_codec->capabilities & CODEC_CAP_DELAY) )
++ if(!p_block && !(p_sys->p_codec->capabilities & AV_CODEC_CAP_DELAY) )
+ return NULL;
+
+ if( p_sys->b_delayed_open )
+@@ -594,13 +593,13 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp
+ p_sys->b_flush = ( p_block->i_flags & BLOCK_FLAG_END_OF_SEQUENCE ) !=
0;
+
+ p_block = block_Realloc( p_block, 0,
+- p_block->i_buffer + FF_INPUT_BUFFER_PADDING_SIZE
);
++ p_block->i_buffer + AV_INPUT_BUFFER_PADDING_SIZE
);
+ if( !p_block )
+ return NULL;
+- p_block->i_buffer -= FF_INPUT_BUFFER_PADDING_SIZE;
++ p_block->i_buffer -= AV_INPUT_BUFFER_PADDING_SIZE;
+ *pp_block = p_block;
+ memset( p_block->p_buffer + p_block->i_buffer, 0,
+- FF_INPUT_BUFFER_PADDING_SIZE );
++ AV_INPUT_BUFFER_PADDING_SIZE );
+ }
+
+ while( !p_block || p_block->i_buffer > 0 || p_sys->b_flush )
+@@ -621,7 +620,7 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp
+ }
+ else
+ {
+- /* Return delayed frames if codec has CODEC_CAP_DELAY */
++ /* Return delayed frames if codec has AV_CODEC_CAP_DELAY */
+ pkt.data = NULL;
+ pkt.size = 0;
+ }
+@@ -849,7 +848,7 @@ void EndVideoDec( decoder_t *p_dec )
+ wait_mt( p_sys );
+
+ if( p_sys->p_ff_pic )
+- avcodec_free_frame( &p_sys->p_ff_pic );
++ av_frame_free( &p_sys->p_ff_pic );
+
+ if( p_sys->p_va )
+ vlc_va_Delete( p_sys->p_va );
+@@ -874,7 +873,7 @@ static void ffmpeg_InitCodec( decoder_t *p_dec )
+ p_sys->p_context->extradata_size = i_size + 12;
+ p = p_sys->p_context->extradata =
+ av_malloc( p_sys->p_context->extradata_size +
+- FF_INPUT_BUFFER_PADDING_SIZE );
++ AV_INPUT_BUFFER_PADDING_SIZE );
+ if( !p )
+ return;
+
+@@ -911,13 +910,13 @@ static void ffmpeg_InitCodec( decoder_t *p_dec )
+ {
+ p_sys->p_context->extradata_size = i_size;
+ p_sys->p_context->extradata =
+- av_malloc( i_size + FF_INPUT_BUFFER_PADDING_SIZE );
++ av_malloc( i_size + AV_INPUT_BUFFER_PADDING_SIZE );
+ if( p_sys->p_context->extradata )
+ {
+ memcpy( p_sys->p_context->extradata,
+ p_dec->fmt_in.p_extra, i_size );
+ memset( p_sys->p_context->extradata + i_size,
+- 0, FF_INPUT_BUFFER_PADDING_SIZE );
++ 0, AV_INPUT_BUFFER_PADDING_SIZE );
+ }
+ }
+ }
+@@ -1336,8 +1335,8 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecCont
+ }
+ #endif
+
+-static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
+- const enum PixelFormat *pi_fmt )
++static enum AVPixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
++ const enum AVPixelFormat *pi_fmt )
+ {
+ decoder_t *p_dec = p_context->opaque;
+ decoder_sys_t *p_sys = p_dec->p_sys;