Commit 8c7506a0 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* Don't use deprecated functions if libswscaler is present.

  - Note that these are not all replaced atm, so some functionality might be lacking
* Make the minimum version of libavcodec version 5000 (september 2005).
  - Removed all the checks for previous API versions.
parent 147753f6
......@@ -58,7 +58,7 @@ struct decoder_sys_t
/* 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;
......@@ -84,7 +84,7 @@ struct decoder_sys_t
* The ffmpeg codec will be opened, some memory allocated.
*****************************************************************************/
int E_(InitAudioDec)( 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;
......
......@@ -36,6 +36,7 @@
#include "ffmpeg.h"
#if !defined(HAVE_FFMPEG_SWSCALE_H) && !defined(HAVE_LIBSWSCALE_TREE)
void E_(InitLibavcodec) ( vlc_object_t *p_object );
static void ChromaConversion( vout_thread_t *, picture_t *, picture_t * );
......@@ -188,3 +189,4 @@ void E_(CloseChroma)( vlc_object_t *p_this )
}
free( p_vout->chroma.p_sys );
}
#endif /* !defined(HAVE_FFMPEG_SWSCALE_H) && !defined(HAVE_LIBSWSCALE_TREE) */
\ No newline at end of file
......@@ -43,7 +43,7 @@
//#define AVFORMAT_DEBUG 1
/* Version checking */
#if (LIBAVFORMAT_BUILD >= 4629) && (defined(HAVE_FFMPEG_AVFORMAT_H) || defined(HAVE_LIBAVFORMAT_TREE))
#if defined(HAVE_FFMPEG_AVFORMAT_H) || defined(HAVE_LIBAVFORMAT_TREE)
/*****************************************************************************
* demux_sys_t: demux descriptor
......@@ -486,7 +486,7 @@ static offset_t IOSeek( void *opaque, offset_t offset, int whence )
return stream_Tell( p_demux->s );
}
#else /* LIBAVFORMAT_BUILD >= 4611 */
#else /* HAVE_FFMPEG_AVFORMAT_H */
int E_(OpenDemux)( vlc_object_t *p_this )
{
......@@ -497,4 +497,4 @@ void E_(CloseDemux)( vlc_object_t *p_this )
{
}
#endif /* LIBAVFORMAT_BUILD >= 4629 */
#endif /* HAVE_FFMPEG_AVFORMAT_H */
......@@ -43,13 +43,6 @@
# 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)
......@@ -76,7 +69,6 @@ static int FfmpegExecute( AVCodecContext *s,
/*****************************************************************************
* thread_context_t : for multithreaded encoding
*****************************************************************************/
#if LIBAVCODEC_BUILD >= 4702
struct thread_context_t
{
VLC_COMMON_MEMBERS
......@@ -90,7 +82,6 @@ struct thread_context_t
vlc_cond_t cond;
vlc_bool_t b_work, b_done;
};
#endif
/*****************************************************************************
* encoder_sys_t : ffmpeg encoder descriptor
......@@ -202,7 +193,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
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;
......@@ -393,13 +384,8 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
&& (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;
......@@ -412,9 +398,7 @@ int E_(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;
#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;
......@@ -426,7 +410,6 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
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 */ );
......@@ -434,16 +417,11 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
&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;
......@@ -454,9 +432,6 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
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 )
{
......@@ -471,9 +446,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
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 )
{
......@@ -499,11 +472,9 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
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 )
......@@ -512,10 +483,8 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
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;
......@@ -531,9 +500,7 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
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 )
......@@ -661,7 +628,6 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
/****************************************************************************
* 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 )
......@@ -730,7 +696,6 @@ static int FfmpegExecute( AVCodecContext *s,
return 0;
}
#endif
/****************************************************************************
* EncodeVideo: the whole thing
......@@ -741,7 +706,6 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
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;
......@@ -771,7 +735,6 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
p_sys->p_context->execute = FfmpegExecute;
}
#endif
memset( &frame, 0, sizeof( AVFrame ) );
for( i_plane = 0; i_plane < p_pict->i_planes; i_plane++ )
......@@ -784,20 +747,13 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
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;
......@@ -818,20 +774,17 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
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
}
}
......@@ -871,14 +824,12 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
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,
......@@ -907,7 +858,6 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
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 /
......@@ -915,7 +865,6 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
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 &&
......@@ -1056,7 +1005,6 @@ void E_(CloseEncoder)( vlc_object_t *p_this )
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;
......@@ -1074,7 +1022,6 @@ void E_(CloseEncoder)( vlc_object_t *p_this )
free( pp_contexts );
}
#endif
vlc_mutex_lock( lockval.p_address );
avcodec_close( p_sys->p_context );
......
......@@ -36,18 +36,16 @@
# 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
#ifdef HAVE_POSTPROC_POSTPROCESS_H
# include <postproc/postprocess.h>
# else
#else
# include <libpostproc/postprocess.h>
# endif
#endif
/*****************************************************************************
......@@ -71,14 +69,14 @@ static int OpenDecoder( vlc_object_t * );
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"),
......@@ -120,20 +118,12 @@ vlc_module_begin();
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 );
......@@ -205,6 +195,26 @@ vlc_module_begin();
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 );
......@@ -223,18 +233,8 @@ vlc_module_begin();
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();
/*****************************************************************************
......@@ -244,7 +244,7 @@ static int OpenDecoder( vlc_object_t *p_this )
{
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;
......@@ -437,7 +437,7 @@ void E_(InitLibavcodec)( vlc_object_t *p_object )
b_ffmpeginit = 1;
msg_Dbg( p_object, "libavcodec initialized (interface %d )",
LIBAVCODEC_BUILD );
LIBAVCODEC_VERSION_INT );
}
else
{
......@@ -518,7 +518,7 @@ static struct
vlc_fourcc_t i_fourcc;
int i_codec;
int i_cat;
char *psz_name;
const char *psz_name;
} codecs_table[] =
{
......@@ -693,15 +693,11 @@ static struct
{ 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,
......@@ -718,14 +714,10 @@ static struct
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,
......@@ -752,7 +744,7 @@ static struct
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,
......@@ -765,7 +757,6 @@ static struct
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" },
......@@ -785,7 +776,6 @@ static struct
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,
......@@ -797,10 +787,8 @@ static struct
{ 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,
......@@ -820,7 +808,7 @@ static struct
{ 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,
......@@ -833,11 +821,9 @@ static struct
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) */
......@@ -864,12 +850,11 @@ static struct
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" },
......@@ -884,17 +869,14 @@ static struct
/* 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,
......@@ -908,19 +890,14 @@ static struct
{ 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" },
......@@ -948,15 +925,13 @@ static struct
{ 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
......@@ -965,8 +940,6 @@ static struct
/*
* 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,
......@@ -977,14 +950,13 @@ static struct
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
......@@ -1037,11 +1009,9 @@ static struct
{ 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,
......@@ -1059,7 +1029,6 @@ static struct
{ 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" },
......@@ -1067,65 +1036,54 @@ static struct
/* 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
......@@ -1168,7 +1126,7 @@ static struct
};
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;
......@@ -1178,7 +1136,7 @@ int E_(GetFfmpegCodec)( vlc_fourcc_t i_fourcc, int *pi_cat,
{
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;
}
......@@ -1187,7 +1145,7 @@ int E_(GetFfmpegCodec)( vlc_fourcc_t i_fourcc, int *pi_cat,
}
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;
......
......@@ -23,32 +23,26 @@
#include "codecs.h" /* BITMAPINFOHEADER */
#if LIBAVCODEC_BUILD >= 4663
# define LIBAVCODEC_PP
#else
# undef LIBAVCODEC_PP
#endif
struct picture_t;
struct AVFrame;
struct AVCodecContext;
struct AVCodec;
void E_(InitLibavcodec)( vlc_object_t * );
int E_(GetFfmpegCodec) ( vlc_fourcc_t, int *, int *, char ** );
int E_(GetVlcFourcc) ( int, int *, vlc_fourcc_t *, char ** );
int E_(GetFfmpegCodec) ( vlc_fourcc_t, int *, int *, const char ** );
int E_(GetVlcFourcc) ( int, int *, vlc_fourcc_t *, const char ** );
int E_(GetFfmpegChroma)( vlc_fourcc_t );
vlc_fourcc_t E_(GetVlcChroma)( int );
/* Video decoder module */
int E_( InitVideoDec )( decoder_t *, AVCodecContext *, AVCodec *,
int, char * );
int, const char * );
void E_( EndVideoDec ) ( decoder_t * );
picture_t *E_( DecodeVideo ) ( decoder_t *, block_t ** );
/* Audio decoder module */
int E_( InitAudioDec )( decoder_t *, AVCodecContext *, AVCodec *,
int, char * );
int, const char * );
void E_( EndAudioDec ) ( decoder_t * );
aout_buffer_t *E_( DecodeAudio ) ( decoder_t *, block_t ** );
......
......@@ -42,7 +42,7 @@
//#define AVFORMAT_DEBUG 1
/* Version checking */
#if (LIBAVFORMAT_BUILD >= 4687) && (defined(HAVE_FFMPEG_AVFORMAT_H) || defined(HAVE_LIBAVFORMAT_TREE))
#if defined(HAVE_FFMPEG_AVFORMAT_H) || defined(HAVE_LIBAVFORMAT_TREE)
/*****************************************************************************
* mux_sys_t: mux descriptor
......@@ -443,7 +443,7 @@ static offset_t IOSeek( void *opaque, offset_t offset, int whence )
return 0;
}
#else /* LIBAVFORMAT_BUILD >= 4687 */
#else /* HAVE_FFMPEG_AVFORMAT_H */
int E_(OpenMux)( vlc_object_t *p_this )
{
......@@ -454,4 +454,4 @@ void E_(CloseMux)( vlc_object_t *p_this )
{
}
#endif /* LIBAVFORMAT_BUILD >= 4687 */
#endif /* HAVE_FFMPEG_AVFORMAT_H */
......@@ -35,8 +35,6 @@
#include "ffmpeg.h"
#ifdef LIBAVCODEC_PP
#ifdef HAVE_POSTPROC_POSTPROCESS_H
# include <postproc/postprocess.h>
#else
......@@ -265,5 +263,3 @@ static int PPQCallback( vlc_object_t *p_this, char const *psz_cmd,
return VLC_SUCCESS;
}
#endif /* LIBAVCODEC_PP */
......@@ -67,7 +67,7 @@ void *( *swscale_fast_memcpy )( void *, const void *, size_t );
static picture_t *Filter( filter_t *, picture_t * );
static int CheckInit( filter_t * );
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"),
......
......@@ -46,7 +46,7 @@ struct decoder_sys_t
/* 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;
......@@ -170,16 +170,12 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec,
}
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 =
......@@ -195,31 +191,20 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec,
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;
}
......@@ -231,7 +216,7 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec,
* 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;
......@@ -271,25 +256,19 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
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 );
......@@ -305,22 +284,16 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
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;
......@@ -354,13 +327,11 @@ int E_(InitVideoDec)( decoder_t *p_dec, AVCodecContext *p_context,
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 );
......@@ -602,7 +573,6 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
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)
......@@ -611,10 +581,7 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
= 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
......@@ -628,7 +595,6 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
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 )
{
......@@ -646,16 +612,6 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
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 )
{
......@@ -665,10 +621,8 @@ picture_t *E_(DecodeVideo)( decoder_t *p_dec, block_t **pp_block )
}
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;
}
......@@ -693,11 +647,7 @@ void E_(EndVideoDec)( decoder_t *p_dec )
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 );
}
......@@ -792,11 +742,10 @@ static void ffmpeg_CopyPicture( decoder_t *p_dec,
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];
......@@ -814,6 +763,7 @@ static void ffmpeg_CopyPicture( decoder_t *p_dec,
}
}
}
}
else
{
AVPicture dest_pic;
......@@ -831,11 +781,13 @@ static void ffmpeg_CopyPicture( decoder_t *p_dec,
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",
......
......@@ -38,6 +38,8 @@
#include "ffmpeg.h"
#if !defined(HAVE_FFMPEG_SWSCALE_H) && !defined(HAVE_LIBSWSCALE_TREE)
void E_(InitLibavcodec) ( vlc_object_t *p_object );
static int CheckInit( filter_t *p_filter );
static picture_t *Process( filter_t *p_filter, picture_t *p_pic );
......@@ -287,7 +289,6 @@ static int CheckInit( filter_t *p_filter )
- p_filter->fmt_out.video.i_x_offset;
}
#if LIBAVCODEC_BUILD >= 4708
p_sys->p_rsc = img_resample_full_init(
p_filter->fmt_out.video.i_width,
p_filter->fmt_out.video.i_height,
......@@ -297,15 +298,7 @@ static int CheckInit( filter_t *p_filter )
i_cropleft,i_cropright,
i_paddtop,i_paddbottom,
i_paddleft,i_paddright );
#else
p_sys->p_rsc = img_resample_full_init(
p_filter->fmt_out.video.i_width - i_paddleft - i_paddright,
p_filter->fmt_out.video.i_height - i_paddtop - i_paddbottom,
p_filter->fmt_in.video.i_width,
p_filter->fmt_in.video.i_height,
i_croptop,i_cropbottom,
i_cropleft,i_cropright );
#endif
msg_Dbg( p_filter, "input: %ix%i -> %ix%i",
p_filter->fmt_out.video.i_width,
p_filter->fmt_out.video.i_height,
......@@ -383,10 +376,7 @@ static void fill_pad_region( AVPicture* img, int height, int width,
}
}
#if LIBAVCODEC_BUILD < 4708
/* Workaround, because old libavcodec doesnt know how to padd */
static void img_resample_padd( ImgReSampleContext *s, AVPicture *output,
const AVPicture *input, int padtop, int padleft )
{
......@@ -398,8 +388,6 @@ static void img_resample_padd( ImgReSampleContext *s, AVPicture *output,
nopadd_pic.data[2] += ( nopadd_pic.linesize[2] * padtop + padleft ) >> 1;
img_resample( s, &nopadd_pic, input );
}
#endif
/*****************************************************************************
......@@ -465,20 +453,7 @@ static picture_t *Process( filter_t *p_filter, picture_t *p_pic )
{
if( p_sys->b_convert ) p_dst = &p_sys->tmp_pic;
#if LIBAVCODEC_BUILD >= 4708
img_resample( p_sys->p_rsc, p_dst, p_src );
#else
if ( p_sys->b_enable_croppadd )
{
img_resample_padd( p_sys->p_rsc, p_dst, p_src,
p_filter->fmt_out.video.i_y_offset,
p_filter->fmt_out.video.i_x_offset );
}
else
{
img_resample( p_sys->p_rsc, p_dst, p_src );
}
#endif
if (p_sys->b_enable_croppadd)
{
......@@ -526,20 +501,7 @@ static picture_t *Process( filter_t *p_filter, picture_t *p_pic )
{
p_dst = &dest_pic;
#if LIBAVCODEC_BUILD >= 4708
img_resample( p_sys->p_rsc, p_dst, p_src );
#else
if ( p_sys->b_enable_croppadd )
{
img_resample_padd( p_sys->p_rsc, p_dst, p_src,
p_filter->fmt_out.video.i_y_offset,
p_filter->fmt_out.video.i_x_offset );
}
else
{
img_resample( p_sys->p_rsc, p_dst, p_src );
}
#endif
if (p_sys->b_enable_croppadd)
{
......@@ -690,3 +652,5 @@ static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
p_pic->pf_release( p_pic );
return p_pic_dst;
}
#endif /* ( (defined(HAVE_FFMPEG_SWSCALE_H) || defined(HAVE_LIBSWSCALE_TREE)) */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment