summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2002-07-25 18:12:46 +0000
committerWim Taymans <wim.taymans@gmail.com>2002-07-25 18:12:46 +0000
commitda620f6842eae3537097172b0c6772ac11611d2f (patch)
tree0c644b9d27db252ed827912e081cb696d33bab92 /ext
parentba4646de1f886504e9789adc45fddd092e241960 (diff)
Expose supported events, formats and querytypes
Original commit message from CVS: Expose supported events, formats and querytypes
Diffstat (limited to 'ext')
-rw-r--r--ext/flac/gstflacdec.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c
index 7404a393..8bc51a72 100644
--- a/ext/flac/gstflacdec.c
+++ b/ext/flac/gstflacdec.c
@@ -52,10 +52,15 @@ static void gst_flacdec_init (FlacDec *flacdec);
static void gst_flacdec_loop (GstElement *element);
static GstElementStateReturn
gst_flacdec_change_state (GstElement *element);
+static const GstFormat* gst_flacdec_get_src_formats (GstPad *pad);
static gboolean gst_flacdec_convert_src (GstPad *pad, GstFormat src_format, gint64 src_value,
GstFormat *dest_format, gint64 *dest_value);
+static const GstPadQueryType*
+ gst_flacdec_get_src_query_types (GstPad *pad);
static gboolean gst_flacdec_src_query (GstPad *pad, GstPadQueryType type,
GstFormat *format, gint64 *value);
+static const GstEventMask*
+ gst_flacdec_get_src_event_masks (GstPad *pad);
static gboolean gst_flacdec_src_event (GstPad *pad, GstEvent *event);
static FLAC__SeekableStreamDecoderReadStatus
@@ -129,8 +134,11 @@ gst_flacdec_init (FlacDec *flacdec)
gst_element_set_loop_function (GST_ELEMENT (flacdec), gst_flacdec_loop);
flacdec->srcpad = gst_pad_new_from_template (dec_src_template, "src");
gst_element_add_pad (GST_ELEMENT (flacdec), flacdec->srcpad);
- gst_pad_set_query_function (flacdec->srcpad, gst_flacdec_src_query);
+ gst_pad_set_formats_function (flacdec->srcpad, gst_flacdec_get_src_formats);
gst_pad_set_convert_function (flacdec->srcpad, gst_flacdec_convert_src);
+ gst_pad_set_query_type_function (flacdec->srcpad, gst_flacdec_get_src_query_types);
+ gst_pad_set_query_function (flacdec->srcpad, gst_flacdec_src_query);
+ gst_pad_set_event_mask_function (flacdec->srcpad, gst_flacdec_get_src_event_masks);
gst_pad_set_event_function (flacdec->srcpad, gst_flacdec_src_event);
flacdec->decoder = FLAC__seekable_stream_decoder_new ();
@@ -270,8 +278,8 @@ gst_flacdec_read (const FLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer[
case GST_EVENT_EOS:
GST_DEBUG (0, "eos");
flacdec->eos = TRUE;
+ gst_event_unref (event);
if (avail == 0) {
- gst_event_unref (event);
return 0;
}
break;
@@ -434,6 +442,12 @@ gst_flacdec_loop (GstElement *element)
}
}
+GST_FORMATS_FUNCTION (gst_flacdec_get_src_formats,
+ GST_FORMAT_UNITS,
+ GST_FORMAT_BYTES,
+ GST_FORMAT_TIME
+)
+
static gboolean
gst_flacdec_convert_src (GstPad *pad, GstFormat src_format, gint64 src_value,
GstFormat *dest_format, gint64 *dest_value)
@@ -503,6 +517,11 @@ gst_flacdec_convert_src (GstPad *pad, GstFormat src_format, gint64 src_value,
return res;
}
+GST_PAD_QUERY_TYPE_FUNCTION (gst_flacdec_get_src_query_types,
+ GST_PAD_QUERY_TOTAL,
+ GST_PAD_QUERY_POSITION
+)
+
static gboolean
gst_flacdec_src_query (GstPad *pad, GstPadQueryType type,
GstFormat *format, gint64 *value)
@@ -534,6 +553,10 @@ gst_flacdec_src_query (GstPad *pad, GstPadQueryType type,
return res;
}
+GST_EVENT_MASK_FUNCTION (gst_flacdec_get_src_event_masks,
+ { GST_EVENT_SEEK, GST_SEEK_FLAG_ACCURATE }
+);
+
static gboolean
gst_flacdec_src_event (GstPad *pad, GstEvent *event)
{