# include <avcodec.h>
#endif
-#if LIBAVCODEC_BUILD < 4704
-# define AV_NOPTS_VALUE (int64_t)0
-#endif
-#if LIBAVCODEC_BUILD < 4684
-# define FF_QP2LAMBDA 118
-#endif
-
#include "ffmpeg.h"
#define HURRY_UP_GUARD1 (450000)
/*****************************************************************************
* thread_context_t : for multithreaded encoding
*****************************************************************************/
-#if LIBAVCODEC_BUILD >= 4702
struct thread_context_t
{
VLC_COMMON_MEMBERS
vlc_cond_t cond;
vlc_bool_t b_work, b_done;
};
-#endif
/*****************************************************************************
* encoder_sys_t : ffmpeg encoder descriptor
AVCodecContext *p_context;
AVCodec *p_codec;
int i_codec_id, i_cat;
- char *psz_namecodec;
+ const char *psz_namecodec;
vlc_value_t val;
vlc_value_t lockval;
&& (p_context->width > 720 || p_context->height > 576) )
p_context->level = 4; /* High level */
-#if LIBAVCODEC_BUILD >= 4754
p_context->time_base.num = p_enc->fmt_in.video.i_frame_rate_base;
p_context->time_base.den = p_enc->fmt_in.video.i_frame_rate;
-#else
- p_context->frame_rate = p_enc->fmt_in.video.i_frame_rate;
- p_context->frame_rate_base= p_enc->fmt_in.video.i_frame_rate_base;
-#endif
/* Defaults from ffmpeg.c */
p_context->qblur = 0.5;
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;
-#if LIBAVCODEC_BUILD >= 4741
p_context->border_masking = p_sys->f_border_masking;
-#endif
p_context->luma_elim_threshold = p_sys->i_luma_elim;
p_context->chroma_elim_threshold = p_sys->i_chroma_elim;
if( !p_context->max_b_frames )
p_context->flags |= CODEC_FLAG_LOW_DELAY;
-#if LIBAVCODEC_BUILD >= 4687
av_reduce( &i_aspect_num, &i_aspect_den,
p_enc->fmt_in.video.i_aspect,
VOUT_ASPECT_FACTOR, 1 << 30 /* something big */ );
&p_context->sample_aspect_ratio.den,
i_aspect_num * (int64_t)p_context->height,
i_aspect_den * (int64_t)p_context->width, 1 << 30 );
-#else
- p_context->aspect_ratio = ((float)p_enc->fmt_in.video.i_aspect) /
- VOUT_ASPECT_FACTOR;
-#endif
p_sys->p_buffer_out = malloc( p_context->height * p_context->width * 3 );
p_enc->fmt_in.i_codec = VLC_FOURCC('I','4','2','0');
p_context->pix_fmt = E_(GetFfmpegChroma)( p_enc->fmt_in.i_codec );
-#if LIBAVCODEC_BUILD >= 4714
if( p_codec->pix_fmts )
{
const enum PixelFormat *p = p_codec->pix_fmts;
if( *p == -1 ) p_context->pix_fmt = p_codec->pix_fmts[0];
p_enc->fmt_in.i_codec = E_(GetVlcChroma)( p_context->pix_fmt );
}
-#else
- p_enc->fmt_in.i_codec = E_(GetVlcChroma)( p_context->pix_fmt );
-#endif
if ( p_sys->b_strict_rc )
{
if ( p_sys->f_i_quant_factor != 0.0 )
p_context->i_quant_factor = p_sys->f_i_quant_factor;
-#if LIBAVCODEC_BUILD >= 4690
p_context->noise_reduction = p_sys->i_noise_reduction;
-#endif
if ( p_sys->b_mpeg4_matrix )
{
else
{
p_context->flags |= CODEC_FLAG_INTERLACED_DCT;
-#if LIBAVCODEC_BUILD >= 4698
if ( p_sys->b_interlace_me )
p_context->flags |= CODEC_FLAG_INTERLACED_ME;
}
-#endif
}
if ( p_sys->b_trellis )
if ( p_sys->i_qmin > 0 && p_sys->i_qmin == p_sys->i_qmax )
p_context->flags |= CODEC_FLAG_QSCALE;
-#if LIBAVCODEC_BUILD >= 4702
if ( p_enc->i_threads >= 1 )
p_context->thread_count = p_enc->i_threads;
-#endif
if( p_sys->i_vtolerance > 0 )
p_context->bit_rate_tolerance = p_sys->i_vtolerance;
if( p_sys->i_quality )
{
p_context->flags |= CODEC_FLAG_QSCALE;
-#if LIBAVCODEC_BUILD >= 4668
p_context->global_quality = p_sys->i_quality;
-#endif
}
}
else if( p_enc->fmt_in.i_cat == AUDIO_ES )
/****************************************************************************
* Ffmpeg threading system
****************************************************************************/
-#if LIBAVCODEC_BUILD >= 4702
static int FfmpegThread( struct thread_context_t *p_context )
{
while ( !p_context->b_die && !p_context->b_error )
return 0;
}
-#endif
/****************************************************************************
* EncodeVideo: the whole thing
AVFrame frame;
int i_out, i_plane;
-#if LIBAVCODEC_BUILD >= 4702
if ( !p_sys->b_inited && p_enc->i_threads >= 1 )
{
struct thread_context_t ** pp_contexts;
p_sys->p_context->execute = FfmpegExecute;
}
-#endif
memset( &frame, 0, sizeof( AVFrame ) );
for( i_plane = 0; i_plane < p_pict->i_planes; i_plane++ )
frame.pict_type = 0;
frame.repeat_pict = p_pict->i_nb_fields - 2;
-
-#if LIBAVCODEC_BUILD >= 4685
frame.interlaced_frame = !p_pict->b_progressive;
frame.top_field_first = !!p_pict->b_top_field_first;
-#endif
-#if LIBAVCODEC_BUILD < 4702
/* Set the pts of the frame being encoded (segfaults with mpeg4!)*/
if( p_enc->fmt_out.i_codec == VLC_FOURCC( 'm', 'p', 'g', 'v' ) ||
p_enc->fmt_out.i_codec == VLC_FOURCC( 'm', 'p', '1', 'v' ) ||
p_enc->fmt_out.i_codec == VLC_FOURCC( 'm', 'p', '2', 'v' ) )
-#else
- if( 1 )
-#endif
{
frame.pts = p_pict->date ? p_pict->date : (signed int) AV_NOPTS_VALUE;
if ( current_date + HURRY_UP_GUARD2 > frame.pts )
{
p_sys->p_context->flags &= ~CODEC_FLAG_TRELLIS_QUANT;
-#if LIBAVCODEC_BUILD >= 4690
p_sys->p_context->noise_reduction = p_sys->i_noise_reduction
+ (HURRY_UP_GUARD2 + current_date - frame.pts) / 500;
-#endif
msg_Dbg( p_enc, "hurry up mode 2" );
}
else
{
if ( p_sys->b_trellis )
p_sys->p_context->flags |= CODEC_FLAG_TRELLIS_QUANT;
-#if LIBAVCODEC_BUILD >= 4690
+
p_sys->p_context->noise_reduction =
p_sys->i_noise_reduction;
-#endif
}
}
frame.quality = p_sys->i_quality;
/* Ugly work-around for stupid libavcodec behaviour */
-#if LIBAVCODEC_BUILD >= 4722
p_sys->i_framenum++;
p_sys->pi_delay_pts[p_sys->i_framenum % MAX_FRAME_DELAY] = frame.pts;
frame.pts = p_sys->i_framenum * AV_TIME_BASE *
p_enc->fmt_in.video.i_frame_rate_base;
frame.pts += p_enc->fmt_in.video.i_frame_rate - 1;
frame.pts /= p_enc->fmt_in.video.i_frame_rate;
-#endif
/* End work-around */
i_out = avcodec_encode_video( p_sys->p_context, (uint8_t*)p_sys->p_buffer_out,
p_block->i_pts = p_sys->p_context->coded_frame->pts;
/* Ugly work-around for stupid libavcodec behaviour */
-#if LIBAVCODEC_BUILD >= 4722
{
int64_t i_framenum = p_block->i_pts *
p_enc->fmt_in.video.i_frame_rate /
p_block->i_pts = p_sys->pi_delay_pts[i_framenum % MAX_FRAME_DELAY];
}
-#endif
/* End work-around */
if( p_sys->p_context->coded_frame->pict_type != FF_I_TYPE &&
var_Get( p_enc->p_libvlc_global, "avcodec", &lockval );
-#if LIBAVCODEC_BUILD >= 4702
if ( p_sys->b_inited && p_enc->i_threads >= 1 )
{
int i;
free( pp_contexts );
}
-#endif
vlc_mutex_lock( lockval.p_address );
avcodec_close( p_sys->p_context );
# include <avcodec.h>
#endif
-#if LIBAVCODEC_BUILD < 4680
-# error You must have a libavcodec >= 4680 (get CVS)
+#if LIBAVCODEC_BUILD < 5000
+# error You must have a libavcodec >= 5000 (get CVS)
#endif
#include "ffmpeg.h"
-#ifdef LIBAVCODEC_PP
-# ifdef HAVE_POSTPROC_POSTPROCESS_H
-# include <postproc/postprocess.h>
-# else
-# include <libpostproc/postprocess.h>
-# endif
+#ifdef HAVE_POSTPROC_POSTPROCESS_H
+# include <postproc/postprocess.h>
+#else
+# include <libpostproc/postprocess.h>
#endif
/*****************************************************************************
static void CloseDecoder( vlc_object_t * );
static int nloopf_list[] = { 0, 1, 2, 3, 4 };
-static char *nloopf_list_text[] =
+static const char *nloopf_list_text[] =
{ N_("None"), N_("Non-ref"), N_("Bidir"), N_("Non-key"), N_("All") };
-static char *enc_hq_list[] = { "rd", "bits", "simple" };
-static char *enc_hq_list_text[] = { N_("rd"), N_("bits"), N_("simple") };
+static const char *enc_hq_list[] = { "rd", "bits", "simple" };
+static const char *enc_hq_list_text[] = { N_("rd"), N_("bits"), N_("simple") };
static int pi_mode_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
-static char *ppsz_mode_descriptions[] =
+static const char *ppsz_mode_descriptions[] =
{ N_("Fast bilinear"), N_("Bilinear"), N_("Bicubic (good quality)"),
N_("Experimental"), N_("Nearest neighbour (bad quality)"),
N_("Area"), N_("Luma bicubic / chroma bilinear"), N_("Gauss"),
SKIPLOOPF_LONGTEXT, VLC_TRUE );
change_integer_list( nloopf_list, nloopf_list_text, 0 );
-#ifdef LIBAVCODEC_PP
add_integer( "ffmpeg-pp-q", 0, NULL, PP_Q_TEXT, PP_Q_LONGTEXT, VLC_FALSE );
add_string( "ffmpeg-pp-name", "default", NULL, LIBAVCODEC_PP_TEXT,
LIBAVCODEC_PP_LONGTEXT, VLC_TRUE );
-#endif
add_integer( "ffmpeg-debug", 0, NULL, DEBUG_TEXT, DEBUG_LONGTEXT,
VLC_TRUE );
- /* chroma conversion submodule */
- add_submodule();
- set_capability( "chroma", 50 );
- set_callbacks( E_(OpenChroma), E_(CloseChroma) );
- set_description( _("FFmpeg chroma conversion") );
-
/* encoder submodule */
add_submodule();
set_section( N_("Encoding") , NULL );
set_capability( "sout mux", 2 );
set_callbacks( E_(OpenMux), E_(CloseMux) );
+#if defined(HAVE_FFMPEG_SWSCALE_H) || defined(HAVE_LIBSWSCALE_TREE)
+ /* video filter submodule */
+ add_submodule();
+ set_description( _("Video scaling filter") );
+ set_capability( "video filter2", 1000 );
+ set_category( CAT_VIDEO );
+ set_subcategory( SUBCAT_VIDEO_VFILTER );
+ set_callbacks( E_(OpenScaler), E_(CloseScaler) );
+ add_integer( "swscale-mode", 0, NULL, SCALEMODE_TEXT, SCALEMODE_LONGTEXT, VLC_TRUE );
+ change_integer_list( pi_mode_values, ppsz_mode_descriptions, 0 );
+
+ var_Create( p_module->p_libvlc_global, "avcodec", VLC_VAR_MUTEX );
+
+#else
+ /* chroma conversion submodule */
+ add_submodule();
+ set_capability( "chroma", 50 );
+ set_callbacks( E_(OpenChroma), E_(CloseChroma) );
+ set_description( _("FFmpeg chroma conversion") );
+
/* video filter submodule */
add_submodule();
set_capability( "video filter2", 50 );
set_callbacks( E_(OpenDeinterlace), E_(CloseDeinterlace) );
set_description( _("FFmpeg deinterlace video filter") );
add_shortcut( "ffmpeg-deinterlace" );
+#endif
- /* video filter submodule */
- add_submodule();
- set_description( _("Video scaling filter") );
- set_capability( "video filter2", 1000 );
- set_category( CAT_VIDEO );
- set_subcategory( SUBCAT_VIDEO_VFILTER );
- set_callbacks( E_(OpenScaler), E_(CloseScaler) );
- add_integer( "swscale-mode", 0, NULL, SCALEMODE_TEXT, SCALEMODE_LONGTEXT, VLC_TRUE );
- change_integer_list( pi_mode_values, ppsz_mode_descriptions, 0 );
-
- var_Create( p_module->p_libvlc_global, "avcodec", VLC_VAR_MUTEX );
vlc_module_end();
/*****************************************************************************
{
decoder_t *p_dec = (decoder_t*) p_this;
int i_cat, i_codec_id, i_result;
- char *psz_namecodec;
+ const char *psz_namecodec;
AVCodecContext *p_context = NULL;
AVCodec *p_codec = NULL;
b_ffmpeginit = 1;
msg_Dbg( p_object, "libavcodec initialized (interface %d )",
- LIBAVCODEC_BUILD );
+ LIBAVCODEC_VERSION_INT );
}
else
{
vlc_fourcc_t i_fourcc;
int i_codec;
int i_cat;
- char *psz_name;
+ const char *psz_name;
} codecs_table[] =
{
{ VLC_FOURCC('F','L','V','1'), CODEC_ID_FLV1,
VIDEO_ES, "Flash Video" },
-#if LIBAVCODEC_BUILD > 4716
{ VLC_FOURCC('H','2','6','1'), CODEC_ID_H261,
VIDEO_ES, "H.261" },
-#endif
-#if LIBAVCODEC_BUILD > 4680
{ VLC_FOURCC('F','L','I','C'), CODEC_ID_FLIC,
VIDEO_ES, "Flic Video" },
-#endif
/* MJPEG */
{ VLC_FOURCC( 'M', 'J', 'P', 'G' ), CODEC_ID_MJPEG,
VIDEO_ES, "Motion JPEG Video" },
{ VLC_FOURCC( 'J', 'P', 'G', 'L' ), CODEC_ID_MJPEG,
VIDEO_ES, "Motion JPEG Video" },
-
{ VLC_FOURCC( 'm', 'j', 'p', 'b' ), CODEC_ID_MJPEGB, /* for mov file */
VIDEO_ES, "Motion JPEG B Video" },
-
-#if LIBAVCODEC_BUILD > 4680
{ VLC_FOURCC( 'S', 'P', '5', 'X' ), CODEC_ID_SP5X,
VIDEO_ES, "Sunplus Motion JPEG Video" },
-#endif
/* DV */
{ VLC_FOURCC('d','v','s','l'), CODEC_ID_DVVIDEO,
VIDEO_ES, "Windows Media Video 1" },
{ VLC_FOURCC('W','M','V','2'), CODEC_ID_WMV2,
VIDEO_ES, "Windows Media Video 2" },
-#if LIBAVCODEC_BUILD >= ((51<<16)+(10<<8)+1)
+#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(10<<8)+1)
{ VLC_FOURCC('W','M','V','3'), CODEC_ID_WMV3,
VIDEO_ES, "Windows Media Video 3" },
{ VLC_FOURCC('W','V','C','1'), CODEC_ID_VC1,
VIDEO_ES, "Windows Media Video Advanced Profile" },
#endif
-#if LIBAVCODEC_BUILD >= 4683
/* Microsoft Video 1 */
{ VLC_FOURCC('M','S','V','C'), CODEC_ID_MSVIDEO1,
VIDEO_ES, "Microsoft Video 1" },
VIDEO_ES, "Microsoft RLE Video" },
{ VLC_FOURCC(0x1,0x0,0x0,0x0), CODEC_ID_MSRLE,
VIDEO_ES, "Microsoft RLE Video" },
-#endif
/* Indeo Video Codecs (Quality of this decoder on ppc is not good) */
{ VLC_FOURCC('I','V','3','1'), CODEC_ID_INDEO3,
{ VLC_FOURCC('i','v','3','2'), CODEC_ID_INDEO3,
VIDEO_ES, "Indeo Video v3" },
-#if LIBAVCODEC_BUILD >= 4721
{ VLC_FOURCC('t','s','c','c'), CODEC_ID_TSCC,
VIDEO_ES, "TechSmith Camtasia Screen Capture Video" },
-#endif
/* Huff YUV */
{ VLC_FOURCC('H','F','Y','U'), CODEC_ID_HUFFYUV,
{ VLC_FOURCC('v','p','3','1'), CODEC_ID_VP3,
VIDEO_ES, "On2's VP3 Video" },
-#if LIBAVCODEC_BUILD >= ((51<<16)+(14<<8)+0)
+#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(14<<8)+0)
{ VLC_FOURCC('V','P','5',' '), CODEC_ID_VP5,
VIDEO_ES, "On2's VP5 Video" },
{ VLC_FOURCC('V','P','5','0'), CODEC_ID_VP5,
VIDEO_ES, "On2's VP6.2 Video (Flash)" },
#endif
-#if LIBAVCODEC_BUILD >= 4685
/* Xiph.org theora */
{ VLC_FOURCC('t','h','e','o'), CODEC_ID_THEORA,
VIDEO_ES, "Xiph.org's Theora Video" },
-#endif
#if ( !defined( WORDS_BIGENDIAN ) )
/* Asus Video (Another thing that doesn't work on PPC) */
VIDEO_ES, "Real Video 10" },
{ VLC_FOURCC('R','V','1','3'), CODEC_ID_RV10,
VIDEO_ES, "Real Video 13" },
-#if LIBAVCODEC_BUILD >= ((51<<16)+(15<<8)+1)
+#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(15<<8)+1)
{ VLC_FOURCC('R','V','2','0'), CODEC_ID_RV20,
VIDEO_ES, "Real Video 20" },
#endif
-#if LIBAVCODEC_BUILD >= 4684
/* Apple Video */
{ VLC_FOURCC('r','p','z','a'), CODEC_ID_RPZA,
VIDEO_ES, "Apple Video" },
/* Id Quake II CIN */
{ VLC_FOURCC('I','D','C','I'), CODEC_ID_IDCIN,
VIDEO_ES, "Id Quake II CIN Video" },
-#endif
/* 4X Technologies */
{ VLC_FOURCC('4','x','m','v'), CODEC_ID_4XM,
VIDEO_ES, "4X Technologies Video" },
-#if LIBAVCODEC_BUILD >= 4694
/* Duck TrueMotion */
{ VLC_FOURCC('D','U','C','K'), CODEC_ID_TRUEMOTION1,
VIDEO_ES, "Duck TrueMotion v1 Video" },
-#endif
/* Interplay MVE */
{ VLC_FOURCC('i','m','v','e'), CODEC_ID_INTERPLAY_VIDEO,
{ VLC_FOURCC('M','D','E','C'), CODEC_ID_MDEC,
VIDEO_ES, "PSX MDEC Video" },
-#if LIBAVCODEC_BUILD >= 4699
/* Sierra VMD */
{ VLC_FOURCC('v','m','d','v'), CODEC_ID_VMDVIDEO,
VIDEO_ES, "Sierra VMD Video" },
-#endif
-#if LIBAVCODEC_BUILD >= 4719
/* FFMPEG's SNOW wavelet codec */
{ VLC_FOURCC('S','N','O','W'), CODEC_ID_SNOW,
VIDEO_ES, "FFMpeg SNOW wavelet Video" },
-#endif
-#if LIBAVCODEC_BUILD >= 4752
{ VLC_FOURCC('r','l','e',' '), CODEC_ID_QTRLE,
VIDEO_ES, "Apple QuickTime RLE Video" },
{ VLC_FOURCC('A','A','S','C'), CODEC_ID_AASC,
VIDEO_ES, "Autodesc RLE Video" },
-#endif
-#if LIBAVCODEC_BUILD >= 4753
+
{ VLC_FOURCC('I','V','2','0'), CODEC_ID_INDEO2,
VIDEO_ES, "Indeo Video v2" },
{ VLC_FOURCC('R','T','2','1'), CODEC_ID_INDEO2,
VIDEO_ES, "Indeo Video v2" },
-#endif
-#if LIBAVCODEC_BUILD >= ((51<<16)+(13<<8)+0)
+#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(13<<8)+0)
{ VLC_FOURCC('V','M','n','c'), CODEC_ID_VMNC,
VIDEO_ES, "VMware Video" },
#endif
/*
* Image codecs
*/
-
-#if LIBAVCODEC_BUILD >= 4731
{ VLC_FOURCC('p','n','g',' '), CODEC_ID_PNG,
VIDEO_ES, "PNG Image" },
{ VLC_FOURCC('p','p','m',' '), CODEC_ID_PPM,
VIDEO_ES, "PGM YUV Image" },
{ VLC_FOURCC('p','a','m',' '), CODEC_ID_PAM,
VIDEO_ES, "PAM Image" },
-#endif
-#if LIBAVCODEC_BUILD >= ((51<<16)+(0<<8)+0)
+#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(0<<8)+0)
{ VLC_FOURCC('b','m','p',' '), CODEC_ID_BMP,
VIDEO_ES, "BMP Image" },
#endif
-#if LIBAVCODEC_BUILD >= ((51<<16)+(21<<8)+0)
+#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(21<<8)+0)
{ VLC_FOURCC('g','i','f',' '), CODEC_ID_GIF,
VIDEO_ES, "GIF Image" },
#endif
{ VLC_FOURCC('a','5','2','b'), CODEC_ID_AC3, /* VLC specific hack */
AUDIO_ES, "A52 Audio (aka AC3)" },
-#if LIBAVCODEC_BUILD >= 4719
/* DTS Audio */
{ VLC_FOURCC('d','t','s',' '), CODEC_ID_DTS,
AUDIO_ES, "DTS Audio" },
-#endif
/* AAC audio */
{ VLC_FOURCC('m','p','4','a'), CODEC_ID_AAC,
{ VLC_FOURCC('R','o','Q','a'), CODEC_ID_ROQ_DPCM,
AUDIO_ES, "Id RoQ DPCM Audio" },
-#if LIBAVCODEC_BUILD >= 4685
/* Sony Playstation XA ADPCM */
{ VLC_FOURCC('x','a',' ',' '), CODEC_ID_ADPCM_XA,
AUDIO_ES, "PSX XA ADPCM Audio" },
/* ADX ADPCM */
{ VLC_FOURCC('a','d','x',' '), CODEC_ID_ADPCM_ADX,
AUDIO_ES, "ADX ADPCM Audio" },
-#endif
-#if LIBAVCODEC_BUILD >= 4699
/* Sierra VMD */
{ VLC_FOURCC('v','m','d','a'), CODEC_ID_VMDAUDIO,
AUDIO_ES, "Sierra VMD Audio" },
-#endif
-#if LIBAVCODEC_BUILD >= 4706
/* G.726 ADPCM */
{ VLC_FOURCC('g','7','2','6'), CODEC_ID_ADPCM_G726,
AUDIO_ES, "G.726 ADPCM Audio" },
-#endif
-#if LIBAVCODEC_BUILD >= 4683
/* AMR */
{ VLC_FOURCC('s','a','m','r'), CODEC_ID_AMR_NB,
AUDIO_ES, "AMR narrow band" },
{ VLC_FOURCC('s','a','w','b'), CODEC_ID_AMR_WB,
AUDIO_ES, "AMR wide band" },
-#endif
-#if LIBAVCODEC_BUILD >= 4703
/* FLAC */
{ VLC_FOURCC('f','l','a','c'), CODEC_ID_FLAC,
AUDIO_ES, "FLAC (Free Lossless Audio Codec)" },
-#endif
-#if LIBAVCODEC_BUILD >= 4745
/* ALAC */
{ VLC_FOURCC('a','l','a','c'), CODEC_ID_ALAC,
AUDIO_ES, "Apple Lossless Audio Codec" },
-#endif
-#if LIBAVCODEC_BUILD >= ((50<<16)+(0<<8)+1)
+#if LIBAVCODEC_VERSION_INT >= ((50<<16)+(0<<8)+1)
/* QDM2 */
{ VLC_FOURCC('Q','D','M','2'), CODEC_ID_QDM2,
AUDIO_ES, "QDM2 Audio" },
#endif
-#if LIBAVCODEC_BUILD >= ((51<<16)+(0<<8)+0)
+#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(0<<8)+0)
/* COOK */
{ VLC_FOURCC('c','o','o','k'), CODEC_ID_COOK,
AUDIO_ES, "Cook Audio" },
#endif
-#if LIBAVCODEC_BUILD >= ((51<<16)+(4<<8)+0)
+#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(4<<8)+0)
/* TTA: The Lossless True Audio */
{ VLC_FOURCC('T','T','A','1'), CODEC_ID_TTA,
AUDIO_ES, "The Lossless True Audio" },
#endif
-#if LIBAVCODEC_BUILD >= ((51<<16)+(8<<8)+0)
+#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(8<<8)+0)
/* Shorten */
{ VLC_FOURCC('s','h','n',' '), CODEC_ID_SHORTEN,
AUDIO_ES, "Shorten Lossless Audio" },
#endif
-#if LIBAVCODEC_BUILD >= ((51<<16)+(16<<8)+0)
+#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(16<<8)+0)
{ VLC_FOURCC('w','v','p','k'), CODEC_ID_WAVPACK,
AUDIO_ES, "WavPack" },
#endif
};
int E_(GetFfmpegCodec)( vlc_fourcc_t i_fourcc, int *pi_cat,
- int *pi_ffmpeg_codec, char **ppsz_name )
+ int *pi_ffmpeg_codec, const char **ppsz_name )
{
int i;
{
if( pi_cat ) *pi_cat = codecs_table[i].i_cat;
if( pi_ffmpeg_codec ) *pi_ffmpeg_codec = codecs_table[i].i_codec;
- if( ppsz_name ) *ppsz_name = codecs_table[i].psz_name;
+ if( ppsz_name ) *ppsz_name = (char *)codecs_table[i].psz_name;
return VLC_TRUE;
}
}
int E_(GetVlcFourcc)( int i_ffmpeg_codec, int *pi_cat,
- vlc_fourcc_t *pi_fourcc, char **ppsz_name )
+ vlc_fourcc_t *pi_fourcc, const char **ppsz_name )
{
int i;
/* Common part between video and audio decoder */
int i_cat;
int i_codec_id;
- char *psz_namecodec;
+ const char *psz_namecodec;
AVCodecContext *p_context;
AVCodec *p_codec;
}
else
{
-#if LIBAVCODEC_BUILD >= 4687
p_dec->fmt_out.video.i_aspect =
VOUT_ASPECT_FACTOR * ( av_q2d(p_context->sample_aspect_ratio) *
p_context->width / p_context->height );
p_dec->fmt_out.video.i_sar_num = p_context->sample_aspect_ratio.num;
p_dec->fmt_out.video.i_sar_den = p_context->sample_aspect_ratio.den;
-#else
- p_dec->fmt_out.video.i_aspect =
- VOUT_ASPECT_FACTOR * p_context->aspect_ratio;
-#endif
+
if( p_dec->fmt_out.video.i_aspect == 0 )
{
p_dec->fmt_out.video.i_aspect =
p_dec->fmt_out.video.i_frame_rate_base =
p_dec->fmt_out.video.i_frame_rate_base;
}
- else
-#if LIBAVCODEC_BUILD >= 4754
- if( p_context->time_base.num > 0 && p_context->time_base.den > 0 )
+ else if( p_context->time_base.num > 0 && p_context->time_base.den > 0 )
{
p_dec->fmt_out.video.i_frame_rate = p_context->time_base.den;
p_dec->fmt_out.video.i_frame_rate_base = p_context->time_base.num;
}
-#else
- if( p_context->frame_rate > 0 && p_context->frame_rate_base > 0 )
- {
- p_dec->fmt_out.video.i_frame_rate = p_context->frame_rate;
- p_dec->fmt_out.video.i_frame_rate_base = p_context->frame_rate_base;
- }
-#endif
p_pic = p_dec->pf_vout_buffer_new( p_dec );
-#ifdef LIBAVCODEC_PP
if( p_sys->p_pp && p_sys->b_pp && !p_sys->b_pp_init )
{
E_(InitPostproc)( p_dec, p_sys->p_pp, p_context->width,
p_context->height, p_context->pix_fmt );
p_sys->b_pp_init = VLC_TRUE;
}
-#endif
return p_pic;
}
* opened (done after the first decoded frame).
*****************************************************************************/
int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
- AVCodec *p_codec, int i_codec_id, char *psz_namecodec )
+ AVCodec *p_codec, int i_codec_id, const char *psz_namecodec )
{
decoder_sys_t *p_sys;
vlc_value_t lockval;
var_Create( p_dec, "ffmpeg-vismv", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_dec, "ffmpeg-vismv", &val );
-#if LIBAVCODEC_BUILD >= 4698
if( val.i_int ) p_sys->p_context->debug_mv = val.i_int;
-#endif
var_Create( p_dec, "ffmpeg-lowres", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_dec, "ffmpeg-lowres", &val );
-#if LIBAVCODEC_BUILD >= 4723
if( val.i_int > 0 && val.i_int <= 2 ) p_sys->p_context->lowres = val.i_int;
-#endif
var_Create( p_dec, "ffmpeg-skiploopfilter",
VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_dec, "ffmpeg-skiploopfilter", &val );
-#if LIBAVCODEC_BUILD >= 4758
if( val.i_int > 0 ) p_sys->p_context->skip_loop_filter = AVDISCARD_NONREF;
if( val.i_int > 1 ) p_sys->p_context->skip_loop_filter = AVDISCARD_BIDIR;
if( val.i_int > 2 ) p_sys->p_context->skip_loop_filter = AVDISCARD_NONKEY;
if( val.i_int > 3 ) p_sys->p_context->skip_loop_filter = AVDISCARD_ALL;
-#endif
/* ***** ffmpeg frame skipping ***** */
var_Create( p_dec, "ffmpeg-hurry-up", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
p_sys->p_context->pix_fmt != PIX_FMT_YUV422P &&
/* H264 uses too many reference frames */
p_sys->i_codec_id != CODEC_ID_H264 &&
-#if LIBAVCODEC_BUILD >= 4698
!p_sys->p_context->debug_mv )
-#else
- 1 )
-#endif
{
/* Some codecs set pix_fmt only after the 1st frame has been decoded,
* so we need to do another check in ffmpeg_GetFrameBuf() */
p_sys->b_direct_rendering = 1;
}
-#ifdef LIBAVCODEC_PP
p_sys->p_pp = NULL;
p_sys->b_pp = p_sys->b_pp_async = p_sys->b_pp_init = VLC_FALSE;
p_sys->p_pp = E_(OpenPostproc)( p_dec, &p_sys->b_pp_async );
-#endif
/* ffmpeg doesn't properly release old pictures when frames are skipped */
//if( p_sys->b_hurry_up ) p_sys->b_direct_rendering = 0;
p_dec->fmt_out.i_codec = ffmpeg_PixFmtToChroma( p_context->pix_fmt );
/* Setup palette */
-#if LIBAVCODEC_BUILD >= 4688
if( p_dec->fmt_in.video.p_palette )
p_sys->p_context->palctrl =
(AVPaletteControl *)p_dec->fmt_in.video.p_palette;
else
p_sys->p_context->palctrl = &palette_control;
-#endif
/* ***** Open the codec ***** */
vlc_mutex_lock( lockval.p_address );
if( !p_dec->fmt_in.video.i_aspect )
{
/* Fetch again the aspect ratio in case it changed */
-#if LIBAVCODEC_BUILD >= 4687
p_dec->fmt_out.video.i_aspect =
VOUT_ASPECT_FACTOR
* ( av_q2d(p_sys->p_context->sample_aspect_ratio)
= p_sys->p_context->sample_aspect_ratio.num;
p_dec->fmt_out.video.i_sar_den
= p_sys->p_context->sample_aspect_ratio.den;
-#else
- p_dec->fmt_out.video.i_aspect =
- VOUT_ASPECT_FACTOR * p_sys->p_context->aspect_ratio;
-#endif
+
if( p_dec->fmt_out.video.i_aspect == 0 )
{
p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR
p_pic->date = p_sys->i_pts;
/* interpolate the next PTS */
-#if LIBAVCODEC_BUILD >= 4754
if( p_dec->fmt_in.video.i_frame_rate > 0 &&
p_dec->fmt_in.video.i_frame_rate_base > 0 )
{
p_block->i_rate / INPUT_RATE_DEFAULT /
(2 * p_sys->p_context->time_base.den);
}
-#else
- if( p_sys->p_context->frame_rate > 0 )
- {
- p_sys->i_pts += I64C(1000000) *
- (2 + p_sys->p_ff_pic->repeat_pict) *
- p_sys->p_context->frame_rate_base *
- p_block->i_rate / INPUT_RATE_DEFAULT /
- (2 * p_sys->p_context->frame_rate);
- }
-#endif
if( p_sys->b_first_frame )
{
}
p_pic->i_nb_fields = 2 + p_sys->p_ff_pic->repeat_pict;
-#if LIBAVCODEC_BUILD >= 4685
p_pic->b_progressive = !p_sys->p_ff_pic->interlaced_frame;
p_pic->b_top_field_first = p_sys->p_ff_pic->top_field_first;
-#endif
return p_pic;
}
decoder_sys_t *p_sys = p_dec->p_sys;
if( p_sys->p_ff_pic ) av_free( p_sys->p_ff_pic );
-
-#ifdef LIBAVCODEC_PP
E_(ClosePostproc)( p_dec, p_sys->p_pp );
-#endif
-
free( p_sys->p_buffer_orig );
}
uint8_t *p_dst, *p_src;
int i_src_stride, i_dst_stride;
-#ifdef LIBAVCODEC_PP
if( p_sys->p_pp && p_sys->b_pp )
E_(PostprocPict)( p_dec, p_sys->p_pp, p_pic, p_ff_pic );
else
-#endif
- for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
{
- p_src = p_ff_pic->data[i_plane];
- p_dst = p_pic->p[i_plane].p_pixels;
- i_src_stride = p_ff_pic->linesize[i_plane];
- i_dst_stride = p_pic->p[i_plane].i_pitch;
-
- i_size = __MIN( i_src_stride, i_dst_stride );
- for( i_line = 0; i_line < p_pic->p[i_plane].i_visible_lines;
- i_line++ )
+ for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
{
- p_dec->p_libvlc->pf_memcpy( p_dst, p_src, i_size );
- p_src += i_src_stride;
- p_dst += i_dst_stride;
+ p_src = p_ff_pic->data[i_plane];
+ p_dst = p_pic->p[i_plane].p_pixels;
+ i_src_stride = p_ff_pic->linesize[i_plane];
+ i_dst_stride = p_pic->p[i_plane].i_pitch;
+
+ i_size = __MIN( i_src_stride, i_dst_stride );
+ for( i_line = 0; i_line < p_pic->p[i_plane].i_visible_lines;
+ i_line++ )
+ {
+ p_dec->p_libvlc->pf_memcpy( p_dst, p_src, i_size );
+ p_src += i_src_stride;
+ p_dst += i_dst_stride;
+ }
}
}
}
dest_pic.data[i] = p_pic->p[i].p_pixels;
dest_pic.linesize[i] = p_pic->p[i].i_pitch;
}
+#if !defined(HAVE_FFMPEG_SWSCALE_H) && !defined(HAVE_LIBSWSCALE_TREE)
img_convert( &dest_pic, PIX_FMT_YUV420P,
(AVPicture *)p_ff_pic,
p_sys->p_context->pix_fmt,
p_sys->p_context->width,
p_sys->p_context->height );
+#endif
break;
default:
msg_Err( p_dec, "don't know how to convert chroma %i",