summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl-Anton Ingmarsson <ca.ingmarsson@gmail.com>2010-07-19 21:53:30 +0200
committerCarl-Anton Ingmarsson <ca.ingmarsson@gmail.com>2010-07-19 21:55:31 +0200
commitb4e447375b3a65aaf33db0d0bd33f9884e75eac4 (patch)
tree2482ce4248e00d50b6332d36be2a8a47402b5456
parentd15418d6aaeb92118693a64de8a3806ebf62774c (diff)
vdpauh264dec: try to calculate framerate if we don't get one from upstream
-rw-r--r--sys/vdpau/h264/gsth264parser.c8
-rw-r--r--sys/vdpau/h264/gstvdph264dec.c14
2 files changed, 21 insertions, 1 deletions
diff --git a/sys/vdpau/h264/gsth264parser.c b/sys/vdpau/h264/gsth264parser.c
index be2c42186..b154a54cc 100644
--- a/sys/vdpau/h264/gsth264parser.c
+++ b/sys/vdpau/h264/gsth264parser.c
@@ -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);
}
diff --git a/sys/vdpau/h264/gstvdph264dec.c b/sys/vdpau/h264/gstvdph264dec.c
index c7b1e24b2..8a7efd882 100644
--- a/sys/vdpau/h264/gstvdph264dec.c
+++ b/sys/vdpau/h264/gstvdph264dec.c
@@ -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);