- query/eventmask/formats functions

Original commit message from CVS:
- query/eventmask/formats functions
This commit is contained in:
Wim Taymans 2002-07-24 21:43:44 +00:00
parent 10717d7386
commit 4e9426038d
3 changed files with 51 additions and 0 deletions

View file

@ -404,7 +404,11 @@ gst_mpeg_demux_parse_syshead (GstMPEGParse *mpeg_parse, GstBuffer *buffer)
if (outpad && *outpad == NULL) {
*outpad = gst_pad_new_from_template (newtemp, name);
gst_pad_try_set_caps (*outpad, gst_pad_get_pad_template_caps (*outpad));
gst_pad_set_formats_function (*outpad, gst_mpeg_parse_get_src_formats);
gst_pad_set_event_mask_function (*outpad, gst_mpeg_parse_get_src_event_masks);
gst_pad_set_event_function (*outpad, gst_mpeg_parse_handle_src_event);
gst_pad_set_query_type_function (*outpad, gst_mpeg_parse_get_src_query_types);
gst_pad_set_query_function (*outpad, gst_mpeg_parse_handle_src_query);
gst_element_add_pad (GST_ELEMENT (mpeg_demux), (*outpad));
@ -788,8 +792,13 @@ gst_mpeg_demux_parse_pes (GstMPEGParse *mpeg_parse, GstBuffer *buffer)
/* create the pad and add it to self */
(*outpad) = gst_pad_new_from_template (newtemp, name);
gst_pad_try_set_caps ((*outpad), gst_pad_get_pad_template_caps (*outpad));
gst_pad_set_formats_function (*outpad, gst_mpeg_parse_get_src_formats);
gst_pad_set_event_mask_function (*outpad, gst_mpeg_parse_get_src_event_masks);
gst_pad_set_event_function (*outpad, gst_mpeg_parse_handle_src_event);
gst_pad_set_query_type_function (*outpad, gst_mpeg_parse_get_src_query_types);
gst_pad_set_query_function (*outpad, gst_mpeg_parse_handle_src_query);
gst_element_add_pad(GST_ELEMENT(mpeg_demux),(*outpad));
}
else {

View file

@ -162,7 +162,10 @@ gst_mpeg_parse_init (GstMPEGParse *mpeg_parse)
mpeg_parse->srcpad = gst_pad_new_from_template(
GST_PAD_TEMPLATE_GET (src_factory), "src");
gst_element_add_pad(GST_ELEMENT(mpeg_parse),mpeg_parse->srcpad);
gst_pad_set_formats_function (mpeg_parse->srcpad, gst_mpeg_parse_get_src_formats);
gst_pad_set_event_mask_function (mpeg_parse->srcpad, gst_mpeg_parse_get_src_event_masks);
gst_pad_set_event_function (mpeg_parse->srcpad, gst_mpeg_parse_handle_src_event);
gst_pad_set_query_type_function (mpeg_parse->srcpad, gst_mpeg_parse_get_src_query_types);
gst_pad_set_query_function (mpeg_parse->srcpad, gst_mpeg_parse_handle_src_query);
gst_element_set_loop_function (GST_ELEMENT (mpeg_parse), gst_mpeg_parse_loop);
@ -426,6 +429,27 @@ gst_mpeg_parse_loop (GstElement *element)
}
}
const GstFormat*
gst_mpeg_parse_get_src_formats (GstPad *pad)
{
static const GstFormat formats[] = {
GST_FORMAT_TIME,
0
};
return formats;
}
const GstPadQueryType*
gst_mpeg_parse_get_src_query_types (GstPad *pad)
{
static const GstPadQueryType types[] = {
GST_PAD_QUERY_TOTAL,
GST_PAD_QUERY_POSITION,
0
};
return types;
}
gboolean
gst_mpeg_parse_handle_src_query (GstPad *pad, GstPadQueryType type,
GstFormat *format, gint64 *value)
@ -488,6 +512,16 @@ gst_mpeg_parse_handle_src_query (GstPad *pad, GstPadQueryType type,
return res;
}
const GstEventMask*
gst_mpeg_parse_get_src_event_masks (GstPad *pad)
{
static const GstEventMask masks[] = {
{ GST_EVENT_SEEK, GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH },
{ 0, }
};
return masks;
}
gboolean
gst_mpeg_parse_handle_src_event (GstPad *pad, GstEvent *event)
{

View file

@ -89,7 +89,15 @@ GType gst_mpeg_parse_get_type(void);
gboolean gst_mpeg_parse_plugin_init (GModule *module, GstPlugin *plugin);
const GstFormat*
gst_mpeg_parse_get_src_formats (GstPad *pad);
const GstEventMask*
gst_mpeg_parse_get_src_event_masks (GstPad *pad);
gboolean gst_mpeg_parse_handle_src_event (GstPad *pad, GstEvent *event);
const GstPadQueryType*
gst_mpeg_parse_get_src_query_types (GstPad *pad);
gboolean gst_mpeg_parse_handle_src_query (GstPad *pad, GstPadQueryType type,
GstFormat *format, gint64 *value);