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);
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;
gtk_object_class_add_signals (gtkobject_class, gst_fakesrc_signals,
LAST_SIGNAL);
-
}
static void
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);
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);
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);
}
src->loop_based = GTK_VALUE_BOOL (*arg);
gst_fakesrc_update_functions (src);
break;
+ case ARG_OUTPUT:
+ break;
+ case ARG_PATERN:
+ break;
default:
break;
}
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;
* 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)
}
/**
- * 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.
*/
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())
gboolean loop_based;
gint numsrcpads;
GSList *srcpads;
+ GstFakeSrcOutputType output;
+ gchar *patern;
+ GList *paternlist;
};
struct _GstFakeSrcClass {
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;
* Boston, MA 02111-1307, USA.
*/
-#define GST_DEBUG_ENABLED
+//#define GST_DEBUG_ENABLED
#include "gstbin.h"
#include "gstdebug.h"
bin->numchildren = 0;
bin->children = NULL;
+ bin->chains = NULL;
// FIXME temporary testing measure
// bin->use_cothreads = TRUE;
}
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;
}
}
/**
+ * 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
* @srcpadname: name of pad in source element
/* 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 */
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) {
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);
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) {
}
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)
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,
_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..
}
/**
// 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;
}
};
-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
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,
pad->parent = NULL;
pad->ghostparents = NULL;
pad->caps = NULL;
+
+ pad->padtemplate = NULL;
}
static void
pad = gst_pad_new (name, temp->direction);
pad->caps = temp->caps;
+ pad->padtemplate = temp;
return 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;
}
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 */
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)
{
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
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)
GstObject *parent;
GList *ghostparents;
+
+ GstPadTemplate *padtemplate; // the template for this pad
};
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[];
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,
* Boston, MA 02111-1307, USA.
*/
+//#define GST_DEBUG_ENABLED
+
+#include "gstdebug.h"
#include "gstpipeline.h"
#include "gstthread.h"
#include "gstsink.h"
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;
}
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");
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);
{
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;
}
if (!connected) {
- g_print("gstpipeline: no path to sinks for type\n");
+ DEBUG("gstpipeline: no path to sinks for type\n");
}
return connected;
}
}
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);
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;
}
}
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);
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]);
}
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
}
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);
}
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;
}
#include <unistd.h>
#include <string.h>
+#include "gstdebug.h"
#include "gstplugin.h"
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;
}
gst_elementfactory_destroy ((GstElementFactory*)(factories->data));
factories = g_list_next(factories);
}
+
_gst_plugins = g_list_remove(_gst_plugins, plugin);
g_free (plugin);
}
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;
}
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);
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);
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);
}
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);
}
* Boston, MA 02111-1307, USA.
*/
-#define GST_DEBUG_ENABLED
+//#define GST_DEBUG_ENABLED
#include "gstscheduler.h"
#include "gstdebug.h"
GList *pads;
GstPad *pad;
+ DEBUG("chain entered\n");
// walk through all the elements
elements = chain->elements;
while (elements) {
g_free(chain);
}
-
g_list_free(bin->chains);
+
+ bin->chains = NULL;
}
void gst_bin_schedule_func(GstBin *bin) {
#include <string.h>
+#include "gstdebug.h"
#include "gsttype.h"
#include "gstplugin.h"
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) {
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);
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);
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;
gtk_object_class_add_signals (gtkobject_class, gst_fakesrc_signals,
LAST_SIGNAL);
-
}
static void
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);
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);
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);
}
src->loop_based = GTK_VALUE_BOOL (*arg);
gst_fakesrc_update_functions (src);
break;
+ case ARG_OUTPUT:
+ break;
+ case ARG_PATERN:
+ break;
default:
break;
}
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;
* 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)
}
/**
- * 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.
*/
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())
gboolean loop_based;
gint numsrcpads;
GSList *srcpads;
+ GstFakeSrcOutputType output;
+ gchar *patern;
+ GList *paternlist;
};
struct _GstFakeSrcClass {