2001-01-18 23:46:15 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2000 Wim Taymans <wim.taymans@chello.be>
|
|
|
|
*
|
|
|
|
* gsttee.c: Tee element, one in N out
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
2001-01-18 23:46:15 +00:00
|
|
|
#include "gsttee.h"
|
|
|
|
|
2003-11-03 20:56:53 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
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
|
|
|
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
2003-10-31 19:32:47 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (gst_tee_debug);
|
2003-06-29 14:05:49 +00:00
|
|
|
#define GST_CAT_DEFAULT gst_tee_debug
|
2001-01-18 23:46:15 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
GstElementDetails gst_tee_details = GST_ELEMENT_DETAILS ("Tee pipe fitting",
|
|
|
|
"Generic",
|
|
|
|
"1-to-N pipe fitting",
|
|
|
|
"Erik Walthinsen <omega@cse.ogi.edu>, "
|
|
|
|
"Wim Taymans <wim.taymans@chello.be>");
|
2001-01-18 23:46:15 +00:00
|
|
|
|
|
|
|
/* Tee signals and args */
|
2004-03-13 15:27:01 +00:00
|
|
|
enum
|
|
|
|
{
|
2001-01-18 23:46:15 +00:00
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
enum
|
|
|
|
{
|
2001-01-18 23:46:15 +00:00
|
|
|
ARG_0,
|
2001-07-11 19:22:20 +00:00
|
|
|
ARG_SILENT,
|
2001-01-18 23:46:15 +00:00
|
|
|
ARG_NUM_PADS,
|
2004-05-28 05:01:05 +00:00
|
|
|
ARG_LAST_MESSAGE
|
|
|
|
/* FILL ME */
|
2001-01-18 23:46:15 +00:00
|
|
|
};
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
GstStaticPadTemplate tee_src_template = GST_STATIC_PAD_TEMPLATE ("src%d",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_REQUEST,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
2001-01-18 23:46:15 +00:00
|
|
|
|
2004-01-08 04:10:18 +00:00
|
|
|
#define _do_init(bla) \
|
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_tee_debug, "tee", 0, "tee element");
|
|
|
|
|
|
|
|
GST_BOILERPLATE_FULL (GstTee, gst_tee, GstElement, GST_TYPE_ELEMENT, _do_init);
|
2001-01-18 23:46:15 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static GstPad *gst_tee_request_new_pad (GstElement * element,
|
|
|
|
GstPadTemplate * temp, const gchar * unused);
|
2001-01-18 23:46:15 +00:00
|
|
|
|
2004-03-21 03:22:55 +00:00
|
|
|
static void gst_tee_finalize (GObject * object);
|
2004-03-13 15:27:01 +00:00
|
|
|
static void gst_tee_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_tee_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
2001-01-18 23:46:15 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void gst_tee_chain (GstPad * pad, GstData * _data);
|
2001-01-18 23:46:15 +00:00
|
|
|
|
2001-12-19 01:17:54 +00:00
|
|
|
|
2003-10-31 19:32:47 +00:00
|
|
|
static void
|
|
|
|
gst_tee_base_init (gpointer g_class)
|
|
|
|
{
|
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
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
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&sinktemplate));
|
2003-10-31 19:32:47 +00:00
|
|
|
gst_element_class_set_details (gstelement_class, &gst_tee_details);
|
2003-12-22 01:39:35 +00:00
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&tee_src_template));
|
2003-10-31 19:32:47 +00:00
|
|
|
}
|
2004-03-21 03:22:55 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gst_tee_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GstTee *tee;
|
|
|
|
|
|
|
|
tee = GST_TEE (object);
|
|
|
|
|
|
|
|
g_free (tee->last_message);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2001-01-18 23:46:15 +00:00
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_tee_class_init (GstTeeClass * klass)
|
2001-01-18 23:46:15 +00:00
|
|
|
{
|
2001-06-25 01:20:11 +00:00
|
|
|
GObjectClass *gobject_class;
|
2001-01-18 23:46:15 +00:00
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2001-01-18 23:46:15 +00:00
|
|
|
|
|
|
|
|
2001-07-11 14:56:16 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS,
|
2004-03-13 15:27:01 +00:00
|
|
|
g_param_spec_int ("num_pads", "num_pads", "num_pads",
|
2004-03-15 19:27:17 +00:00
|
|
|
0, G_MAXINT, 0, G_PARAM_READABLE));
|
2001-07-11 19:22:20 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
|
2004-03-13 15:27:01 +00:00
|
|
|
g_param_spec_boolean ("silent", "silent", "silent",
|
2004-03-15 19:27:17 +00:00
|
|
|
TRUE, G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
|
2002-02-12 13:57:14 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LAST_MESSAGE,
|
2004-03-13 15:27:01 +00:00
|
|
|
g_param_spec_string ("last_message", "last_message", "last_message",
|
2004-03-15 19:27:17 +00:00
|
|
|
NULL, G_PARAM_READABLE));
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-07-11 19:22:20 +00:00
|
|
|
|
2004-03-21 03:22:55 +00:00
|
|
|
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_tee_finalize);
|
2004-03-13 15:27:01 +00:00
|
|
|
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_tee_set_property);
|
|
|
|
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_tee_get_property);
|
2001-01-18 23:46:15 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
gstelement_class->request_new_pad =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_tee_request_new_pad);
|
2001-01-18 23:46:15 +00:00
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void
|
|
|
|
gst_tee_init (GstTee * tee)
|
2001-01-18 23:46:15 +00:00
|
|
|
{
|
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
|
|
|
tee->sinkpad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate),
|
|
|
|
"sink");
|
2001-01-18 23:46:15 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (tee), tee->sinkpad);
|
2001-07-11 15:51:40 +00:00
|
|
|
gst_pad_set_chain_function (tee->sinkpad, GST_DEBUG_FUNCPTR (gst_tee_chain));
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_pad_set_link_function (tee->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_pad_proxy_pad_link));
|
|
|
|
gst_pad_set_getcaps_function (tee->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
|
2001-01-18 23:46:15 +00:00
|
|
|
|
2002-02-12 13:57:14 +00:00
|
|
|
tee->last_message = NULL;
|
2001-01-18 23:46:15 +00:00
|
|
|
}
|
|
|
|
|
2002-02-05 17:42:40 +00:00
|
|
|
/* helper compare function */
|
2004-03-13 15:27:01 +00:00
|
|
|
gint
|
|
|
|
name_pad_compare (gconstpointer a, gconstpointer b)
|
2002-02-05 17:42:40 +00:00
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
GstPad *pad = (GstPad *) a;
|
2002-02-05 17:42:40 +00:00
|
|
|
gchar *name = (gchar *) b;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-02-05 17:42:40 +00:00
|
|
|
g_assert (GST_IS_PAD (pad));
|
|
|
|
|
2004-03-15 19:27:17 +00:00
|
|
|
return strcmp (name, gst_pad_get_name (pad)); /* returns 0 if match */
|
2002-02-05 17:42:40 +00:00
|
|
|
}
|
|
|
|
|
2005-01-14 17:23:59 +00:00
|
|
|
static GstCaps *
|
|
|
|
gst_tee_getcaps (GstPad * pad)
|
|
|
|
{
|
|
|
|
GstTee *tee = GST_TEE (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
if (pad == tee->sinkpad) {
|
|
|
|
GstCaps *caps = gst_caps_new_any (), *tmp, *res;
|
|
|
|
const GList *pads;
|
|
|
|
|
|
|
|
for (pads = gst_element_get_pad_list (GST_ELEMENT (tee));
|
|
|
|
pads != NULL; pads = pads->next) {
|
|
|
|
if (!GST_PAD_IS_SRC (pads->data))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
tmp = gst_pad_get_allowed_caps (GST_PAD (pads->data));
|
|
|
|
res = gst_caps_intersect (caps, tmp);
|
|
|
|
gst_caps_free (tmp);
|
|
|
|
gst_caps_free (caps);
|
|
|
|
caps = res;
|
|
|
|
}
|
|
|
|
|
|
|
|
return caps;
|
|
|
|
} else {
|
|
|
|
return gst_pad_get_allowed_caps (tee->sinkpad);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstPadLinkReturn
|
|
|
|
gst_tee_link (GstPad * pad, const GstCaps * caps)
|
|
|
|
{
|
|
|
|
GstTee *tee = GST_TEE (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
if (pad == tee->sinkpad) {
|
|
|
|
GstPadLinkReturn res;
|
|
|
|
const GList *pads;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (tee, "Forwarding link to all source pads");
|
|
|
|
|
|
|
|
for (pads = gst_element_get_pad_list (GST_ELEMENT (tee));
|
|
|
|
pads != NULL; pads = pads->next) {
|
|
|
|
if (!GST_PAD_IS_SRC (pads->data))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
res = gst_pad_try_set_caps (GST_PAD (pads->data), caps);
|
|
|
|
GST_DEBUG_OBJECT (tee, "Pad %s:%s gave response %d",
|
|
|
|
GST_DEBUG_PAD_NAME (GST_PAD (pads->data)), res);
|
|
|
|
if (GST_PAD_LINK_FAILED (res))
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
return GST_PAD_LINK_OK;
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (tee, "Forwarding negotiation from source pad %s:%s",
|
|
|
|
GST_DEBUG_PAD_NAME (pad));
|
|
|
|
|
|
|
|
return gst_pad_try_set_caps (tee->sinkpad, caps);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static GstPad *
|
|
|
|
gst_tee_request_new_pad (GstElement * element, GstPadTemplate * templ,
|
|
|
|
const gchar * unused)
|
2001-01-18 23:46:15 +00:00
|
|
|
{
|
|
|
|
gchar *name;
|
|
|
|
GstPad *srcpad;
|
|
|
|
GstTee *tee;
|
2002-09-12 20:52:03 +00:00
|
|
|
gint i = 0;
|
|
|
|
const GList *pads;
|
2001-01-18 23:46:15 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_TEE (element), NULL);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-01-18 23:46:15 +00:00
|
|
|
if (templ->direction != GST_PAD_SRC) {
|
|
|
|
g_warning ("gsttee: request new pad that is not a SRC pad\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
tee = GST_TEE (element);
|
|
|
|
|
2002-02-05 17:42:40 +00:00
|
|
|
/* try names in order and find one that's not in use atm */
|
|
|
|
pads = gst_element_get_pad_list (element);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-02-05 17:42:40 +00:00
|
|
|
name = NULL;
|
2004-03-13 15:27:01 +00:00
|
|
|
while (!name) {
|
2002-02-05 17:42:40 +00:00
|
|
|
name = g_strdup_printf ("src%d", i);
|
2004-03-13 15:27:01 +00:00
|
|
|
if (g_list_find_custom ((GList *) pads, (gconstpointer) name,
|
2004-03-15 19:27:17 +00:00
|
|
|
name_pad_compare) != NULL) {
|
2002-02-05 17:42:40 +00:00
|
|
|
/* this name is taken, use the next one */
|
|
|
|
++i;
|
|
|
|
g_free (name);
|
|
|
|
name = NULL;
|
|
|
|
}
|
|
|
|
}
|
2002-02-24 13:38:10 +00:00
|
|
|
if (!tee->silent) {
|
|
|
|
g_free (tee->last_message);
|
|
|
|
tee->last_message = g_strdup_printf ("new pad %s", name);
|
|
|
|
g_object_notify (G_OBJECT (tee), "last_message");
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-01-18 23:46:15 +00:00
|
|
|
srcpad = gst_pad_new_from_template (templ, name);
|
2002-02-12 13:57:14 +00:00
|
|
|
g_free (name);
|
2005-01-14 17:23:59 +00:00
|
|
|
gst_pad_set_link_function (srcpad, GST_DEBUG_FUNCPTR (gst_tee_link));
|
|
|
|
gst_pad_set_getcaps_function (srcpad, GST_DEBUG_FUNCPTR (gst_tee_getcaps));
|
2001-01-18 23:46:15 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (tee), srcpad);
|
2001-12-25 02:15:46 +00:00
|
|
|
GST_PAD_ELEMENT_PRIVATE (srcpad) = NULL;
|
|
|
|
|
|
|
|
if (GST_PAD_CAPS (tee->sinkpad)) {
|
2002-01-13 22:22:42 +00:00
|
|
|
gst_pad_try_set_caps (srcpad, GST_PAD_CAPS (tee->sinkpad));
|
2001-12-25 02:15:46 +00:00
|
|
|
}
|
2001-12-19 01:17:54 +00:00
|
|
|
|
2001-01-18 23:46:15 +00:00
|
|
|
return srcpad;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_tee_set_property (GObject * object, guint prop_id, const GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2001-01-18 23:46:15 +00:00
|
|
|
{
|
|
|
|
GstTee *tee;
|
|
|
|
|
|
|
|
/* it's not null if we got it, but it might not be ours */
|
|
|
|
g_return_if_fail (GST_IS_TEE (object));
|
|
|
|
|
|
|
|
tee = GST_TEE (object);
|
|
|
|
|
2001-06-25 01:20:11 +00:00
|
|
|
switch (prop_id) {
|
2001-07-11 19:22:20 +00:00
|
|
|
case ARG_SILENT:
|
|
|
|
tee->silent = g_value_get_boolean (value);
|
2004-01-11 18:23:48 +00:00
|
|
|
g_object_notify (G_OBJECT (tee), "silent");
|
2001-07-11 19:22:20 +00:00
|
|
|
break;
|
2001-06-25 01:20:11 +00:00
|
|
|
default:
|
2002-02-24 13:38:10 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
2001-06-25 01:20:11 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_tee_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2001-06-25 01:20:11 +00:00
|
|
|
{
|
|
|
|
GstTee *tee;
|
|
|
|
|
|
|
|
/* it's not null if we got it, but it might not be ours */
|
|
|
|
g_return_if_fail (GST_IS_TEE (object));
|
|
|
|
|
|
|
|
tee = GST_TEE (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2001-01-18 23:46:15 +00:00
|
|
|
case ARG_NUM_PADS:
|
2001-12-25 02:15:46 +00:00
|
|
|
g_value_set_int (value, GST_ELEMENT (tee)->numsrcpads);
|
2001-01-18 23:46:15 +00:00
|
|
|
break;
|
2001-07-11 19:22:20 +00:00
|
|
|
case ARG_SILENT:
|
|
|
|
g_value_set_boolean (value, tee->silent);
|
|
|
|
break;
|
2002-02-24 13:38:10 +00:00
|
|
|
case ARG_LAST_MESSAGE:
|
2004-03-21 03:22:55 +00:00
|
|
|
g_value_set_string (value, tee->last_message);
|
2002-02-24 13:38:10 +00:00
|
|
|
break;
|
2001-01-18 23:46:15 +00:00
|
|
|
default:
|
2002-02-24 13:38:10 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
2001-01-18 23:46:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_tee_chain:
|
|
|
|
* @pad: the pad to follow
|
|
|
|
* @buf: the buffer to pass
|
|
|
|
*
|
|
|
|
* Chain a buffer on a pad.
|
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
static void
|
|
|
|
gst_tee_chain (GstPad * pad, GstData * _data)
|
2001-01-18 23:46:15 +00:00
|
|
|
{
|
2003-10-08 16:06:02 +00:00
|
|
|
GstBuffer *buf = GST_BUFFER (_data);
|
2001-01-18 23:46:15 +00:00
|
|
|
GstTee *tee;
|
2002-09-12 20:52:03 +00:00
|
|
|
const GList *pads;
|
2001-01-18 23:46:15 +00:00
|
|
|
|
|
|
|
g_return_if_fail (pad != NULL);
|
|
|
|
g_return_if_fail (GST_IS_PAD (pad));
|
|
|
|
g_return_if_fail (buf != NULL);
|
|
|
|
|
2001-01-29 00:06:02 +00:00
|
|
|
tee = GST_TEE (gst_pad_get_parent (pad));
|
2001-01-18 23:46:15 +00:00
|
|
|
|
2002-02-02 00:22:34 +00:00
|
|
|
gst_buffer_ref_by_count (buf, GST_ELEMENT (tee)->numsrcpads - 1);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-12-25 02:15:46 +00:00
|
|
|
pads = gst_element_get_pad_list (GST_ELEMENT (tee));
|
|
|
|
|
|
|
|
while (pads) {
|
|
|
|
GstPad *outpad = GST_PAD (pads->data);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-12-25 02:15:46 +00:00
|
|
|
pads = g_list_next (pads);
|
|
|
|
|
|
|
|
if (GST_PAD_DIRECTION (outpad) != GST_PAD_SRC)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (!tee->silent) {
|
2002-02-24 13:38:10 +00:00
|
|
|
g_free (tee->last_message);
|
2004-03-13 15:27:01 +00:00
|
|
|
tee->last_message =
|
2004-03-15 19:27:17 +00:00
|
|
|
g_strdup_printf ("chain ******* (%s:%s)t (%d bytes, %"
|
|
|
|
G_GUINT64_FORMAT ") %p", GST_DEBUG_PAD_NAME (outpad),
|
|
|
|
GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf), buf);
|
2002-02-12 13:57:14 +00:00
|
|
|
g_object_notify (G_OBJECT (tee), "last_message");
|
2001-12-25 02:15:46 +00:00
|
|
|
}
|
2001-07-11 19:22:20 +00:00
|
|
|
|
2002-07-24 21:08:43 +00:00
|
|
|
if (GST_PAD_IS_USABLE (outpad))
|
2003-10-08 16:06:02 +00:00
|
|
|
gst_pad_push (outpad, GST_DATA (buf));
|
2001-12-25 02:15:46 +00:00
|
|
|
else
|
|
|
|
gst_buffer_unref (buf);
|
2001-01-18 23:46:15 +00:00
|
|
|
}
|
|
|
|
}
|