vc1parse: set duration on output buffers

This has the nice side effect of avoiding hanging at EOS with truncated asf
clips.

Conflicts:
	gst/videoparsers/gstvc1parse.c
This commit is contained in:
Alessandro Decina 2012-10-14 11:39:55 +02:00 committed by Sebastian Dröge
parent f287dec1a2
commit d03f5499bd
2 changed files with 10 additions and 1 deletions

View file

@ -260,6 +260,7 @@ gst_vc1_parse_reset (GstVC1Parse * vc1parse)
vc1parse->width = 0;
vc1parse->height = 0;
vc1parse->fps_n = vc1parse->fps_d = 0;
vc1parse->frame_duration = GST_CLOCK_TIME_NONE;
vc1parse->fps_from_caps = FALSE;
vc1parse->par_n = vc1parse->par_d = 0;
vc1parse->par_from_caps = FALSE;
@ -609,9 +610,13 @@ gst_vc1_parse_update_caps (GstVC1Parse * vc1parse)
g_assert (vc1parse->width != 0 && vc1parse->height != 0);
gst_caps_set_simple (caps, "width", G_TYPE_INT, vc1parse->width, "height",
G_TYPE_INT, vc1parse->height, NULL);
if (vc1parse->fps_d != 0)
if (vc1parse->fps_d != 0) {
gst_caps_set_simple (caps, "framerate", GST_TYPE_FRACTION, vc1parse->fps_n,
vc1parse->fps_d, NULL);
vc1parse->frame_duration = gst_util_uint64_scale (GST_SECOND,
vc1parse->fps_d, vc1parse->fps_n);
}
if (vc1parse->par_n != 0 && vc1parse->par_d != 0)
gst_caps_set_simple (caps, "pixel-aspect-ratio", GST_TYPE_FRACTION,
vc1parse->par_n, vc1parse->par_d, NULL);
@ -965,6 +970,9 @@ gst_vc1_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
return GST_FLOW_ERROR;
}
if (GST_CLOCK_TIME_IS_VALID (vc1parse->frame_duration))
GST_BUFFER_DURATION (buffer) = vc1parse->frame_duration;
/* Might be multiple BDUs here, complex... */
if (vc1parse->profile == GST_VC1_PROFILE_ADVANCED) {
gboolean startcodes = FALSE;

View file

@ -74,6 +74,7 @@ struct _GstVC1Parse
gint fps_n, fps_d;
gboolean fps_from_caps;
GstClockTime frame_duration;
gint par_n, par_d;
gboolean par_from_caps;