From: LRN Date: Thu, 9 Apr 2009 22:26:44 +0000 (+0200) Subject: avidemux: add convert query, fix duration query X-Git-Tag: RELEASE-0.10.15~313 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3e7aede3ea4a0078dbbbf09b22eb762e5eda404b;p=platform%2Fupstream%2Fgst-plugins-good.git avidemux: add convert query, fix duration query Fix the duration query so that it also works with formats other than TIME, such as DEFAULT to get the number of frames. Add a convert function. Fixes #578052. --- diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index f927b12ee..da2b0fcd2 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -477,6 +477,7 @@ gst_avi_demux_get_src_query_types (GstPad * pad) GST_QUERY_POSITION, GST_QUERY_DURATION, GST_QUERY_SEEKING, + GST_QUERY_CONVERT, 0 }; @@ -553,12 +554,29 @@ gst_avi_demux_handle_src_query (GstPad * pad, GstQuery * query) } case GST_QUERY_DURATION: { + GstFormat fmt; + if (stream->strh->type != GST_RIFF_FCC_auds && stream->strh->type != GST_RIFF_FCC_vids) { res = FALSE; break; } - gst_query_set_duration (query, GST_FORMAT_TIME, stream->duration); + + gst_query_parse_duration (query, &fmt, NULL); + + switch (fmt) { + case GST_FORMAT_TIME: + gst_query_set_duration (query, fmt, stream->duration); + break; + case GST_FORMAT_DEFAULT: + GST_DEBUG_OBJECT (query, "total frames is %" G_GUINT32_FORMAT, + stream->total_frames); + gst_query_set_duration (query, fmt, stream->total_frames); + break; + default: + res = FALSE; + break; + } break; } case GST_QUERY_SEEKING:{ @@ -586,6 +604,18 @@ gst_avi_demux_handle_src_query (GstPad * pad, GstQuery * query) } break; } + case GST_QUERY_CONVERT:{ + GstFormat src_fmt, dest_fmt; + gint64 src_val, dest_val; + + gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val); + if ((res = gst_avi_demux_src_convert (pad, src_fmt, src_val, &dest_fmt, + &dest_val))) + gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val); + else + res = gst_pad_query_default (pad, query); + break; + } default: res = gst_pad_query_default (pad, query); break;