mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
Some code cleanups.
Original commit message from CVS: Some code cleanups. Added printouts of the buffer timestamps in identity, fakesrc, fakesink. Added an aggregator test element.
This commit is contained in:
parent
eaaaabf3aa
commit
93c163032d
30 changed files with 886 additions and 238 deletions
|
@ -21,6 +21,7 @@ libgstelements_la_SOURCES = \
|
|||
gstmultidisksrc.c \
|
||||
gstpipefilter.c \
|
||||
gsttee.c \
|
||||
gstaggregator.c \
|
||||
gstsinesrc.c \
|
||||
$(GSTHTTPSRC)
|
||||
|
||||
|
@ -36,6 +37,7 @@ noinst_HEADERS = \
|
|||
gstfdsink.h \
|
||||
gstpipefilter.h \
|
||||
gsttee.h \
|
||||
gstaggregator.h \
|
||||
gstsinesrc.h
|
||||
|
||||
CFLAGS += -O2 -Wall
|
||||
|
|
229
gst/elements/gstaggregator.c
Normal file
229
gst/elements/gstaggregator.c
Normal file
|
@ -0,0 +1,229 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* 2000 Wim Taymans <wim.taymans@chello.be>
|
||||
*
|
||||
* gstaggregator.c: Aggregator 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.
|
||||
*/
|
||||
|
||||
#include "gstaggregator.h"
|
||||
|
||||
|
||||
GstElementDetails gst_aggregator_details = {
|
||||
"Aggregator pipe fitting",
|
||||
"Aggregator",
|
||||
"N-to-1 pipe fitting",
|
||||
VERSION,
|
||||
"Wim Taymans <wim.taymans@chello.be>",
|
||||
"(C) 2001",
|
||||
};
|
||||
|
||||
/* Aggregator signals and args */
|
||||
enum {
|
||||
/* FILL ME */
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_NUM_PADS,
|
||||
ARG_SILENT,
|
||||
/* FILL ME */
|
||||
};
|
||||
|
||||
GST_PADTEMPLATE_FACTORY (aggregator_src_factory,
|
||||
"sink%d",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_REQUEST,
|
||||
NULL /* no caps */
|
||||
);
|
||||
|
||||
static void gst_aggregator_class_init (GstAggregatorClass *klass);
|
||||
static void gst_aggregator_init (GstAggregator *aggregator);
|
||||
|
||||
static GstPad* gst_aggregator_request_new_pad (GstElement *element, GstPadTemplate *temp);
|
||||
|
||||
static void gst_aggregator_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
static void gst_aggregator_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec);
|
||||
|
||||
static void gst_aggregator_chain (GstPad *pad, GstBuffer *buf);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
//static guint gst_aggregator_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GType
|
||||
gst_aggregator_get_type (void)
|
||||
{
|
||||
static GType aggregator_type = 0;
|
||||
|
||||
if (!aggregator_type) {
|
||||
static const GTypeInfo aggregator_info = {
|
||||
sizeof(GstAggregatorClass),
|
||||
NULL,
|
||||
NULL,
|
||||
(GClassInitFunc)gst_aggregator_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof(GstAggregator),
|
||||
0,
|
||||
(GInstanceInitFunc)gst_aggregator_init,
|
||||
};
|
||||
aggregator_type = g_type_register_static (GST_TYPE_ELEMENT, "GstAggregator", &aggregator_info, 0);
|
||||
}
|
||||
return aggregator_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_aggregator_class_init (GstAggregatorClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
|
||||
gobject_class = (GObjectClass*) klass;
|
||||
gstelement_class = (GstElementClass*) klass;
|
||||
|
||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS,
|
||||
g_param_spec_int ("num_pads", "num_pads", "num_pads",
|
||||
0, G_MAXINT, 0, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
|
||||
g_param_spec_boolean ("silent", "silent", "silent",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_aggregator_set_property;
|
||||
gobject_class->get_property = gst_aggregator_get_property;
|
||||
|
||||
gstelement_class->request_new_pad = gst_aggregator_request_new_pad;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_aggregator_init (GstAggregator *aggregator)
|
||||
{
|
||||
aggregator->srcpad = gst_pad_new ("src", GST_PAD_SINK);
|
||||
gst_element_add_pad (GST_ELEMENT (aggregator), aggregator->srcpad);
|
||||
|
||||
aggregator->numsinkpads = 0;
|
||||
aggregator->sinkpads = NULL;
|
||||
aggregator->silent = FALSE;
|
||||
}
|
||||
|
||||
static GstPad*
|
||||
gst_aggregator_request_new_pad (GstElement *element, GstPadTemplate *templ)
|
||||
{
|
||||
gchar *name;
|
||||
GstPad *sinkpad;
|
||||
GstAggregator *aggregator;
|
||||
|
||||
g_return_val_if_fail (GST_IS_AGGREGATOR (element), NULL);
|
||||
|
||||
if (templ->direction != GST_PAD_SINK) {
|
||||
g_warning ("gstaggregator: request new pad that is not a SRC pad\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
aggregator = GST_AGGREGATOR (element);
|
||||
|
||||
name = g_strdup_printf ("sink%d",aggregator->numsinkpads);
|
||||
|
||||
sinkpad = gst_pad_new_from_template (templ, name);
|
||||
gst_pad_set_chain_function (sinkpad, gst_aggregator_chain);
|
||||
gst_element_add_pad (GST_ELEMENT (aggregator), sinkpad);
|
||||
|
||||
aggregator->sinkpads = g_slist_prepend (aggregator->sinkpads, sinkpad);
|
||||
aggregator->numsinkpads++;
|
||||
|
||||
return sinkpad;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_aggregator_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
GstAggregator *aggregator;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_AGGREGATOR (object));
|
||||
|
||||
aggregator = GST_AGGREGATOR (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case ARG_SILENT:
|
||||
aggregator->silent = g_value_get_boolean (value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_aggregator_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
GstAggregator *aggregator;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_AGGREGATOR (object));
|
||||
|
||||
aggregator = GST_AGGREGATOR (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case ARG_NUM_PADS:
|
||||
g_value_set_int (value, aggregator->numsinkpads);
|
||||
break;
|
||||
case ARG_SILENT:
|
||||
g_value_set_boolean (value, aggregator->silent);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_aggregator_chain:
|
||||
* @pad: the pad to follow
|
||||
* @buf: the buffer to pass
|
||||
*
|
||||
* Chain a buffer on a pad.
|
||||
*/
|
||||
static void
|
||||
gst_aggregator_chain (GstPad *pad, GstBuffer *buf)
|
||||
{
|
||||
GstAggregator *aggregator;
|
||||
|
||||
g_return_if_fail (pad != NULL);
|
||||
g_return_if_fail (GST_IS_PAD (pad));
|
||||
g_return_if_fail (buf != NULL);
|
||||
|
||||
aggregator = GST_AGGREGATOR (gst_pad_get_parent (pad));
|
||||
gst_trace_add_entry (NULL, 0, buf, "aggregator buffer");
|
||||
|
||||
if (!aggregator->silent)
|
||||
g_print("aggregator: chain ******* (%s:%s)a (%d bytes, %llu) \n",
|
||||
GST_DEBUG_PAD_NAME (pad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
|
||||
gst_pad_push (aggregator->srcpad, buf);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_aggregator_factory_init (GstElementFactory *factory)
|
||||
{
|
||||
gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (aggregator_src_factory));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
73
gst/elements/gstaggregator.h
Normal file
73
gst/elements/gstaggregator.h
Normal file
|
@ -0,0 +1,73 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* 2000 Wim Taymans <wtay@chello.be>
|
||||
*
|
||||
* gstaggregator.h: Header for GstAggregator element
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __GST_AGGREGATOR_H__
|
||||
#define __GST_AGGREGATOR_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern GstElementDetails gst_aggregator_details;
|
||||
|
||||
#define GST_TYPE_AGGREGATOR \
|
||||
(gst_aggregator_get_type())
|
||||
#define GST_AGGREGATOR(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AGGREGATOR,GstAggregator))
|
||||
#define GST_AGGREGATOR_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AGGREGATOR,GstAggregatorClass))
|
||||
#define GST_IS_AGGREGATOR(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AGGREGATOR))
|
||||
#define GST_IS_AGGREGATOR_CLASS(obj) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AGGREGATOR))
|
||||
|
||||
typedef struct _GstAggregator GstAggregator;
|
||||
typedef struct _GstAggregatorClass GstAggregatorClass;
|
||||
|
||||
struct _GstAggregator {
|
||||
GstElement element;
|
||||
|
||||
GstPad *srcpad;
|
||||
|
||||
gboolean silent;
|
||||
gint numsinkpads;
|
||||
GSList *sinkpads;
|
||||
};
|
||||
|
||||
struct _GstAggregatorClass {
|
||||
GstElementClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_aggregator_get_type (void);
|
||||
|
||||
gboolean gst_aggregator_factory_init (GstElementFactory *factory);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GST_AGGREGATOR_H__ */
|
|
@ -48,16 +48,18 @@ enum {
|
|||
};
|
||||
|
||||
|
||||
static void gst_disksink_class_init (GstDiskSinkClass *klass);
|
||||
static void gst_disksink_init (GstDiskSink *disksink);
|
||||
static void gst_disksink_class_init (GstDiskSinkClass *klass);
|
||||
static void gst_disksink_init (GstDiskSink *disksink);
|
||||
|
||||
static void gst_disksink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gst_disksink_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
static void gst_disksink_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
static void gst_disksink_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec);
|
||||
|
||||
static gboolean gst_disksink_open_file (GstDiskSink *sink);
|
||||
static void gst_disksink_close_file (GstDiskSink *sink);
|
||||
static gboolean gst_disksink_open_file (GstDiskSink *sink);
|
||||
static void gst_disksink_close_file (GstDiskSink *sink);
|
||||
|
||||
static void gst_disksink_chain (GstPad *pad,GstBuffer *buf);
|
||||
static void gst_disksink_chain (GstPad *pad,GstBuffer *buf);
|
||||
|
||||
static GstElementStateReturn gst_disksink_change_state (GstElement *element);
|
||||
|
||||
|
|
|
@ -56,19 +56,21 @@ enum {
|
|||
};
|
||||
|
||||
|
||||
static void gst_disksrc_class_init (GstDiskSrcClass *klass);
|
||||
static void gst_disksrc_class_init (GstDiskSrcClass *klass);
|
||||
static void gst_disksrc_init (GstDiskSrc *disksrc);
|
||||
|
||||
static void gst_disksrc_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gst_disksrc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
static void gst_disksrc_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
static void gst_disksrc_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec);
|
||||
|
||||
static GstBuffer * gst_disksrc_get (GstPad *pad);
|
||||
static GstBuffer * gst_disksrc_get_region (GstPad *pad,GstRegionType type,guint64 offset,guint64 len);
|
||||
static GstBuffer * gst_disksrc_get (GstPad *pad);
|
||||
static GstBuffer * gst_disksrc_get_region (GstPad *pad,GstRegionType type,guint64 offset,guint64 len);
|
||||
|
||||
static GstElementStateReturn gst_disksrc_change_state (GstElement *element);
|
||||
|
||||
static gboolean gst_disksrc_open_file (GstDiskSrc *src);
|
||||
static void gst_disksrc_close_file (GstDiskSrc *src);
|
||||
static gboolean gst_disksrc_open_file (GstDiskSrc *src);
|
||||
static void gst_disksrc_close_file (GstDiskSrc *src);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
//static guint gst_disksrc_signals[LAST_SIGNAL] = { 0 };
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "gstpipefilter.h"
|
||||
#include "gstsinesrc.h"
|
||||
#include "gsttee.h"
|
||||
#include "gstaggregator.h"
|
||||
|
||||
#if HAVE_LIBGHTTP
|
||||
#include <gsthttpsrc.h>
|
||||
|
@ -59,6 +60,7 @@ static struct _elements_entry _elements[] = {
|
|||
{ "pipefilter", gst_pipefilter_get_type, &gst_pipefilter_details, NULL },
|
||||
{ "sinesrc", gst_sinesrc_get_type, &gst_sinesrc_details, gst_sinesrc_factory_init },
|
||||
{ "tee", gst_tee_get_type, &gst_tee_details, gst_tee_factory_init },
|
||||
{ "aggregator", gst_aggregator_get_type, &gst_aggregator_details, gst_aggregator_factory_init },
|
||||
|
||||
#if HAVE_LIBGHTTP
|
||||
{ "httpsrc", gst_httpsrc_get_type, &gst_httpsrc_details, NULL },
|
||||
|
|
|
@ -48,13 +48,15 @@ enum {
|
|||
};
|
||||
|
||||
|
||||
static void gst_fakesink_class_init (GstFakeSinkClass *klass);
|
||||
static void gst_fakesink_init (GstFakeSink *fakesink);
|
||||
static void gst_fakesink_class_init (GstFakeSinkClass *klass);
|
||||
static void gst_fakesink_init (GstFakeSink *fakesink);
|
||||
|
||||
static void gst_fakesink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gst_fakesink_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
static void gst_fakesink_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
static void gst_fakesink_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec);
|
||||
|
||||
static void gst_fakesink_chain (GstPad *pad,GstBuffer *buf);
|
||||
static void gst_fakesink_chain (GstPad *pad, GstBuffer *buf);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
static guint gst_fakesink_signals[LAST_SIGNAL] = { 0 };
|
||||
|
@ -192,7 +194,8 @@ gst_fakesink_chain (GstPad *pad, GstBuffer *buf)
|
|||
|
||||
fakesink = GST_FAKESINK (gst_pad_get_parent (pad));
|
||||
if (!fakesink->silent)
|
||||
g_print("fakesink: ******* (%s:%s)< (%d bytes) \n",GST_DEBUG_PAD_NAME(pad),GST_BUFFER_SIZE(buf));
|
||||
g_print("fakesink: chain ******* (%s:%s)< (%d bytes, %llu) \n",
|
||||
GST_DEBUG_PAD_NAME (pad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
|
||||
g_signal_emit (G_OBJECT (fakesink), gst_fakesink_signals[SIGNAL_HANDOFF], 0,
|
||||
buf);
|
||||
|
|
|
@ -74,14 +74,14 @@ gst_fakesrc_output_get_type(void) {
|
|||
return fakesrc_output_type;
|
||||
}
|
||||
|
||||
static void gst_fakesrc_class_init (GstFakeSrcClass *klass);
|
||||
static void gst_fakesrc_init (GstFakeSrc *fakesrc);
|
||||
static void gst_fakesrc_class_init (GstFakeSrcClass *klass);
|
||||
static void gst_fakesrc_init (GstFakeSrc *fakesrc);
|
||||
|
||||
static void gst_fakesrc_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gst_fakesrc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
|
||||
static GstBuffer* gst_fakesrc_get (GstPad *pad);
|
||||
static void gst_fakesrc_loop (GstElement *element);
|
||||
static GstBuffer* gst_fakesrc_get (GstPad *pad);
|
||||
static void gst_fakesrc_loop (GstElement *element);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
static guint gst_fakesrc_signals[LAST_SIGNAL] = { 0 };
|
||||
|
@ -137,7 +137,7 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
|
|||
TRUE,G_PARAM_READWRITE)); // CHECKME
|
||||
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SILENT,
|
||||
g_param_spec_boolean("silent","silent","silent",
|
||||
TRUE,G_PARAM_READWRITE)); // CHECKME
|
||||
FALSE, G_PARAM_READWRITE)); // CHECKME
|
||||
|
||||
gst_fakesrc_signals[SIGNAL_HANDOFF] =
|
||||
g_signal_newc ("handoff", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
|
||||
|
@ -158,9 +158,9 @@ gst_fakesrc_init (GstFakeSrc *fakesrc)
|
|||
fakesrc->numsrcpads = 1;
|
||||
|
||||
// create our first output pad
|
||||
pad = gst_pad_new("src",GST_PAD_SRC);
|
||||
gst_element_add_pad(GST_ELEMENT(fakesrc),pad);
|
||||
fakesrc->srcpads = g_slist_append(NULL,pad);
|
||||
pad = gst_pad_new ("src", GST_PAD_SRC);
|
||||
gst_element_add_pad (GST_ELEMENT (fakesrc), pad);
|
||||
fakesrc->srcpads = g_slist_append (NULL, pad);
|
||||
|
||||
fakesrc->loop_based = TRUE;
|
||||
|
||||
|
@ -170,6 +170,7 @@ gst_fakesrc_init (GstFakeSrc *fakesrc)
|
|||
gst_pad_set_get_function(pad,gst_fakesrc_get);
|
||||
|
||||
fakesrc->num_buffers = -1;
|
||||
fakesrc->buffer_count = 0;
|
||||
fakesrc->silent = FALSE;
|
||||
// we're ready right away, since we don't have any args...
|
||||
// gst_element_set_state(GST_ELEMENT(fakesrc),GST_STATE_READY);
|
||||
|
@ -211,7 +212,7 @@ gst_fakesrc_set_property (GObject *object, guint prop_id, const GValue *value, G
|
|||
new_numsrcs = g_value_get_int (value);
|
||||
if (new_numsrcs > src->numsrcpads) {
|
||||
while (src->numsrcpads != new_numsrcs) {
|
||||
pad = gst_pad_new(g_strdup_printf("src%d",src->numsrcpads),GST_PAD_SRC);
|
||||
pad = gst_pad_new (g_strdup_printf ("src%d", src->numsrcpads), GST_PAD_SRC);
|
||||
gst_element_add_pad(GST_ELEMENT(src),pad);
|
||||
src->srcpads = g_slist_append(src->srcpads,pad);
|
||||
src->numsrcpads++;
|
||||
|
@ -316,9 +317,12 @@ gst_fakesrc_get(GstPad *pad)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!src->silent)
|
||||
g_print("fakesrc: ******* (%s:%s)> \n",GST_DEBUG_PAD_NAME(pad));
|
||||
buf = gst_buffer_new();
|
||||
GST_BUFFER_TIMESTAMP (buf) = src->buffer_count++;
|
||||
|
||||
if (!src->silent)
|
||||
g_print("fakesrc: get ******* (%s:%s)> (%d bytes, %llu) \n",
|
||||
GST_DEBUG_PAD_NAME (pad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
|
||||
g_signal_emit (G_OBJECT (src), gst_fakesrc_signals[SIGNAL_HANDOFF], 0,
|
||||
buf);
|
||||
|
@ -367,8 +371,11 @@ gst_fakesrc_loop(GstElement *element)
|
|||
}
|
||||
|
||||
buf = gst_buffer_new();
|
||||
GST_BUFFER_TIMESTAMP (buf) = src->buffer_count++;
|
||||
|
||||
if (!src->silent)
|
||||
g_print("fakesrc: ******* (%s:%s)> \n",GST_DEBUG_PAD_NAME(pad));
|
||||
g_print("fakesrc: loop ******* (%s:%s) > (%d bytes, %llu) \n",
|
||||
GST_DEBUG_PAD_NAME (pad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
|
||||
g_signal_emit (G_OBJECT (src), gst_fakesrc_signals[SIGNAL_HANDOFF], 0,
|
||||
buf);
|
||||
|
|
|
@ -72,6 +72,7 @@ struct _GstFakeSrc {
|
|||
gchar *pattern;
|
||||
GList *patternlist;
|
||||
gint num_buffers;
|
||||
guint64 buffer_count;
|
||||
gboolean silent;
|
||||
};
|
||||
|
||||
|
|
|
@ -46,13 +46,15 @@ enum {
|
|||
};
|
||||
|
||||
|
||||
static void gst_fdsink_class_init (GstFdSinkClass *klass);
|
||||
static void gst_fdsink_init (GstFdSink *fdsink);
|
||||
static void gst_fdsink_class_init (GstFdSinkClass *klass);
|
||||
static void gst_fdsink_init (GstFdSink *fdsink);
|
||||
|
||||
static void gst_fdsink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gst_fdsink_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
static void gst_fdsink_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
static void gst_fdsink_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec);
|
||||
|
||||
static void gst_fdsink_chain (GstPad *pad,GstBuffer *buf);
|
||||
static void gst_fdsink_chain (GstPad *pad,GstBuffer *buf);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
//static guint gst_fdsink_signals[LAST_SIGNAL] = { 0 };
|
||||
|
|
|
@ -57,8 +57,10 @@ enum {
|
|||
static void gst_fdsrc_class_init (GstFdSrcClass *klass);
|
||||
static void gst_fdsrc_init (GstFdSrc *fdsrc);
|
||||
|
||||
static void gst_fdsrc_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gst_fdsrc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
static void gst_fdsrc_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
static void gst_fdsrc_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec);
|
||||
|
||||
static GstBuffer * gst_fdsrc_get (GstPad *pad);
|
||||
|
||||
|
|
|
@ -51,17 +51,19 @@ enum {
|
|||
ARG_OFFSET
|
||||
};
|
||||
|
||||
static void gst_httpsrc_class_init (GstHttpSrcClass *klass);
|
||||
static void gst_httpsrc_init (GstHttpSrc *httpsrc);
|
||||
static void gst_httpsrc_class_init (GstHttpSrcClass *klass);
|
||||
static void gst_httpsrc_init (GstHttpSrc *httpsrc);
|
||||
|
||||
static void gst_httpsrc_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gst_httpsrc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
static void gst_httpsrc_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
static void gst_httpsrc_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec);
|
||||
static GstElementStateReturn gst_httpsrc_change_state (GstElement *element);
|
||||
|
||||
static GstBuffer * gst_httpsrc_get (GstPad *pad);
|
||||
static GstBuffer * gst_httpsrc_get (GstPad *pad);
|
||||
|
||||
static gboolean gst_httpsrc_open_url (GstHttpSrc *src);
|
||||
static void gst_httpsrc_close_url (GstHttpSrc *src);
|
||||
static gboolean gst_httpsrc_open_url (GstHttpSrc *src);
|
||||
static void gst_httpsrc_close_url (GstHttpSrc *src);
|
||||
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
|
|
@ -163,7 +163,8 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
|
|||
identity = GST_IDENTITY (gst_pad_get_parent (pad));
|
||||
|
||||
if (!identity->silent)
|
||||
g_print("identity: ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(pad));
|
||||
g_print("identity: chain ******* (%s:%s)i (%d bytes, %llu) \n",
|
||||
GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
|
||||
gst_pad_push (identity->srcpad, buf);
|
||||
|
||||
|
@ -185,7 +186,10 @@ gst_identity_loop (GstElement *element)
|
|||
do {
|
||||
buf = gst_pad_pull (identity->sinkpad);
|
||||
if (!identity->silent)
|
||||
g_print("identity: ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(identity->sinkpad));
|
||||
g_print("identity: loop ******* (%s:%s)i (%d bytes, %llu) \n",
|
||||
GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
|
||||
|
||||
|
||||
gst_pad_push (identity->srcpad, buf);
|
||||
|
||||
|
|
|
@ -54,58 +54,56 @@ enum {
|
|||
ARG_BUFFER_SIZE,
|
||||
};
|
||||
|
||||
static GstPadTemplate*
|
||||
sinesrc_src_factory (void)
|
||||
{
|
||||
return
|
||||
gst_padtemplate_new (
|
||||
"src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
gst_caps_new (
|
||||
// FIXME: this is not core business...
|
||||
GST_PADTEMPLATE_FACTORY (sinesrc_src_factory,
|
||||
"src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_CAPS_NEW (
|
||||
"sinesrc_src",
|
||||
"audio/raw",
|
||||
gst_props_new (
|
||||
"format", GST_PROPS_STRING ("int"),
|
||||
"law", GST_PROPS_INT (0),
|
||||
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
|
||||
"signed", GST_PROPS_BOOLEAN (TRUE),
|
||||
"width", GST_PROPS_INT (16),
|
||||
"depth", GST_PROPS_INT (16),
|
||||
"rate", GST_PROPS_INT_RANGE (8000, 48000),
|
||||
"channels", GST_PROPS_INT (1),
|
||||
NULL)),
|
||||
NULL);
|
||||
}
|
||||
"audio/raw",
|
||||
"format", GST_PROPS_STRING ("int"),
|
||||
"law", GST_PROPS_INT (0),
|
||||
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
|
||||
"signed", GST_PROPS_BOOLEAN (TRUE),
|
||||
"width", GST_PROPS_INT (16),
|
||||
"depth", GST_PROPS_INT (16),
|
||||
"rate", GST_PROPS_INT_RANGE (8000, 48000),
|
||||
"channels", GST_PROPS_INT (1)
|
||||
)
|
||||
);
|
||||
|
||||
static GstPadTemplate *src_temp;
|
||||
|
||||
static void gst_sinesrc_class_init(GstSineSrcClass *klass);
|
||||
static void gst_sinesrc_init(GstSineSrc *src);
|
||||
static GstPadNegotiateReturn gst_sinesrc_negotiate (GstPad *pad, GstCaps **caps, gpointer *data);
|
||||
static void gst_sinesrc_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gst_sinesrc_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
static void gst_sinesrc_class_init (GstSineSrcClass *klass);
|
||||
static void gst_sinesrc_init (GstSineSrc *src);
|
||||
static GstPadNegotiateReturn gst_sinesrc_negotiate (GstPad *pad, GstCaps **caps, gpointer *data);
|
||||
static void gst_sinesrc_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
static void gst_sinesrc_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec);
|
||||
//static gboolean gst_sinesrc_change_state(GstElement *element,
|
||||
// GstElementState state);
|
||||
//static void gst_sinesrc_close_audio(GstSineSrc *src);
|
||||
//static gboolean gst_sinesrc_open_audio(GstSineSrc *src);
|
||||
static void gst_sinesrc_populate_sinetable(GstSineSrc *src);
|
||||
static inline void gst_sinesrc_update_table_inc(GstSineSrc *src);
|
||||
static inline void gst_sinesrc_update_vol_scale(GstSineSrc *src);
|
||||
static void gst_sinesrc_force_caps(GstSineSrc *src);
|
||||
|
||||
static GstBuffer * gst_sinesrc_get(GstPad *pad);
|
||||
static void gst_sinesrc_populate_sinetable (GstSineSrc *src);
|
||||
static inline void gst_sinesrc_update_table_inc (GstSineSrc *src);
|
||||
static inline void gst_sinesrc_update_vol_scale (GstSineSrc *src);
|
||||
static void gst_sinesrc_force_caps (GstSineSrc *src);
|
||||
|
||||
static GstBuffer* gst_sinesrc_get (GstPad *pad);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
//static guint gst_sinesrc_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GType
|
||||
gst_sinesrc_get_type(void) {
|
||||
gst_sinesrc_get_type (void)
|
||||
{
|
||||
static GType sinesrc_type = 0;
|
||||
|
||||
if (!sinesrc_type) {
|
||||
static const GTypeInfo sinesrc_info = {
|
||||
sizeof(GstSineSrcClass), NULL,
|
||||
sizeof(GstSineSrcClass),
|
||||
NULL,
|
||||
NULL,
|
||||
(GClassInitFunc)gst_sinesrc_class_init,
|
||||
NULL,
|
||||
|
@ -114,13 +112,14 @@ gst_sinesrc_get_type(void) {
|
|||
0,
|
||||
(GInstanceInitFunc)gst_sinesrc_init,
|
||||
};
|
||||
sinesrc_type = g_type_register_static(GST_TYPE_ELEMENT, "GstSineSrc", &sinesrc_info, 0);
|
||||
sinesrc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstSineSrc", &sinesrc_info, 0);
|
||||
}
|
||||
return sinesrc_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_sinesrc_class_init(GstSineSrcClass *klass) {
|
||||
gst_sinesrc_class_init (GstSineSrcClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
|
||||
|
@ -155,10 +154,10 @@ gst_sinesrc_class_init(GstSineSrcClass *klass) {
|
|||
}
|
||||
|
||||
static void
|
||||
gst_sinesrc_init(GstSineSrc *src) {
|
||||
|
||||
src->srcpad = gst_pad_new_from_template (src_temp, "src");
|
||||
|
||||
gst_sinesrc_init (GstSineSrc *src)
|
||||
{
|
||||
src->srcpad = gst_pad_new_from_template (
|
||||
GST_PADTEMPLATE_GET (sinesrc_src_factory), "src");
|
||||
gst_element_add_pad(GST_ELEMENT(src), src->srcpad);
|
||||
gst_pad_set_negotiate_function (src->srcpad, gst_sinesrc_negotiate);
|
||||
|
||||
|
@ -179,7 +178,6 @@ gst_sinesrc_init(GstSineSrc *src) {
|
|||
src->buffer_size=1024;
|
||||
|
||||
src->seq = 0;
|
||||
|
||||
}
|
||||
|
||||
static GstPadNegotiateReturn
|
||||
|
@ -252,7 +250,8 @@ gst_sinesrc_get(GstPad *pad)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_sinesrc_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) {
|
||||
gst_sinesrc_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
GstSineSrc *src;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
|
@ -294,7 +293,8 @@ gst_sinesrc_set_property(GObject *object, guint prop_id, const GValue *value, GP
|
|||
}
|
||||
|
||||
static void
|
||||
gst_sinesrc_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) {
|
||||
gst_sinesrc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
GstSineSrc *src;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
|
@ -350,7 +350,7 @@ static gboolean gst_sinesrc_change_state(GstElement *element,
|
|||
*/
|
||||
|
||||
static void
|
||||
gst_sinesrc_populate_sinetable(GstSineSrc *src)
|
||||
gst_sinesrc_populate_sinetable (GstSineSrc *src)
|
||||
{
|
||||
gint i;
|
||||
gdouble pi2scaled = M_PI * 2 / src->table_size;
|
||||
|
@ -365,13 +365,13 @@ gst_sinesrc_populate_sinetable(GstSineSrc *src)
|
|||
}
|
||||
|
||||
static inline void
|
||||
gst_sinesrc_update_table_inc(GstSineSrc *src)
|
||||
gst_sinesrc_update_table_inc (GstSineSrc *src)
|
||||
{
|
||||
src->table_inc = src->table_size * src->freq / src->samplerate;
|
||||
}
|
||||
|
||||
static inline void
|
||||
gst_sinesrc_update_vol_scale(GstSineSrc *src)
|
||||
gst_sinesrc_update_vol_scale (GstSineSrc *src)
|
||||
{
|
||||
src->vol_scale = 32767 * src->volume;
|
||||
}
|
||||
|
@ -407,8 +407,7 @@ gst_sinesrc_force_caps(GstSineSrc *src) {
|
|||
gboolean
|
||||
gst_sinesrc_factory_init (GstElementFactory *factory)
|
||||
{
|
||||
src_temp = sinesrc_src_factory();
|
||||
gst_elementfactory_add_padtemplate (factory, src_temp);
|
||||
gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (sinesrc_src_factory));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -45,32 +45,27 @@ enum {
|
|||
/* FILL ME */
|
||||
};
|
||||
|
||||
static GstPadTemplate*
|
||||
tee_src_factory_create (void)
|
||||
{
|
||||
return
|
||||
gst_padtemplate_new (
|
||||
"src%d",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_REQUEST,
|
||||
NULL /* no caps */
|
||||
);
|
||||
}
|
||||
|
||||
GST_PADTEMPLATE_FACTORY (tee_src_factory,
|
||||
"src%d",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_REQUEST,
|
||||
NULL /* no caps */
|
||||
);
|
||||
|
||||
static void gst_tee_class_init (GstTeeClass *klass);
|
||||
static void gst_tee_init (GstTee *tee);
|
||||
|
||||
static GstPad* gst_tee_request_new_pad (GstElement *element, GstPadTemplate *temp);
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
static void gst_tee_chain (GstPad *pad, GstBuffer *buf);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
//static guint gst_tee_signals[LAST_SIGNAL] = { 0 };
|
||||
static GstPadTemplate *gst_tee_src_template;
|
||||
|
||||
GType
|
||||
gst_tee_get_type(void) {
|
||||
|
@ -103,9 +98,9 @@ gst_tee_class_init (GstTeeClass *klass)
|
|||
|
||||
parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
|
||||
|
||||
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_NUM_PADS,
|
||||
g_param_spec_int("num_pads","num_pads","num_pads",
|
||||
G_MININT,G_MAXINT,0,G_PARAM_READABLE)); // CHECKME
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS,
|
||||
g_param_spec_int ("num_pads", "num_pads", "num_pads",
|
||||
0, G_MAXINT, 0, G_PARAM_READABLE));
|
||||
|
||||
gobject_class->set_property = gst_tee_set_property;
|
||||
gobject_class->get_property = gst_tee_get_property;
|
||||
|
@ -201,7 +196,7 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf)
|
|||
{
|
||||
GstTee *tee;
|
||||
GSList *srcpads;
|
||||
int i;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (pad != NULL);
|
||||
g_return_if_fail (GST_IS_PAD (pad));
|
||||
|
@ -223,8 +218,7 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf)
|
|||
gboolean
|
||||
gst_tee_factory_init (GstElementFactory *factory)
|
||||
{
|
||||
gst_tee_src_template = tee_src_factory_create ();
|
||||
gst_elementfactory_add_padtemplate (factory, gst_tee_src_template);
|
||||
gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (tee_src_factory));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ libgstelements_la_SOURCES = \
|
|||
gstmultidisksrc.c \
|
||||
gstpipefilter.c \
|
||||
gsttee.c \
|
||||
gstaggregator.c \
|
||||
gstsinesrc.c \
|
||||
$(GSTHTTPSRC)
|
||||
|
||||
|
@ -36,6 +37,7 @@ noinst_HEADERS = \
|
|||
gstfdsink.h \
|
||||
gstpipefilter.h \
|
||||
gsttee.h \
|
||||
gstaggregator.h \
|
||||
gstsinesrc.h
|
||||
|
||||
CFLAGS += -O2 -Wall
|
||||
|
|
229
plugins/elements/gstaggregator.c
Normal file
229
plugins/elements/gstaggregator.c
Normal file
|
@ -0,0 +1,229 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* 2000 Wim Taymans <wim.taymans@chello.be>
|
||||
*
|
||||
* gstaggregator.c: Aggregator 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.
|
||||
*/
|
||||
|
||||
#include "gstaggregator.h"
|
||||
|
||||
|
||||
GstElementDetails gst_aggregator_details = {
|
||||
"Aggregator pipe fitting",
|
||||
"Aggregator",
|
||||
"N-to-1 pipe fitting",
|
||||
VERSION,
|
||||
"Wim Taymans <wim.taymans@chello.be>",
|
||||
"(C) 2001",
|
||||
};
|
||||
|
||||
/* Aggregator signals and args */
|
||||
enum {
|
||||
/* FILL ME */
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_NUM_PADS,
|
||||
ARG_SILENT,
|
||||
/* FILL ME */
|
||||
};
|
||||
|
||||
GST_PADTEMPLATE_FACTORY (aggregator_src_factory,
|
||||
"sink%d",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_REQUEST,
|
||||
NULL /* no caps */
|
||||
);
|
||||
|
||||
static void gst_aggregator_class_init (GstAggregatorClass *klass);
|
||||
static void gst_aggregator_init (GstAggregator *aggregator);
|
||||
|
||||
static GstPad* gst_aggregator_request_new_pad (GstElement *element, GstPadTemplate *temp);
|
||||
|
||||
static void gst_aggregator_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
static void gst_aggregator_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec);
|
||||
|
||||
static void gst_aggregator_chain (GstPad *pad, GstBuffer *buf);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
//static guint gst_aggregator_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GType
|
||||
gst_aggregator_get_type (void)
|
||||
{
|
||||
static GType aggregator_type = 0;
|
||||
|
||||
if (!aggregator_type) {
|
||||
static const GTypeInfo aggregator_info = {
|
||||
sizeof(GstAggregatorClass),
|
||||
NULL,
|
||||
NULL,
|
||||
(GClassInitFunc)gst_aggregator_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof(GstAggregator),
|
||||
0,
|
||||
(GInstanceInitFunc)gst_aggregator_init,
|
||||
};
|
||||
aggregator_type = g_type_register_static (GST_TYPE_ELEMENT, "GstAggregator", &aggregator_info, 0);
|
||||
}
|
||||
return aggregator_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_aggregator_class_init (GstAggregatorClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
|
||||
gobject_class = (GObjectClass*) klass;
|
||||
gstelement_class = (GstElementClass*) klass;
|
||||
|
||||
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
|
||||
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS,
|
||||
g_param_spec_int ("num_pads", "num_pads", "num_pads",
|
||||
0, G_MAXINT, 0, G_PARAM_READABLE));
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
|
||||
g_param_spec_boolean ("silent", "silent", "silent",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
|
||||
gobject_class->set_property = gst_aggregator_set_property;
|
||||
gobject_class->get_property = gst_aggregator_get_property;
|
||||
|
||||
gstelement_class->request_new_pad = gst_aggregator_request_new_pad;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_aggregator_init (GstAggregator *aggregator)
|
||||
{
|
||||
aggregator->srcpad = gst_pad_new ("src", GST_PAD_SINK);
|
||||
gst_element_add_pad (GST_ELEMENT (aggregator), aggregator->srcpad);
|
||||
|
||||
aggregator->numsinkpads = 0;
|
||||
aggregator->sinkpads = NULL;
|
||||
aggregator->silent = FALSE;
|
||||
}
|
||||
|
||||
static GstPad*
|
||||
gst_aggregator_request_new_pad (GstElement *element, GstPadTemplate *templ)
|
||||
{
|
||||
gchar *name;
|
||||
GstPad *sinkpad;
|
||||
GstAggregator *aggregator;
|
||||
|
||||
g_return_val_if_fail (GST_IS_AGGREGATOR (element), NULL);
|
||||
|
||||
if (templ->direction != GST_PAD_SINK) {
|
||||
g_warning ("gstaggregator: request new pad that is not a SRC pad\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
aggregator = GST_AGGREGATOR (element);
|
||||
|
||||
name = g_strdup_printf ("sink%d",aggregator->numsinkpads);
|
||||
|
||||
sinkpad = gst_pad_new_from_template (templ, name);
|
||||
gst_pad_set_chain_function (sinkpad, gst_aggregator_chain);
|
||||
gst_element_add_pad (GST_ELEMENT (aggregator), sinkpad);
|
||||
|
||||
aggregator->sinkpads = g_slist_prepend (aggregator->sinkpads, sinkpad);
|
||||
aggregator->numsinkpads++;
|
||||
|
||||
return sinkpad;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_aggregator_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
GstAggregator *aggregator;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_AGGREGATOR (object));
|
||||
|
||||
aggregator = GST_AGGREGATOR (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case ARG_SILENT:
|
||||
aggregator->silent = g_value_get_boolean (value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_aggregator_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
GstAggregator *aggregator;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_AGGREGATOR (object));
|
||||
|
||||
aggregator = GST_AGGREGATOR (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case ARG_NUM_PADS:
|
||||
g_value_set_int (value, aggregator->numsinkpads);
|
||||
break;
|
||||
case ARG_SILENT:
|
||||
g_value_set_boolean (value, aggregator->silent);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_aggregator_chain:
|
||||
* @pad: the pad to follow
|
||||
* @buf: the buffer to pass
|
||||
*
|
||||
* Chain a buffer on a pad.
|
||||
*/
|
||||
static void
|
||||
gst_aggregator_chain (GstPad *pad, GstBuffer *buf)
|
||||
{
|
||||
GstAggregator *aggregator;
|
||||
|
||||
g_return_if_fail (pad != NULL);
|
||||
g_return_if_fail (GST_IS_PAD (pad));
|
||||
g_return_if_fail (buf != NULL);
|
||||
|
||||
aggregator = GST_AGGREGATOR (gst_pad_get_parent (pad));
|
||||
gst_trace_add_entry (NULL, 0, buf, "aggregator buffer");
|
||||
|
||||
if (!aggregator->silent)
|
||||
g_print("aggregator: chain ******* (%s:%s)a (%d bytes, %llu) \n",
|
||||
GST_DEBUG_PAD_NAME (pad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
|
||||
gst_pad_push (aggregator->srcpad, buf);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_aggregator_factory_init (GstElementFactory *factory)
|
||||
{
|
||||
gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (aggregator_src_factory));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
73
plugins/elements/gstaggregator.h
Normal file
73
plugins/elements/gstaggregator.h
Normal file
|
@ -0,0 +1,73 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* 2000 Wim Taymans <wtay@chello.be>
|
||||
*
|
||||
* gstaggregator.h: Header for GstAggregator element
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __GST_AGGREGATOR_H__
|
||||
#define __GST_AGGREGATOR_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern GstElementDetails gst_aggregator_details;
|
||||
|
||||
#define GST_TYPE_AGGREGATOR \
|
||||
(gst_aggregator_get_type())
|
||||
#define GST_AGGREGATOR(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AGGREGATOR,GstAggregator))
|
||||
#define GST_AGGREGATOR_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AGGREGATOR,GstAggregatorClass))
|
||||
#define GST_IS_AGGREGATOR(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AGGREGATOR))
|
||||
#define GST_IS_AGGREGATOR_CLASS(obj) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AGGREGATOR))
|
||||
|
||||
typedef struct _GstAggregator GstAggregator;
|
||||
typedef struct _GstAggregatorClass GstAggregatorClass;
|
||||
|
||||
struct _GstAggregator {
|
||||
GstElement element;
|
||||
|
||||
GstPad *srcpad;
|
||||
|
||||
gboolean silent;
|
||||
gint numsinkpads;
|
||||
GSList *sinkpads;
|
||||
};
|
||||
|
||||
struct _GstAggregatorClass {
|
||||
GstElementClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_aggregator_get_type (void);
|
||||
|
||||
gboolean gst_aggregator_factory_init (GstElementFactory *factory);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GST_AGGREGATOR_H__ */
|
|
@ -48,16 +48,18 @@ enum {
|
|||
};
|
||||
|
||||
|
||||
static void gst_disksink_class_init (GstDiskSinkClass *klass);
|
||||
static void gst_disksink_init (GstDiskSink *disksink);
|
||||
static void gst_disksink_class_init (GstDiskSinkClass *klass);
|
||||
static void gst_disksink_init (GstDiskSink *disksink);
|
||||
|
||||
static void gst_disksink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gst_disksink_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
static void gst_disksink_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
static void gst_disksink_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec);
|
||||
|
||||
static gboolean gst_disksink_open_file (GstDiskSink *sink);
|
||||
static void gst_disksink_close_file (GstDiskSink *sink);
|
||||
static gboolean gst_disksink_open_file (GstDiskSink *sink);
|
||||
static void gst_disksink_close_file (GstDiskSink *sink);
|
||||
|
||||
static void gst_disksink_chain (GstPad *pad,GstBuffer *buf);
|
||||
static void gst_disksink_chain (GstPad *pad,GstBuffer *buf);
|
||||
|
||||
static GstElementStateReturn gst_disksink_change_state (GstElement *element);
|
||||
|
||||
|
|
|
@ -56,19 +56,21 @@ enum {
|
|||
};
|
||||
|
||||
|
||||
static void gst_disksrc_class_init (GstDiskSrcClass *klass);
|
||||
static void gst_disksrc_class_init (GstDiskSrcClass *klass);
|
||||
static void gst_disksrc_init (GstDiskSrc *disksrc);
|
||||
|
||||
static void gst_disksrc_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gst_disksrc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
static void gst_disksrc_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
static void gst_disksrc_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec);
|
||||
|
||||
static GstBuffer * gst_disksrc_get (GstPad *pad);
|
||||
static GstBuffer * gst_disksrc_get_region (GstPad *pad,GstRegionType type,guint64 offset,guint64 len);
|
||||
static GstBuffer * gst_disksrc_get (GstPad *pad);
|
||||
static GstBuffer * gst_disksrc_get_region (GstPad *pad,GstRegionType type,guint64 offset,guint64 len);
|
||||
|
||||
static GstElementStateReturn gst_disksrc_change_state (GstElement *element);
|
||||
|
||||
static gboolean gst_disksrc_open_file (GstDiskSrc *src);
|
||||
static void gst_disksrc_close_file (GstDiskSrc *src);
|
||||
static gboolean gst_disksrc_open_file (GstDiskSrc *src);
|
||||
static void gst_disksrc_close_file (GstDiskSrc *src);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
//static guint gst_disksrc_signals[LAST_SIGNAL] = { 0 };
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "gstpipefilter.h"
|
||||
#include "gstsinesrc.h"
|
||||
#include "gsttee.h"
|
||||
#include "gstaggregator.h"
|
||||
|
||||
#if HAVE_LIBGHTTP
|
||||
#include <gsthttpsrc.h>
|
||||
|
@ -59,6 +60,7 @@ static struct _elements_entry _elements[] = {
|
|||
{ "pipefilter", gst_pipefilter_get_type, &gst_pipefilter_details, NULL },
|
||||
{ "sinesrc", gst_sinesrc_get_type, &gst_sinesrc_details, gst_sinesrc_factory_init },
|
||||
{ "tee", gst_tee_get_type, &gst_tee_details, gst_tee_factory_init },
|
||||
{ "aggregator", gst_aggregator_get_type, &gst_aggregator_details, gst_aggregator_factory_init },
|
||||
|
||||
#if HAVE_LIBGHTTP
|
||||
{ "httpsrc", gst_httpsrc_get_type, &gst_httpsrc_details, NULL },
|
||||
|
|
|
@ -48,13 +48,15 @@ enum {
|
|||
};
|
||||
|
||||
|
||||
static void gst_fakesink_class_init (GstFakeSinkClass *klass);
|
||||
static void gst_fakesink_init (GstFakeSink *fakesink);
|
||||
static void gst_fakesink_class_init (GstFakeSinkClass *klass);
|
||||
static void gst_fakesink_init (GstFakeSink *fakesink);
|
||||
|
||||
static void gst_fakesink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gst_fakesink_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
static void gst_fakesink_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
static void gst_fakesink_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec);
|
||||
|
||||
static void gst_fakesink_chain (GstPad *pad,GstBuffer *buf);
|
||||
static void gst_fakesink_chain (GstPad *pad, GstBuffer *buf);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
static guint gst_fakesink_signals[LAST_SIGNAL] = { 0 };
|
||||
|
@ -192,7 +194,8 @@ gst_fakesink_chain (GstPad *pad, GstBuffer *buf)
|
|||
|
||||
fakesink = GST_FAKESINK (gst_pad_get_parent (pad));
|
||||
if (!fakesink->silent)
|
||||
g_print("fakesink: ******* (%s:%s)< (%d bytes) \n",GST_DEBUG_PAD_NAME(pad),GST_BUFFER_SIZE(buf));
|
||||
g_print("fakesink: chain ******* (%s:%s)< (%d bytes, %llu) \n",
|
||||
GST_DEBUG_PAD_NAME (pad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
|
||||
g_signal_emit (G_OBJECT (fakesink), gst_fakesink_signals[SIGNAL_HANDOFF], 0,
|
||||
buf);
|
||||
|
|
|
@ -74,14 +74,14 @@ gst_fakesrc_output_get_type(void) {
|
|||
return fakesrc_output_type;
|
||||
}
|
||||
|
||||
static void gst_fakesrc_class_init (GstFakeSrcClass *klass);
|
||||
static void gst_fakesrc_init (GstFakeSrc *fakesrc);
|
||||
static void gst_fakesrc_class_init (GstFakeSrcClass *klass);
|
||||
static void gst_fakesrc_init (GstFakeSrc *fakesrc);
|
||||
|
||||
static void gst_fakesrc_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gst_fakesrc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
|
||||
static GstBuffer* gst_fakesrc_get (GstPad *pad);
|
||||
static void gst_fakesrc_loop (GstElement *element);
|
||||
static GstBuffer* gst_fakesrc_get (GstPad *pad);
|
||||
static void gst_fakesrc_loop (GstElement *element);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
static guint gst_fakesrc_signals[LAST_SIGNAL] = { 0 };
|
||||
|
@ -137,7 +137,7 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
|
|||
TRUE,G_PARAM_READWRITE)); // CHECKME
|
||||
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SILENT,
|
||||
g_param_spec_boolean("silent","silent","silent",
|
||||
TRUE,G_PARAM_READWRITE)); // CHECKME
|
||||
FALSE, G_PARAM_READWRITE)); // CHECKME
|
||||
|
||||
gst_fakesrc_signals[SIGNAL_HANDOFF] =
|
||||
g_signal_newc ("handoff", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
|
||||
|
@ -158,9 +158,9 @@ gst_fakesrc_init (GstFakeSrc *fakesrc)
|
|||
fakesrc->numsrcpads = 1;
|
||||
|
||||
// create our first output pad
|
||||
pad = gst_pad_new("src",GST_PAD_SRC);
|
||||
gst_element_add_pad(GST_ELEMENT(fakesrc),pad);
|
||||
fakesrc->srcpads = g_slist_append(NULL,pad);
|
||||
pad = gst_pad_new ("src", GST_PAD_SRC);
|
||||
gst_element_add_pad (GST_ELEMENT (fakesrc), pad);
|
||||
fakesrc->srcpads = g_slist_append (NULL, pad);
|
||||
|
||||
fakesrc->loop_based = TRUE;
|
||||
|
||||
|
@ -170,6 +170,7 @@ gst_fakesrc_init (GstFakeSrc *fakesrc)
|
|||
gst_pad_set_get_function(pad,gst_fakesrc_get);
|
||||
|
||||
fakesrc->num_buffers = -1;
|
||||
fakesrc->buffer_count = 0;
|
||||
fakesrc->silent = FALSE;
|
||||
// we're ready right away, since we don't have any args...
|
||||
// gst_element_set_state(GST_ELEMENT(fakesrc),GST_STATE_READY);
|
||||
|
@ -211,7 +212,7 @@ gst_fakesrc_set_property (GObject *object, guint prop_id, const GValue *value, G
|
|||
new_numsrcs = g_value_get_int (value);
|
||||
if (new_numsrcs > src->numsrcpads) {
|
||||
while (src->numsrcpads != new_numsrcs) {
|
||||
pad = gst_pad_new(g_strdup_printf("src%d",src->numsrcpads),GST_PAD_SRC);
|
||||
pad = gst_pad_new (g_strdup_printf ("src%d", src->numsrcpads), GST_PAD_SRC);
|
||||
gst_element_add_pad(GST_ELEMENT(src),pad);
|
||||
src->srcpads = g_slist_append(src->srcpads,pad);
|
||||
src->numsrcpads++;
|
||||
|
@ -316,9 +317,12 @@ gst_fakesrc_get(GstPad *pad)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!src->silent)
|
||||
g_print("fakesrc: ******* (%s:%s)> \n",GST_DEBUG_PAD_NAME(pad));
|
||||
buf = gst_buffer_new();
|
||||
GST_BUFFER_TIMESTAMP (buf) = src->buffer_count++;
|
||||
|
||||
if (!src->silent)
|
||||
g_print("fakesrc: get ******* (%s:%s)> (%d bytes, %llu) \n",
|
||||
GST_DEBUG_PAD_NAME (pad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
|
||||
g_signal_emit (G_OBJECT (src), gst_fakesrc_signals[SIGNAL_HANDOFF], 0,
|
||||
buf);
|
||||
|
@ -367,8 +371,11 @@ gst_fakesrc_loop(GstElement *element)
|
|||
}
|
||||
|
||||
buf = gst_buffer_new();
|
||||
GST_BUFFER_TIMESTAMP (buf) = src->buffer_count++;
|
||||
|
||||
if (!src->silent)
|
||||
g_print("fakesrc: ******* (%s:%s)> \n",GST_DEBUG_PAD_NAME(pad));
|
||||
g_print("fakesrc: loop ******* (%s:%s) > (%d bytes, %llu) \n",
|
||||
GST_DEBUG_PAD_NAME (pad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
|
||||
g_signal_emit (G_OBJECT (src), gst_fakesrc_signals[SIGNAL_HANDOFF], 0,
|
||||
buf);
|
||||
|
|
|
@ -72,6 +72,7 @@ struct _GstFakeSrc {
|
|||
gchar *pattern;
|
||||
GList *patternlist;
|
||||
gint num_buffers;
|
||||
guint64 buffer_count;
|
||||
gboolean silent;
|
||||
};
|
||||
|
||||
|
|
|
@ -46,13 +46,15 @@ enum {
|
|||
};
|
||||
|
||||
|
||||
static void gst_fdsink_class_init (GstFdSinkClass *klass);
|
||||
static void gst_fdsink_init (GstFdSink *fdsink);
|
||||
static void gst_fdsink_class_init (GstFdSinkClass *klass);
|
||||
static void gst_fdsink_init (GstFdSink *fdsink);
|
||||
|
||||
static void gst_fdsink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gst_fdsink_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
static void gst_fdsink_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
static void gst_fdsink_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec);
|
||||
|
||||
static void gst_fdsink_chain (GstPad *pad,GstBuffer *buf);
|
||||
static void gst_fdsink_chain (GstPad *pad,GstBuffer *buf);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
//static guint gst_fdsink_signals[LAST_SIGNAL] = { 0 };
|
||||
|
|
|
@ -57,8 +57,10 @@ enum {
|
|||
static void gst_fdsrc_class_init (GstFdSrcClass *klass);
|
||||
static void gst_fdsrc_init (GstFdSrc *fdsrc);
|
||||
|
||||
static void gst_fdsrc_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gst_fdsrc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
static void gst_fdsrc_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
static void gst_fdsrc_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec);
|
||||
|
||||
static GstBuffer * gst_fdsrc_get (GstPad *pad);
|
||||
|
||||
|
|
|
@ -51,17 +51,19 @@ enum {
|
|||
ARG_OFFSET
|
||||
};
|
||||
|
||||
static void gst_httpsrc_class_init (GstHttpSrcClass *klass);
|
||||
static void gst_httpsrc_init (GstHttpSrc *httpsrc);
|
||||
static void gst_httpsrc_class_init (GstHttpSrcClass *klass);
|
||||
static void gst_httpsrc_init (GstHttpSrc *httpsrc);
|
||||
|
||||
static void gst_httpsrc_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gst_httpsrc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
static void gst_httpsrc_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
static void gst_httpsrc_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec);
|
||||
static GstElementStateReturn gst_httpsrc_change_state (GstElement *element);
|
||||
|
||||
static GstBuffer * gst_httpsrc_get (GstPad *pad);
|
||||
static GstBuffer * gst_httpsrc_get (GstPad *pad);
|
||||
|
||||
static gboolean gst_httpsrc_open_url (GstHttpSrc *src);
|
||||
static void gst_httpsrc_close_url (GstHttpSrc *src);
|
||||
static gboolean gst_httpsrc_open_url (GstHttpSrc *src);
|
||||
static void gst_httpsrc_close_url (GstHttpSrc *src);
|
||||
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
|
|
@ -163,7 +163,8 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
|
|||
identity = GST_IDENTITY (gst_pad_get_parent (pad));
|
||||
|
||||
if (!identity->silent)
|
||||
g_print("identity: ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(pad));
|
||||
g_print("identity: chain ******* (%s:%s)i (%d bytes, %llu) \n",
|
||||
GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
|
||||
gst_pad_push (identity->srcpad, buf);
|
||||
|
||||
|
@ -185,7 +186,10 @@ gst_identity_loop (GstElement *element)
|
|||
do {
|
||||
buf = gst_pad_pull (identity->sinkpad);
|
||||
if (!identity->silent)
|
||||
g_print("identity: ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(identity->sinkpad));
|
||||
g_print("identity: loop ******* (%s:%s)i (%d bytes, %llu) \n",
|
||||
GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
|
||||
|
||||
|
||||
|
||||
gst_pad_push (identity->srcpad, buf);
|
||||
|
||||
|
|
|
@ -54,58 +54,56 @@ enum {
|
|||
ARG_BUFFER_SIZE,
|
||||
};
|
||||
|
||||
static GstPadTemplate*
|
||||
sinesrc_src_factory (void)
|
||||
{
|
||||
return
|
||||
gst_padtemplate_new (
|
||||
"src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
gst_caps_new (
|
||||
// FIXME: this is not core business...
|
||||
GST_PADTEMPLATE_FACTORY (sinesrc_src_factory,
|
||||
"src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_CAPS_NEW (
|
||||
"sinesrc_src",
|
||||
"audio/raw",
|
||||
gst_props_new (
|
||||
"format", GST_PROPS_STRING ("int"),
|
||||
"law", GST_PROPS_INT (0),
|
||||
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
|
||||
"signed", GST_PROPS_BOOLEAN (TRUE),
|
||||
"width", GST_PROPS_INT (16),
|
||||
"depth", GST_PROPS_INT (16),
|
||||
"rate", GST_PROPS_INT_RANGE (8000, 48000),
|
||||
"channels", GST_PROPS_INT (1),
|
||||
NULL)),
|
||||
NULL);
|
||||
}
|
||||
"audio/raw",
|
||||
"format", GST_PROPS_STRING ("int"),
|
||||
"law", GST_PROPS_INT (0),
|
||||
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
|
||||
"signed", GST_PROPS_BOOLEAN (TRUE),
|
||||
"width", GST_PROPS_INT (16),
|
||||
"depth", GST_PROPS_INT (16),
|
||||
"rate", GST_PROPS_INT_RANGE (8000, 48000),
|
||||
"channels", GST_PROPS_INT (1)
|
||||
)
|
||||
);
|
||||
|
||||
static GstPadTemplate *src_temp;
|
||||
|
||||
static void gst_sinesrc_class_init(GstSineSrcClass *klass);
|
||||
static void gst_sinesrc_init(GstSineSrc *src);
|
||||
static GstPadNegotiateReturn gst_sinesrc_negotiate (GstPad *pad, GstCaps **caps, gpointer *data);
|
||||
static void gst_sinesrc_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||
static void gst_sinesrc_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||
static void gst_sinesrc_class_init (GstSineSrcClass *klass);
|
||||
static void gst_sinesrc_init (GstSineSrc *src);
|
||||
static GstPadNegotiateReturn gst_sinesrc_negotiate (GstPad *pad, GstCaps **caps, gpointer *data);
|
||||
static void gst_sinesrc_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
static void gst_sinesrc_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec);
|
||||
//static gboolean gst_sinesrc_change_state(GstElement *element,
|
||||
// GstElementState state);
|
||||
//static void gst_sinesrc_close_audio(GstSineSrc *src);
|
||||
//static gboolean gst_sinesrc_open_audio(GstSineSrc *src);
|
||||
static void gst_sinesrc_populate_sinetable(GstSineSrc *src);
|
||||
static inline void gst_sinesrc_update_table_inc(GstSineSrc *src);
|
||||
static inline void gst_sinesrc_update_vol_scale(GstSineSrc *src);
|
||||
static void gst_sinesrc_force_caps(GstSineSrc *src);
|
||||
|
||||
static GstBuffer * gst_sinesrc_get(GstPad *pad);
|
||||
static void gst_sinesrc_populate_sinetable (GstSineSrc *src);
|
||||
static inline void gst_sinesrc_update_table_inc (GstSineSrc *src);
|
||||
static inline void gst_sinesrc_update_vol_scale (GstSineSrc *src);
|
||||
static void gst_sinesrc_force_caps (GstSineSrc *src);
|
||||
|
||||
static GstBuffer* gst_sinesrc_get (GstPad *pad);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
//static guint gst_sinesrc_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GType
|
||||
gst_sinesrc_get_type(void) {
|
||||
gst_sinesrc_get_type (void)
|
||||
{
|
||||
static GType sinesrc_type = 0;
|
||||
|
||||
if (!sinesrc_type) {
|
||||
static const GTypeInfo sinesrc_info = {
|
||||
sizeof(GstSineSrcClass), NULL,
|
||||
sizeof(GstSineSrcClass),
|
||||
NULL,
|
||||
NULL,
|
||||
(GClassInitFunc)gst_sinesrc_class_init,
|
||||
NULL,
|
||||
|
@ -114,13 +112,14 @@ gst_sinesrc_get_type(void) {
|
|||
0,
|
||||
(GInstanceInitFunc)gst_sinesrc_init,
|
||||
};
|
||||
sinesrc_type = g_type_register_static(GST_TYPE_ELEMENT, "GstSineSrc", &sinesrc_info, 0);
|
||||
sinesrc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstSineSrc", &sinesrc_info, 0);
|
||||
}
|
||||
return sinesrc_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_sinesrc_class_init(GstSineSrcClass *klass) {
|
||||
gst_sinesrc_class_init (GstSineSrcClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
|
||||
|
@ -155,10 +154,10 @@ gst_sinesrc_class_init(GstSineSrcClass *klass) {
|
|||
}
|
||||
|
||||
static void
|
||||
gst_sinesrc_init(GstSineSrc *src) {
|
||||
|
||||
src->srcpad = gst_pad_new_from_template (src_temp, "src");
|
||||
|
||||
gst_sinesrc_init (GstSineSrc *src)
|
||||
{
|
||||
src->srcpad = gst_pad_new_from_template (
|
||||
GST_PADTEMPLATE_GET (sinesrc_src_factory), "src");
|
||||
gst_element_add_pad(GST_ELEMENT(src), src->srcpad);
|
||||
gst_pad_set_negotiate_function (src->srcpad, gst_sinesrc_negotiate);
|
||||
|
||||
|
@ -179,7 +178,6 @@ gst_sinesrc_init(GstSineSrc *src) {
|
|||
src->buffer_size=1024;
|
||||
|
||||
src->seq = 0;
|
||||
|
||||
}
|
||||
|
||||
static GstPadNegotiateReturn
|
||||
|
@ -252,7 +250,8 @@ gst_sinesrc_get(GstPad *pad)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_sinesrc_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) {
|
||||
gst_sinesrc_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
GstSineSrc *src;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
|
@ -294,7 +293,8 @@ gst_sinesrc_set_property(GObject *object, guint prop_id, const GValue *value, GP
|
|||
}
|
||||
|
||||
static void
|
||||
gst_sinesrc_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) {
|
||||
gst_sinesrc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
GstSineSrc *src;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
|
@ -350,7 +350,7 @@ static gboolean gst_sinesrc_change_state(GstElement *element,
|
|||
*/
|
||||
|
||||
static void
|
||||
gst_sinesrc_populate_sinetable(GstSineSrc *src)
|
||||
gst_sinesrc_populate_sinetable (GstSineSrc *src)
|
||||
{
|
||||
gint i;
|
||||
gdouble pi2scaled = M_PI * 2 / src->table_size;
|
||||
|
@ -365,13 +365,13 @@ gst_sinesrc_populate_sinetable(GstSineSrc *src)
|
|||
}
|
||||
|
||||
static inline void
|
||||
gst_sinesrc_update_table_inc(GstSineSrc *src)
|
||||
gst_sinesrc_update_table_inc (GstSineSrc *src)
|
||||
{
|
||||
src->table_inc = src->table_size * src->freq / src->samplerate;
|
||||
}
|
||||
|
||||
static inline void
|
||||
gst_sinesrc_update_vol_scale(GstSineSrc *src)
|
||||
gst_sinesrc_update_vol_scale (GstSineSrc *src)
|
||||
{
|
||||
src->vol_scale = 32767 * src->volume;
|
||||
}
|
||||
|
@ -407,8 +407,7 @@ gst_sinesrc_force_caps(GstSineSrc *src) {
|
|||
gboolean
|
||||
gst_sinesrc_factory_init (GstElementFactory *factory)
|
||||
{
|
||||
src_temp = sinesrc_src_factory();
|
||||
gst_elementfactory_add_padtemplate (factory, src_temp);
|
||||
gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (sinesrc_src_factory));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -45,32 +45,27 @@ enum {
|
|||
/* FILL ME */
|
||||
};
|
||||
|
||||
static GstPadTemplate*
|
||||
tee_src_factory_create (void)
|
||||
{
|
||||
return
|
||||
gst_padtemplate_new (
|
||||
"src%d",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_REQUEST,
|
||||
NULL /* no caps */
|
||||
);
|
||||
}
|
||||
|
||||
GST_PADTEMPLATE_FACTORY (tee_src_factory,
|
||||
"src%d",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_REQUEST,
|
||||
NULL /* no caps */
|
||||
);
|
||||
|
||||
static void gst_tee_class_init (GstTeeClass *klass);
|
||||
static void gst_tee_init (GstTee *tee);
|
||||
|
||||
static GstPad* gst_tee_request_new_pad (GstElement *element, GstPadTemplate *temp);
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
static void gst_tee_chain (GstPad *pad, GstBuffer *buf);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
//static guint gst_tee_signals[LAST_SIGNAL] = { 0 };
|
||||
static GstPadTemplate *gst_tee_src_template;
|
||||
|
||||
GType
|
||||
gst_tee_get_type(void) {
|
||||
|
@ -103,9 +98,9 @@ gst_tee_class_init (GstTeeClass *klass)
|
|||
|
||||
parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
|
||||
|
||||
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_NUM_PADS,
|
||||
g_param_spec_int("num_pads","num_pads","num_pads",
|
||||
G_MININT,G_MAXINT,0,G_PARAM_READABLE)); // CHECKME
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS,
|
||||
g_param_spec_int ("num_pads", "num_pads", "num_pads",
|
||||
0, G_MAXINT, 0, G_PARAM_READABLE));
|
||||
|
||||
gobject_class->set_property = gst_tee_set_property;
|
||||
gobject_class->get_property = gst_tee_get_property;
|
||||
|
@ -201,7 +196,7 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf)
|
|||
{
|
||||
GstTee *tee;
|
||||
GSList *srcpads;
|
||||
int i;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (pad != NULL);
|
||||
g_return_if_fail (GST_IS_PAD (pad));
|
||||
|
@ -223,8 +218,7 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf)
|
|||
gboolean
|
||||
gst_tee_factory_init (GstElementFactory *factory)
|
||||
{
|
||||
gst_tee_src_template = tee_src_factory_create ();
|
||||
gst_elementfactory_add_padtemplate (factory, gst_tee_src_template);
|
||||
gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (tee_src_factory));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue