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;
}
}
+ 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;
+ }
+
p_pic = p_dec->pf_vout_buffer_new( p_dec );
#ifdef LIBAVCODEC_PP
p_sys->p_ff_pic = avcodec_alloc_frame();
/* ***** Fill p_context with init values ***** */
+ /* FIXME: remove when ffmpeg deals properly with avc1 */
+ if( p_dec->fmt_in.i_codec != VLC_FOURCC('a','v','c','1') )
+ /* End FIXME */
p_sys->p_context->codec_tag = ffmpeg_CodecTag( p_dec->fmt_in.i_codec );
p_sys->p_context->width = p_dec->fmt_in.video.i_width;
p_sys->p_context->height = p_dec->fmt_in.video.i_height;
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 );
p_sys->p_context->sub_id );
}
}
- else if( p_dec->fmt_in.i_codec != VLC_FOURCC( 'a', 'v', 'c', '1' ) )
+ /* FIXME: remove when ffmpeg deals properly with avc1 */
+ else if( p_dec->fmt_in.i_codec == VLC_FOURCC('a','v','c','1') )
+ {
+ ;
+ }
+ /* End FIXME */
+ else
{
p_sys->p_context->extradata_size = i_size;
p_sys->p_context->extradata =
p_sys->i_late_frames = 0;
p_sys->i_buffer = 0;
p_sys->i_buffer_orig = 1;
- p_sys->p_buffer_orig = p_sys->p_buffer = malloc( p_sys->i_buffer );
+ p_sys->p_buffer_orig = p_sys->p_buffer = malloc( p_sys->i_buffer_orig );
/* Set output properties */
p_dec->fmt_out.i_cat = VIDEO_ES;
{
vlc_mutex_unlock( lockval.p_address );
msg_Err( p_dec, "cannot open codec (%s)", p_sys->psz_namecodec );
+ free( p_sys );
return VLC_EGENERIC;
}
vlc_mutex_unlock( lockval.p_address );
p_block = *pp_block;
- if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
+ if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
p_sys->i_buffer = 0;
p_sys->i_pts = 0; /* To make sure we recover properly */
return NULL;
}
- if( p_sys->i_late_frames > 0 &&
+ if( p_block->i_flags & BLOCK_FLAG_PREROLL )
+ {
+ /* Do not care about late frames when prerolling
+ * TODO avoid decoding of non reference frame
+ * (ie all B except for H264 where it depends only on nal_ref_idc) */
+ p_sys->i_late_frames = 0;
+ }
+
+ if( !p_dec->b_pace_control && p_sys->i_late_frames > 0 &&
mdate() - p_sys->i_late_frames_start > I64C(5000000) )
{
if( p_sys->i_pts )
/* TODO implement it in a better way */
/* A good idea could be to decode all I pictures and see for the other */
- if( p_sys->b_hurry_up && p_sys->i_late_frames > 4 )
+ if( !p_dec->b_pace_control &&
+ p_sys->b_hurry_up && p_sys->i_late_frames > 4 )
{
b_drawpicture = 0;
if( p_sys->i_late_frames < 8 )
}
else
{
- b_drawpicture = 1;
- p_sys->p_context->hurry_up = 0;
+ if (!(p_block->i_flags & BLOCK_FLAG_PREROLL))
+ {
+ b_drawpicture = 1;
+ p_sys->p_context->hurry_up = 0;
+ }
+ else
+ {
+ b_drawpicture = 0;
+ p_sys->p_context->hurry_up = 1;
+ }
}
continue;
}
- /* Update frame late count*/
- if( p_sys->i_pts && p_sys->i_pts <= mdate() )
+ /* Update frame late count (except when doing preroll) */
+ if( p_sys->i_pts && p_sys->i_pts <= mdate() &&
+ !(p_block->i_flags & BLOCK_FLAG_PREROLL) )
{
p_sys->i_late_frames++;
if( p_sys->i_late_frames == 1 )
p_sys->b_first_frame = VLC_FALSE;
p_pic->b_force = VLC_TRUE;
}
+
+ 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;
}
else
{
decoder_sys_t *p_sys = p_dec->p_sys;
- if( p_sys->p_ff_pic ) free( p_sys->p_ff_pic );
+ if( p_sys->p_ff_pic ) av_free( p_sys->p_ff_pic );
#ifdef LIBAVCODEC_PP
E_(ClosePostproc)( p_dec, p_sys->p_pp );
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_lines; i_line++ )
+ for( i_line = 0; i_line < p_pic->p[i_plane].i_visible_lines;
+ i_line++ )
{
p_dec->p_vlc->pf_memcpy( p_dst, p_src, i_size );
p_src += i_src_stride;