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.
This commit is contained in:
parent
7d438518fb
commit
3e7aede3ea
@ -477,6 +477,7 @@ gst_avi_demux_get_src_query_types (GstPad * pad)
|
|||||||
GST_QUERY_POSITION,
|
GST_QUERY_POSITION,
|
||||||
GST_QUERY_DURATION,
|
GST_QUERY_DURATION,
|
||||||
GST_QUERY_SEEKING,
|
GST_QUERY_SEEKING,
|
||||||
|
GST_QUERY_CONVERT,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -553,12 +554,29 @@ gst_avi_demux_handle_src_query (GstPad * pad, GstQuery * query)
|
|||||||
}
|
}
|
||||||
case GST_QUERY_DURATION:
|
case GST_QUERY_DURATION:
|
||||||
{
|
{
|
||||||
|
GstFormat fmt;
|
||||||
|
|
||||||
if (stream->strh->type != GST_RIFF_FCC_auds &&
|
if (stream->strh->type != GST_RIFF_FCC_auds &&
|
||||||
stream->strh->type != GST_RIFF_FCC_vids) {
|
stream->strh->type != GST_RIFF_FCC_vids) {
|
||||||
res = FALSE;
|
res = FALSE;
|
||||||
break;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case GST_QUERY_SEEKING:{
|
case GST_QUERY_SEEKING:{
|
||||||
@ -586,6 +604,18 @@ gst_avi_demux_handle_src_query (GstPad * pad, GstQuery * query)
|
|||||||
}
|
}
|
||||||
break;
|
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:
|
default:
|
||||||
res = gst_pad_query_default (pad, query);
|
res = gst_pad_query_default (pad, query);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user