GstBaseParseFrame * frame);
static GstFlowReturn gst_flac_parse_pre_push_frame (GstBaseParse * parse,
GstBaseParseFrame * frame);
+static gboolean gst_flac_parse_convert (GstBaseParse * parse,
+ GstFormat src_format, gint64 src_value, GstFormat dest_format,
+ gint64 * dest_value);
GST_BOILERPLATE (GstFlacParse, gst_flac_parse, GstBaseParse,
GST_TYPE_BASE_PARSE);
baseparse_class->parse_frame = GST_DEBUG_FUNCPTR (gst_flac_parse_parse_frame);
baseparse_class->pre_push_frame =
GST_DEBUG_FUNCPTR (gst_flac_parse_pre_push_frame);
+ baseparse_class->convert = GST_DEBUG_FUNCPTR (gst_flac_parse_convert);
}
static void
return GST_FLOW_OK;
}
+
+static gboolean
+gst_flac_parse_convert (GstBaseParse * parse,
+ GstFormat src_format, gint64 src_value, GstFormat dest_format,
+ gint64 * dest_value)
+{
+ GstFlacParse *flacparse = GST_FLAC_PARSE (parse);
+
+ if (flacparse->samplerate > 0) {
+ if (src_format == GST_FORMAT_DEFAULT && dest_format == GST_FORMAT_TIME) {
+ if (src_value != -1)
+ *dest_value =
+ gst_util_uint64_scale (src_value, GST_SECOND,
+ flacparse->samplerate);
+ else
+ *dest_value = -1;
+ return TRUE;
+ } else if (src_format == GST_FORMAT_TIME && dest_format == GST_FORMAT_TIME) {
+ if (src_value != -1)
+ *dest_value =
+ gst_util_uint64_scale (src_value, flacparse->samplerate,
+ GST_SECOND);
+ else
+ *dest_value = -1;
+ return TRUE;
+ }
+ }
+
+ return GST_BASE_PARSE_CLASS (parent_class)->convert (parse, src_format,
+ src_value, dest_format, dest_value);
+}