}
case GST_QUERY_DURATION:{
if (bsrc->num_buffers != -1) {
- gint64 dur = gst_util_uint64_scale_int_round (bsrc->num_buffers
- * GST_SECOND, src->info.fps_d, src->info.fps_n);
- res = TRUE;
- gst_query_set_duration (query, GST_FORMAT_TIME, dur);
- break;
+ GstFormat format;
+
+ gst_query_parse_duration (query, &format, NULL);
+ switch (format) {
+ case GST_FORMAT_TIME:{
+ gint64 dur = gst_util_uint64_scale_int_round (bsrc->num_buffers
+ * GST_SECOND, src->info.fps_d, src->info.fps_n);
+ res = TRUE;
+ gst_query_set_duration (query, GST_FORMAT_TIME, dur);
+ break;
+ }
+ case GST_FORMAT_BYTES:
+ gst_query_set_duration (query, GST_FORMAT_BYTES,
+ bsrc->num_buffers * src->info.size);
+ break;
+ default:
+ break;
+ }
}
/* fall through */
}