2002-01-28 01:47:31 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2002 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2002 Wim Taymans <wtay@chello.be>
|
|
|
|
*
|
2002-09-12 09:19:00 +00:00
|
|
|
* gstspideridentity.c: identity element for the spider autoplugger
|
2002-01-28 01:47:31 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
#include "gstspideridentity.h"
|
|
|
|
#include "gstspider.h"
|
|
|
|
|
2003-10-31 19:32:47 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (gst_spider_identity_debug);
|
2003-06-29 14:05:49 +00:00
|
|
|
#define GST_CAT_DEFAULT gst_spider_identity_debug
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static GstElementDetails gst_spider_identity_details =
|
|
|
|
GST_ELEMENT_DETAILS ("SpiderIdentity",
|
|
|
|
"Generic",
|
|
|
|
"Link between spider and outside elements",
|
|
|
|
"Benjamin Otte <in7y118@public.uni-hamburg.de>");
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* generic templates
|
|
|
|
* delete me when meging with spider.c
|
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
static GstStaticPadTemplate spider_src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
2002-01-28 01:47:31 +00:00
|
|
|
|
2003-12-22 01:39:35 +00:00
|
|
|
static GstStaticPadTemplate spider_sink_factory =
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
/* SpiderIdentity signals and args */
|
2004-03-13 15:27:01 +00:00
|
|
|
enum
|
|
|
|
{
|
2002-01-28 01:47:31 +00:00
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
enum
|
|
|
|
{
|
2004-01-30 20:48:13 +00:00
|
|
|
ARG_0
|
2004-03-13 15:27:01 +00:00
|
|
|
/* FILL ME */
|
2002-01-28 01:47:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* GObject stuff */
|
2004-03-13 15:27:01 +00:00
|
|
|
static void gst_spider_identity_class_init (GstSpiderIdentityClass * klass);
|
|
|
|
static void gst_spider_identity_init (GstSpiderIdentity * spider_identity);
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
/* functions set in pads, elements and stuff */
|
2004-03-13 15:27:01 +00:00
|
|
|
static void gst_spider_identity_chain (GstPad * pad, GstBuffer * buf);
|
|
|
|
static GstElementStateReturn gst_spider_identity_change_state (GstElement *
|
|
|
|
element);
|
|
|
|
static GstPadLinkReturn gst_spider_identity_link (GstPad * pad,
|
|
|
|
const GstCaps * caps);
|
|
|
|
static GstCaps *gst_spider_identity_getcaps (GstPad * pad);
|
|
|
|
|
2002-01-28 01:47:31 +00:00
|
|
|
/* loop functions */
|
2004-03-13 15:27:01 +00:00
|
|
|
static void gst_spider_identity_dumb_loop (GstSpiderIdentity * ident);
|
|
|
|
static void gst_spider_identity_src_loop (GstSpiderIdentity * ident);
|
|
|
|
static void gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity *
|
|
|
|
ident);
|
2002-01-28 01:47:31 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static gboolean gst_spider_identity_handle_src_event (GstPad * pad,
|
|
|
|
GstEvent * event);
|
2002-06-08 12:51:11 +00:00
|
|
|
|
2002-01-28 01:47:31 +00:00
|
|
|
/* other functions */
|
2004-03-13 15:27:01 +00:00
|
|
|
static void gst_spider_identity_start_type_finding (GstSpiderIdentity * ident);
|
|
|
|
|
|
|
|
static GstElementClass *parent_class = NULL;
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
/* no signals
|
|
|
|
static guint gst_spider_identity_signals[LAST_SIGNAL] = { 0 }; */
|
|
|
|
|
|
|
|
GType
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_spider_identity_get_type (void)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
|
|
|
static GType spider_identity_type = 0;
|
|
|
|
|
|
|
|
if (!spider_identity_type) {
|
|
|
|
static const GTypeInfo spider_identity_info = {
|
2004-03-13 15:27:01 +00:00
|
|
|
sizeof (GstSpiderIdentityClass), NULL,
|
2002-01-28 01:47:31 +00:00
|
|
|
NULL,
|
2004-03-13 15:27:01 +00:00
|
|
|
(GClassInitFunc) gst_spider_identity_class_init,
|
2002-01-28 01:47:31 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2004-03-13 15:27:01 +00:00
|
|
|
sizeof (GstSpiderIdentity),
|
2002-01-28 01:47:31 +00:00
|
|
|
0,
|
2004-03-13 15:27:01 +00:00
|
|
|
(GInstanceInitFunc) gst_spider_identity_init,
|
2002-01-28 01:47:31 +00:00
|
|
|
};
|
2004-03-15 19:27:17 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
spider_identity_type =
|
2004-03-15 19:27:17 +00:00
|
|
|
g_type_register_static (GST_TYPE_ELEMENT, "GstSpiderIdentity",
|
|
|
|
&spider_identity_info, 0);
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_spider_identity_debug, "spideridentity", 0,
|
2004-03-15 19:27:17 +00:00
|
|
|
"spider autoplugging proxy element");
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
|
|
|
return spider_identity_type;
|
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void
|
|
|
|
gst_spider_identity_class_init (GstSpiderIdentityClass * klass)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
|
|
|
GstElementClass *gstelement_class = (GstElementClass *) klass;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-01-28 01:47:31 +00:00
|
|
|
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-01-28 01:47:31 +00:00
|
|
|
/* add our two pad templates */
|
2003-12-22 01:39:35 +00:00
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&spider_src_factory));
|
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&spider_sink_factory));
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_class_set_details (gstelement_class,
|
|
|
|
&gst_spider_identity_details);
|
|
|
|
|
|
|
|
gstelement_class->change_state =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_spider_identity_change_state);
|
|
|
|
gstelement_class->request_new_pad =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_spider_identity_request_new_pad);
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
2002-06-12 22:26:36 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void
|
|
|
|
gst_spider_identity_init (GstSpiderIdentity * ident)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2002-02-05 17:08:08 +00:00
|
|
|
/* sink */
|
2004-03-13 15:27:01 +00:00
|
|
|
ident->sink =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get
|
|
|
|
(&spider_sink_factory), "sink");
|
2002-02-05 17:08:08 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (ident), ident->sink);
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_pad_set_link_function (ident->sink,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_spider_identity_link));
|
|
|
|
gst_pad_set_getcaps_function (ident->sink,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_spider_identity_getcaps));
|
2002-02-05 17:08:08 +00:00
|
|
|
/* src */
|
2004-03-13 15:27:01 +00:00
|
|
|
ident->src =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get
|
|
|
|
(&spider_src_factory), "src");
|
2002-02-05 17:08:08 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (ident), ident->src);
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_pad_set_link_function (ident->src,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_spider_identity_link));
|
|
|
|
gst_pad_set_getcaps_function (ident->src,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_spider_identity_getcaps));
|
|
|
|
gst_pad_set_event_function (ident->src,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_spider_identity_handle_src_event));
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
/* variables */
|
2002-02-05 17:08:08 +00:00
|
|
|
ident->plugged = FALSE;
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void
|
|
|
|
gst_spider_identity_chain (GstPad * pad, GstBuffer * buf)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
|
|
|
GstSpiderIdentity *ident;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-01-28 01:47:31 +00:00
|
|
|
g_return_if_fail (pad != NULL);
|
|
|
|
g_return_if_fail (GST_IS_PAD (pad));
|
2004-07-07 14:15:28 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
if (buf == NULL)
|
|
|
|
return;
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
ident = GST_SPIDER_IDENTITY (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
if (GST_IS_EVENT (buf)) {
|
gst/autoplug/gstspideridentity.c: extra debugging
Original commit message from CVS:
* gst/autoplug/gstspideridentity.c: (gst_spider_identity_chain):
extra debugging
* gst/gstevent.h:
* gst/gstinfo.c: (gst_debug_log_default):
print time nicely. add thread pointer until someone figures out
a completely portable way of getting at thread id's.
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_link_try),
(_invent_event), (gst_pad_pull), (gst_pad_event_default_dispatch),
(gst_pad_call_chain_function):
extra debugging
* gst/schedulers/gstoptimalscheduler.c:
(get_group_schedule_function), (loop_group_schedule_function),
(gst_opt_scheduler_loop_wrapper), (gst_opt_scheduler_get_wrapper),
(pad_clear_queued), (gst_opt_scheduler_iterate):
rename BUFPEN and friends to DATAPEN since that's what they are.
2004-07-08 13:49:14 +00:00
|
|
|
GST_DEBUG_OBJECT (ident, "spider identity received event %p", buf);
|
2002-02-11 08:18:09 +00:00
|
|
|
/* start hack for current event stuff here */
|
2003-01-09 14:15:37 +00:00
|
|
|
/* check for unlinked elements and send them the EOS event, too */
|
2004-03-13 15:27:01 +00:00
|
|
|
if (GST_EVENT_TYPE (GST_EVENT (buf)) == GST_EVENT_EOS) {
|
2002-02-11 08:18:09 +00:00
|
|
|
GstSpider *spider = (GstSpider *) GST_OBJECT_PARENT (ident);
|
2003-01-09 14:15:37 +00:00
|
|
|
GList *list = spider->links;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
while (list) {
|
2004-03-15 19:27:17 +00:00
|
|
|
GstSpiderConnection *conn = (GstSpiderConnection *) list->data;
|
|
|
|
|
|
|
|
list = g_list_next (list);
|
|
|
|
if (conn->current != (GstElement *) conn->src) {
|
gst/autoplug/gstspideridentity.c: extra debugging
Original commit message from CVS:
* gst/autoplug/gstspideridentity.c: (gst_spider_identity_chain):
extra debugging
* gst/gstevent.h:
* gst/gstinfo.c: (gst_debug_log_default):
print time nicely. add thread pointer until someone figures out
a completely portable way of getting at thread id's.
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_link_try),
(_invent_event), (gst_pad_pull), (gst_pad_event_default_dispatch),
(gst_pad_call_chain_function):
extra debugging
* gst/schedulers/gstoptimalscheduler.c:
(get_group_schedule_function), (loop_group_schedule_function),
(gst_opt_scheduler_loop_wrapper), (gst_opt_scheduler_get_wrapper),
(pad_clear_queued), (gst_opt_scheduler_iterate):
rename BUFPEN and friends to DATAPEN since that's what they are.
2004-07-08 13:49:14 +00:00
|
|
|
GstEvent *event;
|
|
|
|
|
|
|
|
event = gst_event_new (GST_EVENT_EOS);
|
|
|
|
GST_DEBUG_OBJECT (ident,
|
|
|
|
"sending EOS event %p to unconnected element %s from %s",
|
|
|
|
event, GST_ELEMENT_NAME (conn->src), GST_ELEMENT_NAME (ident));
|
|
|
|
gst_pad_push (conn->src->src, GST_DATA (event));
|
2004-03-15 19:27:17 +00:00
|
|
|
gst_element_set_eos (GST_ELEMENT (conn->src));
|
|
|
|
}
|
2002-02-11 08:18:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* end hack for current event stuff here */
|
gst/autoplug/gstspideridentity.c: extra debugging
Original commit message from CVS:
* gst/autoplug/gstspideridentity.c: (gst_spider_identity_chain):
extra debugging
* gst/gstevent.h:
* gst/gstinfo.c: (gst_debug_log_default):
print time nicely. add thread pointer until someone figures out
a completely portable way of getting at thread id's.
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_link_try),
(_invent_event), (gst_pad_pull), (gst_pad_event_default_dispatch),
(gst_pad_call_chain_function):
extra debugging
* gst/schedulers/gstoptimalscheduler.c:
(get_group_schedule_function), (loop_group_schedule_function),
(gst_opt_scheduler_loop_wrapper), (gst_opt_scheduler_get_wrapper),
(pad_clear_queued), (gst_opt_scheduler_iterate):
rename BUFPEN and friends to DATAPEN since that's what they are.
2004-07-08 13:49:14 +00:00
|
|
|
GST_DEBUG_OBJECT (ident,
|
|
|
|
"calling default handler for event %p on pad %s:%s",
|
|
|
|
buf, GST_DEBUG_PAD_NAME (pad));
|
2002-02-11 08:18:09 +00:00
|
|
|
|
2003-05-17 17:08:58 +00:00
|
|
|
gst_pad_event_default (pad, GST_EVENT (buf));
|
2002-01-30 21:54:06 +00:00
|
|
|
return;
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((ident->src != NULL) && (GST_PAD_PEER (ident->src) != NULL)) {
|
2004-07-07 14:15:28 +00:00
|
|
|
GST_LOG_OBJECT (ident, "pushing buffer %p "
|
|
|
|
"(refcount %d, size %u, offset %" G_GINT64_FORMAT ") ",
|
|
|
|
buf, GST_BUFFER_REFCOUNT_VALUE (buf),
|
|
|
|
GST_BUFFER_SIZE (buf), GST_BUFFER_OFFSET (buf));
|
2003-10-08 16:06:02 +00:00
|
|
|
gst_pad_push (ident->src, GST_DATA (buf));
|
2002-01-28 01:47:31 +00:00
|
|
|
} else if (GST_IS_BUFFER (buf)) {
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
}
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
GstSpiderIdentity *
|
|
|
|
gst_spider_identity_new_src (gchar * name)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
GstSpiderIdentity *ret =
|
|
|
|
(GstSpiderIdentity *) gst_element_factory_make ("spideridentity", name);
|
2002-01-28 01:47:31 +00:00
|
|
|
/* set the right functions */
|
2004-03-15 19:27:17 +00:00
|
|
|
gst_element_set_loop_function (GST_ELEMENT (ret), (GstElementLoopFunction)
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_spider_identity_src_loop));
|
|
|
|
|
2002-01-28 01:47:31 +00:00
|
|
|
return ret;
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
GstSpiderIdentity *
|
|
|
|
gst_spider_identity_new_sink (gchar * name)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
GstSpiderIdentity *ret =
|
|
|
|
(GstSpiderIdentity *) gst_element_factory_make ("spideridentity", name);
|
2002-01-28 01:47:31 +00:00
|
|
|
|
2002-02-05 17:08:08 +00:00
|
|
|
/* set the right functions */
|
2004-03-15 19:27:17 +00:00
|
|
|
gst_element_set_loop_function (GST_ELEMENT (ret), (GstElementLoopFunction)
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_spider_identity_dumb_loop));
|
2002-02-05 17:08:08 +00:00
|
|
|
|
2002-01-28 01:47:31 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2003-01-09 14:15:37 +00:00
|
|
|
/* shamelessly stolen from gstqueue.c to get proxy links */
|
2003-01-09 22:59:37 +00:00
|
|
|
static GstPadLinkReturn
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_spider_identity_link (GstPad * pad, const GstCaps * caps)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
GstSpiderIdentity *spider_identity =
|
|
|
|
GST_SPIDER_IDENTITY (gst_pad_get_parent (pad));
|
2002-01-28 01:47:31 +00:00
|
|
|
GstPad *otherpad;
|
|
|
|
|
2004-07-25 15:01:52 +00:00
|
|
|
if (pad == spider_identity->src) {
|
2002-01-28 01:47:31 +00:00
|
|
|
otherpad = spider_identity->sink;
|
2004-07-25 15:01:52 +00:00
|
|
|
if (GST_PAD_PEER (otherpad) == NULL)
|
|
|
|
return GST_PAD_LINK_DELAYED;
|
|
|
|
} else {
|
2002-01-28 01:47:31 +00:00
|
|
|
otherpad = spider_identity->src;
|
2004-07-25 15:01:52 +00:00
|
|
|
}
|
2002-01-28 01:47:31 +00:00
|
|
|
|
2003-12-22 18:06:22 +00:00
|
|
|
g_return_val_if_fail (otherpad != NULL, GST_PAD_LINK_REFUSED);
|
|
|
|
|
2004-02-05 02:44:34 +00:00
|
|
|
return gst_pad_try_set_caps (otherpad, caps);
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static GstCaps *
|
|
|
|
gst_spider_identity_getcaps (GstPad * pad)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2003-12-22 18:06:22 +00:00
|
|
|
GstSpiderIdentity *ident = GST_SPIDER_IDENTITY (gst_pad_get_parent (pad));
|
2002-01-28 01:47:31 +00:00
|
|
|
GstPad *otherpad;
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
if (pad == ident->src)
|
2003-12-22 18:06:22 +00:00
|
|
|
otherpad = ident->sink;
|
2002-01-28 01:47:31 +00:00
|
|
|
else
|
2003-12-22 18:06:22 +00:00
|
|
|
otherpad = ident->src;
|
2002-01-28 01:47:31 +00:00
|
|
|
|
2003-12-22 01:39:35 +00:00
|
|
|
if (otherpad != NULL) {
|
gst/gstclock.*: deprecate old interface and disable functions that aren't in use anymore.
Original commit message from CVS:
2004-01-13 Benjamin Otte <in7y118@public.uni-hamburg.de>
* gst/gstclock.c: (gst_clock_class_init), (gst_clock_init),
(gst_clock_set_speed), (gst_clock_set_active),
(gst_clock_is_active), (gst_clock_reset),
(gst_clock_handle_discont):
* gst/gstclock.h:
deprecate old interface and disable functions that aren't in use
anymore.
* gst/gstelement.h:
* gst/gstelement.c: (gst_element_get_time), (gst_element_wait),
(gst_element_set_time), (gst_element_adjust_time):
add concept of "element time" and functions to get/set this time.
* gst/gstelement.c: (gst_element_change_state):
update element time correctly.
* gst/gstelement.c: (gst_element_get_compatible_pad_filtered):
This is a debug message, not a g_critical.
* gst/gstpad.c: (gst_pad_event_default):
handle discontinuous events right with element time.
* gst/gstscheduler.c: (gst_scheduler_state_transition):
update to clocking fixes.
set clocks on elements in READY=>PAUSED. The old behaviour caused
a wrong element time on the first element that started playing.
* gst/schedulers/gstbasicscheduler.c:
(gst_basic_scheduler_class_init):
* gst/schedulers/gstoptimalscheduler.c:
(gst_opt_scheduler_class_init):
remove code that just implements the default behaviour.
* gst/elements/gstfakesink.c: (gst_fakesink_chain):
update to use new clocking functions
* testsuite/clock/clock1.c: (gst_clock_debug), (main):
* testsuite/clock/clock2.c: (gst_clock_debug), (main):
update to test new element time.
* gst/autoplug/gstspideridentity.c: (gst_spider_identity_getcaps):
use _get_allowed_caps instead of _get_caps. This catches filtered
caps correctly.
* testsuite/debug/commandline.c:
update for new GST_DEBUG syntax.
* testsuite/threads/Makefile.am:
disable a test that only works sometimes.
2004-01-14 00:46:48 +00:00
|
|
|
if (GST_PAD_PEER (otherpad)) {
|
|
|
|
GstCaps *ret = gst_pad_get_allowed_caps (otherpad);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-12-22 18:06:22 +00:00
|
|
|
if (ident->caps) {
|
2004-03-15 19:27:17 +00:00
|
|
|
GstCaps *ret2 = gst_caps_intersect (ident->caps, ret);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2004-03-15 19:27:17 +00:00
|
|
|
gst_caps_free (ret);
|
|
|
|
ret = ret2;
|
2003-12-22 18:06:22 +00:00
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
2003-12-22 01:39:35 +00:00
|
|
|
}
|
2003-12-22 18:06:22 +00:00
|
|
|
if (ident->caps)
|
|
|
|
return gst_caps_copy (ident->caps);
|
|
|
|
|
2003-12-22 01:39:35 +00:00
|
|
|
return gst_caps_new_any ();
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
GstPad *
|
|
|
|
gst_spider_identity_request_new_pad (GstElement * element,
|
|
|
|
GstPadTemplate * templ, const gchar * name)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
|
|
|
GstSpiderIdentity *ident;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-01-28 01:47:31 +00:00
|
|
|
/*checks */
|
|
|
|
g_return_val_if_fail (templ != NULL, NULL);
|
2002-04-11 20:35:18 +00:00
|
|
|
g_return_val_if_fail (GST_IS_PAD_TEMPLATE (templ), NULL);
|
2002-01-28 01:47:31 +00:00
|
|
|
ident = GST_SPIDER_IDENTITY (element);
|
|
|
|
g_return_val_if_fail (ident != NULL, NULL);
|
|
|
|
g_return_val_if_fail (GST_IS_SPIDER_IDENTITY (ident), NULL);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
switch (GST_PAD_TEMPLATE_DIRECTION (templ)) {
|
2002-01-28 01:47:31 +00:00
|
|
|
case GST_PAD_SINK:
|
2004-03-13 15:27:01 +00:00
|
|
|
if (ident->sink != NULL)
|
2004-03-15 19:27:17 +00:00
|
|
|
break;
|
2002-01-28 01:47:31 +00:00
|
|
|
/* sink */
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_DEBUG ("element %s requests new sink pad", GST_ELEMENT_NAME (ident));
|
gst/: s/gst_pad_new/&_from_template/ register pad templates in the base_init function add static pad template definit...
Original commit message from CVS:
* gst/autoplug/gstspideridentity.c:
(gst_spider_identity_request_new_pad):
* gst/elements/gstaggregator.c: (gst_aggregator_base_init),
(gst_aggregator_init):
* gst/elements/gstfakesink.c: (gst_fakesink_base_init),
(gst_fakesink_init):
* gst/elements/gstfakesrc.c: (gst_fakesrc_base_init),
(gst_fakesrc_init):
* gst/elements/gstfdsink.c: (gst_fdsink_base_init),
(gst_fdsink_init):
* gst/elements/gstfdsrc.c: (gst_fdsrc_base_init), (gst_fdsrc_init):
* gst/elements/gstfilesink.c: (gst_filesink_base_init),
(gst_filesink_init):
* gst/elements/gstfilesrc.c: (gst_filesrc_base_init),
(gst_filesrc_init):
* gst/elements/gstidentity.c: (gst_identity_base_init),
(gst_identity_init):
* gst/elements/gstmultifilesrc.c: (gst_multifilesrc_base_init),
(gst_multifilesrc_init):
* gst/elements/gstpipefilter.c: (gst_pipefilter_base_init),
(gst_pipefilter_init):
* gst/elements/gststatistics.c: (gst_statistics_base_init),
(gst_statistics_init):
* gst/elements/gsttee.c: (gst_tee_base_init), (gst_tee_init):
* gst/gstqueue.c: (gst_queue_base_init), (gst_queue_init):
s/gst_pad_new/&_from_template/
register pad templates in the base_init function
add static pad template definitions
2004-08-17 14:11:23 +00:00
|
|
|
ident->sink =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get
|
|
|
|
(&spider_sink_factory), "sink");
|
2002-01-28 01:47:31 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (ident), ident->sink);
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_pad_set_link_function (ident->sink,
|
2004-03-15 19:27:17 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_spider_identity_link));
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_pad_set_getcaps_function (ident->sink,
|
2004-03-15 19:27:17 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_spider_identity_getcaps));
|
2002-01-28 01:47:31 +00:00
|
|
|
return ident->sink;
|
|
|
|
case GST_PAD_SRC:
|
|
|
|
/* src */
|
2004-03-13 15:27:01 +00:00
|
|
|
if (ident->src != NULL)
|
2004-03-15 19:27:17 +00:00
|
|
|
break;
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_DEBUG ("element %s requests new src pad", GST_ELEMENT_NAME (ident));
|
gst/: s/gst_pad_new/&_from_template/ register pad templates in the base_init function add static pad template definit...
Original commit message from CVS:
* gst/autoplug/gstspideridentity.c:
(gst_spider_identity_request_new_pad):
* gst/elements/gstaggregator.c: (gst_aggregator_base_init),
(gst_aggregator_init):
* gst/elements/gstfakesink.c: (gst_fakesink_base_init),
(gst_fakesink_init):
* gst/elements/gstfakesrc.c: (gst_fakesrc_base_init),
(gst_fakesrc_init):
* gst/elements/gstfdsink.c: (gst_fdsink_base_init),
(gst_fdsink_init):
* gst/elements/gstfdsrc.c: (gst_fdsrc_base_init), (gst_fdsrc_init):
* gst/elements/gstfilesink.c: (gst_filesink_base_init),
(gst_filesink_init):
* gst/elements/gstfilesrc.c: (gst_filesrc_base_init),
(gst_filesrc_init):
* gst/elements/gstidentity.c: (gst_identity_base_init),
(gst_identity_init):
* gst/elements/gstmultifilesrc.c: (gst_multifilesrc_base_init),
(gst_multifilesrc_init):
* gst/elements/gstpipefilter.c: (gst_pipefilter_base_init),
(gst_pipefilter_init):
* gst/elements/gststatistics.c: (gst_statistics_base_init),
(gst_statistics_init):
* gst/elements/gsttee.c: (gst_tee_base_init), (gst_tee_init):
* gst/gstqueue.c: (gst_queue_base_init), (gst_queue_init):
s/gst_pad_new/&_from_template/
register pad templates in the base_init function
add static pad template definitions
2004-08-17 14:11:23 +00:00
|
|
|
ident->src =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get
|
|
|
|
(&spider_src_factory), "src");
|
2002-01-28 01:47:31 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (ident), ident->src);
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_pad_set_link_function (ident->src,
|
2004-03-15 19:27:17 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_spider_identity_link));
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_pad_set_getcaps_function (ident->src,
|
2004-03-15 19:27:17 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_spider_identity_getcaps));
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_pad_set_event_function (ident->src,
|
2004-03-15 19:27:17 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_spider_identity_handle_src_event));
|
2002-01-28 01:47:31 +00:00
|
|
|
return ident->src;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
GST_DEBUG ("element %s requested a new pad but none could be created",
|
|
|
|
GST_ELEMENT_NAME (ident));
|
2002-01-28 01:47:31 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* this function has to
|
|
|
|
* - start the autoplugger
|
|
|
|
* - start type finding
|
|
|
|
* ...
|
|
|
|
*/
|
|
|
|
static GstElementStateReturn
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_spider_identity_change_state (GstElement * element)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
|
|
|
GstSpiderIdentity *ident;
|
|
|
|
GstSpider *spider;
|
|
|
|
GstElementStateReturn ret = GST_STATE_SUCCESS;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-01-28 01:47:31 +00:00
|
|
|
/* element check */
|
|
|
|
ident = GST_SPIDER_IDENTITY (element);
|
2002-06-07 19:41:35 +00:00
|
|
|
g_return_val_if_fail (ident != NULL, GST_STATE_FAILURE);
|
|
|
|
g_return_val_if_fail (GST_IS_SPIDER_IDENTITY (ident), GST_STATE_FAILURE);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-01-28 01:47:31 +00:00
|
|
|
switch (GST_STATE_TRANSITION (element)) {
|
2003-12-22 18:06:22 +00:00
|
|
|
case GST_STATE_PAUSED_TO_READY:
|
|
|
|
gst_caps_replace (&ident->caps, NULL);
|
|
|
|
break;
|
2002-01-28 01:47:31 +00:00
|
|
|
case GST_STATE_PAUSED_TO_PLAYING:
|
2002-06-07 19:41:35 +00:00
|
|
|
/* autoplugger check */
|
|
|
|
spider = GST_SPIDER (GST_ELEMENT_PARENT (ident));
|
|
|
|
g_return_val_if_fail (spider != NULL, GST_STATE_FAILURE);
|
|
|
|
g_return_val_if_fail (GST_IS_SPIDER (spider), GST_STATE_FAILURE);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-01-28 01:47:31 +00:00
|
|
|
/* start typefinding or plugging */
|
2004-03-13 15:27:01 +00:00
|
|
|
if ((GST_RPAD_PEER (ident->sink) != NULL)
|
2004-03-15 19:27:17 +00:00
|
|
|
&& (GST_RPAD_PEER (ident->src) == NULL)) {
|
|
|
|
GstCaps *caps =
|
|
|
|
gst_pad_get_caps ((GstPad *) GST_PAD_PEER (ident->sink));
|
|
|
|
if (gst_caps_is_any (caps) || gst_caps_is_empty (caps)) {
|
|
|
|
gst_spider_identity_start_type_finding (ident);
|
|
|
|
gst_caps_free (caps);
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
gst_spider_identity_plug (ident);
|
|
|
|
}
|
|
|
|
gst_caps_free (caps);
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
|
|
|
/* autoplug on src */
|
2004-03-13 15:27:01 +00:00
|
|
|
if ((GST_RPAD_PEER (ident->src) != NULL)
|
2004-03-15 19:27:17 +00:00
|
|
|
&& (GST_RPAD_PEER (ident->sink) == NULL)) {
|
|
|
|
gst_spider_identity_plug (ident);
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
if ((ret != GST_STATE_FAILURE)
|
|
|
|
&& (GST_ELEMENT_CLASS (parent_class)->change_state))
|
2002-01-28 01:47:31 +00:00
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-01-28 01:47:31 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_spider_identity_start_type_finding (GstSpiderIdentity * ident)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2002-12-01 01:37:58 +00:00
|
|
|
/* GstElement* typefind;
|
|
|
|
gchar *name;*/
|
2002-03-02 18:27:45 +00:00
|
|
|
gboolean restart = FALSE;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
GST_DEBUG ("element %s starts typefinding", GST_ELEMENT_NAME (ident));
|
|
|
|
if (GST_STATE (GST_ELEMENT_PARENT (ident)) == GST_STATE_PLAYING) {
|
|
|
|
gst_element_set_state (GST_ELEMENT (GST_ELEMENT_PARENT (ident)),
|
2004-03-15 19:27:17 +00:00
|
|
|
GST_STATE_PAUSED);
|
2002-03-02 18:27:45 +00:00
|
|
|
restart = TRUE;
|
|
|
|
}
|
2002-12-01 01:37:58 +00:00
|
|
|
|
2004-03-15 19:27:17 +00:00
|
|
|
gst_element_set_loop_function (GST_ELEMENT (ident), (GstElementLoopFunction)
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_spider_identity_sink_loop_type_finding));
|
2002-03-02 18:27:45 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
if (restart) {
|
|
|
|
gst_element_set_state (GST_ELEMENT (GST_ELEMENT_PARENT (ident)),
|
2004-03-15 19:27:17 +00:00
|
|
|
GST_STATE_PLAYING);
|
2002-03-02 18:27:45 +00:00
|
|
|
}
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* since we can't set the loop function to NULL if there's a cothread for us,
|
|
|
|
* we have to use a dumb one
|
|
|
|
*/
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_spider_identity_dumb_loop (GstSpiderIdentity * ident)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
|
|
|
GstBuffer *buf;
|
|
|
|
|
|
|
|
g_return_if_fail (ident != NULL);
|
|
|
|
g_return_if_fail (GST_IS_SPIDER_IDENTITY (ident));
|
|
|
|
g_assert (ident->sink != NULL);
|
|
|
|
|
2003-10-08 16:06:02 +00:00
|
|
|
buf = GST_BUFFER (gst_pad_pull (ident->sink));
|
2002-01-28 01:47:31 +00:00
|
|
|
|
|
|
|
gst_spider_identity_chain (ident->sink, buf);
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-01-09 14:15:37 +00:00
|
|
|
/* do nothing until we're linked - then disable yourself
|
2002-01-28 01:47:31 +00:00
|
|
|
*/
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_spider_identity_src_loop (GstSpiderIdentity * ident)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
|
|
|
/* checks - disable for speed */
|
|
|
|
g_return_if_fail (ident != NULL);
|
|
|
|
g_return_if_fail (GST_IS_SPIDER_IDENTITY (ident));
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-01-28 01:47:31 +00:00
|
|
|
/* we don't want a loop function if we're plugged */
|
2004-03-13 15:27:01 +00:00
|
|
|
if (ident->sink && GST_PAD_PEER (ident->sink)) {
|
2004-03-15 19:27:17 +00:00
|
|
|
gst_element_set_loop_function (GST_ELEMENT (ident), (GstElementLoopFunction)
|
|
|
|
GST_DEBUG_FUNCPTR (gst_spider_identity_dumb_loop));
|
2002-01-28 01:47:31 +00:00
|
|
|
gst_spider_identity_dumb_loop (ident);
|
|
|
|
return;
|
|
|
|
}
|
2003-01-12 20:28:08 +00:00
|
|
|
gst_element_interrupt (GST_ELEMENT (ident));
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-01-28 01:47:31 +00:00
|
|
|
/* This loop function is only needed when typefinding.
|
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2003-10-28 20:25:30 +00:00
|
|
|
GstBuffer *buffer;
|
|
|
|
guint best_probability;
|
|
|
|
GstCaps *caps;
|
2004-03-15 19:27:17 +00:00
|
|
|
}
|
|
|
|
SpiderTypeFind;
|
2003-10-28 20:25:30 +00:00
|
|
|
guint8 *
|
|
|
|
spider_find_peek (gpointer data, gint64 offset, guint size)
|
|
|
|
{
|
|
|
|
SpiderTypeFind *find = (SpiderTypeFind *) data;
|
2004-03-13 15:27:01 +00:00
|
|
|
gint64 buffer_offset = GST_BUFFER_OFFSET_IS_VALID (find->buffer) ?
|
|
|
|
GST_BUFFER_OFFSET (find->buffer) : 0;
|
|
|
|
|
|
|
|
if (offset >= buffer_offset
|
|
|
|
&& offset + size <= buffer_offset + GST_BUFFER_SIZE (find->buffer)) {
|
|
|
|
GST_LOG ("peek %" G_GINT64_FORMAT ", %u successful", offset, size);
|
2003-10-28 20:25:30 +00:00
|
|
|
return GST_BUFFER_DATA (find->buffer) + offset - buffer_offset;
|
|
|
|
} else {
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_LOG ("peek %" G_GINT64_FORMAT ", %u failed", offset, size);
|
2003-10-28 20:25:30 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
spider_find_suggest (gpointer data, guint probability, const GstCaps * caps)
|
2003-10-28 20:25:30 +00:00
|
|
|
{
|
|
|
|
SpiderTypeFind *find = (SpiderTypeFind *) data;
|
|
|
|
|
2004-01-29 01:44:08 +00:00
|
|
|
GST_INFO ("suggest %u, %" GST_PTR_FORMAT, probability, caps);
|
2003-10-28 20:25:30 +00:00
|
|
|
if (probability > find->best_probability) {
|
2003-12-22 01:39:35 +00:00
|
|
|
gst_caps_replace (&find->caps, gst_caps_copy (caps));
|
2003-10-28 20:25:30 +00:00
|
|
|
find->best_probability = probability;
|
|
|
|
}
|
|
|
|
}
|
2002-01-28 01:47:31 +00:00
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_spider_identity_sink_loop_type_finding (GstSpiderIdentity * ident)
|
2002-01-28 01:47:31 +00:00
|
|
|
{
|
2003-10-28 20:25:30 +00:00
|
|
|
GstData *data;
|
|
|
|
GstTypeFind gst_find;
|
|
|
|
SpiderTypeFind find;
|
|
|
|
GList *walk, *type_list = NULL;
|
2002-12-01 01:37:58 +00:00
|
|
|
|
2002-01-28 01:47:31 +00:00
|
|
|
g_return_if_fail (GST_IS_SPIDER_IDENTITY (ident));
|
2003-04-08 08:02:36 +00:00
|
|
|
|
2003-10-28 20:25:30 +00:00
|
|
|
data = gst_pad_pull (ident->sink);
|
2004-01-15 01:35:41 +00:00
|
|
|
if (!GST_IS_BUFFER (data)) {
|
2003-10-28 20:25:30 +00:00
|
|
|
gst_spider_identity_chain (ident->sink, GST_BUFFER (data));
|
2004-01-15 01:35:41 +00:00
|
|
|
return;
|
2002-12-01 01:37:58 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-10-28 20:25:30 +00:00
|
|
|
find.buffer = GST_BUFFER (data);
|
2003-04-08 08:02:36 +00:00
|
|
|
/* maybe there are already valid caps now? */
|
2004-02-04 22:16:30 +00:00
|
|
|
find.caps = gst_pad_get_allowed_caps (ident->sink);
|
|
|
|
if (!gst_caps_is_empty (find.caps) && !gst_caps_is_any (find.caps)) {
|
2003-04-08 08:02:36 +00:00
|
|
|
goto plug;
|
2003-12-22 18:06:22 +00:00
|
|
|
} else {
|
|
|
|
gst_caps_free (find.caps);
|
|
|
|
find.caps = NULL;
|
2003-04-08 08:02:36 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-12-01 01:37:58 +00:00
|
|
|
/* now do the actual typefinding with the supplied buffer */
|
2003-10-28 20:25:30 +00:00
|
|
|
walk = type_list = gst_type_find_factory_get_list ();
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-10-28 20:25:30 +00:00
|
|
|
find.best_probability = 0;
|
|
|
|
find.caps = NULL;
|
|
|
|
gst_find.data = &find;
|
2004-11-07 17:16:31 +00:00
|
|
|
gst_find.get_length = NULL;
|
2003-10-28 20:25:30 +00:00
|
|
|
gst_find.peek = spider_find_peek;
|
|
|
|
gst_find.suggest = spider_find_suggest;
|
|
|
|
while (walk) {
|
|
|
|
GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY (walk->data);
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_DEBUG ("trying typefind function %s",
|
2004-03-15 19:27:17 +00:00
|
|
|
GST_PLUGIN_FEATURE_NAME (factory));
|
2003-10-28 20:25:30 +00:00
|
|
|
gst_type_find_factory_call_function (factory, &gst_find);
|
|
|
|
if (find.best_probability >= GST_TYPE_FIND_MAXIMUM)
|
|
|
|
goto plug;
|
|
|
|
walk = g_list_next (walk);
|
2002-12-01 01:37:58 +00:00
|
|
|
}
|
2003-10-28 20:25:30 +00:00
|
|
|
if (find.best_probability > 0)
|
|
|
|
goto plug;
|
2004-01-31 19:30:31 +00:00
|
|
|
GST_ELEMENT_ERROR (ident, STREAM, TYPE_NOT_FOUND, (NULL), (NULL));
|
2003-10-28 20:25:30 +00:00
|
|
|
find.buffer = GST_BUFFER (gst_event_new (GST_EVENT_EOS));
|
2002-12-01 01:37:58 +00:00
|
|
|
|
|
|
|
end:
|
|
|
|
/* remove loop function */
|
2004-03-15 19:27:17 +00:00
|
|
|
gst_element_set_loop_function (GST_ELEMENT (ident), (GstElementLoopFunction)
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_spider_identity_dumb_loop));
|
|
|
|
|
2002-12-01 01:37:58 +00:00
|
|
|
/* push the buffer */
|
2003-10-28 20:25:30 +00:00
|
|
|
gst_spider_identity_chain (ident->sink, find.buffer);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-04-08 08:02:36 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
plug:
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_INFO ("typefind function found caps");
|
2003-12-22 18:06:22 +00:00
|
|
|
ident->caps = find.caps;
|
2003-12-24 01:39:08 +00:00
|
|
|
if (GST_PAD_IS_LINKED (ident->src)) {
|
|
|
|
GstPadLinkReturn ret;
|
|
|
|
|
|
|
|
ret = gst_pad_try_set_caps (ident->src, find.caps);
|
2004-03-13 15:27:01 +00:00
|
|
|
if (GST_PAD_LINK_FAILED (ret)) {
|
|
|
|
g_critical ("could not set caps on spideridentity src pad\n");
|
2003-12-24 01:39:08 +00:00
|
|
|
}
|
|
|
|
}
|
2004-01-29 01:44:08 +00:00
|
|
|
GST_LOG_OBJECT (ident, "spider starting caps: %" GST_PTR_FORMAT, find.caps);
|
2003-10-28 20:25:30 +00:00
|
|
|
if (type_list)
|
|
|
|
g_list_free (type_list);
|
2003-04-11 00:00:46 +00:00
|
|
|
|
2003-10-01 13:11:45 +00:00
|
|
|
gst_spider_identity_plug (ident);
|
|
|
|
|
2003-04-08 08:02:36 +00:00
|
|
|
goto end;
|
2002-01-28 01:47:31 +00:00
|
|
|
}
|
|
|
|
|
2002-06-08 12:51:11 +00:00
|
|
|
static gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_spider_identity_handle_src_event (GstPad * pad, GstEvent * event)
|
2002-06-08 12:51:11 +00:00
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
|
|
|
GstSpiderIdentity *ident;
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_DEBUG ("spider_identity src_event");
|
2002-06-08 12:51:11 +00:00
|
|
|
|
|
|
|
ident = GST_SPIDER_IDENTITY (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_FLUSH:
|
|
|
|
case GST_EVENT_SEEK:
|
|
|
|
default:
|
2002-06-08 14:58:03 +00:00
|
|
|
res = gst_pad_event_default (pad, event);
|
2002-06-08 12:51:11 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|