diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2000-11-04 18:54:07 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2000-11-04 18:54:07 +0000 |
commit | c125059f9705d8115a46da2956e91a628342eb53 (patch) | |
tree | 499c644b01d91f6b76aca7f4d35fc71857a29a43 | |
parent | dbe262dfbb8baaff2e18a921e91103340026c141 (diff) |
Added the excellent mpeg2dec decoder. Not 100% optimized but allready very fast.
Original commit message from CVS:
Added the excellent mpeg2dec decoder. Not 100% optimized but allready
very fast.
More cleanup.
38 files changed, 1447 insertions, 620 deletions
diff --git a/configure.in b/configure.in index 6d7647361..a2b942461 100644 --- a/configure.in +++ b/configure.in @@ -432,6 +432,7 @@ plugins/mpeg2/ac3parse/Makefile plugins/mpeg2/ac3dec/Makefile plugins/mpeg2/video/Makefile plugins/mpeg2/mpeg2enc/Makefile +plugins/mpeg2/mpeg2dec/Makefile plugins/mpeg2/subtitles/Makefile plugins/mpeg2/videoparse/Makefile plugins/mpeg2/mpegtypes/Makefile diff --git a/gst/Makefile.am b/gst/Makefile.am index 2b71fc95f..26942f85e 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -1,5 +1,5 @@ # cheap trick to build . first... -SUBDIRS = . types meta elements xml +SUBDIRS = . types meta elements lib_LTLIBRARIES = libgst.la diff --git a/gst/cothreads.c b/gst/cothreads.c index e684c9b99..44feacf44 100644 --- a/gst/cothreads.c +++ b/gst/cothreads.c @@ -15,7 +15,9 @@ pthread_key_t _cothread_key = -1; -cothread_state *cothread_create(cothread_context *ctx) { +cothread_state* +cothread_create (cothread_context *ctx) +{ cothread_state *s; DEBUG("cothread: pthread_self() %ld\n",pthread_self()); @@ -50,25 +52,32 @@ cothread_state *cothread_create(cothread_context *ctx) { return s; } -void cothread_setfunc(cothread_state *thread,cothread_func func,int argc,char **argv) { +void +cothread_setfunc (cothread_state *thread, + cothread_func func, + int argc, + char **argv) +{ thread->func = func; thread->argc = argc; thread->argv = argv; thread->pc = (int *)func; } -cothread_context *cothread_init() { +cothread_context* +cothread_init (void) +{ cothread_context *ctx = (cothread_context *)malloc(sizeof(cothread_context)); if (_cothread_key == -1) { - if (pthread_key_create(&_cothread_key,NULL) != 0) { - perror("pthread_key_create"); + if (pthread_key_create (&_cothread_key,NULL) != 0) { + perror ("pthread_key_create"); return NULL; } } - pthread_setspecific(_cothread_key,ctx); + pthread_setspecific (_cothread_key,ctx); - memset(ctx->threads,0,sizeof(ctx->threads)); + memset (ctx->threads,0,sizeof(ctx->threads)); ctx->threads[0] = (cothread_state *)malloc(sizeof(cothread_state)); ctx->threads[0]->ctx = ctx; @@ -89,12 +98,16 @@ cothread_context *cothread_init() { return ctx; } -cothread_state *cothread_main(cothread_context *ctx) { -// fprintf(stderr,"returning %p, the 0th cothread\n",ctx->threads[0]); +cothread_state* +cothread_main(cothread_context *ctx) +{ + DEBUG(stderr,"returning %p, the 0th cothread\n",ctx->threads[0]); return ctx->threads[0]; } -void cothread_stub() { +void +cothread_stub (void) +{ cothread_context *ctx = pthread_getspecific(_cothread_key); register cothread_state *thread = ctx->threads[ctx->current]; @@ -109,7 +122,9 @@ void cothread_stub() { //printf("uh, yeah, we shouldn't be here, but we should deal anyway\n"); } -void cothread_switch(cothread_state *thread) { +void +cothread_switch (cothread_state *thread) +{ cothread_context *ctx; cothread_state *current; int enter; diff --git a/gst/cothreads.h b/gst/cothreads.h index b8edb4f3f..57ba54625 100644 --- a/gst/cothreads.h +++ b/gst/cothreads.h @@ -12,10 +12,10 @@ #define CURRENT_STACK_FRAME ({ char __csf; &__csf; }) #endif /* CURRENT_STACK_FRAME */ -typedef struct _cothread_state cothread_state; -typedef struct _cothread_context cothread_context; +typedef struct _cothread_state cothread_state; +typedef struct _cothread_context cothread_context; -typedef int (*cothread_func)(int argc,char **argv); +typedef int (*cothread_func) (int argc,char **argv); #define COTHREAD_STARTED 0x01 @@ -40,10 +40,11 @@ struct _cothread_context { int current; }; -cothread_context *cothread_init(); -cothread_state *cothread_create(cothread_context *ctx); -void cothread_setfunc(cothread_state *thread,cothread_func func,int argc,char **argv); -void cothread_switch(cothread_state *thread); -cothread_state *cothread_main(cothread_context *ctx); +cothread_context* cothread_init(); +cothread_state* cothread_create (cothread_context *ctx); +void cothread_setfunc (cothread_state *thread, cothread_func func, + int argc, char **argv); +void cothread_switch (cothread_state *thread); +cothread_state* cothread_main (cothread_context *ctx); #endif /* __COTHREAD_H__ */ @@ -29,33 +29,35 @@ extern gint _gst_trace_on; * Initializes the GStreamer library, setting up internal path lists, * registering built-in elements, and loading standard plugins. */ -void gst_init(int *argc,char **argv[]) { +void +gst_init (int *argc, char **argv[]) +{ GstTrace *gst_trace; - if (!g_thread_supported()) g_thread_init (NULL); + if (!g_thread_supported ()) g_thread_init (NULL); - gtk_init(argc,argv); + gtk_init (argc,argv); - _gst_cpu_initialize(); - _gst_type_initialize(); - _gst_plugin_initialize(); - _gst_buffer_initialize(); + _gst_cpu_initialize (); + _gst_type_initialize (); + _gst_plugin_initialize (); + _gst_buffer_initialize (); /* register some standard builtin types */ - gst_elementfactory_register(gst_elementfactory_new( - "bin",gst_bin_get_type(),&gst_bin_details)); - gst_elementfactory_register(gst_elementfactory_new( - "pipeline",gst_pipeline_get_type(),&gst_pipeline_details)); - gst_elementfactory_register(gst_elementfactory_new( - "thread",gst_thread_get_type(),&gst_thread_details)); + gst_elementfactory_register (gst_elementfactory_new ("bin", + gst_bin_get_type (), &gst_bin_details)); + gst_elementfactory_register (gst_elementfactory_new ("pipeline", + gst_pipeline_get_type (), &gst_pipeline_details)); + gst_elementfactory_register (gst_elementfactory_new("thread", + gst_thread_get_type (), &gst_thread_details)); //gst_plugin_load_elementfactory("gsttypes"); //gst_plugin_load("libgstelements.so"); _gst_trace_on = 0; if (_gst_trace_on) { - gst_trace = gst_trace_new("gst.trace",1024); - gst_trace_set_default(gst_trace); + gst_trace = gst_trace_new ("gst.trace",1024); + gst_trace_set_default (gst_trace); } } @@ -64,8 +66,10 @@ void gst_init(int *argc,char **argv[]) { * * Enter the main GStreamer processing loop */ -void gst_main() { - gtk_main(); +void +gst_main (void) +{ + gtk_main (); } /** @@ -73,6 +77,8 @@ void gst_main() { * * Exits the main GStreamer processing loop */ -void gst_main_quit() { - gtk_main_quit(); +void +gst_main_quit (void) +{ + gtk_main_quit (); } @@ -51,8 +51,8 @@ /* initialize GST */ void gst_init(int *argc,char **argv[]); -void gst_main(); -void gst_main_quit(); +void gst_main (void); +void gst_main_quit (void); /* debugging */ #ifndef DEBUG diff --git a/gst/gstbin.c b/gst/gstbin.c index 7fea38990..f691a3f41 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -33,19 +33,20 @@ GstElementDetails gst_bin_details = { }; -void gst_bin_real_destroy(GtkObject *object); +static void gst_bin_real_destroy (GtkObject *object); -static GstElementStateReturn gst_bin_change_state(GstElement *element); -static GstElementStateReturn gst_bin_change_state_norecurse(GstBin *bin); -static gboolean gst_bin_change_state_type(GstBin *bin, - GstElementState state, - GtkType type); +static GstElementStateReturn gst_bin_change_state (GstElement *element); +static GstElementStateReturn gst_bin_change_state_norecurse (GstBin *bin); +static gboolean gst_bin_change_state_type (GstBin *bin, + GstElementState state, + GtkType type); -static void gst_bin_create_plan_func(GstBin *bin); -static void gst_bin_iterate_func(GstBin *bin); +static void gst_bin_create_plan_func (GstBin *bin); +static void gst_bin_iterate_func (GstBin *bin); -static xmlNodePtr gst_bin_save_thyself(GstElement *element,xmlNodePtr parent); -static void gst_bin_restore_thyself(GstElement *element, xmlNodePtr parent, GHashTable *elements); +static xmlNodePtr gst_bin_save_thyself (GstElement *element, xmlNodePtr parent); +static void gst_bin_restore_thyself (GstElement *element, xmlNodePtr parent, + GHashTable *elements); /* Bin signals and args */ enum { @@ -59,15 +60,16 @@ enum { }; -static void gst_bin_class_init(GstBinClass *klass); -static void gst_bin_init(GstBin *bin); +static void gst_bin_class_init (GstBinClass *klass); +static void gst_bin_init (GstBin *bin); static GstElementClass *parent_class = NULL; static guint gst_bin_signals[LAST_SIGNAL] = { 0 }; GtkType -gst_bin_get_type(void) { +gst_bin_get_type (void) +{ static GtkType bin_type = 0; if (!bin_type) { @@ -81,41 +83,44 @@ gst_bin_get_type(void) { (GtkArgGetFunc)NULL, (GtkClassInitFunc)NULL, }; - bin_type = gtk_type_unique(GST_TYPE_ELEMENT,&bin_info); + bin_type = gtk_type_unique (GST_TYPE_ELEMENT, &bin_info); } return bin_type; } static void -gst_bin_class_init(GstBinClass *klass) { +gst_bin_class_init (GstBinClass *klass) +{ GtkObjectClass *gtkobject_class; GstElementClass *gstelement_class; gtkobject_class = (GtkObjectClass*)klass; gstelement_class = (GstElementClass*)klass; - parent_class = gtk_type_class(GST_TYPE_ELEMENT); + parent_class = gtk_type_class (GST_TYPE_ELEMENT); gst_bin_signals[OBJECT_ADDED] = - gtk_signal_new("object_added",GTK_RUN_FIRST,gtkobject_class->type, - GTK_SIGNAL_OFFSET(GstBinClass,object_added), - gtk_marshal_NONE__POINTER,GTK_TYPE_NONE,1, - GST_TYPE_ELEMENT); - gtk_object_class_add_signals(gtkobject_class,gst_bin_signals,LAST_SIGNAL); - - klass->change_state_type = gst_bin_change_state_type; - klass->create_plan = gst_bin_create_plan_func; - klass->iterate = gst_bin_iterate_func; - - gstelement_class->change_state = gst_bin_change_state; - gstelement_class->save_thyself = gst_bin_save_thyself; - gstelement_class->restore_thyself = gst_bin_restore_thyself; - gstelement_class->elementfactory = gst_elementfactory_find("bin"); - - gtkobject_class->destroy = gst_bin_real_destroy; + gtk_signal_new ("object_added", GTK_RUN_FIRST, gtkobject_class->type, + GTK_SIGNAL_OFFSET (GstBinClass, object_added), + gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1, + GST_TYPE_ELEMENT); + gtk_object_class_add_signals (gtkobject_class, gst_bin_signals, LAST_SIGNAL); + + klass->change_state_type = gst_bin_change_state_type; + klass->create_plan = gst_bin_create_plan_func; + klass->iterate = gst_bin_iterate_func; + + gstelement_class->change_state = gst_bin_change_state; + gstelement_class->save_thyself = gst_bin_save_thyself; + gstelement_class->restore_thyself = gst_bin_restore_thyself; + gstelement_class->elementfactory = gst_elementfactory_find("bin"); + + gtkobject_class->destroy = gst_bin_real_destroy; } -static void gst_bin_init(GstBin *bin) { +static void +gst_bin_init (GstBin *bin) +{ bin->numchildren = 0; bin->children = NULL; bin->use_cothreads = TRUE; @@ -129,9 +134,11 @@ static void gst_bin_init(GstBin *bin) { * * Returns: new bin */ -GstElement *gst_bin_new(gchar *name) { - GstElement *bin = GST_ELEMENT(gtk_type_new(GST_TYPE_BIN)); - gst_element_set_name(GST_ELEMENT(bin),name); +GstElement* +gst_bin_new (gchar *name) +{ + GstElement *bin = GST_ELEMENT (gtk_type_new (GST_TYPE_BIN)); + gst_element_set_name (GST_ELEMENT (bin), name); return bin; } @@ -143,25 +150,28 @@ GstElement *gst_bin_new(gchar *name) { * Add the given element to the bin. Set the elements parent, and thus * add a reference. */ -void gst_bin_add(GstBin *bin,GstElement *element) { - g_return_if_fail(bin != NULL); - g_return_if_fail(GST_IS_BIN(bin)); - g_return_if_fail(element != NULL); - g_return_if_fail(GST_IS_ELEMENT(element)); +void +gst_bin_add (GstBin *bin, + GstElement *element) +{ + g_return_if_fail (bin != NULL); + g_return_if_fail (GST_IS_BIN (bin)); + g_return_if_fail (element != NULL); + g_return_if_fail (GST_IS_ELEMENT (element)); // must be NULL or PAUSED state in order to modify bin - g_return_if_fail((GST_STATE(bin) == GST_STATE_NULL) || - (GST_STATE(bin) == GST_STATE_PAUSED)); + g_return_if_fail ((GST_STATE (bin) == GST_STATE_NULL) || + (GST_STATE (bin) == GST_STATE_PAUSED)); - bin->children = g_list_append(bin->children,element); + bin->children = g_list_append (bin->children, element); bin->numchildren++; - gst_object_set_parent(GST_OBJECT(element),GST_OBJECT(bin)); + gst_object_set_parent (GST_OBJECT (element), GST_OBJECT (bin)); /* we know we have at least one child, we just added one... */ // if (GST_STATE(element) < GST_STATE_READY) // gst_bin_change_state_norecurse(bin,GST_STATE_READY); - gtk_signal_emit(GTK_OBJECT(bin),gst_bin_signals[OBJECT_ADDED],element); + gtk_signal_emit (GTK_OBJECT (bin), gst_bin_signals[OBJECT_ADDED], element); } /** @@ -171,113 +181,123 @@ void gst_bin_add(GstBin *bin,GstElement *element) { * * Remove the element from its associated bin, unparenting as well. */ -void gst_bin_remove(GstBin *bin,GstElement *element) { - g_return_if_fail(bin != NULL); - g_return_if_fail(GST_IS_BIN(bin)); - g_return_if_fail(element != NULL); - g_return_if_fail(GST_IS_ELEMENT(element)); - g_return_if_fail(bin->children != NULL); +void +gst_bin_remove (GstBin *bin, + GstElement *element) +{ + g_return_if_fail (bin != NULL); + g_return_if_fail (GST_IS_BIN (bin)); + g_return_if_fail (element != NULL); + g_return_if_fail (GST_IS_ELEMENT (element)); + g_return_if_fail (bin->children != NULL); // must be NULL or PAUSED state in order to modify bin - g_return_if_fail((GST_STATE(bin) == GST_STATE_NULL) || - (GST_STATE(bin) == GST_STATE_PAUSED)); + g_return_if_fail ((GST_STATE (bin) == GST_STATE_NULL) || + (GST_STATE (bin) == GST_STATE_PAUSED)); - gst_object_unparent(GST_OBJECT(element)); - bin->children = g_list_remove(bin->children,element); + gst_object_unparent (GST_OBJECT (element)); + bin->children = g_list_remove (bin->children, element); bin->numchildren--; /* if we're down to zero children, force state to NULL */ if (bin->numchildren == 0) - gst_element_set_state(GST_ELEMENT(bin),GST_STATE_NULL); + gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL); } -static GstElementStateReturn gst_bin_change_state(GstElement *element) { +static GstElementStateReturn +gst_bin_change_state (GstElement *element) +{ GstBin *bin; GList *children; GstElement *child; - g_return_val_if_fail(GST_IS_BIN(element), GST_STATE_FAILURE); - bin = GST_BIN(element); + g_return_val_if_fail (GST_IS_BIN (element), GST_STATE_FAILURE); + + bin = GST_BIN (element); g_print("gst_bin_change_state(\"%s\"): currently %d(%s), %d(%s) pending\n", - gst_element_get_name(element),GST_STATE(element), - _gst_print_statename(GST_STATE(element)),GST_STATE_PENDING(element), - _gst_print_statename(GST_STATE_PENDING(element))); + gst_element_get_name (element), GST_STATE (element), + _gst_print_statename (GST_STATE (element)), GST_STATE_PENDING (element), + _gst_print_statename (GST_STATE_PENDING (element))); - if (GST_STATE_PENDING(element) == GST_STATE_READY) { + if (GST_STATE_PENDING (element) == GST_STATE_READY) { GstObject *parent; - parent = gst_object_get_parent(GST_OBJECT(element)); + parent = gst_object_get_parent (GST_OBJECT (element)); - if (!parent || !GST_IS_BIN(parent)) - gst_bin_create_plan(bin); + if (!parent || !GST_IS_BIN (parent)) + gst_bin_create_plan (bin); } // g_return_val_if_fail(bin->numchildren != 0, GST_STATE_FAILURE); // g_print("-->\n"); children = bin->children; while (children) { - child = GST_ELEMENT(children->data); + child = GST_ELEMENT (children->data); g_print("gst_bin_change_state: setting state on '%s'\n", - gst_element_get_name(child)); - switch (gst_element_set_state(child,GST_STATE_PENDING(element))) { + gst_element_get_name (child)); + switch (gst_element_set_state (child, GST_STATE_PENDING (element))) { case GST_STATE_FAILURE: - GST_STATE_PENDING(element) = GST_STATE_NONE_PENDING; - g_print("gstbin: child '%s' failed to go to state %d(%s)\n",gst_element_get_name(child), - GST_STATE_PENDING(element),_gst_print_statename(GST_STATE_PENDING(element))); + GST_STATE_PENDING (element) = GST_STATE_NONE_PENDING; + g_print("gstbin: child '%s' failed to go to state %d(%s)\n", gst_element_get_name (child), + GST_STATE_PENDING (element), _gst_print_statename (GST_STATE_PENDING (element))); return GST_STATE_FAILURE; break; case GST_STATE_ASYNC: - g_print("gstbin: child '%s' is changing state asynchronously\n",gst_element_get_name(child)); + g_print("gstbin: child '%s' is changing state asynchronously\n", gst_element_get_name (child)); break; } // g_print("\n"); - children = g_list_next(children); + children = g_list_next (children); } // g_print("<-- \"%s\"\n",gst_object_get_name(GST_OBJECT(bin))); - return gst_bin_change_state_norecurse(bin); + return gst_bin_change_state_norecurse (bin); } -static GstElementStateReturn gst_bin_change_state_norecurse(GstBin *bin) { +static GstElementStateReturn +gst_bin_change_state_norecurse (GstBin *bin) +{ - if (GST_ELEMENT_CLASS(parent_class)->change_state) - return GST_ELEMENT_CLASS(parent_class)->change_state(GST_ELEMENT(bin)); + if (GST_ELEMENT_CLASS (parent_class)->change_state) + return GST_ELEMENT_CLASS (parent_class)->change_state (GST_ELEMENT (bin)); else return GST_STATE_FAILURE; } -static gboolean gst_bin_change_state_type(GstBin *bin, - GstElementState state, - GtkType type) { +static gboolean +gst_bin_change_state_type(GstBin *bin, + GstElementState state, + GtkType type) +{ GList *children; GstElement *child; // g_print("gst_bin_change_state_type(\"%s\",%d,%d);\n", // gst_object_get_name(GST_OBJECT(bin)),state,type); - g_return_val_if_fail(GST_IS_BIN(bin), FALSE); - g_return_val_if_fail(bin->numchildren != 0, FALSE); + g_return_val_if_fail (GST_IS_BIN (bin), FALSE); + g_return_val_if_fail (bin->numchildren != 0, FALSE); // g_print("-->\n"); children = bin->children; while (children) { - child = GST_ELEMENT(children->data); - if (GST_IS_BIN(child)) { - if (!gst_bin_set_state_type(GST_BIN(child),state,type)) + child = GST_ELEMENT (children->data); + if (GST_IS_BIN (child)) { + if (!gst_bin_set_state_type (GST_BIN (child), state,type)) return FALSE; - } else if (GTK_CHECK_TYPE(child,type)) { - if (!gst_element_set_state(child,state)) + } else if (GTK_CHECK_TYPE (child,type)) { + if (!gst_element_set_state (child,state)) return FALSE; } // g_print("\n"); - children = g_list_next(children); + children = g_list_next (children); } if (type == GST_TYPE_BIN) - gst_element_set_state(GST_ELEMENT(bin),state); + gst_element_set_state (GST_ELEMENT (bin),state); return TRUE; } @@ -292,26 +312,30 @@ static gboolean gst_bin_change_state_type(GstBin *bin, * * Returns: indication if the state change was successfull */ -gboolean gst_bin_set_state_type(GstBin *bin, - GstElementState state, - GtkType type) { +gboolean +gst_bin_set_state_type (GstBin *bin, + GstElementState state, + GtkType type) +{ GstBinClass *oclass; DEBUG("gst_bin_set_state_type(\"%s\",%d,%d)\n", - gst_element_get_name(GST_ELEMENT(bin)),state,type); + gst_element_get_name (GST_ELEMENT (bin)), state,type); - g_return_val_if_fail(bin != NULL, FALSE); - g_return_val_if_fail(GST_IS_BIN(bin), FALSE); + g_return_val_if_fail (bin != NULL, FALSE); + g_return_val_if_fail (GST_IS_BIN (bin), FALSE); - oclass = GST_BIN_CLASS(GTK_OBJECT(bin)->klass); + oclass = GST_BIN_CLASS (GTK_OBJECT (bin)->klass); if (oclass->change_state_type) - (oclass->change_state_type)(bin,state,type); + (oclass->change_state_type) (bin,state,type); return TRUE; } -void gst_bin_real_destroy(GtkObject *object) { - GstBin *bin = GST_BIN(object); +static void +gst_bin_real_destroy (GtkObject *object) +{ + GstBin *bin = GST_BIN (object); GList *children; GstElement *child; @@ -319,12 +343,12 @@ void gst_bin_real_destroy(GtkObject *object) { children = bin->children; while (children) { - child = GST_ELEMENT(children->data); - gst_element_destroy(child); - children = g_list_next(children); + child = GST_ELEMENT (children->data); + gst_element_destroy (child); + children = g_list_next (children); } - g_list_free(bin->children); + g_list_free (bin->children); } /** @@ -336,26 +360,31 @@ void gst_bin_real_destroy(GtkObject *object) { * * Returns: the element with the given name */ -GstElement *gst_bin_get_by_name(GstBin *bin,gchar *name) { +GstElement* +gst_bin_get_by_name (GstBin *bin, + gchar *name) +{ GList *children; GstElement *child; - g_return_val_if_fail(bin != NULL, NULL); - g_return_val_if_fail(GST_IS_BIN(bin), NULL); - g_return_val_if_fail(name != NULL, NULL); + g_return_val_if_fail (bin != NULL, NULL); + g_return_val_if_fail (GST_IS_BIN (bin), NULL); + g_return_val_if_fail (name != NULL, NULL); - g_print("gstbin: lookup element \"%s\" in \"%s\"\n", name, gst_element_get_name(GST_ELEMENT(bin))); + g_print("gstbin: lookup element \"%s\" in \"%s\"\n", name, + gst_element_get_name (GST_ELEMENT (bin))); + children = bin->children; while (children) { - child = GST_ELEMENT(children->data); - if (!strcmp(child->name,name)) + child = GST_ELEMENT (children->data); + if (!strcmp (child->name,name)) return child; - if (GST_IS_BIN(child)) { - GstElement *res = gst_bin_get_by_name(GST_BIN(child), name); + if (GST_IS_BIN (child)) { + GstElement *res = gst_bin_get_by_name (GST_BIN (child), name); if (res) return res; } - children = g_list_next(children); + children = g_list_next (children); } return NULL; @@ -369,48 +398,57 @@ GstElement *gst_bin_get_by_name(GstBin *bin,gchar *name) { * * Returns: a GList of elements */ -GList *gst_bin_get_list(GstBin *bin) { - g_return_val_if_fail(bin != NULL, NULL); - g_return_val_if_fail(GST_IS_BIN(bin), NULL); +GList* +gst_bin_get_list (GstBin *bin) +{ + g_return_val_if_fail (bin != NULL, NULL); + g_return_val_if_fail (GST_IS_BIN (bin), NULL); return bin->children; } -static xmlNodePtr gst_bin_save_thyself(GstElement *element, xmlNodePtr parent) { - GstBin *bin = GST_BIN(element); +static xmlNodePtr +gst_bin_save_thyself (GstElement *element, + xmlNodePtr parent) +{ + GstBin *bin = GST_BIN (element); xmlNodePtr childlist; GList *children; GstElement *child; - if (GST_ELEMENT_CLASS(parent_class)->save_thyself) - GST_ELEMENT_CLASS(parent_class)->save_thyself(GST_ELEMENT(bin),parent); + if (GST_ELEMENT_CLASS (parent_class)->save_thyself) + GST_ELEMENT_CLASS (parent_class)->save_thyself (GST_ELEMENT (bin), parent); - childlist = xmlNewChild(parent,NULL,"children",NULL); + childlist = xmlNewChild (parent,NULL,"children",NULL); children = bin->children; while (children) { - child = GST_ELEMENT(children->data); - gst_element_save_thyself(child,childlist); - children = g_list_next(children); + child = GST_ELEMENT (children->data); + gst_element_save_thyself (child, childlist); + children = g_list_next (children); } return childlist; } -static void gst_bin_restore_thyself(GstElement *element, xmlNodePtr parent, GHashTable *elements) { - GstBin *bin = GST_BIN(element); +static void +gst_bin_restore_thyself (GstElement *element, + xmlNodePtr parent, + GHashTable *elements) +{ + GstBin *bin = GST_BIN (element); xmlNodePtr field = parent->childs; xmlNodePtr childlist; - g_print("gstbin: restore \"%s\"\n", gst_element_get_name(element)); + g_print("gstbin: restore \"%s\"\n", gst_element_get_name (element)); while (field) { - if (!strcmp(field->name, "children")) { + if (!strcmp (field->name, "children")) { childlist = field->childs; while (childlist) { - if (!strcmp(childlist->name, "element")) { - GstElement *element = gst_element_load_thyself(childlist, elements); + if (!strcmp (childlist->name, "element")) { + GstElement *element = gst_element_load_thyself (childlist, elements); - gst_bin_add(bin, element); + gst_bin_add (bin, element); } childlist = childlist->next; } @@ -421,8 +459,11 @@ static void gst_bin_restore_thyself(GstElement *element, xmlNodePtr parent, GHas } -void gst_bin_use_cothreads(GstBin *bin, gboolean enabled) { - g_return_if_fail(GST_IS_BIN(bin)); +void +gst_bin_use_cothreads (GstBin *bin, + gboolean enabled) +{ + g_return_if_fail (GST_IS_BIN (bin)); bin->use_cothreads = enabled; } @@ -433,14 +474,17 @@ void gst_bin_use_cothreads(GstBin *bin, gboolean enabled) { * * iterates over the elements in this bin */ -void gst_bin_iterate(GstBin *bin) { +void +gst_bin_iterate (GstBin *bin) +{ GstBinClass *oclass; - oclass = GST_BIN_CLASS(GTK_OBJECT(bin)->klass); + oclass = GST_BIN_CLASS (GTK_OBJECT (bin)->klass); DEBUG("gst_bin_iterate()\n"); + if (oclass->iterate) - (oclass->iterate)(bin); + (oclass->iterate) (bin); } /** @@ -449,56 +493,60 @@ void gst_bin_iterate(GstBin *bin) { * * let the bin figure out how to handle the plugins in it. */ -void gst_bin_create_plan(GstBin *bin) { +void +gst_bin_create_plan (GstBin *bin) +{ GstBinClass *oclass; - oclass = GST_BIN_CLASS(GTK_OBJECT(bin)->klass); + oclass = GST_BIN_CLASS (GTK_OBJECT (bin)->klass); if (oclass->create_plan) - (oclass->create_plan)(bin); + (oclass->create_plan) (bin); } -static int gst_bin_loopfunc_wrapper(int argc,char *argv[]) { - GstElement *element = GST_ELEMENT(argv); +static int +gst_bin_loopfunc_wrapper (int argc,char *argv[]) +{ + GstElement *element = GST_ELEMENT (argv); GList *pads; GstPad *pad; GstBuffer *buf; - G_GNUC_UNUSED gchar *name = gst_element_get_name(element); + G_GNUC_UNUSED gchar *name = gst_element_get_name (element); DEBUG("** gst_bin_loopfunc_wrapper(%d,\"%s\")\n", - argc,gst_element_get_name(element)); + argc,gst_element_get_name (element)); if (element->loopfunc != NULL) { while (1) { DEBUG("** gst_bin_loopfunc_wrapper(): element %s has loop function, calling it\n", name); - (element->loopfunc)(element); + (element->loopfunc) (element); DEBUG("** gst_bin_loopfunc_wrapper(): element %s ended loop function\n", name); } } else { DEBUG("** gst_bin_loopfunc_wrapper(): element %s is chain-based, calling in infinite loop\n", name); - if (GST_IS_SRC(element)) { + if (GST_IS_SRC (element)) { DEBUG("** gst_bin_loopfunc_wrapper(): calling push function of source %s\n", name); - gst_src_push(GST_SRC(element)); + gst_src_push (GST_SRC (element)); DEBUG("** gst_bin_loopfunc_wrapper(): calling push function of source %s done\n", name); - } else if (GST_IS_CONNECTION(element) && argc == 1) { + } else if (GST_IS_CONNECTION (element) && argc == 1) { while (1) { DEBUG("** gst_bin_loopfunc_wrapper(): calling push function of connection %s\n", name); - gst_connection_push(GST_CONNECTION(element)); + gst_connection_push (GST_CONNECTION (element)); DEBUG("** gst_bin_loopfunc_wrapper(): calling push function of connection %s done\n", name); } } else { while (1) { pads = element->pads; while (pads) { - pad = GST_PAD(pads->data); + pad = GST_PAD (pads->data); if (pad->direction == GST_PAD_SINK) { - DEBUG("** gst_bin_loopfunc_wrapper(): pulling a buffer from %s:%s\n", name, gst_pad_get_name(pad)); - buf = gst_pad_pull(pad); - DEBUG("** gst_bin_loopfunc_wrapper(): calling chain function of %s:%s\n", name, gst_pad_get_name(pad)); - (pad->chainfunc)(pad,buf); - DEBUG("** gst_bin_loopfunc_wrapper(): calling chain function of %s:%s done\n", name, gst_pad_get_name(pad)); + DEBUG("** gst_bin_loopfunc_wrapper(): pulling a buffer from %s:%s\n", name, gst_pad_get_name (pad)); + buf = gst_pad_pull (pad); + DEBUG("** gst_bin_loopfunc_wrapper(): calling chain function of %s:%s\n", name, gst_pad_get_name (pad)); + (pad->chainfunc) (pad,buf); + DEBUG("** gst_bin_loopfunc_wrapper(): calling chain function of %s:%s done\n", name, gst_pad_get_name (pad)); } - pads = g_list_next(pads); + pads = g_list_next (pads); } } } @@ -506,23 +554,29 @@ static int gst_bin_loopfunc_wrapper(int argc,char *argv[]) { return 0; } -static void gst_bin_pullfunc_wrapper(GstPad *pad) { +static void +gst_bin_pullfunc_wrapper (GstPad *pad) +{ DEBUG("** in gst_bin_pullfunc_wrapper()============================= %s\n", - gst_element_get_name(GST_ELEMENT(pad->parent))); - cothread_switch(GST_ELEMENT(pad->parent)->threadstate); + gst_element_get_name (GST_ELEMENT (pad->parent))); + cothread_switch (GST_ELEMENT (pad->parent)->threadstate); DEBUG("** out gst_bin_pullfunc_wrapper()============================= %s\n", - gst_element_get_name(GST_ELEMENT(pad->parent))); + gst_element_get_name (GST_ELEMENT (pad->parent))); } -static void gst_bin_pushfunc_wrapper(GstPad *pad) { +static void +gst_bin_pushfunc_wrapper (GstPad *pad) +{ DEBUG("** in gst_bin_pushfunc_wrapper()============================= %s\n", - gst_element_get_name(GST_ELEMENT(pad->parent))); - cothread_switch(GST_ELEMENT(pad->parent)->threadstate); + gst_element_get_name (GST_ELEMENT (pad->parent))); + cothread_switch (GST_ELEMENT (pad->parent)->threadstate); DEBUG("** out gst_bin_pushfunc_wrapper()============================= %s\n", - gst_element_get_name(GST_ELEMENT(pad->parent))); + gst_element_get_name (GST_ELEMENT (pad->parent))); } -static void gst_bin_create_plan_func(GstBin *bin) { +static void +gst_bin_create_plan_func (GstBin *bin) +{ GList *elements; GstElement *element; int sink_pads; @@ -530,48 +584,61 @@ static void gst_bin_create_plan_func(GstBin *bin) { GstPad *pad, *opad, *peer; GstElement *outside; - g_print("gstbin: creating plan for bin \"%s\"\n", gst_element_get_name(GST_ELEMENT(bin))); + g_print("gstbin: creating plan for bin \"%s\"\n", gst_element_get_name (GST_ELEMENT (bin))); // first loop through all children to see if we need cothreads // we break immediately when we find we need to, why keep searching? elements = bin->children; while (elements) { - element = GST_ELEMENT(elements->data); - g_print("gstbin: found element \"%s\" in bin \"%s\"\n", gst_element_get_name(element), gst_element_get_name(GST_ELEMENT(bin))); + element = GST_ELEMENT (elements->data); + + g_print("gstbin: found element \"%s\" in bin \"%s\"\n", + gst_element_get_name (element), + gst_element_get_name (GST_ELEMENT (bin))); + // if it's a loop-based element, use cothreads if (element->loopfunc != NULL) { - g_print("gstbin: loop based element \"%s\" in bin \"%s\"\n", gst_element_get_name(element), gst_element_get_name(GST_ELEMENT(bin))); + g_print("gstbin: loop based element \"%s\" in bin \"%s\"\n", + gst_element_get_name (element), + gst_element_get_name (GST_ELEMENT (bin))); + bin->need_cothreads = TRUE; break; } // if it's a complex element, use cothreads - else if (GST_ELEMENT_IS_MULTI_IN(element)) { - g_print("gstbin: complex element \"%s\" in bin \"%s\"\n", gst_element_get_name(element), gst_element_get_name(GST_ELEMENT(bin))); + else if (GST_ELEMENT_IS_MULTI_IN (element)) { + g_print("gstbin: complex element \"%s\" in bin \"%s\"\n", + gst_element_get_name (element), + gst_element_get_name (GST_ELEMENT (bin))); + bin->need_cothreads = TRUE; break; } // if it has more than one input pad, use cothreads sink_pads = 0; - pads = gst_element_get_pad_list(element); + pads = gst_element_get_pad_list (element); while (pads) { - pad = GST_PAD(pads->data); + pad = GST_PAD (pads->data); if (pad->direction == GST_PAD_SINK) sink_pads++; - pads = g_list_next(pads); + pads = g_list_next (pads); } if (sink_pads > 1) { - g_print("gstbin: more than 1 sinkpad for element \"%s\" in bin \"%s\"\n", gst_element_get_name(element), gst_element_get_name(GST_ELEMENT(bin))); + g_print("gstbin: more than 1 sinkpad for element \"%s\" in bin \"%s\"\n", + gst_element_get_name (element), + gst_element_get_name (GST_ELEMENT (bin))); + bin->need_cothreads = TRUE; break; } - elements = g_list_next(elements); + elements = g_list_next (elements); } // FIXME bin->need_cothreads &= bin->use_cothreads; // clear previous plan state - g_list_free(bin->entries); + g_list_free (bin->entries); bin->entries = NULL; bin->numentries = 0; @@ -580,146 +647,148 @@ static void gst_bin_create_plan_func(GstBin *bin) { // first create thread context if (bin->threadcontext == NULL) { - bin->threadcontext = cothread_init(); + bin->threadcontext = cothread_init (); g_print("gstbin: initialized cothread context\n"); } // walk through all the children elements = bin->children; while (elements) { - element = GST_ELEMENT(elements->data); + element = GST_ELEMENT (elements->data); // start by creating thread state for the element if (element->threadstate == NULL) { - element->threadstate = cothread_create(bin->threadcontext); - cothread_setfunc(element->threadstate,gst_bin_loopfunc_wrapper, - 0,(char **)element); + element->threadstate = cothread_create (bin->threadcontext); + cothread_setfunc (element->threadstate, gst_bin_loopfunc_wrapper, + 0, (char **)element); } - if (GST_IS_BIN(element)) { - gst_bin_create_plan( GST_BIN (element)); + if (GST_IS_BIN (element)) { + gst_bin_create_plan (GST_BIN (element)); } - if (GST_IS_SRC(element)) { - g_print("gstbin: adding '%s' as entry point\n",gst_element_get_name(element)); - bin->entries = g_list_prepend(bin->entries,element); + if (GST_IS_SRC (element)) { + g_print("gstbin: adding '%s' as entry point\n",gst_element_get_name (element)); + bin->entries = g_list_prepend (bin->entries,element); bin->numentries++; } - pads = gst_element_get_pad_list(element); + pads = gst_element_get_pad_list (element); while (pads) { pad = GST_PAD(pads->data); g_print("gstbin: setting push&pull handlers for %s:%s\n", - gst_element_get_name(element),gst_pad_get_name(pad)); + gst_element_get_name (element), gst_pad_get_name (pad)); // an internal connection will push outside this bin. - if (!GST_IS_CONNECTION(element)) { + if (!GST_IS_CONNECTION (element)) { pad->pushfunc = gst_bin_pushfunc_wrapper; } pad->pullfunc = gst_bin_pullfunc_wrapper; /* we only worry about sink pads */ - if (gst_pad_get_direction(pad) == GST_PAD_SINK) { + if (gst_pad_get_direction (pad) == GST_PAD_SINK) { /* get the pad's peer */ - peer = gst_pad_get_peer(pad); + peer = gst_pad_get_peer (pad); if (!peer) break; /* get the parent of the peer of the pad */ - outside = GST_ELEMENT(gst_pad_get_parent(peer)); + outside = GST_ELEMENT (gst_pad_get_parent (peer)); if (!outside) break; /* if it's a connection and it's not ours... */ - if (GST_IS_CONNECTION(outside) && - (gst_object_get_parent(GST_OBJECT(outside)) != GST_OBJECT(bin))) { - GList *connection_pads = gst_element_get_pad_list(outside); + if (GST_IS_CONNECTION (outside) && + (gst_object_get_parent (GST_OBJECT (outside)) != GST_OBJECT (bin))) { + GList *connection_pads = gst_element_get_pad_list (outside); while (connection_pads) { - opad = GST_PAD(connection_pads->data); - if (gst_pad_get_direction(opad) == GST_PAD_SRC) { + opad = GST_PAD (connection_pads->data); + if (gst_pad_get_direction (opad) == GST_PAD_SRC) { g_print("gstbin: setting push&pull handlers for %s:%s SRC connection %p %p\n", - gst_element_get_name(outside),gst_pad_get_name(opad), opad, opad->pullfunc); + gst_element_get_name (outside),gst_pad_get_name (opad), opad, opad->pullfunc); opad->pushfunc = gst_bin_pushfunc_wrapper; opad->pullfunc = gst_bin_pullfunc_wrapper; if (outside->threadstate == NULL) { - outside->threadstate = cothread_create(bin->threadcontext); - cothread_setfunc(outside->threadstate,gst_bin_loopfunc_wrapper, - 1,(char **)outside); + outside->threadstate = cothread_create (bin->threadcontext); + cothread_setfunc (outside->threadstate, gst_bin_loopfunc_wrapper, + 1, (char **)outside); } } - connection_pads = g_list_next(connection_pads); + connection_pads = g_list_next (connection_pads); } gst_info("gstbin: element \"%s\" is the external source Connection " "for internal element \"%s\"\n", - gst_element_get_name(GST_ELEMENT(outside)), - gst_element_get_name(GST_ELEMENT(element))); - bin->entries = g_list_prepend(bin->entries,outside); + gst_element_get_name (GST_ELEMENT (outside)), + gst_element_get_name (GST_ELEMENT (element))); + bin->entries = g_list_prepend (bin->entries,outside); bin->numentries++; } } - pads = g_list_next(pads); + pads = g_list_next (pads); } - elements = g_list_next(elements); + elements = g_list_next (elements); } } else { g_print("gstbin: don't need cothreads, looking for entry points\n"); // we have to find which elements will drive an iteration elements = bin->children; while (elements) { - element = GST_ELEMENT(elements->data); - g_print("gstbin: found element \"%s\"\n", gst_element_get_name(element)); - if (GST_IS_BIN(element)) { - gst_bin_create_plan( GST_BIN (element)); + element = GST_ELEMENT (elements->data); + g_print("gstbin: found element \"%s\"\n", gst_element_get_name (element)); + if (GST_IS_BIN (element)) { + gst_bin_create_plan (GST_BIN (element)); } - if (GST_IS_SRC(element)) { - g_print("gstbin: adding '%s' as entry point\n",gst_element_get_name(element)); - bin->entries = g_list_prepend(bin->entries,element); + if (GST_IS_SRC (element)) { + g_print("gstbin: adding '%s' as entry point\n",gst_element_get_name (element)); + bin->entries = g_list_prepend (bin->entries, element); bin->numentries++; } else { /* go through the list of pads to see if there's a Connection */ - pads = gst_element_get_pad_list(element); + pads = gst_element_get_pad_list (element); while (pads) { - pad = GST_PAD(pads->data); + pad = GST_PAD (pads->data); /* we only worry about sink pads */ - if (gst_pad_get_direction(pad) == GST_PAD_SINK) { - g_print("gstbin: found SINK pad %s\n", gst_pad_get_name(pad)); + if (gst_pad_get_direction (pad) == GST_PAD_SINK) { + g_print("gstbin: found SINK pad %s\n", gst_pad_get_name (pad)); /* get the pad's peer */ - peer = gst_pad_get_peer(pad); + peer = gst_pad_get_peer (pad); if (!peer) { - g_print("gstbin: found SINK pad %s has no peer\n", gst_pad_get_name(pad)); + g_print("gstbin: found SINK pad %s has no peer\n", gst_pad_get_name (pad)); break; } /* get the parent of the peer of the pad */ - outside = GST_ELEMENT(gst_pad_get_parent(peer)); + outside = GST_ELEMENT (gst_pad_get_parent (peer)); if (!outside) break; /* if it's a connection and it's not ours... */ - if (GST_IS_CONNECTION(outside) && - (gst_object_get_parent(GST_OBJECT(outside)) != GST_OBJECT(bin))) { + if (GST_IS_CONNECTION (outside) && + (gst_object_get_parent (GST_OBJECT (outside)) != GST_OBJECT (bin))) { gst_info("gstbin: element \"%s\" is the external source Connection " "for internal element \"%s\"\n", - gst_element_get_name(GST_ELEMENT(outside)), - gst_element_get_name(GST_ELEMENT(element))); - bin->entries = g_list_prepend(bin->entries,outside); + gst_element_get_name (GST_ELEMENT (outside)), + gst_element_get_name (GST_ELEMENT (element))); + bin->entries = g_list_prepend (bin->entries, outside); bin->numentries++; } } else { - g_print("gstbin: found pad %s\n", gst_pad_get_name(pad)); + g_print("gstbin: found pad %s\n", gst_pad_get_name (pad)); } - pads = g_list_next(pads); + pads = g_list_next (pads); } } - elements = g_list_next(elements); + elements = g_list_next (elements); } } } -void gst_bin_iterate_func(GstBin *bin) { +void +gst_bin_iterate_func (GstBin *bin) +{ GList *entries; GstElement *entry; - DEBUG("gst_bin_iterate_func() in \"%s\"\n", gst_element_get_name(GST_ELEMENT(bin))); + DEBUG("gst_bin_iterate_func() in \"%s\"\n", gst_element_get_name (GST_ELEMENT (bin))); - g_return_if_fail(bin != NULL); - g_return_if_fail(GST_IS_BIN(bin)); - g_return_if_fail(GST_STATE(bin) == GST_STATE_PLAYING); + g_return_if_fail (bin != NULL); + g_return_if_fail (GST_IS_BIN (bin)); + g_return_if_fail (GST_STATE (bin) == GST_STATE_PLAYING); DEBUG("GstBin: iterating\n"); @@ -727,10 +796,13 @@ void gst_bin_iterate_func(GstBin *bin) { // all we really have to do is switch to the first child // FIXME this should be lots more intelligent about where to start DEBUG("** in gst_bin_iterate_func()==================================%s\n", - gst_element_get_name(GST_ELEMENT(bin->children->data))); - cothread_switch(GST_ELEMENT(bin->children->data)->threadstate); + gst_element_get_name (GST_ELEMENT (bin->children->data))); + + cothread_switch (GST_ELEMENT (bin->children->data)->threadstate); + DEBUG("** out gst_bin_iterate_func()==================================%s\n", - gst_element_get_name(GST_ELEMENT(bin->children->data))); + gst_element_get_name (GST_ELEMENT (bin->children->data))); + } else { if (bin->numentries <= 0) { //printf("gstbin: no entries in bin \"%s\" trying children...\n", gst_element_get_name(GST_ELEMENT(bin))); @@ -744,16 +816,16 @@ void gst_bin_iterate_func(GstBin *bin) { g_assert(entries != NULL); while (entries) { - entry = GST_ELEMENT(entries->data); - if (GST_IS_SRC(entry)) - gst_src_push(GST_SRC(entry)); - else if (GST_IS_CONNECTION(entry)) - gst_connection_push(GST_CONNECTION(entry)); - else if (GST_IS_BIN(entry)) - gst_bin_iterate(GST_BIN(entry)); + entry = GST_ELEMENT (entries->data); + if (GST_IS_SRC (entry)) + gst_src_push (GST_SRC (entry)); + else if (GST_IS_CONNECTION (entry)) + gst_connection_push (GST_CONNECTION (entry)); + else if (GST_IS_BIN (entry)) + gst_bin_iterate (GST_BIN (entry)); else - g_assert_not_reached(); - entries = g_list_next(entries); + g_assert_not_reached (); + entries = g_list_next (entries); } } } diff --git a/gst/gstbin.h b/gst/gstbin.h index a1962fab4..ab2102194 100644 --- a/gst/gstbin.h +++ b/gst/gstbin.h @@ -34,7 +34,6 @@ extern "C" { extern GstElementDetails gst_bin_details; - #define GST_TYPE_BIN \ (gst_bin_get_type()) #define GST_BIN(obj) \ @@ -68,42 +67,41 @@ struct _GstBin { struct _GstBinClass { GstElementClass parent_class; - void (*object_added) (GstObject *object,GstObject *child); + void (*object_added) (GstObject *object, GstObject *child); /* change the state of elements of the given type */ - gboolean (*change_state_type) (GstBin *bin, - GstElementState state, - GtkType type); + gboolean (*change_state_type) (GstBin *bin, + GstElementState state, + GtkType type); /* create a plan for the execution of the bin */ - void (*create_plan) (GstBin *bin); + void (*create_plan) (GstBin *bin); /* run a full iteration of operation */ - void (*iterate) (GstBin *bin); + void (*iterate) (GstBin *bin); }; -GtkType gst_bin_get_type(void); -GstElement *gst_bin_new(gchar *name); -#define gst_bin_destroy(bin) gst_object_destroy(GST_OBJECT(bin)) +GtkType gst_bin_get_type (void); +GstElement* gst_bin_new (gchar *name); +#define gst_bin_destroy(bin) gst_object_destroy(GST_OBJECT(bin)) /* add and remove elements from the bin */ -void gst_bin_add(GstBin *bin,GstElement *element); -void gst_bin_remove(GstBin *bin,GstElement *element); +void gst_bin_add (GstBin *bin, GstElement *element); +void gst_bin_remove (GstBin *bin, GstElement *element); -/* retrieve a single element or the while list of children */ -GstElement *gst_bin_get_by_name(GstBin *bin,gchar *name); -GList *gst_bin_get_list(GstBin *bin); +/* retrieve a single element or the list of children */ +GstElement* gst_bin_get_by_name (GstBin *bin, gchar *name); +GList* gst_bin_get_list (GstBin *bin); -/* set the state for only elements of the given type */ -gboolean gst_bin_set_state_type(GstBin *bin, - GstElementState state, - GtkType type); +void gst_bin_create_plan (GstBin *bin); +gboolean gst_bin_set_state_type (GstBin *bin, + GstElementState state, + GtkType type); -void gst_bin_iterate(GstBin *bin); -void gst_bin_create_plan(GstBin *bin); +void gst_bin_iterate (GstBin *bin); // hack FIXME -void gst_bin_use_cothreads(GstBin *bin, gboolean enabled); +void gst_bin_use_cothreads (GstBin *bin, gboolean enabled); #ifdef __cplusplus } diff --git a/gst/gstbuffer.h b/gst/gstbuffer.h index 4437cf129..d6c078178 100644 --- a/gst/gstbuffer.h +++ b/gst/gstbuffer.h @@ -108,31 +108,30 @@ struct _GstBuffer { }; /* initialisation */ -void _gst_buffer_initialize(); +void _gst_buffer_initialize (void); /* creating a new buffer from scratch */ -GstBuffer *gst_buffer_new(); -GstBuffer *gst_buffer_new_from_pool(GstBufferPool *pool); +GstBuffer* gst_buffer_new (void); +GstBuffer* gst_buffer_new_from_pool (GstBufferPool *pool); /* creating a subbuffer */ -GstBuffer *gst_buffer_create_sub(GstBuffer *parent,guint32 offset,guint32 size); +GstBuffer* gst_buffer_create_sub (GstBuffer *parent, guint32 offset, guint32 size); /* adding data to a buffer */ -GstBuffer *gst_buffer_append(GstBuffer *buffer, GstBuffer *append); +GstBuffer* gst_buffer_append (GstBuffer *buffer, GstBuffer *append); /* refcounting */ -void gst_buffer_ref(GstBuffer *buffer); -void gst_buffer_ref_by_count(GstBuffer *buffer,int count); -void gst_buffer_unref(GstBuffer *buffer); +void gst_buffer_ref (GstBuffer *buffer); +void gst_buffer_ref_by_count (GstBuffer *buffer, int count); +void gst_buffer_unref (GstBuffer *buffer); /* destroying the buffer */ -void gst_buffer_destroy(GstBuffer *buffer); +void gst_buffer_destroy (GstBuffer *buffer); /* add, retrieve, and remove metadata from the buffer */ -void gst_buffer_add_meta(GstBuffer *buffer,GstMeta *meta); -GstMeta *gst_buffer_get_first_meta(GstBuffer *buffer); -GSList *gst_buffer_get_metas(GstBuffer *buffer); -void gst_buffer_remove_meta(GstBuffer *buffer,GstMeta *meta); - +void gst_buffer_add_meta (GstBuffer *buffer, GstMeta *meta); +void gst_buffer_remove_meta (GstBuffer *buffer, GstMeta *meta); +GstMeta* gst_buffer_get_first_meta (GstBuffer *buffer); +GSList* gst_buffer_get_metas (GstBuffer *buffer); #ifdef __cplusplus } diff --git a/gst/gstbufferpool.h b/gst/gstbufferpool.h index 823eb5466..c13367b55 100644 --- a/gst/gstbufferpool.h +++ b/gst/gstbufferpool.h @@ -33,8 +33,8 @@ extern "C" { typedef struct _GstBufferPool GstBufferPool; -typedef GstBuffer *(*GstBufferPoolCreateFunction) (GstBufferPool *pool, gpointer user_data); -typedef void (*GstBufferPoolDestroyFunction) (GstBufferPool *pool, GstBuffer *buffer, gpointer user_data); +typedef GstBuffer* (*GstBufferPoolCreateFunction) (GstBufferPool *pool, gpointer user_data); +typedef void (*GstBufferPoolDestroyFunction) (GstBufferPool *pool, GstBuffer *buffer, gpointer user_data); struct _GstBufferPool { /* will be called when a new buffer is to be created */ @@ -47,18 +47,22 @@ struct _GstBufferPool { }; /* creating a new buffer pool from scratch */ -GstBufferPool *gst_buffer_pool_new(); +GstBufferPool* gst_buffer_pool_new (void); /* creating a buffer from the pool */ -GstBuffer *gst_buffer_pool_new_buffer(GstBufferPool *pool); -void gst_buffer_pool_destroy_buffer(GstBufferPool *pool, GstBuffer *buffer); +GstBuffer* gst_buffer_pool_new_buffer (GstBufferPool *pool); +void gst_buffer_pool_destroy_buffer (GstBufferPool *pool, GstBuffer *buffer); /* setting create and destroy functions */ -void gst_buffer_pool_set_create_function(GstBufferPool *pool, GstBufferPoolCreateFunction create, gpointer user_data); -void gst_buffer_pool_set_destroy_function(GstBufferPool *pool, GstBufferPoolDestroyFunction destroy, gpointer user_data); +void gst_buffer_pool_set_create_function (GstBufferPool *pool, + GstBufferPoolCreateFunction create, + gpointer user_data); +void gst_buffer_pool_set_destroy_function (GstBufferPool *pool, + GstBufferPoolDestroyFunction destroy, + gpointer user_data); /* destroying the buffer pool */ -void gst_buffer_pool_destroy(GstBufferPool *pool); +void gst_buffer_pool_destroy (GstBufferPool *pool); #ifdef __cplusplus } diff --git a/gst/gstclock.h b/gst/gstclock.h index ba6452bc1..7aa2494d5 100644 --- a/gst/gstclock.h +++ b/gst/gstclock.h @@ -48,14 +48,14 @@ struct _GstClock { GMutex *lock; }; -GstClock *gst_clock_new(gchar *name); -GstClock *gst_clock_get_system(void); +GstClock* gst_clock_new (gchar *name); +GstClock* gst_clock_get_system (void); -void gst_clock_register(GstClock *clock, GstObject *obj); -void gst_clock_set(GstClock *clock, GstClockTime time); -void gst_clock_reset(GstClock *clock); -void gst_clock_wait(GstClock *clock, GstClockTime time, GstObject *obj); -GstClockTimeDiff gst_clock_current_diff(GstClock *clock, GstClockTime time); +void gst_clock_register (GstClock *clock, GstObject *obj); +void gst_clock_set (GstClock *clock, GstClockTime time); +void gst_clock_reset (GstClock *clock); +void gst_clock_wait (GstClock *clock, GstClockTime time, GstObject *obj); +GstClockTimeDiff gst_clock_current_diff (GstClock *clock, GstClockTime time); #ifdef __cplusplus } diff --git a/gst/gstconnection.h b/gst/gstconnection.h index cde0cb136..6295fe483 100644 --- a/gst/gstconnection.h +++ b/gst/gstconnection.h @@ -55,11 +55,10 @@ struct _GstConnectionClass { void (*push) (GstConnection *connection); }; -GtkType gst_connection_get_type(void); -GstElement *gst_connection_new(gchar *name); - -void gst_connection_push(GstConnection *connection); +GtkType gst_connection_get_type (void); +GstElement* gst_connection_new (gchar *name); +void gst_connection_push (GstConnection *connection); #ifdef __cplusplus } diff --git a/gst/gstcpu.h b/gst/gstcpu.h index c6ee4fb91..5ccd89b05 100644 --- a/gst/gstcpu.h +++ b/gst/gstcpu.h @@ -28,8 +28,8 @@ typedef enum { GST_CPU_FLAG_SSE = (1<<1), } GstCPUFlags; -void _gst_cpu_initialize(); +void _gst_cpu_initialize (void); -GstCPUFlags gst_cpu_get_flags(); +GstCPUFlags gst_cpu_get_flags (void); #endif /* __GST_CPU_H__ */ diff --git a/gst/gstelement.h b/gst/gstelement.h index deb28a6c1..42ef24856 100644 --- a/gst/gstelement.h +++ b/gst/gstelement.h @@ -129,8 +129,8 @@ struct _GstElementClass { GstElementStateReturn (*change_state) (GstElement *element); /* create or read XML representation of self */ - xmlNodePtr (*save_thyself)(GstElement *element,xmlNodePtr parent); - void (*restore_thyself)(GstElement *element, xmlNodePtr self, GHashTable *elements); + xmlNodePtr (*save_thyself) (GstElement *element, xmlNodePtr parent); + void (*restore_thyself) (GstElement *element, xmlNodePtr self, GHashTable *elements); }; struct _GstElementDetails { diff --git a/gst/gstfilter.h b/gst/gstfilter.h index 682a60c79..86b0656bf 100644 --- a/gst/gstfilter.h +++ b/gst/gstfilter.h @@ -52,8 +52,8 @@ struct _GstFilterClass { GstElementClass parent_class; }; -GtkType gst_filter_get_type(void); -GstElement *gst_filter_new(gchar *name); +GtkType gst_filter_get_type (void); +GstElement* gst_filter_new (gchar *name); #ifdef __cplusplus } diff --git a/gst/gstmeta.h b/gst/gstmeta.h index 47b33fb03..f361a47d3 100644 --- a/gst/gstmeta.h +++ b/gst/gstmeta.h @@ -69,12 +69,12 @@ struct _GstMeta { }; -GstMeta *gst_meta_new_size(gint size); -#define gst_meta_new(type) (type *)gst_meta_new_size(sizeof(type)) +GstMeta* gst_meta_new_size (gint size); +#define gst_meta_new(type) (type *)gst_meta_new_size(sizeof(type)) /* refcounting */ -void gst_meta_ref(GstMeta *meta); -void gst_meta_unref(GstMeta *meta); +void gst_meta_ref (GstMeta *meta); +void gst_meta_unref (GstMeta *meta); #ifdef __cplusplus } diff --git a/gst/gstobject.h b/gst/gstobject.h index 35e1b5a5e..a6894d718 100644 --- a/gst/gstobject.h +++ b/gst/gstobject.h @@ -90,24 +90,21 @@ struct _GstObjectClass { /* normal GtkObject stuff */ -GtkType gst_object_get_type(void); -GstObject* gst_object_new(void); +GtkType gst_object_get_type (void); +GstObject* gst_object_new (void); /* parentage routines */ -void gst_object_set_parent(GstObject *object,GstObject *parent); -GstObject *gst_object_get_parent(GstObject *object); -void gst_object_unparent(GstObject *object); +void gst_object_set_parent (GstObject *object,GstObject *parent); +GstObject* gst_object_get_parent (GstObject *object); +void gst_object_unparent (GstObject *object); /* refcounting */ -//void gst_object_ref(GstObject *object); -#define gst_object_ref(object) gtk_object_ref(GTK_OBJECT(object)); -//void gst_object_unref(GstObject *object); -#define gst_object_unref(object) gtk_object_unref(GTK_OBJECT(object)); -//void gst_object_sink(GstObject *object); -#define gst_object_sink(object) gtk_object_sink(GTK_OBJECT(object)); +#define gst_object_ref(object) gtk_object_ref(GTK_OBJECT(object)); +#define gst_object_unref(object) gtk_object_unref(GTK_OBJECT(object)); +#define gst_object_sink(object) gtk_object_sink(GTK_OBJECT(object)); /* destroying an object */ -#define gst_object_destroy(object) gtk_object_destroy(GTK_OBJECT(object)) +#define gst_object_destroy(object) gtk_object_destroy(GTK_OBJECT(object)) #ifdef __cplusplus diff --git a/gst/gstpipeline.h b/gst/gstpipeline.h index 7416ff62e..24f295e1e 100644 --- a/gst/gstpipeline.h +++ b/gst/gstpipeline.h @@ -57,16 +57,16 @@ struct _GstPipelineClass { GstBinClass parent_class; }; -GtkType gst_pipeline_get_type(void); -GstElement *gst_pipeline_new(guchar *name); -#define gst_pipeline_destroy(pipeline) gst_object_destroy(GST_OBJECT(pipeline)) +GtkType gst_pipeline_get_type (void); +GstElement* gst_pipeline_new (guchar *name); +#define gst_pipeline_destroy(pipeline) gst_object_destroy(GST_OBJECT(pipeline)) -gboolean gst_pipeline_autoplug(GstPipeline *pipeline); +void gst_pipeline_add_src (GstPipeline *pipeline, GstElement *src); +void gst_pipeline_add_sink (GstPipeline *pipeline, GstElement *sink); -void gst_pipeline_add_src(GstPipeline *pipeline, GstElement *src); -void gst_pipeline_add_sink(GstPipeline *pipeline, GstElement *sink); +gboolean gst_pipeline_autoplug (GstPipeline *pipeline); -void gst_pipeline_iterate(GstPipeline *pipeline); +void gst_pipeline_iterate (GstPipeline *pipeline); #ifdef __cplusplus } diff --git a/gst/gstplugin.h b/gst/gstplugin.h index 8d5bc7875..0f45f84bb 100644 --- a/gst/gstplugin.h +++ b/gst/gstplugin.h @@ -27,8 +27,8 @@ #include <gst/gsttype.h> #include <gst/gstelement.h> -typedef struct _GstPlugin GstPlugin; -typedef struct _GstPluginElement GstPluginElement; +typedef struct _GstPlugin GstPlugin; +typedef struct _GstPluginElement GstPluginElement; struct _GstPlugin { gchar *name; /* name of the plugin */ @@ -42,28 +42,29 @@ struct _GstPlugin { }; -typedef GstPlugin * (*GstPluginInitFunc) (GModule *module); +typedef GstPlugin* (*GstPluginInitFunc) (GModule *module); -GstPlugin *gst_plugin_new(gchar *name); -void gst_plugin_set_longname(GstPlugin *plugin,gchar *longname); +void _gst_plugin_initialize (void); -void _gst_plugin_initialize(); -void gst_plugin_load_all(); -gboolean gst_plugin_load(gchar *name); -gboolean gst_library_load(gchar *name); -gboolean gst_plugin_load_absolute(gchar *name); +GstPlugin* gst_plugin_new (gchar *name); -void gst_plugin_add_factory(GstPlugin *plugin,GstElementFactory *factory); -void gst_plugin_add_type(GstPlugin *plugin,GstTypeFactory *factory); +void gst_plugin_load_all (void); +gboolean gst_plugin_load (gchar *name); +gboolean gst_library_load (gchar *name); +gboolean gst_plugin_load_absolute (gchar *name); -GstPlugin *gst_plugin_find(const gchar *name); -GList *gst_plugin_get_list(); -GstElementFactory *gst_plugin_find_elementfactory(gchar *name); +void gst_plugin_set_longname (GstPlugin *plugin, gchar *longname); +void gst_plugin_add_factory (GstPlugin *plugin, GstElementFactory *factory); +void gst_plugin_add_type (GstPlugin *plugin, GstTypeFactory *factory); -GstElementFactory *gst_plugin_load_elementfactory(gchar *name); -void gst_plugin_load_typefactory(gchar *mime); +GstPlugin* gst_plugin_find (const gchar *name); +GList* gst_plugin_get_list (void); +GstElementFactory* gst_plugin_find_elementfactory (gchar *name); -xmlNodePtr gst_plugin_save_thyself(xmlNodePtr parent); -void gst_plugin_load_thyself(xmlNodePtr parent); +GstElementFactory* gst_plugin_load_elementfactory (gchar *name); +void gst_plugin_load_typefactory (gchar *mime); + +xmlNodePtr gst_plugin_save_thyself (xmlNodePtr parent); +void gst_plugin_load_thyself (xmlNodePtr parent); #endif /* __GST_PLUGIN_H__ */ diff --git a/gst/gstsink.h b/gst/gstsink.h index e04bdb073..2ea51e3c4 100644 --- a/gst/gstsink.h +++ b/gst/gstsink.h @@ -41,8 +41,8 @@ extern "C" { #define GST_IS_SINK_CLASS(obj) \ (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_SINK)) -typedef struct _GstSink GstSink; -typedef struct _GstSinkClass GstSinkClass; +typedef struct _GstSink GstSink; +typedef struct _GstSinkClass GstSinkClass; struct _GstSink { GstElement element; @@ -52,8 +52,8 @@ struct _GstSinkClass { GstElementClass parent_class; }; -GtkType gst_sink_get_type(void); -GstObject *gst_sink_new(gchar *name); +GtkType gst_sink_get_type (void); +GstObject* gst_sink_new (gchar *name); #ifdef __cplusplus diff --git a/gst/gstsrc.h b/gst/gstsrc.h index 39fdfe155..190d8fae0 100644 --- a/gst/gstsrc.h +++ b/gst/gstsrc.h @@ -42,7 +42,7 @@ extern "C" { (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_SRC)) typedef enum { - GST_SRC_ASYNC = 1 << 0, + GST_SRC_ASYNC = (1 << 0), } GstSrcFlags; #define GST_SRC_FLAGS(obj) \ @@ -50,8 +50,8 @@ typedef enum { #define GST_SRC_ASYNC(obj) \ ((GST_SRC_FLAGS(obj) & GST_SRC_ASYNC)) -typedef struct _GstSrc GstSrc; -typedef struct _GstSrcClass GstSrcClass; +typedef struct _GstSrc GstSrc; +typedef struct _GstSrcClass GstSrcClass; struct _GstSrc { GstElement element; @@ -62,11 +62,11 @@ struct _GstSrcClass { GstElementClass parent_class; /* subclass functions */ - void (*push) (GstSrc *src); - void (*push_region) (GstSrc *src,gulong offset,gulong size); + void (*push) (GstSrc *src); + void (*push_region) (GstSrc *src, gulong offset, gulong size); /* signals */ - void (*eos) (GstSrc *src); + void (*eos) (GstSrc *src); }; #define GST_SRC_SET_FLAGS(src,flag) \ @@ -74,13 +74,12 @@ struct _GstSrcClass { #define GST_SRC_UNSET_FLAGS(src,flag) \ G_STMT_START{ (GST_SRC_FLAGS (src) &= ~(flag)); }G_STMT_END +GtkType gst_src_get_type (void); -GtkType gst_src_get_type(void); +void gst_src_push (GstSrc *src); +void gst_src_push_region (GstSrc *src, gulong offset, gulong size); -void gst_src_signal_eos(GstSrc *src); - -void gst_src_push(GstSrc *src); -void gst_src_push_region(GstSrc *src,gulong offset,gulong size); +void gst_src_signal_eos (GstSrc *src); #ifdef __cplusplus } diff --git a/gst/gsttee.h b/gst/gsttee.h index 1e819248a..e2a204682 100644 --- a/gst/gsttee.h +++ b/gst/gsttee.h @@ -40,8 +40,8 @@ extern "C" { #define GST_IS_TEE_CLASS(obj) \ (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_TEE)) -typedef struct _GstTee GstTee; -typedef struct _GstTeeClass GstTeeClass; +typedef struct _GstTee GstTee; +typedef struct _GstTeeClass GstTeeClass; struct _GstTee { GstFilter filter; @@ -56,11 +56,12 @@ struct _GstTeeClass { GstFilterClass parent_class; }; -GtkType gst_tee_get_type(void); -GstElement *gst_tee_new(gchar *name); -void gst_tee_chain(GstPad *pad,GstBuffer *buf); -gchar *gst_tee_new_pad(GstTee *tee); +GtkType gst_tee_get_type (void); +GstElement* gst_tee_new (gchar *name); + +gchar* gst_tee_new_pad (GstTee *tee); +void gst_tee_chain (GstPad *pad, GstBuffer *buf); #ifdef __cplusplus } diff --git a/gst/gstthread.c b/gst/gstthread.c index 492e49ce6..65b159ea1 100644 --- a/gst/gstthread.c +++ b/gst/gstthread.c @@ -44,20 +44,22 @@ enum { }; -static void gst_thread_class_init(GstThreadClass *klass); -static void gst_thread_init(GstThread *thread); +static void gst_thread_class_init (GstThreadClass *klass); +static void gst_thread_init (GstThread *thread); -static void gst_thread_set_arg(GtkObject *object,GtkArg *arg,guint id); -static void gst_thread_get_arg(GtkObject *object,GtkArg *arg,guint id); -static GstElementStateReturn gst_thread_change_state(GstElement *element); +static void gst_thread_set_arg (GtkObject *object,GtkArg *arg,guint id); +static void gst_thread_get_arg (GtkObject *object,GtkArg *arg,guint id); -static xmlNodePtr gst_thread_save_thyself(GstElement *element,xmlNodePtr parent); -static void gst_thread_restore_thyself(GstElement *element,xmlNodePtr parent, GHashTable *elements); +static GstElementStateReturn gst_thread_change_state (GstElement *element); -static void gst_thread_signal_thread(GstThread *thread); -static void gst_thread_create_plan_dummy(GstBin *bin); +static xmlNodePtr gst_thread_save_thyself (GstElement *element,xmlNodePtr parent); +static void gst_thread_restore_thyself (GstElement *element,xmlNodePtr parent, + GHashTable *elements); -static void *gst_thread_main_loop(void *arg); +static void gst_thread_signal_thread (GstThread *thread); +static void gst_thread_create_plan_dummy (GstBin *bin); + +static void* gst_thread_main_loop (void *arg); static GstBin *parent_class = NULL; //static guint gst_thread_signals[LAST_SIGNAL] = { 0 }; @@ -83,26 +85,27 @@ gst_thread_get_type(void) { } static void -gst_thread_class_init(GstThreadClass *klass) { +gst_thread_class_init (GstThreadClass *klass) +{ GtkObjectClass *gtkobject_class; GstObjectClass *gstobject_class; GstElementClass *gstelement_class; GstBinClass *gstbin_class; - gtkobject_class = (GtkObjectClass*)klass; - gstobject_class = (GstObjectClass*)klass; - gstelement_class = (GstElementClass*)klass; - gstbin_class = (GstBinClass*)klass; + gtkobject_class = (GtkObjectClass*)klass; + gstobject_class = (GstObjectClass*)klass; + gstelement_class = (GstElementClass*)klass; + gstbin_class = (GstBinClass*)klass; - parent_class = gtk_type_class(GST_TYPE_BIN); + parent_class = gtk_type_class (GST_TYPE_BIN); - gtk_object_add_arg_type("GstThread::create_thread", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_CREATE_THREAD); + gtk_object_add_arg_type ("GstThread::create_thread", GTK_TYPE_BOOL, + GTK_ARG_READWRITE, ARG_CREATE_THREAD); - gstelement_class->change_state = gst_thread_change_state; - gstelement_class->save_thyself = gst_thread_save_thyself; - gstelement_class->restore_thyself = gst_thread_restore_thyself; - gstelement_class->elementfactory = gst_elementfactory_find("thread"); + gstelement_class->change_state = gst_thread_change_state; + gstelement_class->save_thyself = gst_thread_save_thyself; + gstelement_class->restore_thyself = gst_thread_restore_thyself; + gstelement_class->elementfactory = gst_elementfactory_find("thread"); gstbin_class->create_plan = gst_thread_create_plan_dummy; @@ -111,31 +114,42 @@ gst_thread_class_init(GstThreadClass *klass) { } -static void gst_thread_init(GstThread *thread) { - GST_FLAG_SET(thread,GST_THREAD_CREATE); +static void +gst_thread_init (GstThread *thread) +{ + GST_FLAG_SET (thread, GST_THREAD_CREATE); thread->lock = g_mutex_new(); thread->cond = g_cond_new(); } -static void gst_thread_create_plan_dummy(GstBin *bin) { - gst_info("gstthread: create plan delayed until thread starts\n"); +static void +gst_thread_create_plan_dummy (GstBin *bin) +{ + g_return_if_fail (GST_IS_THREAD (bin)); + + if (!GST_FLAG_IS_SET (GST_THREAD (bin), GST_THREAD_STATE_SPINNING)) + gst_info("gstthread: create plan delayed until thread starts\n"); } -static void gst_thread_set_arg(GtkObject *object,GtkArg *arg,guint id) { +static void +gst_thread_set_arg (GtkObject *object, + GtkArg *arg, + guint id) +{ /* it's not null if we got it, but it might not be ours */ - g_return_if_fail(GST_IS_THREAD(object)); + g_return_if_fail (GST_IS_THREAD (object)); switch(id) { case ARG_CREATE_THREAD: - if (GTK_VALUE_BOOL(*arg)) { + if (GTK_VALUE_BOOL (*arg)) { gst_info("gstthread: turning ON the creation of the thread\n"); - GST_FLAG_SET(object,GST_THREAD_CREATE); - gst_info("gstthread: flags are 0x%08x\n",GST_FLAGS(object)); + GST_FLAG_SET (object, GST_THREAD_CREATE); + gst_info("gstthread: flags are 0x%08x\n", GST_FLAGS (object)); } else { gst_info("gstthread: turning OFF the creation of the thread\n"); - GST_FLAG_UNSET(object,GST_THREAD_CREATE); - gst_info("gstthread: flags are 0x%08x\n",GST_FLAGS(object)); + GST_FLAG_UNSET (object, GST_THREAD_CREATE); + gst_info("gstthread: flags are 0x%08x\n", GST_FLAGS (object)); } break; default: @@ -143,13 +157,17 @@ static void gst_thread_set_arg(GtkObject *object,GtkArg *arg,guint id) { } } -static void gst_thread_get_arg(GtkObject *object,GtkArg *arg,guint id) { +static void +gst_thread_get_arg (GtkObject *object, + GtkArg *arg, + guint id) +{ /* it's not null if we got it, but it might not be ours */ - g_return_if_fail(GST_IS_THREAD(object)); + g_return_if_fail (GST_IS_THREAD (object)); switch(id) { case ARG_CREATE_THREAD: - GTK_VALUE_BOOL(*arg) = GST_FLAG_IS_SET(object,GST_THREAD_CREATE); + GTK_VALUE_BOOL (*arg) = GST_FLAG_IS_SET (object, GST_THREAD_CREATE); break; default: break; @@ -165,79 +183,93 @@ static void gst_thread_get_arg(GtkObject *object,GtkArg *arg,guint id) { * * Returns; The new thread */ -GstElement *gst_thread_new(guchar *name) { +GstElement* +gst_thread_new (guchar *name) +{ GstThread *thread; - thread = gtk_type_new(gst_thread_get_type()); - gst_element_set_name(GST_ELEMENT(thread),name); - GST_FLAG_UNSET(thread,GST_THREAD_STATE_REAPING); - return GST_ELEMENT(thread); + thread = gtk_type_new (gst_thread_get_type ()); + + gst_element_set_name (GST_ELEMENT (thread), name); + + GST_FLAG_UNSET (thread, GST_THREAD_STATE_REAPING); + + return GST_ELEMENT (thread); } -static GstElementStateReturn gst_thread_change_state(GstElement *element) { +static GstElementStateReturn +gst_thread_change_state (GstElement *element) +{ GstThread *thread; gboolean stateset = GST_STATE_SUCCESS; gint pending; - g_return_val_if_fail(GST_IS_THREAD(element), FALSE); - thread = GST_THREAD(element); + g_return_val_if_fail (GST_IS_THREAD(element), FALSE); + thread = GST_THREAD (element); gst_info("gstthread: thread \"%s\" change state %d\n", - gst_element_get_name(GST_ELEMENT(element)), GST_STATE_PENDING(element)); + gst_element_get_name (GST_ELEMENT (element)), + GST_STATE_PENDING (element)); - pending = GST_STATE_PENDING(element); + pending = GST_STATE_PENDING (element); - if (pending == GST_STATE(element)) return GST_STATE_SUCCESS; + if (pending == GST_STATE (element)) return GST_STATE_SUCCESS; - GST_FLAG_UNSET(thread,GST_THREAD_STATE_SPINNING); + GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING); - if (GST_ELEMENT_CLASS(parent_class)->change_state) - stateset = GST_ELEMENT_CLASS(parent_class)->change_state(element); + if (GST_ELEMENT_CLASS (parent_class)->change_state) + stateset = GST_ELEMENT_CLASS (parent_class)->change_state (element); - gst_info("gstthread: stateset %d %d %d\n", GST_STATE(element), stateset, GST_STATE_PENDING(element)); + gst_info("gstthread: stateset %d %d %d\n", GST_STATE (element), stateset, + GST_STATE_PENDING (element)); switch (pending) { case GST_STATE_READY: if (!stateset) return FALSE; // we want to prepare our internal state for doing the iterations gst_info("gstthread: preparing thread \"%s\" for iterations:\n", - gst_element_get_name(GST_ELEMENT(element))); + gst_element_get_name (GST_ELEMENT (element))); // set the state to idle - GST_FLAG_UNSET(thread,GST_THREAD_STATE_SPINNING); + GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING); // create the thread if that's what we're supposed to do - gst_info("gstthread: flags are 0x%08x\n",GST_FLAGS(thread)); - if (GST_FLAG_IS_SET(thread,GST_THREAD_CREATE)) { + gst_info("gstthread: flags are 0x%08x\n", GST_FLAGS (thread)); + + if (GST_FLAG_IS_SET (thread, GST_THREAD_CREATE)) { gst_info("gstthread: starting thread \"%s\"\n", - gst_element_get_name(GST_ELEMENT(element))); - pthread_create(&thread->thread_id,NULL, - gst_thread_main_loop,thread); + gst_element_get_name (GST_ELEMENT (element))); + + pthread_create (&thread->thread_id, NULL, + gst_thread_main_loop, thread); } else { gst_info("gstthread: NOT starting thread \"%s\"\n", - gst_element_get_name(GST_ELEMENT(element))); + gst_element_get_name (GST_ELEMENT (element))); } return GST_STATE_ASYNC; break; case GST_STATE_PLAYING: if (!stateset) return FALSE; gst_info("gstthread: starting thread \"%s\"\n", - gst_element_get_name(GST_ELEMENT(element))); - GST_FLAG_SET(thread,GST_THREAD_STATE_SPINNING); - gst_thread_signal_thread(thread); + gst_element_get_name (GST_ELEMENT (element))); + + GST_FLAG_SET (thread, GST_THREAD_STATE_SPINNING); + gst_thread_signal_thread (thread); break; case GST_STATE_PAUSED: gst_info("gstthread: pausing thread \"%s\"\n", - gst_element_get_name(GST_ELEMENT(element))); + gst_element_get_name (GST_ELEMENT (element))); + //GST_FLAG_UNSET(thread,GST_THREAD_STATE_SPINNING); - gst_thread_signal_thread(thread); + gst_thread_signal_thread (thread); break; case GST_STATE_NULL: gst_info("gstthread: stopping thread \"%s\"\n", - gst_element_get_name(GST_ELEMENT(element))); - GST_FLAG_SET(thread,GST_THREAD_STATE_REAPING); - gst_thread_signal_thread(thread); + gst_element_get_name (GST_ELEMENT (element))); + + GST_FLAG_SET (thread, GST_THREAD_STATE_REAPING); + gst_thread_signal_thread (thread); break; default: break; @@ -256,49 +288,56 @@ static GstElementStateReturn gst_thread_change_state(GstElement *element) { static void * gst_thread_main_loop (void *arg) { - GstThread *thread = GST_THREAD(arg); + GstThread *thread = GST_THREAD (arg); gst_info("gstthread: thread \"%s\" is running with PID %d\n", - gst_element_get_name(GST_ELEMENT(thread)), getpid()); + gst_element_get_name (GST_ELEMENT (thread)), getpid ()); - if (GST_BIN_CLASS(parent_class)->create_plan) - GST_BIN_CLASS(parent_class)->create_plan(GST_BIN(thread)); + if (GST_BIN_CLASS (parent_class)->create_plan) + GST_BIN_CLASS (parent_class)->create_plan (GST_BIN (thread)); - while(!GST_FLAG_IS_SET(thread,GST_THREAD_STATE_REAPING)) { - if (GST_FLAG_IS_SET(thread,GST_THREAD_STATE_SPINNING)) - gst_bin_iterate(GST_BIN(thread)); + while (!GST_FLAG_IS_SET (thread, GST_THREAD_STATE_REAPING)) { + if (GST_FLAG_IS_SET (thread, GST_THREAD_STATE_SPINNING)) + gst_bin_iterate (GST_BIN (thread)); else { - g_mutex_lock(thread->lock); - g_cond_wait(thread->cond,thread->lock); - g_mutex_unlock(thread->lock); + g_mutex_lock (thread->lock); + g_cond_wait (thread->cond, thread->lock); + g_mutex_unlock (thread->lock); } } - GST_FLAG_UNSET(thread,GST_THREAD_STATE_REAPING); - pthread_join(thread->thread_id,0); + GST_FLAG_UNSET (thread, GST_THREAD_STATE_REAPING); + pthread_join (thread->thread_id, 0); gst_info("gstthread: thread \"%s\" is stopped\n", - gst_element_get_name(GST_ELEMENT(thread))); + gst_element_get_name (GST_ELEMENT (thread))); return NULL; } -static void gst_thread_signal_thread(GstThread *thread) { - g_mutex_lock(thread->lock); - g_cond_signal(thread->cond); - g_mutex_unlock(thread->lock); +static void +gst_thread_signal_thread (GstThread *thread) +{ + g_mutex_lock (thread->lock); + g_cond_signal (thread->cond); + g_mutex_unlock (thread->lock); } -static void gst_thread_restore_thyself(GstElement *element,xmlNodePtr parent, GHashTable *elements) { - - g_print("gstthread: restore\n"); +static void +gst_thread_restore_thyself (GstElement *element, + xmlNodePtr parent, + GHashTable *elements) +{ + g_print("gstthread: restore\n"); - if (GST_ELEMENT_CLASS(parent_class)->restore_thyself) - GST_ELEMENT_CLASS(parent_class)->restore_thyself(element,parent, elements); + if (GST_ELEMENT_CLASS (parent_class)->restore_thyself) + GST_ELEMENT_CLASS (parent_class)->restore_thyself (element,parent, elements); } -static xmlNodePtr gst_thread_save_thyself(GstElement *element,xmlNodePtr parent) { - - if (GST_ELEMENT_CLASS(parent_class)->save_thyself) - GST_ELEMENT_CLASS(parent_class)->save_thyself(element,parent); +static xmlNodePtr +gst_thread_save_thyself (GstElement *element, + xmlNodePtr parent) +{ + if (GST_ELEMENT_CLASS (parent_class)->save_thyself) + GST_ELEMENT_CLASS (parent_class)->save_thyself (element,parent); return NULL; } diff --git a/gst/gstthread.h b/gst/gstthread.h index bdecf353a..f68304478 100644 --- a/gst/gstthread.h +++ b/gst/gstthread.h @@ -51,8 +51,8 @@ typedef enum { #define GST_IS_THREAD_CLASS(obj) \ (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_THREAD)) -typedef struct _GstThread GstThread; -typedef struct _GstThreadClass GstThreadClass; +typedef struct _GstThread GstThread; +typedef struct _GstThreadClass GstThreadClass; struct _GstThread { GstBin bin; @@ -66,8 +66,9 @@ struct _GstThreadClass { GstBinClass parent_class; }; -GtkType gst_thread_get_type(void); -GstElement *gst_thread_new(guchar *name); +GtkType gst_thread_get_type (void); + +GstElement* gst_thread_new (guchar *name); #ifdef __cplusplus } diff --git a/gst/gsttrace.h b/gst/gsttrace.h index 0fdbabf4c..fef370e6d 100644 --- a/gst/gsttrace.h +++ b/gst/gsttrace.h @@ -21,10 +21,9 @@ #ifndef __GST_TRACE_H__ #define __GST_TRACE_H__ -void gst_trace_read_tsc(guint64 *dst); -typedef struct _GstTrace GstTrace; -typedef struct _GstTraceEntry GstTraceEntry; +typedef struct _GstTrace GstTrace; +typedef struct _GstTraceEntry GstTraceEntry; struct _GstTrace { /* where this trace is going */ @@ -44,15 +43,19 @@ struct _GstTraceEntry { gchar message[112]; }; -GstTrace *gst_trace_new(guchar *filename,gint size); -void gst_trace_destroy(GstTrace *trace); -void gst_trace_flush(GstTrace *trace); -#define gst_trace_get_size(trace) ((trace)->bufsize) -#define gst_trace_get_offset(trace) ((trace)->bufoffset) -#define gst_trace_get_remaining(trace) ((trace)->bufsize - (trace)->bufoffset) -void gst_trace_set_default(GstTrace *trace); +GstTrace* gst_trace_new (guchar *filename, gint size); -void _gst_trace_add_entry(GstTrace *trace,guint32 seq,guint32 data,gchar *msg); +void gst_trace_destroy (GstTrace *trace); +void gst_trace_flush (GstTrace *trace); +#define gst_trace_get_size(trace) ((trace)->bufsize) +#define gst_trace_get_offset(trace) ((trace)->bufoffset) +#define gst_trace_get_remaining(trace) ((trace)->bufsize - (trace)->bufoffset) +void gst_trace_set_default (GstTrace *trace); + +void _gst_trace_add_entry (GstTrace *trace, guint32 seq, + guint32 data, gchar *msg); + +void gst_trace_read_tsc (guint64 *dst); #define TRACE_ENABLE diff --git a/gst/gsttype.h b/gst/gsttype.h index 2a89a2171..3eb8a0d5e 100644 --- a/gst/gsttype.h +++ b/gst/gsttype.h @@ -56,36 +56,36 @@ struct _GstTypeFactory { /* initialize the subsystem */ -void _gst_type_initialize(); +void _gst_type_initialize (void); /* create a new type, or find/merge an existing one */ -guint16 gst_type_register(GstTypeFactory *factory); +guint16 gst_type_register (GstTypeFactory *factory); /* look up a type by mime or extension */ -guint16 gst_type_find_by_mime(gchar *mime); -guint16 gst_type_find_by_ext(gchar *ext); +guint16 gst_type_find_by_mime (gchar *mime); +guint16 gst_type_find_by_ext (gchar *ext); /* add src or sink object */ -void gst_type_add_src(guint16 id,GstElementFactory *src); -void gst_type_add_sink(guint16 id,GstElementFactory *sink); +void gst_type_add_src (guint16 id, GstElementFactory *src); +void gst_type_add_sink (guint16 id, GstElementFactory *sink); /* get list of src or sink objects */ -GList *gst_type_get_srcs(guint16 id); -GList *gst_type_get_sinks(guint16 id); +GList* gst_type_get_srcs (guint16 id); +GList* gst_type_get_sinks (guint16 id); /* get GstType by id */ -GstType *gst_type_find_by_id(guint16 id); +GstType* gst_type_find_by_id (guint16 id); -GList *gst_type_get_sink_to_src(guint16 sinkid, guint16 srcid); +GList* gst_type_get_sink_to_src (guint16 sinkid, guint16 srcid); /* get the list of registered types (returns list of GstType!) */ -GList *gst_type_get_list(); +GList* gst_type_get_list (void); -void gst_type_dump(); +void gst_type_dump (void); -xmlNodePtr gst_type_save_thyself(GstType *type, xmlNodePtr parent); -guint16 gst_type_load_thyself(xmlNodePtr parent); +xmlNodePtr gst_type_save_thyself (GstType *type, xmlNodePtr parent); +guint16 gst_type_load_thyself (xmlNodePtr parent); -xmlNodePtr gst_typefactory_save_thyself(GstTypeFactory *factory, xmlNodePtr parent); -GstTypeFactory *gst_typefactory_load_thyself(xmlNodePtr parent); +xmlNodePtr gst_typefactory_save_thyself (GstTypeFactory *factory, xmlNodePtr parent); +GstTypeFactory* gst_typefactory_load_thyself (xmlNodePtr parent); #endif /* __GST_TYPE_H__ */ diff --git a/gst/gstutils.h b/gst/gstutils.h index 521e73ea1..6cb4e6d51 100644 --- a/gst/gstutils.h +++ b/gst/gstutils.h @@ -23,14 +23,14 @@ #include <gtk/gtk.h> -gint gst_util_get_int_arg(GtkObject *object,guchar *argname); -glong gst_util_get_long_arg(GtkObject *object,guchar *argname); -gfloat gst_util_get_float_arg(GtkObject *object,guchar *argname); -gdouble gst_util_get_double_arg(GtkObject *object,guchar *argname); -guchar *gst_util_get_string_arg(GtkObject *object,guchar *argname); -gpointer gst_util_get_pointer_arg(GtkObject *object,guchar *argname); -GtkWidget *gst_util_get_widget_arg(GtkObject *object,guchar *argname); +gint gst_util_get_int_arg (GtkObject *object, guchar *argname); +glong gst_util_get_long_arg (GtkObject *object, guchar *argname); +gfloat gst_util_get_float_arg (GtkObject *object, guchar *argname); +gdouble gst_util_get_double_arg (GtkObject *object, guchar *argname); +guchar* gst_util_get_string_arg (GtkObject *object, guchar *argname); +gpointer gst_util_get_pointer_arg (GtkObject *object, guchar *argname); +GtkWidget* gst_util_get_widget_arg (GtkObject *object, guchar *argname); -void gst_util_dump_mem(guchar *mem, guint size); +void gst_util_dump_mem (guchar *mem, guint size); #endif /* __GST_UTILS_H__ */ diff --git a/gst/gstxml.h b/gst/gstxml.h index c152f3a12..4ebb9ec61 100644 --- a/gst/gstxml.h +++ b/gst/gstxml.h @@ -52,15 +52,15 @@ struct _GstXMLClass { GtkObjectClass parent_class; }; -GtkType gst_xml_get_type(void); +GtkType gst_xml_get_type (void); /* create an XML document out of a pipeline */ -xmlDocPtr gst_xml_write(GstElement *element); +xmlDocPtr gst_xml_write (GstElement *element); -GstXML *gst_xml_new(const guchar *fname, const guchar *root); +GstXML* gst_xml_new (const guchar *fname, const guchar *root); -GstElement *gst_xml_get_element(GstXML *xml, const guchar *name); +GstElement* gst_xml_get_element (GstXML *xml, const guchar *name); #ifdef __cplusplus } diff --git a/gst/types/gsttypes.c b/gst/types/gsttypes.c index 3dc7778a3..e2b185021 100644 --- a/gst/types/gsttypes.c +++ b/gst/types/gsttypes.c @@ -29,21 +29,23 @@ GstTypeFactory _factories[] = { }; -GstPlugin *plugin_init(GModule *module) { +GstPlugin* +plugin_init (GModule *module) +{ GstPlugin *plugin; gint i = 0; - plugin = gst_plugin_new("gsttypes"); - g_return_val_if_fail(plugin != NULL,NULL); + plugin = gst_plugin_new ("gsttypes"); + g_return_val_if_fail (plugin != NULL,NULL); while (_factories[i].mime) { - gst_type_register(&_factories[i]); - gst_plugin_add_type(plugin, &_factories[i]); + gst_type_register (&_factories[i]); + gst_plugin_add_type (plugin, &_factories[i]); // DEBUG("added factory #%d '%s'\n",i,_factories[i].mime); i++; } - gst_info("gsttypes: loaded %d standard types\n",i); + gst_info ("gsttypes: loaded %d standard types\n",i); return plugin; } diff --git a/gst/xml/.gitignore b/gst/xml/.gitignore deleted file mode 100644 index 839aee507..000000000 --- a/gst/xml/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -Makefile -Makefile.in -*.o -*.lo -*.la -.deps -.libs - -save diff --git a/gst/xml/Makefile.am b/gst/xml/Makefile.am deleted file mode 100644 index 304102226..000000000 --- a/gst/xml/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -noinst_PROGRAMS = save - -INCLUDES = $(GLIB_CFLAGS) $(GTK_CFLAGS) $(XML_CFLAGS) -I$(top_srcdir) -LDADD = $(GLIB_LIBS) $(GTK_LIBS) $(XML_LIBS) $(top_srcdir)/gst/libgst.la - diff --git a/gst/xml/notes b/gst/xml/notes deleted file mode 100644 index 5ed0566da..000000000 --- a/gst/xml/notes +++ /dev/null @@ -1,6 +0,0 @@ -The naming hiearchy you'll see bits of but never the whole thing is -basically container:container:container:element.pad, which reflects -parentage. When naming connections between elements, those are the what -will be used, possibly along with .. as container to indicate 'up one'. I -don't think this will ever by used, since ghost pads are supposed to make -all connections between elements with the same parent. diff --git a/gst/xml/save.c b/gst/xml/save.c deleted file mode 100644 index 5e41244a1..000000000 --- a/gst/xml/save.c +++ /dev/null @@ -1,43 +0,0 @@ -#include <gst/gst.h> - -extern gboolean _gst_plugin_spew; - -GstPipeline *create_pipeline() { - GstPipeline *pipeline; - GstElement *src, *sink; - GstPad *srcpad, *sinkpad; - - pipeline = gst_pipeline_new("fake_pipeline"); - g_return_if_fail(pipeline != NULL); - - src = gst_elementfactory_make("fakesrc","fakesrc"); - g_return_if_fail(src != NULL); - sink = gst_elementfactory_make("fakesink","fakesink"); - g_return_if_fail(sink != NULL); - - gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(src)); - gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(sink)); - - srcpad = gst_element_get_pad(src,"src"); - g_return_if_fail(srcpad != NULL); - sinkpad = gst_element_get_pad(sink,"sink"); - g_return_if_fail(srcpad != NULL); - - gst_pad_connect(srcpad,sinkpad); - - return GST_PIPELINE(pipeline); -} - -int main(int argc,char *argv[]) { - GstElement *pipeline; - xmlDocPtr doc; - -// _gst_plugin_spew = TRUE; - - gst_init(&argc,&argv); - - pipeline = GST_ELEMENT(create_pipeline()); - - doc = gst_xml_write(pipeline); - xmlSaveFile("save.xml",doc); -} diff --git a/libs/idct/Makefile.am b/libs/idct/Makefile.am index 7f45549eb..f3fabc786 100644 --- a/libs/idct/Makefile.am +++ b/libs/idct/Makefile.am @@ -1,6 +1,6 @@ if HAVE_LIBMMX -GSTIDCTARCH_SRCS = mmxidct.S mmx32idct.c +GSTIDCTARCH_SRCS = mmxidct.S mmx32idct.c sseidct.S else GSTIDCTARCH_SRCS = endif diff --git a/libs/idct/dct.h b/libs/idct/dct.h index 71811a11e..fcb7de37d 100644 --- a/libs/idct/dct.h +++ b/libs/idct/dct.h @@ -26,6 +26,7 @@ extern void gst_idct_fast_int_idct (short *block); #ifdef HAVE_LIBMMX extern void gst_idct_mmx_idct (short *block); extern void gst_idct_mmx32_idct (short *block); +extern void gst_idct_sse_idct (short *block); #endif /* HAVE_LIBMMX */ extern void gst_idct_init_float_idct(void); diff --git a/libs/idct/gstidct.c b/libs/idct/gstidct.c index 701df771e..6eae831ce 100644 --- a/libs/idct/gstidct.c +++ b/libs/idct/gstidct.c @@ -37,6 +37,11 @@ GstIDCT *gst_idct_new(GstIDCTMethod method) if (gst_cpu_get_flags() & GST_CPU_FLAG_MMX) { method = GST_IDCT_MMX; } + /* disabled for now + if (gst_cpu_get_flags() & GST_CPU_FLAG_SSE) { + method = GST_IDCT_SSE; + } + */ else #endif /* HAVE_LIBMMX */ { @@ -72,6 +77,11 @@ GstIDCT *gst_idct_new(GstIDCTMethod method) new->convert = gst_idct_mmx32_idct; new->need_transpose = TRUE; break; + case GST_IDCT_SSE: + g_print("GstIDCT: using SSE_idct\n"); + new->convert = gst_idct_sse_idct; + new->need_transpose = TRUE; + break; #endif /* HAVE_LIBMMX */ default: g_print("GstIDCT: method not supported\n"); diff --git a/libs/idct/gstidct.h b/libs/idct/gstidct.h index 2e0fd4b06..b5654737f 100644 --- a/libs/idct/gstidct.h +++ b/libs/idct/gstidct.h @@ -29,7 +29,8 @@ typedef enum { GST_IDCT_FAST_INT, GST_IDCT_FLOAT, GST_IDCT_MMX, - GST_IDCT_MMX32 + GST_IDCT_MMX32, + GST_IDCT_SSE, } GstIDCTMethod; typedef struct _GstIDCT GstIDCT; diff --git a/libs/idct/sseidct.S b/libs/idct/sseidct.S new file mode 100644 index 000000000..99cda4f2e --- /dev/null +++ b/libs/idct/sseidct.S @@ -0,0 +1,740 @@ +.data + .align 4 + .type rounder0,@object +rounder0: + .long 65536 + .long 65536 + .size rounder0,8 + .align 4 + .type rounder4,@object +rounder4: + .long 1024 + .long 1024 + .size rounder4,8 + .align 4 + .type rounder1,@object +rounder1: + .long 3597 + .long 3597 + .size rounder1,8 + .align 4 + .type rounder7,@object +rounder7: + .long 512 + .long 512 + .size rounder7,8 + .align 4 + .type rounder2,@object +rounder2: + .long 2260 + .long 2260 + .size rounder2,8 + .align 4 + .type rounder6,@object +rounder6: + .long 512 + .long 512 + .size rounder6,8 + .align 4 + .type rounder3,@object +rounder3: + .long 1203 + .long 1203 + .size rounder3,8 + .align 4 + .type rounder5,@object +rounder5: + .long 120 + .long 120 + .size rounder5,8 + .align 2 + .type _T1.46,@object +_T1.46: + .value 13036 + .value 13036 + .value 13036 + .value 13036 + .align 2 + .type _T2.47,@object +_T2.47: + .value 27146 + .value 27146 + .value 27146 + .value 27146 + .align 2 + .type _T3.48,@object +_T3.48: + .value -21746 + .value -21746 + .value -21746 + .value -21746 + .align 2 + .type _C4.49,@object +_C4.49: + .value 23170 + .value 23170 + .value 23170 + .value 23170 + .local scratch0.50 + .comm scratch0.50,8,4 + .local scratch1.51 + .comm scratch1.51,8,4 + .align 2 + .type table04.54,@object +table04.54: + .value 16384 + .value 21407 + .value -16384 + .value -21407 + .value 16384 + .value 8867 + .value 16384 + .value 8867 + .value 22725 + .value 19266 + .value -22725 + .value -12873 + .value 12873 + .value 4520 + .value 19266 + .value -4520 + .value 16384 + .value -8867 + .value 16384 + .value -8867 + .value -16384 + .value 21407 + .value 16384 + .value -21407 + .value 12873 + .value -22725 + .value 19266 + .value -22725 + .value 4520 + .value 19266 + .value 4520 + .value -12873 + .align 2 + .type table17.55,@object +table17.55: + .value 22725 + .value 29692 + .value -22725 + .value -29692 + .value 22725 + .value 12299 + .value 22725 + .value 12299 + .value 31521 + .value 26722 + .value -31521 + .value -17855 + .value 17855 + .value 6270 + .value 26722 + .value -6270 + .value 22725 + .value -12299 + .value 22725 + .value -12299 + .value -22725 + .value 29692 + .value 22725 + .value -29692 + .value 17855 + .value -31521 + .value 26722 + .value -31521 + .value 6270 + .value 26722 + .value 6270 + .value -17855 + .align 2 + .type table26.56,@object +table26.56: + .value 21407 + .value 27969 + .value -21407 + .value -27969 + .value 21407 + .value 11585 + .value 21407 + .value 11585 + .value 29692 + .value 25172 + .value -29692 + .value -16819 + .value 16819 + .value 5906 + .value 25172 + .value -5906 + .value 21407 + .value -11585 + .value 21407 + .value -11585 + .value -21407 + .value 27969 + .value 21407 + .value -27969 + .value 16819 + .value -29692 + .value 25172 + .value -29692 + .value 5906 + .value 25172 + .value 5906 + .value -16819 + .align 2 + .type table35.57,@object +table35.57: + .value 19266 + .value 25172 + .value -19266 + .value -25172 + .value 19266 + .value 10426 + .value 19266 + .value 10426 + .value 26722 + .value 22654 + .value -26722 + .value -15137 + .value 15137 + .value 5315 + .value 22654 + .value -5315 + .value 19266 + .value -10426 + .value 19266 + .value -10426 + .value -19266 + .value 25172 + .value 19266 + .value -25172 + .value 15137 + .value -26722 + .value 22654 + .value -26722 + .value 5315 + .value 22654 + .value 5315 + .value -15137 +.text + .align 4 +.globl gst_idct_sse_idct + .type gst_idct_sse_idct,@function +gst_idct_sse_idct: + subl $8,%esp + pushl %ebp + pushl %edi + pushl %esi + pushl %ebx + call .L51 +.L51: + popl %ebx + addl $_GLOBAL_OFFSET_TABLE_+[.-.L51],%ebx + movl 28(%esp),%edx + leal table04.54@GOTOFF(%ebx),%eax + movq (%edx), %mm2 + movq 8(%edx), %mm5 + movq %mm2, %mm0 + movq (%eax), %mm3 + movq %mm5, %mm6 + movq 8(%eax), %mm4 + pmaddwd %mm0, %mm3 + pshufw $78, %mm2, %mm2 + leal rounder0@GOTOFF(%ebx),%ecx + movq 16(%eax), %mm1 + pmaddwd %mm2, %mm4 + pmaddwd 32(%eax), %mm0 + pshufw $78, %mm6, %mm6 + movq 24(%eax), %mm7 + pmaddwd %mm5, %mm1 + paddd (%ecx), %mm3 + pmaddwd %mm6, %mm7 + pmaddwd 40(%eax), %mm2 + paddd %mm4, %mm3 + pmaddwd 48(%eax), %mm5 + movq %mm3, %mm4 + pmaddwd 56(%eax), %mm6 + paddd %mm7, %mm1 + paddd (%ecx), %mm0 + psubd %mm1, %mm3 + psrad $11, %mm3 + paddd %mm4, %mm1 + paddd %mm2, %mm0 + psrad $11, %mm1 + paddd %mm6, %mm5 + movq %mm0, %mm4 + paddd %mm5, %mm0 + psubd %mm5, %mm4 + movq 64(%edx), %mm2 + psrad $11, %mm0 + movq 72(%edx), %mm5 + psrad $11, %mm4 + packssdw %mm0, %mm1 + movq %mm5, %mm6 + packssdw %mm3, %mm4 + movq %mm2, %mm0 + movq %mm1, (%edx) + pshufw $177, %mm4, %mm4 + movq (%eax), %mm3 + movq %mm4, 8(%edx) + pmaddwd %mm0, %mm3 + movq 8(%eax), %mm4 + pshufw $78, %mm2, %mm2 + leal rounder4@GOTOFF(%ebx),%ecx + movq 16(%eax), %mm1 + pmaddwd %mm2, %mm4 + pmaddwd 32(%eax), %mm0 + pshufw $78, %mm6, %mm6 + movq 24(%eax), %mm7 + pmaddwd %mm5, %mm1 + paddd (%ecx), %mm3 + pmaddwd %mm6, %mm7 + pmaddwd 40(%eax), %mm2 + paddd %mm4, %mm3 + pmaddwd 48(%eax), %mm5 + movq %mm3, %mm4 + pmaddwd 56(%eax), %mm6 + paddd %mm7, %mm1 + paddd (%ecx), %mm0 + psubd %mm1, %mm3 + psrad $11, %mm3 + paddd %mm4, %mm1 + paddd %mm2, %mm0 + psrad $11, %mm1 + paddd %mm6, %mm5 + movq %mm0, %mm4 + paddd %mm5, %mm0 + psubd %mm5, %mm4 + leal table17.55@GOTOFF(%ebx),%eax + movq 16(%edx), %mm2 + psrad $11, %mm0 + movq 24(%edx), %mm5 + psrad $11, %mm4 + packssdw %mm0, %mm1 + movq %mm5, %mm6 + packssdw %mm3, %mm4 + movq %mm2, %mm0 + movq %mm1, 64(%edx) + pshufw $177, %mm4, %mm4 + movq (%eax), %mm3 + movq %mm4, 72(%edx) + pmaddwd %mm0, %mm3 + movq 8(%eax), %mm4 + pshufw $78, %mm2, %mm2 + leal rounder1@GOTOFF(%ebx),%ecx + movq 16(%eax), %mm1 + pmaddwd %mm2, %mm4 + pmaddwd 32(%eax), %mm0 + pshufw $78, %mm6, %mm6 + movq 24(%eax), %mm7 + pmaddwd %mm5, %mm1 + paddd (%ecx), %mm3 + pmaddwd %mm6, %mm7 + pmaddwd 40(%eax), %mm2 + paddd %mm4, %mm3 + pmaddwd 48(%eax), %mm5 + movq %mm3, %mm4 + pmaddwd 56(%eax), %mm6 + paddd %mm7, %mm1 + paddd (%ecx), %mm0 + psubd %mm1, %mm3 + psrad $11, %mm3 + paddd %mm4, %mm1 + paddd %mm2, %mm0 + psrad $11, %mm1 + paddd %mm6, %mm5 + movq %mm0, %mm4 + paddd %mm5, %mm0 + psubd %mm5, %mm4 + movq 112(%edx), %mm2 + psrad $11, %mm0 + movq 120(%edx), %mm5 + psrad $11, %mm4 + packssdw %mm0, %mm1 + movq %mm5, %mm6 + packssdw %mm3, %mm4 + movq %mm2, %mm0 + movq %mm1, 16(%edx) + pshufw $177, %mm4, %mm4 + movq (%eax), %mm3 + movq %mm4, 24(%edx) + pmaddwd %mm0, %mm3 + movq 8(%eax), %mm4 + pshufw $78, %mm2, %mm2 + leal rounder7@GOTOFF(%ebx),%ecx + movq 16(%eax), %mm1 + pmaddwd %mm2, %mm4 + pmaddwd 32(%eax), %mm0 + pshufw $78, %mm6, %mm6 + movq 24(%eax), %mm7 + pmaddwd %mm5, %mm1 + paddd (%ecx), %mm3 + pmaddwd %mm6, %mm7 + pmaddwd 40(%eax), %mm2 + paddd %mm4, %mm3 + pmaddwd 48(%eax), %mm5 + movq %mm3, %mm4 + pmaddwd 56(%eax), %mm6 + paddd %mm7, %mm1 + paddd (%ecx), %mm0 + psubd %mm1, %mm3 + psrad $11, %mm3 + paddd %mm4, %mm1 + paddd %mm2, %mm0 + psrad $11, %mm1 + paddd %mm6, %mm5 + movq %mm0, %mm4 + paddd %mm5, %mm0 + psubd %mm5, %mm4 + leal table26.56@GOTOFF(%ebx),%eax + movq 32(%edx), %mm2 + psrad $11, %mm0 + movq 40(%edx), %mm5 + psrad $11, %mm4 + packssdw %mm0, %mm1 + movq %mm5, %mm6 + packssdw %mm3, %mm4 + movq %mm2, %mm0 + movq %mm1, 112(%edx) + pshufw $177, %mm4, %mm4 + movq (%eax), %mm3 + movq %mm4, 120(%edx) + pmaddwd %mm0, %mm3 + movq 8(%eax), %mm4 + pshufw $78, %mm2, %mm2 + leal rounder2@GOTOFF(%ebx),%ecx + movq 16(%eax), %mm1 + pmaddwd %mm2, %mm4 + pmaddwd 32(%eax), %mm0 + pshufw $78, %mm6, %mm6 + movq 24(%eax), %mm7 + pmaddwd %mm5, %mm1 + paddd (%ecx), %mm3 + pmaddwd %mm6, %mm7 + pmaddwd 40(%eax), %mm2 + paddd %mm4, %mm3 + pmaddwd 48(%eax), %mm5 + movq %mm3, %mm4 + pmaddwd 56(%eax), %mm6 + paddd %mm7, %mm1 + paddd (%ecx), %mm0 + psubd %mm1, %mm3 + psrad $11, %mm3 + paddd %mm4, %mm1 + paddd %mm2, %mm0 + psrad $11, %mm1 + paddd %mm6, %mm5 + movq %mm0, %mm4 + paddd %mm5, %mm0 + psubd %mm5, %mm4 + movq 96(%edx), %mm2 + psrad $11, %mm0 + movq 104(%edx), %mm5 + psrad $11, %mm4 + packssdw %mm0, %mm1 + movq %mm5, %mm6 + packssdw %mm3, %mm4 + movq %mm2, %mm0 + movq %mm1, 32(%edx) + pshufw $177, %mm4, %mm4 + movq (%eax), %mm3 + movq %mm4, 40(%edx) + pmaddwd %mm0, %mm3 + movq 8(%eax), %mm4 + pshufw $78, %mm2, %mm2 + leal rounder6@GOTOFF(%ebx),%ecx + movq 16(%eax), %mm1 + pmaddwd %mm2, %mm4 + pmaddwd 32(%eax), %mm0 + pshufw $78, %mm6, %mm6 + movq 24(%eax), %mm7 + pmaddwd %mm5, %mm1 + paddd (%ecx), %mm3 + pmaddwd %mm6, %mm7 + pmaddwd 40(%eax), %mm2 + paddd %mm4, %mm3 + pmaddwd 48(%eax), %mm5 + movq %mm3, %mm4 + pmaddwd 56(%eax), %mm6 + paddd %mm7, %mm1 + paddd (%ecx), %mm0 + psubd %mm1, %mm3 + psrad $11, %mm3 + paddd %mm4, %mm1 + paddd %mm2, %mm0 + psrad $11, %mm1 + paddd %mm6, %mm5 + movq %mm0, %mm4 + paddd %mm5, %mm0 + psubd %mm5, %mm4 + leal table35.57@GOTOFF(%ebx),%eax + movq 48(%edx), %mm2 + psrad $11, %mm0 + movq 56(%edx), %mm5 + psrad $11, %mm4 + packssdw %mm0, %mm1 + movq %mm5, %mm6 + packssdw %mm3, %mm4 + movq %mm2, %mm0 + movq %mm1, 96(%edx) + pshufw $177, %mm4, %mm4 + movq (%eax), %mm3 + movq %mm4, 104(%edx) + pmaddwd %mm0, %mm3 + movq 8(%eax), %mm4 + pshufw $78, %mm2, %mm2 + leal rounder3@GOTOFF(%ebx),%ecx + movq 16(%eax), %mm1 + pmaddwd %mm2, %mm4 + pmaddwd 32(%eax), %mm0 + pshufw $78, %mm6, %mm6 + movq 24(%eax), %mm7 + pmaddwd %mm5, %mm1 + paddd (%ecx), %mm3 + pmaddwd %mm6, %mm7 + pmaddwd 40(%eax), %mm2 + paddd %mm4, %mm3 + pmaddwd 48(%eax), %mm5 + movq %mm3, %mm4 + pmaddwd 56(%eax), %mm6 + paddd %mm7, %mm1 + paddd (%ecx), %mm0 + psubd %mm1, %mm3 + psrad $11, %mm3 + paddd %mm4, %mm1 + paddd %mm2, %mm0 + psrad $11, %mm1 + paddd %mm6, %mm5 + movq %mm0, %mm4 + paddd %mm5, %mm0 + psubd %mm5, %mm4 + movq 80(%edx), %mm2 + psrad $11, %mm0 + movq 88(%edx), %mm5 + psrad $11, %mm4 + packssdw %mm0, %mm1 + movq %mm5, %mm6 + packssdw %mm3, %mm4 + movq %mm2, %mm0 + movq %mm1, 48(%edx) + pshufw $177, %mm4, %mm4 + movq (%eax), %mm3 + movq %mm4, 56(%edx) + pmaddwd %mm0, %mm3 + movq 8(%eax), %mm4 + pshufw $78, %mm2, %mm2 + leal rounder5@GOTOFF(%ebx),%ecx + movq 16(%eax), %mm1 + pmaddwd %mm2, %mm4 + pmaddwd 32(%eax), %mm0 + pshufw $78, %mm6, %mm6 + movq 24(%eax), %mm7 + pmaddwd %mm5, %mm1 + paddd (%ecx), %mm3 + pmaddwd %mm6, %mm7 + pmaddwd 40(%eax), %mm2 + paddd %mm4, %mm3 + pmaddwd 48(%eax), %mm5 + movq %mm3, %mm4 + pmaddwd 56(%eax), %mm6 + paddd %mm7, %mm1 + paddd (%ecx), %mm0 + psubd %mm1, %mm3 + psrad $11, %mm3 + paddd %mm4, %mm1 + paddd %mm2, %mm0 + psrad $11, %mm1 + paddd %mm6, %mm5 + movq %mm0, %mm4 + paddd %mm5, %mm0 + psubd %mm5, %mm4 + psrad $11, %mm0 + psrad $11, %mm4 + packssdw %mm0, %mm1 + packssdw %mm3, %mm4 + movq %mm1, 80(%edx) + pshufw $177, %mm4, %mm4 + movq %mm4, 88(%edx) + leal _T1.46@GOTOFF(%ebx),%edi + movq (%edi), %mm0 + movq 16(%edx), %mm1 + movq %mm0, %mm2 + movq 112(%edx), %mm4 + pmulhw %mm1, %mm0 + leal _T3.48@GOTOFF(%ebx),%esi + movl %esi,16(%esp) + movq (%esi), %mm5 + pmulhw %mm4, %mm2 + movq 80(%edx), %mm6 + movq %mm5, %mm7 + movq 48(%edx), %mm3 + psubsw %mm4, %mm0 + leal _T2.47@GOTOFF(%ebx),%ecx + movq (%ecx), %mm4 + pmulhw %mm3, %mm5 + paddsw %mm2, %mm1 + pmulhw %mm6, %mm7 + movq %mm4, %mm2 + paddsw %mm3, %mm5 + pmulhw 32(%edx), %mm4 + paddsw %mm6, %mm7 + psubsw %mm6, %mm5 + paddsw %mm3, %mm7 + movq 96(%edx), %mm3 + movq %mm0, %mm6 + pmulhw %mm3, %mm2 + psubsw %mm5, %mm0 + psubsw %mm3, %mm4 + paddsw %mm6, %mm5 + leal scratch0.50@GOTOFF(%ebx),%esi + movl %esi,20(%esp) + movq %mm0, scratch0.50@GOTOFF(%ebx) + movq %mm1, %mm6 + paddsw 32(%edx), %mm2 + paddsw %mm7, %mm6 + psubsw %mm7, %mm1 + movq %mm1, %mm7 + movq (%edx), %mm3 + paddsw %mm5, %mm1 + leal _C4.49@GOTOFF(%ebx),%eax + movq (%eax), %mm0 + psubsw %mm5, %mm7 + leal scratch1.51@GOTOFF(%ebx),%ebp + movq %mm6, scratch1.51@GOTOFF(%ebx) + pmulhw %mm0, %mm1 + movq %mm4, %mm6 + pmulhw %mm0, %mm7 + movq 64(%edx), %mm5 + movq %mm3, %mm0 + psubsw %mm5, %mm3 + paddsw %mm5, %mm0 + paddsw %mm3, %mm4 + movq %mm0, %mm5 + psubsw %mm6, %mm3 + paddsw %mm2, %mm5 + paddsw %mm1, %mm1 + psubsw %mm2, %mm0 + paddsw %mm7, %mm7 + movq %mm3, %mm2 + movq %mm4, %mm6 + paddsw %mm7, %mm3 + psraw $6, %mm3 + paddsw %mm1, %mm4 + psraw $6, %mm4 + psubsw %mm1, %mm6 + movq (%ebp), %mm1 + psubsw %mm7, %mm2 + psraw $6, %mm6 + movq %mm5, %mm7 + movq %mm4, 16(%edx) + psraw $6, %mm2 + movq %mm3, 32(%edx) + paddsw %mm1, %mm5 + movq (%esi), %mm4 + psubsw %mm1, %mm7 + psraw $6, %mm5 + movq %mm0, %mm3 + movq %mm2, 80(%edx) + psubsw %mm4, %mm3 + psraw $6, %mm7 + paddsw %mm0, %mm4 + movq %mm5, (%edx) + psraw $6, %mm3 + movq %mm6, 96(%edx) + psraw $6, %mm4 + movq %mm7, 112(%edx) + movq %mm3, 64(%edx) + movq %mm4, 48(%edx) + movq (%edi), %mm0 + movq 24(%edx), %mm1 + movq %mm0, %mm2 + movq 120(%edx), %mm4 + pmulhw %mm1, %mm0 + movl 16(%esp),%esi + movq (%esi), %mm5 + pmulhw %mm4, %mm2 + movq 88(%edx), %mm6 + movq %mm5, %mm7 + movq 56(%edx), %mm3 + psubsw %mm4, %mm0 + movq (%ecx), %mm4 + pmulhw %mm3, %mm5 + paddsw %mm2, %mm1 + pmulhw %mm6, %mm7 + movq %mm4, %mm2 + paddsw %mm3, %mm5 + pmulhw 40(%edx), %mm4 + paddsw %mm6, %mm7 + psubsw %mm6, %mm5 + paddsw %mm3, %mm7 + movq 104(%edx), %mm3 + movq %mm0, %mm6 + pmulhw %mm3, %mm2 + psubsw %mm5, %mm0 + psubsw %mm3, %mm4 + paddsw %mm6, %mm5 + movq %mm0, scratch0.50@GOTOFF(%ebx) + movq %mm1, %mm6 + paddsw 40(%edx), %mm2 + paddsw %mm7, %mm6 + psubsw %mm7, %mm1 + movq %mm1, %mm7 + movq 8(%edx), %mm3 + paddsw %mm5, %mm1 + movq (%eax), %mm0 + psubsw %mm5, %mm7 + movq %mm6, scratch1.51@GOTOFF(%ebx) + pmulhw %mm0, %mm1 + movq %mm4, %mm6 + pmulhw %mm0, %mm7 + movq 72(%edx), %mm5 + movq %mm3, %mm0 + psubsw %mm5, %mm3 + paddsw %mm5, %mm0 + paddsw %mm3, %mm4 + movq %mm0, %mm5 + psubsw %mm6, %mm3 + paddsw %mm2, %mm5 + paddsw %mm1, %mm1 + psubsw %mm2, %mm0 + paddsw %mm7, %mm7 + movq %mm3, %mm2 + movq %mm4, %mm6 + paddsw %mm7, %mm3 + psraw $6, %mm3 + paddsw %mm1, %mm4 + psraw $6, %mm4 + psubsw %mm1, %mm6 + movq (%ebp), %mm1 + psubsw %mm7, %mm2 + psraw $6, %mm6 + movq %mm5, %mm7 + movq %mm4, 24(%edx) + psraw $6, %mm2 + movq %mm3, 40(%edx) + paddsw %mm1, %mm5 + movl 20(%esp),%esi + movq (%esi), %mm4 + psubsw %mm1, %mm7 + psraw $6, %mm5 + movq %mm0, %mm3 + movq %mm2, 88(%edx) + psubsw %mm4, %mm3 + psraw $6, %mm7 + paddsw %mm0, %mm4 + movq %mm5, 8(%edx) + psraw $6, %mm3 + movq %mm6, 104(%edx) + psraw $6, %mm4 + movq %mm7, 120(%edx) + movq %mm3, 72(%edx) + movq %mm4, 56(%edx) + popl %ebx + popl %esi + popl %edi + popl %ebp + addl $8,%esp + ret |