vdpauh264dec: try to calculate framerate if we don't get one from upstream

This commit is contained in:
Carl-Anton Ingmarsson 2010-07-19 21:53:30 +02:00
parent d15418d6aa
commit b4e447375b
2 changed files with 21 additions and 1 deletions

View file

@ -235,7 +235,15 @@ gst_h264_parse_vui_parameters (GstH264VUIParameters * vui,
READ_UINT8 (reader, vui->timing_info_present_flag, 1);
if (vui->timing_info_present_flag) {
READ_UINT32 (reader, vui->num_units_in_tick, 32);
if (vui->num_units_in_tick == 0)
GST_WARNING
("num_units_in_tick = 0 detected in stream (incompliant to H.264 E.2.1).");
READ_UINT32 (reader, vui->time_scale, 32);
if (vui->time_scale == 0)
GST_WARNING
("time_scale = 0 detected in stream (incompliant to H.264 E.2.1).");
READ_UINT8 (reader, vui->fixed_frame_rate_flag, 1);
}

View file

@ -277,7 +277,19 @@ gst_vdp_h264_dec_idr (GstVdpH264Dec * h264_dec, GstH264Frame * h264_frame)
else
state.height -= 4 * seq->frame_crop_bottom_offset;
/* FIXME: try to calculate framerate */
/* calculate framerate if we haven't got one */
if (state.fps_n == 0 && seq->vui_parameters_present_flag) {
GstH264VUIParameters *vui;
vui = &seq->vui_parameters;
if (vui->timing_info_present_flag && vui->fixed_frame_rate_flag) {
state.fps_n = vui->time_scale;
state.fps_d = vui->num_units_in_tick;
if (seq->frame_mbs_only_flag)
state.fps_d *= 2;
}
}
gst_base_video_decoder_set_state (GST_BASE_VIDEO_DECODER (h264_dec), state);