mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 11:10:37 +00:00
Fixes for the new scheduler.
Original commit message from CVS: Fixes for the new scheduler. Autoplug works again with mp3/mpeg1/ogg
This commit is contained in:
parent
1c568619e9
commit
41aa51ba45
15 changed files with 306 additions and 128 deletions
|
@ -42,8 +42,30 @@ enum {
|
|||
ARG_0,
|
||||
ARG_NUM_SOURCES,
|
||||
ARG_LOOP_BASED,
|
||||
ARG_OUTPUT,
|
||||
ARG_PATERN,
|
||||
};
|
||||
|
||||
#define GST_TYPE_FAKESRC_OUTPUT (gst_fakesrc_output_get_type())
|
||||
static GtkType
|
||||
gst_fakesrc_output_get_type(void) {
|
||||
static GtkType fakesrc_output_type = 0;
|
||||
static GtkEnumValue fakesrc_output[] = {
|
||||
{ FAKESRC_FIRST_LAST_LOOP, "1", "First-Last loop"},
|
||||
{ FAKESRC_LAST_FIRST_LOOP, "2", "Last-First loop"},
|
||||
{ FAKESRC_PING_PONG, "3", "Ping-Pong"},
|
||||
{ FAKESRC_ORDERED_RANDOM, "4", "Ordered Random"},
|
||||
{ FAKESRC_RANDOM, "5", "Random"},
|
||||
{ FAKESRC_PATERN_LOOP, "6", "Patern loop"},
|
||||
{ FAKESRC_PING_PONG_PATERN, "7", "Ping-Pong Patern"},
|
||||
{ FAKESRC_GET_ALWAYS_SUCEEDS, "8", "'_get' Always succeeds"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
if (!fakesrc_output_type) {
|
||||
fakesrc_output_type = gtk_type_register_enum("GstFakeSrcOutput", fakesrc_output);
|
||||
}
|
||||
return fakesrc_output_type;
|
||||
}
|
||||
|
||||
static void gst_fakesrc_class_init (GstFakeSrcClass *klass);
|
||||
static void gst_fakesrc_init (GstFakeSrc *fakesrc);
|
||||
|
@ -91,8 +113,12 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
|
|||
|
||||
gtk_object_add_arg_type ("GstFakeSrc::num_sources", GTK_TYPE_INT,
|
||||
GTK_ARG_READWRITE, ARG_NUM_SOURCES);
|
||||
gtk_object_add_arg_type ("GstIdentity::loop_based", GTK_TYPE_BOOL,
|
||||
gtk_object_add_arg_type ("GstFakeSrc::loop_based", GTK_TYPE_BOOL,
|
||||
GTK_ARG_READWRITE, ARG_LOOP_BASED);
|
||||
gtk_object_add_arg_type ("GstFakeSrc::output", GST_TYPE_FAKESRC_OUTPUT,
|
||||
GTK_ARG_READWRITE, ARG_OUTPUT);
|
||||
gtk_object_add_arg_type ("GstFakeSrc::patern", GTK_TYPE_STRING,
|
||||
GTK_ARG_READWRITE, ARG_PATERN);
|
||||
|
||||
gtkobject_class->set_arg = gst_fakesrc_set_arg;
|
||||
gtkobject_class->get_arg = gst_fakesrc_get_arg;
|
||||
|
@ -104,7 +130,6 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
|
|||
|
||||
gtk_object_class_add_signals (gtkobject_class, gst_fakesrc_signals,
|
||||
LAST_SIGNAL);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -116,7 +141,7 @@ gst_fakesrc_init (GstFakeSrc *fakesrc)
|
|||
fakesrc->numsrcpads = 1;
|
||||
|
||||
// create our first output pad
|
||||
pad = gst_pad_new("src",GST_PAD_SRC);
|
||||
pad = gst_pad_new("src1",GST_PAD_SRC);
|
||||
gst_pad_set_get_function(pad,gst_fakesrc_get);
|
||||
gst_element_add_pad(GST_ELEMENT(fakesrc),pad);
|
||||
fakesrc->srcpads = g_slist_append(NULL,pad);
|
||||
|
@ -138,10 +163,10 @@ gst_fakesrc_update_functions (GstFakeSrc *src)
|
|||
|
||||
if (src->loop_based) {
|
||||
gst_element_set_loop_function (GST_ELEMENT (src), gst_fakesrc_loop);
|
||||
gst_fakesrc_set_get_function (pad, NULL);
|
||||
gst_pad_set_get_function (pad, NULL);
|
||||
}
|
||||
else {
|
||||
gst_fakesrc_set_get_function (pad, gst_fakesrc_get);
|
||||
gst_pad_set_get_function (pad, gst_fakesrc_get);
|
||||
gst_element_set_loop_function (GST_ELEMENT (src), NULL);
|
||||
}
|
||||
pads = g_slist_next (pads);
|
||||
|
@ -163,10 +188,10 @@ gst_fakesrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
|||
new_numsrcs = GTK_VALUE_INT (*arg);
|
||||
if (new_numsrcs > src->numsrcpads) {
|
||||
while (src->numsrcpads != new_numsrcs) {
|
||||
src->numsrcpads++;
|
||||
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++;
|
||||
}
|
||||
gst_fakesrc_update_functions (src);
|
||||
}
|
||||
|
@ -175,6 +200,10 @@ gst_fakesrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
|||
src->loop_based = GTK_VALUE_BOOL (*arg);
|
||||
gst_fakesrc_update_functions (src);
|
||||
break;
|
||||
case ARG_OUTPUT:
|
||||
break;
|
||||
case ARG_PATERN:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -197,6 +226,12 @@ gst_fakesrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
|
|||
case ARG_LOOP_BASED:
|
||||
GTK_VALUE_BOOL (*arg) = src->loop_based;
|
||||
break;
|
||||
case ARG_OUTPUT:
|
||||
GTK_VALUE_INT (*arg) = src->output;
|
||||
break;
|
||||
case ARG_PATERN:
|
||||
GTK_VALUE_STRING (*arg) = src->patern;
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
break;
|
||||
|
@ -208,7 +243,9 @@ gst_fakesrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
|
|||
* gst_fakesrc_get:
|
||||
* @src: the faksesrc to get
|
||||
*
|
||||
* generate an empty buffer and push it to the next element.
|
||||
* generate an empty buffer and return it
|
||||
*
|
||||
* Returns: a new empty buffer
|
||||
*/
|
||||
static GstBuffer *
|
||||
gst_fakesrc_get(GstPad *pad)
|
||||
|
@ -230,8 +267,8 @@ gst_fakesrc_get(GstPad *pad)
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_fakesrc_get:
|
||||
* @src: the faksesrc to get
|
||||
* gst_fakesrc_loop:
|
||||
* @element: the faksesrc to loop
|
||||
*
|
||||
* generate an empty buffer and push it to the next element.
|
||||
*/
|
||||
|
|
|
@ -33,6 +33,16 @@ extern "C" {
|
|||
|
||||
GstElementDetails gst_fakesrc_details;
|
||||
|
||||
typedef enum {
|
||||
FAKESRC_FIRST_LAST_LOOP = 1,
|
||||
FAKESRC_LAST_FIRST_LOOP,
|
||||
FAKESRC_PING_PONG,
|
||||
FAKESRC_ORDERED_RANDOM,
|
||||
FAKESRC_RANDOM,
|
||||
FAKESRC_PATERN_LOOP,
|
||||
FAKESRC_PING_PONG_PATERN,
|
||||
FAKESRC_GET_ALWAYS_SUCEEDS,
|
||||
} GstFakeSrcOutputType;
|
||||
|
||||
#define GST_TYPE_FAKESRC \
|
||||
(gst_fakesrc_get_type())
|
||||
|
@ -54,6 +64,9 @@ struct _GstFakeSrc {
|
|||
gboolean loop_based;
|
||||
gint numsrcpads;
|
||||
GSList *srcpads;
|
||||
GstFakeSrcOutputType output;
|
||||
gchar *patern;
|
||||
GList *paternlist;
|
||||
};
|
||||
|
||||
struct _GstFakeSrcClass {
|
||||
|
|
|
@ -176,9 +176,13 @@ construct_path (gst_autoplug_node *rgnNodes, gpointer factory)
|
|||
|
||||
while (current != NULL)
|
||||
{
|
||||
gpointer next;
|
||||
gpointer next = NULL;
|
||||
|
||||
next = rgnNodes[find_factory(rgnNodes, current)].iPrev;
|
||||
if (next) factories = g_list_prepend (factories, current);
|
||||
if (next) {
|
||||
factories = g_list_prepend (factories, current);
|
||||
DEBUG ("%s %p\n", current->name, next);
|
||||
}
|
||||
current = next;
|
||||
}
|
||||
return factories;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#define GST_DEBUG_ENABLED
|
||||
//#define GST_DEBUG_ENABLED
|
||||
|
||||
#include "gstbin.h"
|
||||
#include "gstdebug.h"
|
||||
|
@ -130,6 +130,7 @@ gst_bin_init (GstBin *bin)
|
|||
|
||||
bin->numchildren = 0;
|
||||
bin->children = NULL;
|
||||
bin->chains = NULL;
|
||||
// FIXME temporary testing measure
|
||||
// bin->use_cothreads = TRUE;
|
||||
}
|
||||
|
|
|
@ -99,6 +99,7 @@ gst_element_class_init (GstElementClass *klass)
|
|||
gtk_object_class_add_signals (gtkobject_class, gst_element_signals, LAST_SIGNAL);
|
||||
|
||||
klass->change_state = gst_element_change_state;
|
||||
klass->elementfactory = NULL;
|
||||
|
||||
gtkobject_class->destroy = gst_element_real_destroy;
|
||||
}
|
||||
|
@ -241,6 +242,30 @@ gst_element_get_pad_list (GstElement *element)
|
|||
return element->pads;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_element_get_padtemplate_list:
|
||||
* @element: element to get padtemplates of
|
||||
*
|
||||
* Retrieve a list of the padtemplates associated with the element.
|
||||
*
|
||||
* Returns: GList of padtemplates
|
||||
*/
|
||||
GList*
|
||||
gst_element_get_padtemplate_list (GstElement *element)
|
||||
{
|
||||
GstElementClass *oclass;
|
||||
|
||||
g_return_val_if_fail (element != NULL, NULL);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
||||
|
||||
oclass = GST_ELEMENT_CLASS (GTK_OBJECT (element)->klass);
|
||||
|
||||
if (oclass->elementfactory == NULL) return NULL;
|
||||
|
||||
/* return the list of pads */
|
||||
return oclass->elementfactory->padtemplates;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_element_connect:
|
||||
* @src: element containing source pad
|
||||
|
@ -346,7 +371,9 @@ gst_element_set_state (GstElement *element, GstElementState state)
|
|||
|
||||
/* if that outright didn't work, we need to bail right away */
|
||||
/* NOTE: this will bail on ASYNC as well! */
|
||||
if (return_val != GST_STATE_SUCCESS) return return_val;
|
||||
if (return_val != GST_STATE_SUCCESS &&
|
||||
return_val != GST_STATE_ASYNC)
|
||||
return return_val;
|
||||
}
|
||||
|
||||
/* this is redundant, really, it will always return SUCCESS */
|
||||
|
@ -508,16 +535,6 @@ gst_element_save_thyself (GstElement *element,
|
|||
xmlNewChild (self, NULL, "version", factory->details->version);
|
||||
}
|
||||
|
||||
pads = element->pads;
|
||||
while (pads) {
|
||||
xmlNodePtr padtag = xmlNewChild (self, NULL, "pad", NULL);
|
||||
pad = GST_PAD (pads->data);
|
||||
// figure out if it's a direct pad or a ghostpad
|
||||
if (GST_ELEMENT (pad->parent) == element)
|
||||
gst_pad_save_thyself (pad, padtag);
|
||||
pads = g_list_next (pads);
|
||||
}
|
||||
|
||||
// output all args to the element
|
||||
type = GTK_OBJECT_TYPE (element);
|
||||
while (type != GTK_TYPE_INVALID) {
|
||||
|
@ -582,6 +599,17 @@ gst_element_save_thyself (GstElement *element,
|
|||
type = gtk_type_parent (type);
|
||||
}
|
||||
|
||||
pads = element->pads;
|
||||
while (pads) {
|
||||
xmlNodePtr padtag = xmlNewChild (self, NULL, "pad", NULL);
|
||||
pad = GST_PAD (pads->data);
|
||||
// figure out if it's a direct pad or a ghostpad
|
||||
if (GST_ELEMENT (pad->parent) == element)
|
||||
gst_pad_save_thyself (pad, padtag);
|
||||
pads = g_list_next (pads);
|
||||
}
|
||||
|
||||
|
||||
if (oclass->save_thyself)
|
||||
(oclass->save_thyself)(element, self);
|
||||
|
||||
|
@ -630,14 +658,11 @@ gst_element_load_thyself (xmlNodePtr parent,
|
|||
|
||||
g_hash_table_insert (elements, g_strdup (gst_element_get_name (element)), element);
|
||||
|
||||
// we have the element now, set the arguments and pads
|
||||
// we have the element now, set the arguments
|
||||
children = parent->childs;
|
||||
|
||||
while (children) {
|
||||
if (!strcmp (children->name, "pad")) {
|
||||
gst_pad_load_and_connect (children, GST_OBJECT(element), elements);
|
||||
}
|
||||
else if (!strcmp (children->name, "arg")) {
|
||||
if (!strcmp (children->name, "arg")) {
|
||||
xmlNodePtr child = children->childs;
|
||||
|
||||
while (child) {
|
||||
|
@ -724,6 +749,15 @@ gst_element_load_thyself (xmlNodePtr parent,
|
|||
}
|
||||
children = children->next;
|
||||
}
|
||||
// we have the element now, set the pads
|
||||
children = parent->childs;
|
||||
|
||||
while (children) {
|
||||
if (!strcmp (children->name, "pad")) {
|
||||
gst_pad_load_and_connect (children, GST_OBJECT(element), elements);
|
||||
}
|
||||
children = children->next;
|
||||
}
|
||||
|
||||
oclass = GST_ELEMENT_CLASS (GTK_OBJECT (element)->klass);
|
||||
if (oclass->restore_thyself)
|
||||
|
|
|
@ -192,6 +192,7 @@ GstElement* gst_element_get_manager (GstElement *element);
|
|||
void gst_element_add_pad (GstElement *element, GstPad *pad);
|
||||
GstPad* gst_element_get_pad (GstElement *element, gchar *name);
|
||||
GList* gst_element_get_pad_list (GstElement *element);
|
||||
GList* gst_element_get_padtemplate_list (GstElement *element);
|
||||
void gst_element_add_ghost_pad (GstElement *element, GstPad *pad);
|
||||
|
||||
void gst_element_connect (GstElement *src, gchar *srcpadname,
|
||||
|
|
|
@ -46,7 +46,7 @@ gst_elementfactory_destroy (GstElementFactory *factory)
|
|||
|
||||
_gst_elementfactories = g_list_remove (_gst_elementfactories, factory);
|
||||
|
||||
g_free (factory);
|
||||
// we don't free the struct bacause someone might have a handle to it..
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -159,7 +159,7 @@ gst_elementfactory_create (GstElementFactory *factory,
|
|||
// attempt to set the elemenfactory class pointer if necessary
|
||||
oclass = GST_ELEMENT_CLASS(GTK_OBJECT(element)->klass);
|
||||
if (oclass->elementfactory == NULL) {
|
||||
g_print ("gstelementfactory: class %s\n", factory->name);
|
||||
DEBUG ("gstelementfactory: class %s\n", factory->name);
|
||||
oclass->elementfactory = factory;
|
||||
}
|
||||
|
||||
|
|
116
gst/gstpad.c
116
gst/gstpad.c
|
@ -39,18 +39,17 @@ enum {
|
|||
};
|
||||
|
||||
|
||||
static void gst_pad_class_init(GstPadClass *klass);
|
||||
static void gst_pad_init(GstPad *pad);
|
||||
static void gst_pad_class_init (GstPadClass *klass);
|
||||
static void gst_pad_init (GstPad *pad);
|
||||
|
||||
static void gst_pad_set_arg(GtkObject *object,GtkArg *arg,guint id);
|
||||
static void gst_pad_get_arg(GtkObject *object,GtkArg *arg,guint id);
|
||||
static void gst_pad_set_arg (GtkObject *object,GtkArg *arg,guint id);
|
||||
static void gst_pad_get_arg (GtkObject *object,GtkArg *arg,guint id);
|
||||
|
||||
static void gst_pad_real_destroy(GtkObject *object);
|
||||
static void gst_pad_real_destroy (GtkObject *object);
|
||||
|
||||
static void gst_pad_push_func(GstPad *pad, GstBuffer *buf);
|
||||
static void gst_pad_push_func (GstPad *pad, GstBuffer *buf);
|
||||
|
||||
|
||||
static GstObject *parent_class = NULL;
|
||||
static GstObject *pad_parent_class = NULL;
|
||||
static guint gst_pad_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GtkType
|
||||
|
@ -80,7 +79,7 @@ gst_pad_class_init (GstPadClass *klass)
|
|||
|
||||
gtkobject_class = (GtkObjectClass*)klass;
|
||||
|
||||
parent_class = gtk_type_class(GST_TYPE_OBJECT);
|
||||
pad_parent_class = gtk_type_class(GST_TYPE_OBJECT);
|
||||
|
||||
gst_pad_signals[SET_ACTIVE] =
|
||||
gtk_signal_new ("set_active", GTK_RUN_LAST, gtkobject_class->type,
|
||||
|
@ -119,6 +118,8 @@ gst_pad_init (GstPad *pad)
|
|||
pad->parent = NULL;
|
||||
pad->ghostparents = NULL;
|
||||
pad->caps = NULL;
|
||||
|
||||
pad->padtemplate = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -205,6 +206,7 @@ gst_pad_new_from_template (GstPadTemplate *temp,
|
|||
|
||||
pad = gst_pad_new (name, temp->direction);
|
||||
pad->caps = temp->caps;
|
||||
pad->padtemplate = temp;
|
||||
|
||||
return pad;
|
||||
}
|
||||
|
@ -314,7 +316,7 @@ gst_pad_set_getregion_function (GstPad *pad,
|
|||
g_return_if_fail (pad != NULL);
|
||||
g_return_if_fail (GST_IS_PAD (pad));
|
||||
|
||||
g_print("gstpad: pad setting getregion function\n");
|
||||
DEBUG("gstpad: pad setting getregion function\n");
|
||||
|
||||
pad->getregionfunc = getregion;
|
||||
}
|
||||
|
@ -625,11 +627,11 @@ gst_pad_connect (GstPad *srcpad,
|
|||
g_warning ("gstpad: connecting incompatible pads (%s:%s) and (%s:%s)\n",
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
|
||||
else
|
||||
g_print ("gstpad: connecting compatible pads (%s:%s) and (%s:%s)\n",
|
||||
DEBUG ("gstpad: connecting compatible pads (%s:%s) and (%s:%s)\n",
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
|
||||
}
|
||||
else
|
||||
g_print ("gstpad: could not check capabilities of pads (%s:%s) and (%s:%s)\n",
|
||||
DEBUG ("gstpad: could not check capabilities of pads (%s:%s) and (%s:%s)\n",
|
||||
GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (sinkpad));
|
||||
|
||||
/* first set peers */
|
||||
|
@ -910,6 +912,53 @@ gst_pad_ghost_save_thyself (GstPad *pad,
|
|||
return self;
|
||||
}
|
||||
|
||||
#ifndef gst_pad_push
|
||||
void gst_pad_push(GstPad *pad,GstBuffer *buf) {
|
||||
DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad));
|
||||
if (pad->peer->pushfunc) {
|
||||
DEBUG("calling pushfunc &%s of peer pad %s:%s\n",
|
||||
GST_DEBUG_FUNCPTR_NAME(pad->peer->pushfunc),GST_DEBUG_PAD_NAME(pad->peer));
|
||||
(pad->peer->pushfunc)(pad->peer,buf);
|
||||
} else
|
||||
DEBUG("no pushfunc\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef gst_pad_pull
|
||||
GstBuffer *gst_pad_pull(GstPad *pad) {
|
||||
GstPad *peer = pad->peer;
|
||||
DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad));
|
||||
if (peer->pullfunc) {
|
||||
DEBUG("calling pullfunc &%s (@%p) of peer pad %s:%s\n",
|
||||
GST_DEBUG_FUNCPTR_NAME(peer->pullfunc),&peer->pullfunc,GST_DEBUG_PAD_NAME(peer));
|
||||
return (peer->pullfunc)(peer);
|
||||
} else {
|
||||
DEBUG("no pullfunc for peer pad %s:%s at %p\n",GST_DEBUG_PAD_NAME(peer),&peer->pullfunc);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef gst_pad_pullregion
|
||||
GstBuffer *gst_pad_pullregion(GstPad *pad,gulong offset,gulong size) {
|
||||
DEBUG_ENTER("(%s:%s,%ld,%ld)",GST_DEBUG_PAD_NAME(pad),offset,size);
|
||||
if (pad->peer->pullregionfunc) {
|
||||
DEBUG("calling pullregionfunc &%s of peer pad %s:%s\n",
|
||||
GST_DEBUG_FUNCPTR_NAME(pad->peer->pullregionfunc),GST_DEBUG_PAD_NAME(pad->peer));
|
||||
return (pad->peer->pullregionfunc)(pad->peer,offset,size);
|
||||
} else {
|
||||
DEBUG("no pullregionfunc\n");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* templates
|
||||
*
|
||||
*/
|
||||
|
||||
GstPadTemplate*
|
||||
gst_padtemplate_new (GstPadFactory *factory)
|
||||
{
|
||||
|
@ -1008,46 +1057,3 @@ gst_padtemplate_load_thyself (xmlNodePtr parent)
|
|||
return factory;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef gst_pad_push
|
||||
void gst_pad_push(GstPad *pad,GstBuffer *buf) {
|
||||
DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad));
|
||||
if (pad->peer->pushfunc) {
|
||||
DEBUG("calling pushfunc &%s of peer pad %s:%s\n",
|
||||
GST_DEBUG_FUNCPTR_NAME(pad->peer->pushfunc),GST_DEBUG_PAD_NAME(pad->peer));
|
||||
(pad->peer->pushfunc)(pad->peer,buf);
|
||||
} else
|
||||
DEBUG("no pushfunc\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef gst_pad_pull
|
||||
GstBuffer *gst_pad_pull(GstPad *pad) {
|
||||
GstPad *peer = pad->peer;
|
||||
DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad));
|
||||
if (peer->pullfunc) {
|
||||
DEBUG("calling pullfunc &%s (@%p) of peer pad %s:%s\n",
|
||||
GST_DEBUG_FUNCPTR_NAME(peer->pullfunc),&peer->pullfunc,GST_DEBUG_PAD_NAME(peer));
|
||||
return (peer->pullfunc)(peer);
|
||||
} else {
|
||||
DEBUG("no pullfunc for peer pad %s:%s at %p\n",GST_DEBUG_PAD_NAME(peer),&peer->pullfunc);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef gst_pad_pullregion
|
||||
GstBuffer *gst_pad_pullregion(GstPad *pad,gulong offset,gulong size) {
|
||||
DEBUG_ENTER("(%s:%s,%ld,%ld)",GST_DEBUG_PAD_NAME(pad),offset,size);
|
||||
if (pad->peer->pullregionfunc) {
|
||||
DEBUG("calling pullregionfunc &%s of peer pad %s:%s\n",
|
||||
GST_DEBUG_FUNCPTR_NAME(pad->peer->pullregionfunc),GST_DEBUG_PAD_NAME(pad->peer));
|
||||
return (pad->peer->pullregionfunc)(pad->peer,offset,size);
|
||||
} else {
|
||||
DEBUG("no pullregionfunc\n");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
28
gst/gstpad.h
28
gst/gstpad.h
|
@ -47,6 +47,8 @@ extern "C" {
|
|||
|
||||
typedef struct _GstPad GstPad;
|
||||
typedef struct _GstPadClass GstPadClass;
|
||||
typedef struct _GstPadTemplate GstPadTemplate;
|
||||
typedef struct _GstPadTemplateClass GstPadTemplateClass;
|
||||
|
||||
/* this defines the functions used to chain buffers
|
||||
* pad is the sink pad (so the same chain function can be used for N pads)
|
||||
|
@ -98,6 +100,8 @@ struct _GstPad {
|
|||
|
||||
GstObject *parent;
|
||||
GList *ghostparents;
|
||||
|
||||
GstPadTemplate *padtemplate; // the template for this pad
|
||||
};
|
||||
|
||||
struct _GstPadClass {
|
||||
|
@ -109,21 +113,35 @@ struct _GstPadClass {
|
|||
void (*eos) (GstPad *pad);
|
||||
};
|
||||
|
||||
/* template */
|
||||
#define GST_TYPE_PADTEMPLATE (gst_padtemplate_get_type ())
|
||||
#define GST_PADTEMPLATE(obj) (GTK_CHECK_CAST ((obj), GST_TYPE_PADTEMPLATE,GstPad))
|
||||
#define GST_PADTEMPLATE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GST_TYPE_PADTEMPLATE,GstPadClass))
|
||||
#define GST_IS_PADTEMPLATE(obj) (GTK_CHECK_TYPE ((obj), GST_TYPE_PADTEMPLATE))
|
||||
#define GST_IS_PADTEMPLATE_CLASS(obj) (GTK_CHECK_CLASS_TYPE ((klass), GST_TYPE_PADTEMPLATE))
|
||||
|
||||
typedef enum {
|
||||
GST_PAD_ALWAYS,
|
||||
GST_PAD_SOMETIMES,
|
||||
} GstPadPresence;
|
||||
|
||||
typedef struct _GstPadTemplate GstPadTemplate;
|
||||
|
||||
/* template */
|
||||
struct _GstPadTemplate {
|
||||
GstObject object;
|
||||
|
||||
gchar *name_template;
|
||||
GstPadDirection direction;
|
||||
GstPadPresence presence;
|
||||
GstCaps *caps;
|
||||
};
|
||||
|
||||
struct _GstPadTemplateClass {
|
||||
GstObjectClass parent_class;
|
||||
|
||||
/* signal callbacks */
|
||||
void (*pad_created) (GstPadTemplate *temp, GstPad *pad);
|
||||
};
|
||||
|
||||
|
||||
/* factory */
|
||||
typedef gpointer GstPadFactoryEntry;
|
||||
typedef GstPadFactoryEntry GstPadFactory[];
|
||||
|
@ -186,7 +204,9 @@ xmlNodePtr gst_pad_save_thyself (GstPad *pad, xmlNodePtr parent);
|
|||
void gst_pad_load_and_connect (xmlNodePtr parent, GstObject *element, GHashTable *elements);
|
||||
|
||||
|
||||
/* factory */
|
||||
/* templates and factories */
|
||||
GtkType gst_padtemplate_get_type (void);
|
||||
|
||||
GstPadTemplate* gst_padtemplate_new (GstPadFactory *factory);
|
||||
GstPadTemplate* gst_padtemplate_create (gchar *name_template,
|
||||
GstPadDirection direction, GstPadPresence presence,
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
//#define GST_DEBUG_ENABLED
|
||||
|
||||
#include "gstdebug.h"
|
||||
#include "gstpipeline.h"
|
||||
#include "gstthread.h"
|
||||
#include "gstsink.h"
|
||||
|
@ -119,14 +122,14 @@ gst_pipeline_new (guchar *name)
|
|||
static void
|
||||
gst_pipeline_prepare (GstPipeline *pipeline)
|
||||
{
|
||||
g_print("GstPipeline: preparing pipeline \"%s\" for playing\n",
|
||||
DEBUG("GstPipeline: preparing pipeline \"%s\" for playing\n",
|
||||
gst_element_get_name(GST_ELEMENT(pipeline)));
|
||||
}
|
||||
|
||||
static void
|
||||
gst_pipeline_have_type (GstSink *sink, GstSink *sink2, gpointer data)
|
||||
{
|
||||
g_print("GstPipeline: pipeline have type %p\n", (gboolean *)data);
|
||||
DEBUG("GstPipeline: pipeline have type %p\n", (gboolean *)data);
|
||||
|
||||
*(gboolean *)data = TRUE;
|
||||
}
|
||||
|
@ -138,7 +141,7 @@ gst_pipeline_typefind (GstPipeline *pipeline, GstElement *element)
|
|||
GstElement *typefind;
|
||||
GstCaps *caps = NULL;
|
||||
|
||||
g_print("GstPipeline: typefind for element \"%s\" %p\n",
|
||||
DEBUG("GstPipeline: typefind for element \"%s\" %p\n",
|
||||
gst_element_get_name(element), &found);
|
||||
|
||||
typefind = gst_elementfactory_make ("typefind", "typefind");
|
||||
|
@ -183,7 +186,7 @@ gst_pipeline_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink)
|
|||
GList *sinkpads;
|
||||
gboolean connected = FALSE;
|
||||
|
||||
g_print("gstpipeline: autoplug pad connect function for \"%s\" to \"%s\"\n",
|
||||
DEBUG("gstpipeline: autoplug pad connect function for \"%s\" to \"%s\"\n",
|
||||
gst_element_get_name(src), gst_element_get_name(sink));
|
||||
|
||||
sinkpads = gst_element_get_pad_list(sink);
|
||||
|
@ -196,9 +199,9 @@ gst_pipeline_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink)
|
|||
{
|
||||
if (gst_caps_check_compatibility (pad->caps, sinkpad->caps)) {
|
||||
gst_pad_connect(pad, sinkpad);
|
||||
g_print("gstpipeline: autoconnect pad \"%s\" in element %s <-> ", pad->name,
|
||||
DEBUG("gstpipeline: autoconnect pad \"%s\" in element %s <-> ", pad->name,
|
||||
gst_element_get_name(src));
|
||||
g_print("pad \"%s\" in element %s\n", sinkpad->name,
|
||||
DEBUG("pad \"%s\" in element %s\n", sinkpad->name,
|
||||
gst_element_get_name(sink));
|
||||
connected = TRUE;
|
||||
break;
|
||||
|
@ -208,7 +211,7 @@ gst_pipeline_pads_autoplug_func (GstElement *src, GstPad *pad, GstElement *sink)
|
|||
}
|
||||
|
||||
if (!connected) {
|
||||
g_print("gstpipeline: no path to sinks for type\n");
|
||||
DEBUG("gstpipeline: no path to sinks for type\n");
|
||||
}
|
||||
return connected;
|
||||
}
|
||||
|
@ -231,7 +234,7 @@ gst_pipeline_pads_autoplug (GstElement *src, GstElement *sink)
|
|||
}
|
||||
|
||||
if (!connected) {
|
||||
g_print("gstpipeline: delaying pad connections for \"%s\" to \"%s\"\n",
|
||||
DEBUG("gstpipeline: delaying pad connections for \"%s\" to \"%s\"\n",
|
||||
gst_element_get_name(src), gst_element_get_name(sink));
|
||||
gtk_signal_connect(GTK_OBJECT(src),"new_pad",
|
||||
GTK_SIGNAL_FUNC(gst_pipeline_pads_autoplug_func), sink);
|
||||
|
@ -310,28 +313,28 @@ gst_pipeline_autoplug (GstPipeline *pipeline)
|
|||
g_return_val_if_fail(pipeline != NULL, FALSE);
|
||||
g_return_val_if_fail(GST_IS_PIPELINE(pipeline), FALSE);
|
||||
|
||||
g_print("GstPipeline: autopluging pipeline \"%s\"\n",
|
||||
DEBUG("GstPipeline: autopluging pipeline \"%s\"\n",
|
||||
gst_element_get_name(GST_ELEMENT(pipeline)));
|
||||
|
||||
|
||||
// fase 1, run typedetect on the source if needed...
|
||||
if (!pipeline->src) {
|
||||
g_print("GstPipeline: no source detected, can't autoplug pipeline \"%s\"\n",
|
||||
DEBUG("GstPipeline: no source detected, can't autoplug pipeline \"%s\"\n",
|
||||
gst_element_get_name(GST_ELEMENT(pipeline)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_print("GstPipeline: source \"%s\" has no MIME type, running typefind...\n",
|
||||
DEBUG("GstPipeline: source \"%s\" has no MIME type, running typefind...\n",
|
||||
gst_element_get_name(pipeline->src));
|
||||
|
||||
src_caps = gst_pipeline_typefind(pipeline, pipeline->src);
|
||||
|
||||
if (src_caps) {
|
||||
g_print("GstPipeline: source \"%s\" type found %d\n", gst_element_get_name(pipeline->src),
|
||||
DEBUG("GstPipeline: source \"%s\" type found %d\n", gst_element_get_name(pipeline->src),
|
||||
src_caps->id);
|
||||
}
|
||||
else {
|
||||
g_print("GstPipeline: source \"%s\" has no type\n", gst_element_get_name(pipeline->src));
|
||||
DEBUG("GstPipeline: source \"%s\" has no type\n", gst_element_get_name(pipeline->src));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -372,7 +375,7 @@ gst_pipeline_autoplug (GstPipeline *pipeline)
|
|||
}
|
||||
factory = (GstElementFactory *)(factories[0]->data);
|
||||
|
||||
g_print("GstPipeline: common factory \"%s\"\n", factory->name);
|
||||
DEBUG("common factory \"%s\"\n", factory->name);
|
||||
|
||||
element = gst_elementfactory_create(factory, factory->name);
|
||||
gst_bin_add(GST_BIN(pipeline), element);
|
||||
|
@ -406,7 +409,7 @@ differ:
|
|||
|
||||
if (factories[i]) {
|
||||
factory = (GstElementFactory *)(factories[i]->data);
|
||||
g_print("GstPipeline: factory \"%s\"\n", factory->name);
|
||||
DEBUG("factory \"%s\"\n", factory->name);
|
||||
element = gst_elementfactory_create(factory, factory->name);
|
||||
factories[i] = g_list_next(factories[i]);
|
||||
}
|
||||
|
@ -424,10 +427,11 @@ differ:
|
|||
|
||||
use_thread = FALSE;
|
||||
|
||||
g_print("GstPipeline: sugest new thread for \"%s\" %08x\n", element->name, GST_FLAGS(element));
|
||||
DEBUG("sugest new thread for \"%s\" %08x\n", element->name, GST_FLAGS(element));
|
||||
|
||||
// create a new queue and add to the previous bin
|
||||
queue = gst_elementfactory_make("queue", g_strconcat("queue_", gst_element_get_name(element), NULL));
|
||||
DEBUG("adding element \"%s\"\n", element->name);
|
||||
gst_bin_add(GST_BIN(thebin), queue);
|
||||
|
||||
// this will be the new bin for all following elements
|
||||
|
@ -453,12 +457,15 @@ differ:
|
|||
}
|
||||
gst_pipeline_pads_autoplug(thesrcelement, queue);
|
||||
|
||||
DEBUG("adding element %s\n", gst_element_get_name (element));
|
||||
gst_bin_add(GST_BIN(thebin), element);
|
||||
DEBUG("adding element %s\n", gst_element_get_name (thebin));
|
||||
gst_bin_add(GST_BIN(pipeline), thebin);
|
||||
thesrcelement = queue;
|
||||
}
|
||||
// no thread needed, easy case
|
||||
else {
|
||||
DEBUG("adding element %s\n", gst_element_get_name (element));
|
||||
gst_bin_add(GST_BIN(thebin), element);
|
||||
}
|
||||
gst_pipeline_pads_autoplug(thesrcelement, element);
|
||||
|
@ -472,7 +479,7 @@ next:
|
|||
}
|
||||
return TRUE;
|
||||
|
||||
g_print("GstPipeline: unable to autoplug pipeline \"%s\"\n",
|
||||
DEBUG("GstPipeline: unable to autoplug pipeline \"%s\"\n",
|
||||
gst_element_get_name(GST_ELEMENT(pipeline)));
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "gstdebug.h"
|
||||
#include "gstplugin.h"
|
||||
|
||||
|
||||
|
@ -82,7 +83,7 @@ _gst_plugin_initialize (void)
|
|||
doc = xmlParseFile ("/etc/gstreamer/reg.xml");
|
||||
|
||||
if (!doc || strcmp (doc->root->name, "GST-PluginRegistry")) {
|
||||
g_print ("gstplugin: registry needs rebuild\n");
|
||||
g_warning ("gstplugin: registry needs rebuild\n");
|
||||
gst_plugin_load_all ();
|
||||
return;
|
||||
}
|
||||
|
@ -183,6 +184,7 @@ gst_plugin_remove (GstPlugin *plugin)
|
|||
gst_elementfactory_destroy ((GstElementFactory*)(factories->data));
|
||||
factories = g_list_next(factories);
|
||||
}
|
||||
|
||||
_gst_plugins = g_list_remove(_gst_plugins, plugin);
|
||||
g_free (plugin);
|
||||
}
|
||||
|
@ -244,7 +246,7 @@ gst_plugin_load_absolute (gchar *name)
|
|||
struct stat file_status;
|
||||
|
||||
if (g_module_supported() == FALSE) {
|
||||
g_print("gstplugin: wow, you built this on a platform without dynamic loading???\n");
|
||||
g_warning("gstplugin: wow, you built this on a platform without dynamic loading???\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -257,7 +259,7 @@ gst_plugin_load_absolute (gchar *name)
|
|||
if (module != NULL) {
|
||||
if (g_module_symbol(module,"plugin_init",(gpointer *)&initfunc)) {
|
||||
if ((plugin = (initfunc)(module))) {
|
||||
g_print("gstplugin: plugin %s loaded\n", plugin->name);
|
||||
DEBUG("gstplugin: plugin %s loaded\n", plugin->name);
|
||||
plugin->filename = g_strdup(name);
|
||||
plugin->loaded = TRUE;
|
||||
_gst_modules = g_list_prepend(_gst_modules,module);
|
||||
|
@ -404,14 +406,14 @@ gst_plugin_load_elementfactory (gchar *name)
|
|||
if (!strcmp(factory->name,name)) {
|
||||
if (!plugin->loaded) {
|
||||
gchar *filename = g_strdup (plugin->filename);
|
||||
g_print("gstplugin: loading element factory %s from plugin %s\n", name, plugin->name);
|
||||
DEBUG("gstplugin: loading element factory %s from plugin %s\n", name, plugin->name);
|
||||
gst_plugin_remove(plugin);
|
||||
if (!gst_plugin_load_absolute(filename)) {
|
||||
g_print("gstplugin: error loading element factory %s from plugin %s\n", name, plugin->name);
|
||||
DEBUG("gstplugin: error loading element factory %s from plugin %s\n", name, plugin->name);
|
||||
}
|
||||
g_free (filename);
|
||||
factory = gst_plugin_find_elementfactory(name);
|
||||
}
|
||||
factory = gst_plugin_find_elementfactory(name);
|
||||
return factory;
|
||||
}
|
||||
factories = g_list_next(factories);
|
||||
|
@ -446,10 +448,10 @@ gst_plugin_load_typefactory (gchar *mime)
|
|||
if (!strcmp(factory->mime,mime)) {
|
||||
if (!plugin->loaded) {
|
||||
gchar *filename = g_strdup (plugin->filename);
|
||||
g_print("gstplugin: loading type factory for \"%s\" from plugin %s\n", mime, plugin->name);
|
||||
DEBUG("gstplugin: loading type factory for \"%s\" from plugin %s\n", mime, plugin->name);
|
||||
gst_plugin_remove(plugin);
|
||||
if (!gst_plugin_load_absolute(filename)) {
|
||||
g_print("gstplugin: error loading type factory \"%s\" from plugin %s\n", mime, plugin->name);
|
||||
DEBUG("gstplugin: error loading type factory \"%s\" from plugin %s\n", mime, plugin->name);
|
||||
}
|
||||
g_free (filename);
|
||||
}
|
||||
|
@ -616,6 +618,6 @@ gst_plugin_load_thyself (xmlNodePtr parent)
|
|||
|
||||
kinderen = kinderen->next;
|
||||
}
|
||||
g_print("gstplugin: added %d registered factories and %d types\n", elementcount, typecount);
|
||||
DEBUG("gstplugin: added %d registered factories and %d types\n", elementcount, typecount);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#define GST_DEBUG_ENABLED
|
||||
//#define GST_DEBUG_ENABLED
|
||||
|
||||
#include "gstscheduler.h"
|
||||
#include "gstdebug.h"
|
||||
|
@ -268,6 +268,7 @@ gst_schedule_chained_chain (GstBin *bin, _GstBinChain *chain) {
|
|||
GList *pads;
|
||||
GstPad *pad;
|
||||
|
||||
DEBUG("chain entered\n");
|
||||
// walk through all the elements
|
||||
elements = chain->elements;
|
||||
while (elements) {
|
||||
|
@ -306,8 +307,9 @@ static void gst_bin_schedule_cleanup(GstBin *bin) {
|
|||
|
||||
g_free(chain);
|
||||
}
|
||||
|
||||
g_list_free(bin->chains);
|
||||
|
||||
bin->chains = NULL;
|
||||
}
|
||||
|
||||
void gst_bin_schedule_func(GstBin *bin) {
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#include "gstdebug.h"
|
||||
#include "gsttype.h"
|
||||
#include "gstplugin.h"
|
||||
|
||||
|
@ -64,7 +65,7 @@ gst_type_register (GstTypeFactory *factory)
|
|||
|
||||
g_return_val_if_fail (factory != NULL, 0);
|
||||
|
||||
//g_print("gsttype: type register %s\n", factory->mime);
|
||||
DEBUG("type register %s\n", factory->mime);
|
||||
id = gst_type_find_by_mime (factory->mime);
|
||||
|
||||
if (!id) {
|
||||
|
@ -227,7 +228,7 @@ gst_type_typefind_dummy (GstBuffer *buffer, gpointer priv)
|
|||
guint16 typeid;
|
||||
GSList *funcs;
|
||||
|
||||
g_print ("gsttype: need to load typefind function\n");
|
||||
DEBUG ("gsttype: need to load typefind function for %s\n", type->mime);
|
||||
|
||||
type->typefindfuncs = NULL;
|
||||
gst_plugin_load_typefactory (type->mime);
|
||||
|
|
|
@ -42,8 +42,30 @@ enum {
|
|||
ARG_0,
|
||||
ARG_NUM_SOURCES,
|
||||
ARG_LOOP_BASED,
|
||||
ARG_OUTPUT,
|
||||
ARG_PATERN,
|
||||
};
|
||||
|
||||
#define GST_TYPE_FAKESRC_OUTPUT (gst_fakesrc_output_get_type())
|
||||
static GtkType
|
||||
gst_fakesrc_output_get_type(void) {
|
||||
static GtkType fakesrc_output_type = 0;
|
||||
static GtkEnumValue fakesrc_output[] = {
|
||||
{ FAKESRC_FIRST_LAST_LOOP, "1", "First-Last loop"},
|
||||
{ FAKESRC_LAST_FIRST_LOOP, "2", "Last-First loop"},
|
||||
{ FAKESRC_PING_PONG, "3", "Ping-Pong"},
|
||||
{ FAKESRC_ORDERED_RANDOM, "4", "Ordered Random"},
|
||||
{ FAKESRC_RANDOM, "5", "Random"},
|
||||
{ FAKESRC_PATERN_LOOP, "6", "Patern loop"},
|
||||
{ FAKESRC_PING_PONG_PATERN, "7", "Ping-Pong Patern"},
|
||||
{ FAKESRC_GET_ALWAYS_SUCEEDS, "8", "'_get' Always succeeds"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
if (!fakesrc_output_type) {
|
||||
fakesrc_output_type = gtk_type_register_enum("GstFakeSrcOutput", fakesrc_output);
|
||||
}
|
||||
return fakesrc_output_type;
|
||||
}
|
||||
|
||||
static void gst_fakesrc_class_init (GstFakeSrcClass *klass);
|
||||
static void gst_fakesrc_init (GstFakeSrc *fakesrc);
|
||||
|
@ -91,8 +113,12 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
|
|||
|
||||
gtk_object_add_arg_type ("GstFakeSrc::num_sources", GTK_TYPE_INT,
|
||||
GTK_ARG_READWRITE, ARG_NUM_SOURCES);
|
||||
gtk_object_add_arg_type ("GstIdentity::loop_based", GTK_TYPE_BOOL,
|
||||
gtk_object_add_arg_type ("GstFakeSrc::loop_based", GTK_TYPE_BOOL,
|
||||
GTK_ARG_READWRITE, ARG_LOOP_BASED);
|
||||
gtk_object_add_arg_type ("GstFakeSrc::output", GST_TYPE_FAKESRC_OUTPUT,
|
||||
GTK_ARG_READWRITE, ARG_OUTPUT);
|
||||
gtk_object_add_arg_type ("GstFakeSrc::patern", GTK_TYPE_STRING,
|
||||
GTK_ARG_READWRITE, ARG_PATERN);
|
||||
|
||||
gtkobject_class->set_arg = gst_fakesrc_set_arg;
|
||||
gtkobject_class->get_arg = gst_fakesrc_get_arg;
|
||||
|
@ -104,7 +130,6 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
|
|||
|
||||
gtk_object_class_add_signals (gtkobject_class, gst_fakesrc_signals,
|
||||
LAST_SIGNAL);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -116,7 +141,7 @@ gst_fakesrc_init (GstFakeSrc *fakesrc)
|
|||
fakesrc->numsrcpads = 1;
|
||||
|
||||
// create our first output pad
|
||||
pad = gst_pad_new("src",GST_PAD_SRC);
|
||||
pad = gst_pad_new("src1",GST_PAD_SRC);
|
||||
gst_pad_set_get_function(pad,gst_fakesrc_get);
|
||||
gst_element_add_pad(GST_ELEMENT(fakesrc),pad);
|
||||
fakesrc->srcpads = g_slist_append(NULL,pad);
|
||||
|
@ -138,10 +163,10 @@ gst_fakesrc_update_functions (GstFakeSrc *src)
|
|||
|
||||
if (src->loop_based) {
|
||||
gst_element_set_loop_function (GST_ELEMENT (src), gst_fakesrc_loop);
|
||||
gst_fakesrc_set_get_function (pad, NULL);
|
||||
gst_pad_set_get_function (pad, NULL);
|
||||
}
|
||||
else {
|
||||
gst_fakesrc_set_get_function (pad, gst_fakesrc_get);
|
||||
gst_pad_set_get_function (pad, gst_fakesrc_get);
|
||||
gst_element_set_loop_function (GST_ELEMENT (src), NULL);
|
||||
}
|
||||
pads = g_slist_next (pads);
|
||||
|
@ -163,10 +188,10 @@ gst_fakesrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
|||
new_numsrcs = GTK_VALUE_INT (*arg);
|
||||
if (new_numsrcs > src->numsrcpads) {
|
||||
while (src->numsrcpads != new_numsrcs) {
|
||||
src->numsrcpads++;
|
||||
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++;
|
||||
}
|
||||
gst_fakesrc_update_functions (src);
|
||||
}
|
||||
|
@ -175,6 +200,10 @@ gst_fakesrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
|||
src->loop_based = GTK_VALUE_BOOL (*arg);
|
||||
gst_fakesrc_update_functions (src);
|
||||
break;
|
||||
case ARG_OUTPUT:
|
||||
break;
|
||||
case ARG_PATERN:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -197,6 +226,12 @@ gst_fakesrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
|
|||
case ARG_LOOP_BASED:
|
||||
GTK_VALUE_BOOL (*arg) = src->loop_based;
|
||||
break;
|
||||
case ARG_OUTPUT:
|
||||
GTK_VALUE_INT (*arg) = src->output;
|
||||
break;
|
||||
case ARG_PATERN:
|
||||
GTK_VALUE_STRING (*arg) = src->patern;
|
||||
break;
|
||||
default:
|
||||
arg->type = GTK_TYPE_INVALID;
|
||||
break;
|
||||
|
@ -208,7 +243,9 @@ gst_fakesrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
|
|||
* gst_fakesrc_get:
|
||||
* @src: the faksesrc to get
|
||||
*
|
||||
* generate an empty buffer and push it to the next element.
|
||||
* generate an empty buffer and return it
|
||||
*
|
||||
* Returns: a new empty buffer
|
||||
*/
|
||||
static GstBuffer *
|
||||
gst_fakesrc_get(GstPad *pad)
|
||||
|
@ -230,8 +267,8 @@ gst_fakesrc_get(GstPad *pad)
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_fakesrc_get:
|
||||
* @src: the faksesrc to get
|
||||
* gst_fakesrc_loop:
|
||||
* @element: the faksesrc to loop
|
||||
*
|
||||
* generate an empty buffer and push it to the next element.
|
||||
*/
|
||||
|
|
|
@ -33,6 +33,16 @@ extern "C" {
|
|||
|
||||
GstElementDetails gst_fakesrc_details;
|
||||
|
||||
typedef enum {
|
||||
FAKESRC_FIRST_LAST_LOOP = 1,
|
||||
FAKESRC_LAST_FIRST_LOOP,
|
||||
FAKESRC_PING_PONG,
|
||||
FAKESRC_ORDERED_RANDOM,
|
||||
FAKESRC_RANDOM,
|
||||
FAKESRC_PATERN_LOOP,
|
||||
FAKESRC_PING_PONG_PATERN,
|
||||
FAKESRC_GET_ALWAYS_SUCEEDS,
|
||||
} GstFakeSrcOutputType;
|
||||
|
||||
#define GST_TYPE_FAKESRC \
|
||||
(gst_fakesrc_get_type())
|
||||
|
@ -54,6 +64,9 @@ struct _GstFakeSrc {
|
|||
gboolean loop_based;
|
||||
gint numsrcpads;
|
||||
GSList *srcpads;
|
||||
GstFakeSrcOutputType output;
|
||||
gchar *patern;
|
||||
GList *paternlist;
|
||||
};
|
||||
|
||||
struct _GstFakeSrcClass {
|
||||
|
|
Loading…
Reference in a new issue