From e29787776c4eccfecaecf5ead5c0ec17871037d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 13 Dec 2007 10:38:23 +0000 Subject: gst/videoparse/gstvideoparse.c: Handle -1 values for the CONVERT query too. Original commit message from CVS: * gst/videoparse/gstvideoparse.c: (gst_video_parse_convert), (gst_video_parse_sink_event): Handle -1 values for the CONVERT query too. --- gst/videoparse/gstvideoparse.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'gst/videoparse') diff --git a/gst/videoparse/gstvideoparse.c b/gst/videoparse/gstvideoparse.c index c18cb2e6..139a9cff 100644 --- a/gst/videoparse/gstvideoparse.c +++ b/gst/videoparse/gstvideoparse.c @@ -415,6 +415,13 @@ gst_video_parse_convert (GstVideoParse * vp, if (src_format == dest_format) { *dest_value = src_value; ret = TRUE; + goto done; + } + + if (src_value == -1) { + *dest_value = -1; + ret = TRUE; + goto done; } /* bytes to frames */ @@ -426,12 +433,14 @@ gst_video_parse_convert (GstVideoParse * vp, *dest_value = 0; } ret = TRUE; + goto done; } /* frames to bytes */ if (src_format == GST_FORMAT_DEFAULT && dest_format == GST_FORMAT_BYTES) { *dest_value = gst_util_uint64_scale_int (src_value, vp->blocksize, 1); ret = TRUE; + goto done; } /* time to frames */ @@ -444,6 +453,7 @@ gst_video_parse_convert (GstVideoParse * vp, *dest_value = 0; } ret = TRUE; + goto done; } /* frames to time */ @@ -456,6 +466,7 @@ gst_video_parse_convert (GstVideoParse * vp, *dest_value = 0; } ret = TRUE; + goto done; } /* time to bytes */ @@ -468,6 +479,7 @@ gst_video_parse_convert (GstVideoParse * vp, *dest_value = 0; } ret = TRUE; + goto done; } /* bytes to time */ @@ -482,6 +494,8 @@ gst_video_parse_convert (GstVideoParse * vp, ret = TRUE; } +done: + GST_DEBUG ("ret=%d result %" G_GINT64_FORMAT, ret, *dest_value); return ret; @@ -512,9 +526,7 @@ gst_video_parse_sink_event (GstPad * pad, GstEvent * event) ret = gst_video_parse_convert (vp, format, start, GST_FORMAT_TIME, &start); ret &= gst_video_parse_convert (vp, format, time, GST_FORMAT_TIME, &time); - if (stop != GST_CLOCK_TIME_NONE) - ret &= - gst_video_parse_convert (vp, format, stop, GST_FORMAT_TIME, &stop); + ret &= gst_video_parse_convert (vp, format, stop, GST_FORMAT_TIME, &stop); if (!ret) { GST_ERROR_OBJECT (vp, "Failed converting to GST_FORMAT_TIME format (%d)", format); -- cgit v1.2.1