* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
- * Gildas Bazin <gbazin@netcourrier.com>
+ * Gildas Bazin <gbazin@videolan.org>
*
* 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
if( p_enc->fmt_in.i_cat == VIDEO_ES )
{
+ int i_aspect_num, i_aspect_den;
+
if( !p_enc->fmt_in.video.i_width || !p_enc->fmt_in.video.i_height )
{
msg_Warn( p_enc, "invalid size %ix%i", p_enc->fmt_in.video.i_width,
p_context->b_frame_strategy = 0;
#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 */ );
av_reduce( &p_context->sample_aspect_ratio.num,
&p_context->sample_aspect_ratio.den,
- p_enc->fmt_in.video.i_aspect *
+ i_aspect_num *
(int64_t)p_context->height / p_context->width,
- VOUT_ASPECT_FACTOR, 1 << 30 /* something big */ );
+ i_aspect_den, 1 << 30 /* something big */ );
#else
p_context->aspect_ratio = ((float)p_enc->fmt_in.video.i_aspect) /
VOUT_ASPECT_FACTOR;
VLC_FALSE );
add_integer ( "ffmpeg-vismv", 0, NULL, VISMV_TEXT, VISMV_LONGTEXT,
VLC_TRUE );
+ add_integer ( "ffmpeg-lowres", 0, NULL, LOWRES_TEXT, LOWRES_LONGTEXT,
+ VLC_TRUE );
+ change_integer_range( 0, 2 );
#ifdef LIBAVCODEC_PP
add_integer( "ffmpeg-pp-q", 0, NULL, PP_Q_TEXT, PP_Q_LONGTEXT, VLC_FALSE );
decoder_t *p_dec = (decoder_t *)p_this;
decoder_sys_t *p_sys = p_dec->p_sys;
- if( p_sys->p_context )
- {
- if( p_sys->p_context->extradata )
- free( p_sys->p_context->extradata );
-
- avcodec_close( p_sys->p_context );
- msg_Dbg( p_dec, "ffmpeg codec (%s) stopped", p_sys->psz_namecodec );
- av_free( p_sys->p_context );
- }
-
switch( p_sys->i_cat )
{
case AUDIO_ES:
break;
}
+ if( p_sys->p_context )
+ {
+ if( p_sys->p_context->extradata )
+ free( p_sys->p_context->extradata );
+
+ avcodec_close( p_sys->p_context );
+ msg_Dbg( p_dec, "ffmpeg codec (%s) stopped", p_sys->psz_namecodec );
+ av_free( p_sys->p_context );
+ }
+
free( p_sys );
}
-
+
/*****************************************************************************
* local Functions
*****************************************************************************/
"2 - visualize forward predicted MVs of B frames\n" \
"4 - visualize backward predicted MVs of B frames" )
+#define LOWRES_TEXT N_( "Low resolution decoding" )
+#define LOWRES_LONGTEXT N_( "Will only decode a low resolution version of " \
+ "the video." )
+
#define LIBAVCODEC_PP_TEXT N_("ffmpeg post processing filter chains")
/* FIXME (cut/past from ffmpeg */
#define LIBAVCODEC_PP_LONGTEXT \
return NULL; /* invalid display size */
}
+#if LIBAVCODEC_BUILD >= 4723
+ p_dec->fmt_out.video.i_width >>= p_context->lowres;
+ p_dec->fmt_out.video.i_height >>= p_context->lowres;
+#endif
+
if( !p_dec->fmt_out.i_codec )
{
/* we make conversion if possible*/
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
+
/* ***** ffmpeg frame skipping ***** */
var_Create( p_dec, "ffmpeg-hurry-up", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Get( p_dec, "ffmpeg-hurry-up", &val );