Pull some bits from 2.1 to deal with newer FFmpeg API.

ok sthen@
This commit is contained in:
brad 2014-04-12 20:41:26 +00:00
parent 703cdb3480
commit 7636022790
8 changed files with 279 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.177 2014/03/16 11:38:47 brad Exp $
# $OpenBSD: Makefile,v 1.178 2014/04/12 20:41:26 brad Exp $
SHARED_ONLY= Yes
@ -9,6 +9,7 @@ V= 2.0.10
DISTNAME= vlc-${V}
PKGNAME-main= ${DISTNAME}
PKGNAME-jack= vlc-jack-${V}
REVISION-main= 0
CATEGORIES= x11
MASTER_SITES= http://download.videolan.org/pub/videolan/vlc/${V}/
EXTRACT_SUFX= .tar.xz

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-configure_ac,v 1.28 2013/11/07 00:30:07 brad Exp $
--- configure.ac.orig Mon Oct 14 12:46:55 2013
+++ configure.ac Sat Oct 26 21:43:55 2013
$OpenBSD: patch-configure_ac,v 1.29 2014/04/12 20:41:26 brad Exp $
--- configure.ac.orig Fri Feb 21 10:27:16 2014
+++ configure.ac Thu Apr 10 22:21:58 2014
@@ -122,10 +122,6 @@ case "${host_os}" in
;;
openbsd*)
@ -55,7 +55,37 @@ $OpenBSD: patch-configure_ac,v 1.28 2013/11/07 00:30:07 brad Exp $
], [
CPPFLAGS_live555="-I${CONTRIB_DIR}/include/liveMedia -I${CONTRIB_DIR}/include/groupsock -I${CONTRIB_DIR}/include/BasicUsageEnvironment -I${CONTRIB_DIR}/include/UsageEnvironment"
])
@@ -3516,6 +3485,24 @@ AS_IF([test "$enable_oss" != "no"], [
@@ -2412,10 +2381,10 @@ dnl
AC_ARG_ENABLE(avcodec,
[ --enable-avcodec libavcodec codec (default enabled)])
AS_IF([test "${enable_avcodec}" != "no"], [
- PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 52.25.0 libavutil], [
- PKG_CHECK_EXISTS([libavcodec < 55],, [
- AC_MSG_ERROR([libavcodec versions 55 and later are not supported yet.])
- ])
+ PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 53.34.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}"
@@ -2536,12 +2505,13 @@ AC_ARG_ENABLE(avformat,
])
if test "${enable_avformat}" != "no"
then
- PKG_CHECK_MODULES(AVFORMAT,[libavformat > 52.30.0 libavcodec libavutil],
+ PKG_CHECK_MODULES(AVFORMAT,[libavformat > 53.21.0 libavcodec libavutil],
[
VLC_SAVE_FLAGS
CPPFLAGS="${CPPFLAGS} ${AVFORMAT_CFLAGS}"
CFLAGS="${CFLAGS} ${AVFORMAT_CFLAGS}"
AC_CHECK_HEADERS(libavformat/avformat.h libavformat/avio.h)
+ AC_CHECK_HEADERS(libavcodec/avcodec.h)
AC_CHECK_HEADERS(libavutil/avutil.h)
AS_IF([test "$enable_merge_ffmpeg" = "no"], [
VLC_ADD_PLUGIN([avformat access_avio])
@@ -3516,6 +3486,24 @@ AS_IF([test "$enable_oss" != "no"], [
])
AC_SUBST(OSS_LIBS)
AM_CONDITIONAL([HAVE_OSS], [test "${have_oss}" = "yes"])

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-modules_codec_avcodec_Modules_am,v 1.1 2014/04/12 20:41:26 brad Exp $
--- modules/codec/avcodec/Modules.am.orig Thu Apr 10 02:02:17 2014
+++ modules/codec/avcodec/Modules.am Thu Apr 10 02:02:35 2014
@@ -4,6 +4,7 @@ libavcodec_plugin_la_SOURCES = \
video.c \
subtitle.c \
audio.c \
+ cpu.c \
deinterlace.c \
fourcc.c \
chroma.h \

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-modules_codec_avcodec_audio_c,v 1.3 2014/04/12 20:41:26 brad Exp $
--- modules/codec/avcodec/audio.c.orig Thu Apr 10 20:11:22 2014
+++ modules/codec/avcodec/audio.c Thu Apr 10 20:40:24 2014
@@ -228,8 +228,8 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_
p_sys->i_output_max = 0;
break;
}
- if( p_sys->i_output_max < 2 * AVCODEC_MAX_AUDIO_FRAME_SIZE )
- p_sys->i_output_max = 2 * AVCODEC_MAX_AUDIO_FRAME_SIZE;
+ if( p_sys->i_output_max < 2 * MAX_AUDIO_FRAME_SIZE )
+ p_sys->i_output_max = 2 * MAX_AUDIO_FRAME_SIZE;
msg_Dbg( p_dec, "Using %d bytes output buffer", p_sys->i_output_max );
p_sys->p_output = av_malloc( p_sys->i_output_max );

View File

@ -0,0 +1,51 @@
$OpenBSD: patch-modules_codec_avcodec_avcodec_c,v 1.4 2014/04/12 20:41:26 brad Exp $
--- modules/codec/avcodec/avcodec.c.orig Thu Apr 10 01:51:51 2014
+++ modules/codec/avcodec/avcodec.c Thu Apr 10 01:56:03 2014
@@ -274,43 +274,10 @@ static int OpenDecoder( vlc_object_t *p_this )
p_context->opaque = (void *)p_this;
/* Set CPU capabilities */
- unsigned i_cpu = vlc_CPU();
- p_context->dsp_mask = 0;
- if( !(i_cpu & CPU_CAPABILITY_MMX) )
- {
- p_context->dsp_mask |= AV_CPU_FLAG_MMX;
- }
- if( !(i_cpu & CPU_CAPABILITY_MMXEXT) )
- {
- p_context->dsp_mask |= AV_CPU_FLAG_MMX2;
- }
- if( !(i_cpu & CPU_CAPABILITY_3DNOW) )
- {
- p_context->dsp_mask |= AV_CPU_FLAG_3DNOW;
- }
- if( !(i_cpu & CPU_CAPABILITY_SSE) )
- {
- p_context->dsp_mask |= AV_CPU_FLAG_SSE;
- }
- if( !(i_cpu & CPU_CAPABILITY_SSE2) )
- {
- p_context->dsp_mask |= AV_CPU_FLAG_SSE2;
- }
-#ifdef AV_CPU_FLAG_SSE3
- if( !(i_cpu & CPU_CAPABILITY_SSE3) )
- p_context->dsp_mask |= AV_CPU_FLAG_SSE3;
-#endif
-#ifdef AV_CPU_FLAG_SSSE3
- if( !(i_cpu & CPU_CAPABILITY_SSSE3) )
- p_context->dsp_mask |= AV_CPU_FLAG_SSSE3;
-#endif
-#ifdef AV_CPU_FLAG_SSE4
- if( !(i_cpu & CPU_CAPABILITY_SSE4_1) )
- p_context->dsp_mask |= AV_CPU_FLAG_SSE4;
-#endif
-#ifdef AV_CPU_FLAG_SSE42
- if( !(i_cpu & CPU_CAPABILITY_SSE4_2) )
- p_context->dsp_mask |= AV_CPU_FLAG_SSE42;
+#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( 51, 25, 0 )
+ av_set_cpu_flags_mask( INT_MAX & ~GetVlcDspMask() );
+#else
+ p_context->dsp_mask = GetVlcDspMask();
#endif
p_dec->b_need_packetized = true;

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-modules_codec_avcodec_avcodec_h,v 1.3 2014/04/12 20:41:26 brad Exp $
--- modules/codec/avcodec/avcodec.h.orig Thu Apr 10 01:56:19 2014
+++ modules/codec/avcodec/avcodec.h Thu Apr 10 20:42:34 2014
@@ -38,6 +38,8 @@ int GetVlcFourcc( int i_ffmpeg_codec, int *pi_cat,
vlc_fourcc_t *pi_fourcc, const char **ppsz_name );
vlc_fourcc_t GetVlcAudioFormat( int i_sample_fmt );
+unsigned GetVlcDspMask( void );
+
picture_t * DecodeVideo ( decoder_t *, block_t ** );
aout_buffer_t * DecodeAudio( decoder_t *, block_t ** );
subpicture_t *DecodeSubtitle( decoder_t *p_dec, block_t ** );
@@ -397,3 +399,5 @@ int ffmpeg_OpenCodec( decoder_t *p_dec );
#ifndef AV_PKT_FLAG_KEY
# define AV_PKT_FLAG_KEY PKT_FLAG_KEY
#endif
+
+#define MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio

View File

@ -0,0 +1,85 @@
$OpenBSD: patch-modules_codec_avcodec_cpu_c,v 1.1 2014/04/12 20:41:26 brad Exp $
--- modules/codec/avcodec/cpu.c.orig Thu Apr 10 21:09:43 2014
+++ modules/codec/avcodec/cpu.c Thu Apr 10 21:22:54 2014
@@ -0,0 +1,81 @@
+/*****************************************************************************
+ * cpu.c: CPU capabilities for libavcodec
+ *****************************************************************************
+ * Copyright (C) 1999-2012 the VideoLAN team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_cpu.h>
+
+#define HAVE_MMX 1
+#ifdef HAVE_LIBAVCODEC_AVCODEC_H
+# include <libavcodec/avcodec.h>
+#else
+# include <avcodec.h>
+#endif
+#include "avcodec.h"
+
+/**
+ * Maps CPU capabilities computed by VLC to libav DSP mask.
+ */
+unsigned GetVlcDspMask( void )
+{
+ unsigned mask = 0;
+
+#if defined (__i386__) || defined (__x86_64__)
+ unsigned i_cpu = vlc_CPU();
+ if( !(i_cpu & CPU_CAPABILITY_MMX) )
+ mask |= AV_CPU_FLAG_MMX;
+ if( !(i_cpu & CPU_CAPABILITY_MMXEXT) )
+ mask |= AV_CPU_FLAG_MMX2;
+ if( !(i_cpu & CPU_CAPABILITY_3DNOW) )
+ mask |= AV_CPU_FLAG_3DNOW;
+ if( !(i_cpu & CPU_CAPABILITY_SSE) )
+ mask |= AV_CPU_FLAG_SSE;
+ if( !(i_cpu & CPU_CAPABILITY_SSE2) )
+ mask |= AV_CPU_FLAG_SSE2;
+# ifdef AV_CPU_FLAG_SSE3
+ if( !(i_cpu & CPU_CAPABILITY_SSE3) )
+ mask |= AV_CPU_FLAG_SSE3;
+# endif
+# ifdef AV_CPU_FLAG_SSSE3
+ if( !(i_cpu & CPU_CAPABILITY_SSSE3) )
+ mask |= AV_CPU_FLAG_SSSE3;
+# endif
+# ifdef AV_CPU_FLAG_SSE4
+ if( !(i_cpu & CPU_CAPABILITY_SSE4_1) )
+ mask |= AV_CPU_FLAG_SSE4;
+# endif
+# ifdef AV_CPU_FLAG_SSE42
+ if( !(i_cpu & CPU_CAPABILITY_SSE4_2) )
+ mask |= AV_CPU_FLAG_SSE42;
+# endif
+ // TODO: AVX
+#endif
+
+#if defined (__ppc__) || defined (__ppc64__) || defined (__powerpc__)
+ unsigned i_cpu = vlc_CPU();
+ if( !(i_cpu & CPU_CAPABILITY_ALTIVEC) )
+ mask |= AV_CPU_FLAG_ALTIVEC;
+#endif
+
+ return mask;
+}

View File

@ -0,0 +1,64 @@
$OpenBSD: patch-modules_codec_avcodec_encoder_c,v 1.3 2014/04/12 20:41:26 brad Exp $
--- modules/codec/avcodec/encoder.c.orig Fri Feb 21 10:27:16 2014
+++ modules/codec/avcodec/encoder.c Thu Apr 10 21:35:17 2014
@@ -358,25 +358,11 @@ int OpenEncoder( vlc_object_t *p_this )
p_context->opaque = (void *)p_this;
/* Set CPU capabilities */
- unsigned i_cpu = vlc_CPU();
- p_context->dsp_mask = 0;
- if( !(i_cpu & CPU_CAPABILITY_MMX) )
- {
- p_context->dsp_mask |= AV_CPU_FLAG_MMX;
- }
- if( !(i_cpu & CPU_CAPABILITY_MMXEXT) )
- {
- p_context->dsp_mask |= AV_CPU_FLAG_MMX2;
- }
- if( !(i_cpu & CPU_CAPABILITY_3DNOW) )
- {
- p_context->dsp_mask |= AV_CPU_FLAG_3DNOW;
- }
- if( !(i_cpu & CPU_CAPABILITY_SSE) )
- {
- p_context->dsp_mask |= AV_CPU_FLAG_SSE;
- p_context->dsp_mask |= AV_CPU_FLAG_SSE2;
- }
+#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( 51, 25, 0 )
+ av_set_cpu_flags_mask( INT_MAX & ~GetVlcDspMask() );
+#else
+ p_context->dsp_mask = GetVlcDspMask();
+#endif
p_sys->i_key_int = var_GetInteger( p_enc, ENC_CFG_PREFIX "keyint" );
p_sys->i_b_frames = var_GetInteger( p_enc, ENC_CFG_PREFIX "bframes" );
@@ -497,8 +483,10 @@ int OpenEncoder( vlc_object_t *p_this )
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;
+#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;
+#endif
if( p_sys->i_key_int > 0 )
p_context->gop_size = p_sys->i_key_int;
@@ -511,9 +499,6 @@ int OpenEncoder( vlc_object_t *p_this )
p_enc->fmt_out.i_codec == VLC_CODEC_MP1V ) )
p_context->flags |= CODEC_FLAG_LOW_DELAY;
- if( p_enc->fmt_out.i_codec == VLC_CODEC_MP2V )
- p_context->idct_algo = FF_IDCT_LIBMPEG2MMX;
-
av_reduce( &p_context->sample_aspect_ratio.num,
&p_context->sample_aspect_ratio.den,
p_enc->fmt_in.video.i_sar_num,
@@ -885,7 +870,7 @@ int OpenEncoder( vlc_object_t *p_this )
p_enc->fmt_out.audio.i_bitspersample = aout_BitsPerSample( vlc_fourcc_GetCodec( AUDIO_ES, p_enc->fmt_out.i_codec ) );
if( p_context->frame_size > 1 )
- p_sys->i_buffer_out = 8 * AVCODEC_MAX_AUDIO_FRAME_SIZE;
+ p_sys->i_buffer_out = 8 * MAX_AUDIO_FRAME_SIZE;
else
p_sys->i_buffer_out = p_sys->i_frame_size * p_sys->i_sample_bytes;
p_sys->p_buffer_out = malloc( p_sys->i_buffer_out );