mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-05 15:08:48 +00:00
- fixed configure.in %VAR stuff
Original commit message from CVS: - fixed configure.in %VAR stuff - fixed gstreamer.pc.in description string - fixed up incremental scheduling some more - updated the GST_DEBUG_FUNCPTR code to no longer need a hash - minor updates to DEBUG colorization - new test/mpeg2parse4.c
This commit is contained in:
parent
899edf17dd
commit
879f3b4f29
15 changed files with 345 additions and 76 deletions
|
@ -730,9 +730,9 @@ AM_CONDITIONAL(HAVE_MPEG2DEC, test "x$HAVE_MPEG2DEC" = "xyes")
|
|||
AM_CONDITIONAL(HAVE_LIBXMMS, test "x$HAVE_LIBXMMS" = "xyes")
|
||||
AM_CONDITIONAL(HAVE_LIBRTP, test "x$HAVE_LIBRTP" = "xyes")
|
||||
AM_CONDITIONAL(HAVE_ARTS, test "x$HAVE_ARTS" = "xyes")
|
||||
AM_CONDITIONAL(HAVE_RAW1394, test "x%HAVE_RAW1394" = "xyes")
|
||||
AM_CONDITIONAL(HAVE_LIBDV, test "x%HAVE_LIBDV" = "xyes")
|
||||
AM_CONDITIONAL(HAVE_LIBAA, test "x%HAVE_LIBAA" = "xyes")
|
||||
AM_CONDITIONAL(HAVE_RAW1394, test "x$HAVE_RAW1394" = "xyes")
|
||||
AM_CONDITIONAL(HAVE_LIBDV, test "x$HAVE_LIBDV" = "xyes")
|
||||
AM_CONDITIONAL(HAVE_LIBAA, test "x$HAVE_LIBAA" = "xyes")
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ noinst_HEADERS = \
|
|||
gstsparc.h \
|
||||
gstpropsprivate.h
|
||||
|
||||
CFLAGS = $(LIBGST_CFLAGS)
|
||||
CFLAGS = $(LIBGST_CFLAGS) -D_GNU_SOURCE
|
||||
LIBS = $(LIBGST_LIBS)
|
||||
libgst_la_LDFLAGS = -version-info $(GST_LIBVERSION)
|
||||
|
||||
|
|
29
gst/gstbin.c
29
gst/gstbin.c
|
@ -174,7 +174,6 @@ gst_bin_reset_element_sched (GstElement *element, GstSchedule *sched)
|
|||
void
|
||||
gst_bin_set_element_sched (GstElement *element,GstSchedule *sched)
|
||||
{
|
||||
GstSchedule *realsched = NULL;
|
||||
GList *children;
|
||||
GstElement *child;
|
||||
|
||||
|
@ -189,28 +188,25 @@ gst_bin_set_element_sched (GstElement *element,GstSchedule *sched)
|
|||
// if it's actually a Bin
|
||||
if (GST_IS_BIN(element)) {
|
||||
|
||||
// figure out which element is the manager
|
||||
if (GST_FLAG_IS_SET(element,GST_BIN_FLAG_MANAGER)) {
|
||||
realsched = GST_ELEMENT_SCHED(element);
|
||||
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, element, "setting children's schedule to own sched");
|
||||
} else {
|
||||
realsched = sched;
|
||||
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, element, "setting children's schedule to parent's");
|
||||
GST_SCHEDULE_ADD_ELEMENT (sched, element);
|
||||
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, element, "child is already a manager, not resetting");
|
||||
return;
|
||||
}
|
||||
|
||||
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, element, "setting children's schedule to parent's");
|
||||
GST_SCHEDULE_ADD_ELEMENT (sched, element);
|
||||
|
||||
// set the children's schedule
|
||||
children = GST_BIN(element)->children;
|
||||
while (children) {
|
||||
child = GST_ELEMENT (children->data);
|
||||
children = g_list_next(children);
|
||||
|
||||
gst_bin_set_element_sched (child, realsched);
|
||||
gst_bin_set_element_sched (child, sched);
|
||||
}
|
||||
|
||||
// otherwise, if it's just a regular old element
|
||||
} else {
|
||||
//g_print("calling schedule_add_element (%p, \"%s\")\n",sched, GST_ELEMENT_NAME(element));
|
||||
GST_SCHEDULE_ADD_ELEMENT (sched, element);
|
||||
}
|
||||
}
|
||||
|
@ -228,6 +224,15 @@ gst_bin_unset_element_sched (GstElement *element)
|
|||
// if it's actually a Bin
|
||||
if (GST_IS_BIN(element)) {
|
||||
|
||||
if (GST_FLAG_IS_SET(element,GST_BIN_FLAG_MANAGER)) {
|
||||
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, element, "child is already a manager, not unsetting sched");
|
||||
return;
|
||||
}
|
||||
|
||||
// FIXME this check should be irrelevant
|
||||
if (GST_ELEMENT_SCHED (element))
|
||||
GST_SCHEDULE_REMOVE_ELEMENT (GST_ELEMENT_SCHED(element), element);
|
||||
|
||||
// for each child, remove them from their schedule
|
||||
children = GST_BIN(element)->children;
|
||||
while (children) {
|
||||
|
@ -239,6 +244,7 @@ gst_bin_unset_element_sched (GstElement *element)
|
|||
|
||||
// otherwise, if it's just a regular old element
|
||||
} else {
|
||||
// FIXME this check should be irrelevant
|
||||
if (GST_ELEMENT_SCHED (element))
|
||||
GST_SCHEDULE_REMOVE_ELEMENT (GST_ELEMENT_SCHED(element), element);
|
||||
}
|
||||
|
@ -262,7 +268,8 @@ gst_bin_add (GstBin *bin,
|
|||
g_return_if_fail (element != NULL);
|
||||
g_return_if_fail (GST_IS_ELEMENT (element));
|
||||
|
||||
GST_DEBUG_ENTER ("");
|
||||
GST_DEBUG (GST_CAT_PARENTAGE, "adding element \"%s\" to bin \"%s\"\n",
|
||||
GST_ELEMENT_NAME(element),GST_ELEMENT_NAME(bin));
|
||||
|
||||
// must be not be in PLAYING state in order to modify bin
|
||||
// g_return_if_fail (GST_STATE (bin) != GST_STATE_PLAYING);
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include "gst_private.h"
|
||||
#include "gstelement.h"
|
||||
#include "gstpad.h"
|
||||
|
@ -50,7 +51,7 @@ static gchar *_gst_info_category_strings[] = {
|
|||
"STATES",
|
||||
"PLANNING",
|
||||
"SCHEDULING",
|
||||
"OPERATION",
|
||||
"DATAFLOW",
|
||||
"BUFFER",
|
||||
"CAPS",
|
||||
"CLOCK",
|
||||
|
@ -85,7 +86,7 @@ const gchar *_gst_category_colors[32] = {
|
|||
[GST_CAT_AUTOPLUG_ATTEMPT] = "00;36;44",
|
||||
[GST_CAT_PARENTAGE] = "01;37;41", // !!
|
||||
[GST_CAT_STATES] = "00;31",
|
||||
[GST_CAT_PLANNING] = "00;35",
|
||||
[GST_CAT_PLANNING] = "07;35",
|
||||
[GST_CAT_SCHEDULING] = "00;35",
|
||||
[GST_CAT_DATAFLOW] = "00;32",
|
||||
[GST_CAT_BUFFER] = "00;32",
|
||||
|
@ -153,12 +154,12 @@ gst_default_info_handler (gint category, gchar *file, gchar *function,
|
|||
|
||||
#ifdef GST_DEBUG_ENABLED
|
||||
#ifdef GST_DEBUG_COLOR
|
||||
fprintf(stderr,"INFO (\033[00;%dm%5d\033[00m:\033[00;%dm%2d\033[00m):\033["
|
||||
fprintf(stderr,"INFO (\033[00;%dm%5d\033[00m:\033[00;%dm%2d\033[00m)\033["
|
||||
GST_DEBUG_CHAR_MODE ";%sm%s%s\033[00m %s\n",
|
||||
pthread_color,pthread_id,cothread_color,cothread_id,
|
||||
_gst_category_colors[category],location,elementname,string);
|
||||
#else
|
||||
fprintf(stderr,"INFO (%5d:%2d):%s%s %s\n",
|
||||
fprintf(stderr,"INFO (%5d:%2d)%s%s %s\n",
|
||||
getpid(),cothread_id,location,elementname,string);
|
||||
#endif /* GST_DEBUG_COLOR */
|
||||
#else
|
||||
|
@ -381,3 +382,24 @@ gst_default_error_handler (gchar *file, gchar *function,
|
|||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef __USE_GNU
|
||||
#warning __USE_GNU is defined
|
||||
#endif
|
||||
|
||||
gchar *
|
||||
_gst_debug_nameof_funcptr (void *ptr)
|
||||
{
|
||||
gchar *ptrname;
|
||||
Dl_info dlinfo;
|
||||
if (__gst_function_pointers) {
|
||||
if (ptrname = g_hash_table_lookup(__gst_function_pointers,ptr))
|
||||
return g_strdup(ptrname);
|
||||
} else if (dladdr(ptr,&dlinfo)) {
|
||||
return g_strdup(dlinfo.dli_sname);
|
||||
} else {
|
||||
return g_strdup_printf("%p",ptr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,16 +76,16 @@ G_GNUC_UNUSED static gchar *_debug_string = NULL;
|
|||
#ifdef _GST_COLOR_CODE
|
||||
#warning have a coded debug
|
||||
#define GST_DEBUG_PREFIX(cat,format,args...) \
|
||||
"DEBUG(%d:%d)\033[" _GST_COLOR_CODE "m" __PRETTY_FUNCTION__ ":%d\033[00m" format , \
|
||||
"DEBUG(%5d:%2d)\033[" _GST_COLOR_CODE "m" __PRETTY_FUNCTION__ ":%d\033[00m" format , \
|
||||
getpid() , cothread_getcurrent() , __LINE__ , ## args
|
||||
#else
|
||||
#define GST_DEBUG_PREFIX(cat,format,args...) \
|
||||
"DEBUG(%d:%d)\033[" GST_DEBUG_CHAR_MODE ";%sm" __PRETTY_FUNCTION__ ":%d\033[00m" format , \
|
||||
"DEBUG(%5d:%2d)\033[" GST_DEBUG_CHAR_MODE ";%sm" __PRETTY_FUNCTION__ ":%d\033[00m" format , \
|
||||
getpid() , cothread_getcurrent() , _gst_category_colors[cat] , __LINE__ , ## args
|
||||
#endif /* _GST_COLOR_CODE */
|
||||
#else
|
||||
#define GST_DEBUG_PREFIX(cat,format,args...) \
|
||||
"DEBUG(%d:%d)" __PRETTY_FUNCTION__ ":%d" format , getpid() ,cothread_getcurrent() , __LINE__ , ## args
|
||||
"DEBUG(%5d:%2d)" __PRETTY_FUNCTION__ ":%d" format , getpid() ,cothread_getcurrent() , __LINE__ , ## args
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -164,7 +164,7 @@ getpid() , cothread_getcurrent() , _gst_category_colors[cat] , __LINE__ , ## arg
|
|||
/********** function pointer stuff **********/
|
||||
extern GHashTable *__gst_function_pointers;
|
||||
|
||||
#ifdef GST_DEBUG_ENABLED
|
||||
#ifdef GST_DEBUG_ENABLED_dontuse
|
||||
#define GST_DEBUG_FUNCPTR(ptr) _gst_debug_register_funcptr((void *)(ptr), #ptr)
|
||||
#define GST_DEBUG_FUNCPTR_NAME(ptr) _gst_debug_nameof_funcptr((void *)ptr)
|
||||
#else
|
||||
|
@ -181,14 +181,7 @@ _gst_debug_register_funcptr (void *ptr, gchar *ptrname)
|
|||
return ptr;
|
||||
}
|
||||
|
||||
static inline gchar *
|
||||
_gst_debug_nameof_funcptr (void *ptr)
|
||||
{
|
||||
gchar *ptrname = (gchar*)( __gst_function_pointers ? g_hash_table_lookup(__gst_function_pointers,ptr) : NULL );
|
||||
// FIXME this must go away, it's a major leak
|
||||
if (!ptrname) return g_strdup_printf("%p",ptr);
|
||||
else return ptrname;
|
||||
}
|
||||
gchar *_gst_debug_nameof_funcptr (void *ptr);
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
|
|
|
@ -391,7 +391,7 @@ gst_queue_change_state (GstElement *element)
|
|||
// can't call this queue's _get (or whatever)
|
||||
GST_LOCK (queue);
|
||||
|
||||
GST_DEBUG (0,"gstqueue: state pending %d\n", GST_STATE_PENDING (element));
|
||||
GST_DEBUG (GST_CAT_STATES,"gstqueue: state pending %d\n", GST_STATE_PENDING (element));
|
||||
|
||||
/* if going down into NULL state, clear out buffers*/
|
||||
if (GST_STATE_PENDING (element) == GST_STATE_READY) {
|
||||
|
|
|
@ -846,28 +846,33 @@ gst_schedule_new(GstElement *parent)
|
|||
|
||||
/* this function will look at a pad and determine if the peer parent is
|
||||
* a possible candidate for connecting up in the same chain. */
|
||||
/* DEPRACATED !!!!
|
||||
GstElement *gst_schedule_check_pad (GstSchedule *sched, GstPad *pad) {
|
||||
GstRealPad *peer;
|
||||
GstElement *peerelement;
|
||||
GstElement *element, *peerelement;
|
||||
|
||||
GST_INFO (GST_CAT_SCHEDULING, "checking pad %s:%s for peer in scheduler",
|
||||
GST_DEBUG_PAD_NAME(pad));
|
||||
|
||||
element = GST_ELEMENT(GST_PAD_PARENT(peer));
|
||||
GST_DEBUG(GST_CAT_SCHEDULING, "element is \"%s\"\n",GST_ELEMENT_NAME(element));
|
||||
|
||||
peer = GST_PAD_PEER (pad);
|
||||
if (peer == NULL) return NULL;
|
||||
peerelement = GST_ELEMENT(GST_PAD_PARENT (peer));
|
||||
|
||||
// first of all, if the peer element is decoupled, it will be in the same chain
|
||||
if (GST_FLAG_IS_SET(peerelement,GST_ELEMENT_DECOUPLED))
|
||||
return peerelement;
|
||||
if (peerelement == NULL) return NULL;
|
||||
GST_DEBUG(GST_CAT_SCHEDULING, "peer element is \"%s\"\n",GST_ELEMENT_NAME(peerelement));
|
||||
|
||||
// now check to see if it's in the same schedule
|
||||
if (g_list_find(sched->elements,peerelement))
|
||||
if (GST_ELEMENT_SCHED(element) == GST_ELEMENT_SCHED(peerelement)) {
|
||||
GST_DEBUG(GST_CAT_SCHEDULING, "peer is in same schedule\n");
|
||||
return peerelement;
|
||||
}
|
||||
|
||||
// otherwise it's not a candidate
|
||||
return NULL;
|
||||
}
|
||||
*/
|
||||
|
||||
GstScheduleChain *
|
||||
gst_schedule_chain_new (GstSchedule *sched)
|
||||
|
@ -887,7 +892,8 @@ gst_schedule_chain_new (GstSchedule *sched)
|
|||
sched->chains = g_list_prepend (sched->chains, chain);
|
||||
sched->num_chains++;
|
||||
|
||||
GST_INFO (GST_CAT_SCHEDULING, "created new chain, now are %d chains",sched->num_chains);
|
||||
GST_INFO (GST_CAT_SCHEDULING, "created new chain %p, now are %d chains in sched %p",
|
||||
chain,sched->num_chains,sched);
|
||||
|
||||
return chain;
|
||||
}
|
||||
|
@ -895,6 +901,8 @@ gst_schedule_chain_new (GstSchedule *sched)
|
|||
void
|
||||
gst_schedule_chain_destroy (GstScheduleChain *chain)
|
||||
{
|
||||
GST_INFO (GST_CAT_SCHEDULING, "destroying chain %p",chain);
|
||||
|
||||
// remove the chain from the schedules' list of chains
|
||||
chain->sched->chains = g_list_remove (chain->sched->chains, chain);
|
||||
chain->sched->num_chains--;
|
||||
|
@ -908,7 +916,7 @@ gst_schedule_chain_destroy (GstScheduleChain *chain)
|
|||
void
|
||||
gst_schedule_chain_add_element (GstScheduleChain *chain, GstElement *element)
|
||||
{
|
||||
GST_INFO (GST_CAT_SCHEDULING, "adding element \"%s\" to chain", GST_ELEMENT_NAME (element));
|
||||
GST_INFO (GST_CAT_SCHEDULING, "adding element \"%s\" to chain %p", GST_ELEMENT_NAME (element),chain);
|
||||
|
||||
// set the sched pointer for the element
|
||||
element->sched = chain->sched;
|
||||
|
@ -921,7 +929,7 @@ gst_schedule_chain_add_element (GstScheduleChain *chain, GstElement *element)
|
|||
void
|
||||
gst_schedule_chain_enable_element (GstScheduleChain *chain, GstElement *element)
|
||||
{
|
||||
GST_INFO (GST_CAT_SCHEDULING, "enabling element \"%s\" in chain", GST_ELEMENT_NAME (element));
|
||||
GST_INFO (GST_CAT_SCHEDULING, "enabling element \"%s\" in chain %p", GST_ELEMENT_NAME (element),chain);
|
||||
|
||||
// remove from disabled list
|
||||
chain->disabled = g_list_remove (chain->disabled, element);
|
||||
|
@ -936,7 +944,7 @@ gst_schedule_chain_enable_element (GstScheduleChain *chain, GstElement *element)
|
|||
void
|
||||
gst_schedule_chain_disable_element (GstScheduleChain *chain, GstElement *element)
|
||||
{
|
||||
GST_INFO (GST_CAT_SCHEDULING, "disabling element \"%s\" in chain", GST_ELEMENT_NAME (element));
|
||||
GST_INFO (GST_CAT_SCHEDULING, "disabling element \"%s\" in chain %p", GST_ELEMENT_NAME (element),chain);
|
||||
|
||||
// remove from elements list
|
||||
chain->elements = g_list_remove (chain->elements, element);
|
||||
|
@ -952,7 +960,7 @@ gst_schedule_chain_disable_element (GstScheduleChain *chain, GstElement *element
|
|||
void
|
||||
gst_schedule_chain_remove_element (GstScheduleChain *chain, GstElement *element)
|
||||
{
|
||||
GST_INFO (GST_CAT_SCHEDULING, "removing element \"%s\" from chain", GST_ELEMENT_NAME (element));
|
||||
GST_INFO (GST_CAT_SCHEDULING, "removing element \"%s\" from chain %p", GST_ELEMENT_NAME (element),chain);
|
||||
|
||||
// if it's active, deactivate it
|
||||
if (g_list_find (chain->elements, element)) {
|
||||
|
@ -1013,7 +1021,7 @@ gst_schedule_chain_elements (GstSchedule *sched, GstElement *element1, GstElemen
|
|||
|
||||
// otherwise if both have chains already, join them
|
||||
} else if ((chain1 != NULL) && (chain2 != NULL)) {
|
||||
GST_INFO (GST_CAT_SCHEDULING, "joining two existing chains together");
|
||||
GST_INFO (GST_CAT_SCHEDULING, "merging chain %p into chain %p\n",chain2,chain1);
|
||||
// take the contents of chain2 and merge them into chain1
|
||||
chain1->disabled = g_list_concat (chain1->disabled, g_list_copy(chain2->disabled));
|
||||
chain1->elements = g_list_concat (chain1->elements, g_list_copy(chain2->elements));
|
||||
|
@ -1039,13 +1047,20 @@ gst_schedule_chain_elements (GstSchedule *sched, GstElement *element1, GstElemen
|
|||
void
|
||||
gst_schedule_pad_connect (GstSchedule *sched, GstPad *srcpad, GstPad *sinkpad)
|
||||
{
|
||||
GstElement *peerelement;
|
||||
GstElement *srcelement,*sinkelement;
|
||||
|
||||
GST_INFO (GST_CAT_SCHEDULING, "have pad connected callback on %s:%s",GST_DEBUG_PAD_NAME(srcpad));
|
||||
srcelement = GST_PAD_PARENT(srcpad);
|
||||
g_return_if_fail(srcelement != NULL);
|
||||
sinkelement = GST_PAD_PARENT(sinkpad);
|
||||
g_return_if_fail(sinkelement != NULL);
|
||||
|
||||
if ((peerelement = gst_schedule_check_pad(sched,srcpad))) {
|
||||
GST_INFO (GST_CAT_SCHEDULING, "have pad connected callback on %s:%s to %s:%s",GST_DEBUG_PAD_NAME(srcpad),GST_DEBUG_PAD_NAME(sinkpad));
|
||||
GST_DEBUG(GST_CAT_SCHEDULING, "srcpad sched is %p, sinkpad sched is %p\n",
|
||||
GST_ELEMENT_SCHED(srcelement),GST_ELEMENT_SCHED(sinkelement));
|
||||
|
||||
if (GST_ELEMENT_SCHED(srcelement) == GST_ELEMENT_SCHED(sinkelement)) {
|
||||
GST_INFO (GST_CAT_SCHEDULING, "peer %s:%s is in same schedule, chaining together",GST_DEBUG_PAD_NAME(sinkpad));
|
||||
gst_schedule_chain_elements (sched, GST_ELEMENT(GST_PAD_PARENT(srcpad)), peerelement);
|
||||
gst_schedule_chain_elements (sched, srcelement, sinkelement);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1088,11 +1103,13 @@ gst_schedule_chain_recursive_add (GstScheduleChain *chain, GstElement *element)
|
|||
pad = GST_PAD(pads->data);
|
||||
pads = g_list_next (pads);
|
||||
|
||||
// if it's a potential peer
|
||||
if ((peerelement = gst_schedule_check_pad (chain->sched, pad))) {
|
||||
// if it's not already in a chain, add it to this one
|
||||
if (gst_schedule_find_chain (chain->sched, peerelement) == NULL) {
|
||||
gst_schedule_chain_recursive_add (chain, peerelement);
|
||||
// if the peer exists and could be in the same chain
|
||||
if (GST_PAD_PEER(pad)) {
|
||||
if (GST_ELEMENT_SCHED(GST_PAD_PARENT(pad)) == GST_ELEMENT_SCHED(GST_PAD_PARENT(GST_PAD_PEER(pad)))) {
|
||||
// if it's not already in a chain, add it to this one
|
||||
if (gst_schedule_find_chain (chain->sched, peerelement) == NULL) {
|
||||
gst_schedule_chain_recursive_add (chain, peerelement);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1184,11 +1201,13 @@ gst_schedule_add_element (GstSchedule *sched, GstElement *element)
|
|||
// set the pad's sched pointer
|
||||
gst_pad_set_sched (pad, sched);
|
||||
|
||||
// if the peer element is a candidate
|
||||
if ((peerelement = gst_schedule_check_pad(sched,pad))) {
|
||||
GST_INFO (GST_CAT_SCHEDULING, "peer is in same schedule, chaining together");
|
||||
// make sure that the two elements are in the same chain
|
||||
gst_schedule_chain_elements (sched,element,peerelement);
|
||||
// if the peer element exists and is a candidate
|
||||
if (GST_PAD_PEER(pad)) {
|
||||
if (GST_ELEMENT_SCHED(GST_PAD_PARENT(pad)) == GST_ELEMENT_SCHED(GST_PAD_PARENT(GST_PAD_PEER(pad)))) {
|
||||
GST_INFO (GST_CAT_SCHEDULING, "peer is in same schedule, chaining together");
|
||||
// make sure that the two elements are in the same chain
|
||||
gst_schedule_chain_elements (sched,element,peerelement);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1282,17 +1301,16 @@ g_return_val_if_fail (chains != NULL, FALSE);
|
|||
|
||||
if (chain->elements) {
|
||||
entry = NULL; //MattH ADDED?
|
||||
GST_DEBUG(GST_CAT_SCHEDULING,"there are %d elements in this chain\n",chain->num_elements);
|
||||
elements = chain->elements;
|
||||
//printf("searching for non-decoupled element\n");
|
||||
while (elements) {
|
||||
entry = GST_ELEMENT(elements->data);
|
||||
elements = g_list_next(elements);
|
||||
//printf("checking %s\n",GST_ELEMENT_NAME(entry));
|
||||
if (!GST_FLAG_IS_SET(entry,GST_ELEMENT_DECOUPLED)) break;
|
||||
if (GST_FLAG_IS_SET(entry,GST_ELEMENT_DECOUPLED))
|
||||
GST_DEBUG(GST_CAT_SCHEDULING,"entry \"%s\" is DECOUPLED, skipping\n",GST_ELEMENT_NAME(entry));
|
||||
else
|
||||
break;
|
||||
}
|
||||
//printf("found non-decoupled element\n");
|
||||
// FIXME FIXME FIXME need to not use a DECOUPLED element as entry
|
||||
// entry = GST_ELEMENT (chain->elements->data);
|
||||
if (entry) {
|
||||
GST_FLAG_SET (entry, GST_ELEMENT_COTHREAD_STOPPING);
|
||||
GST_DEBUG (GST_CAT_DATAFLOW,"set COTHREAD_STOPPING flag on \"%s\"(@%p)\n",
|
||||
|
@ -1393,6 +1411,8 @@ gst_schedule_show (GstSchedule *sched)
|
|||
|
||||
g_return_if_fail(GST_IS_SCHEDULE(sched));
|
||||
|
||||
g_print("SCHEDULE DUMP FOR MANAGING BIN \"%s\"\n",GST_ELEMENT_NAME(sched->parent));
|
||||
|
||||
g_print("schedule has %d elements in it: ",sched->num_elements);
|
||||
elements = sched->elements;
|
||||
while (elements) {
|
||||
|
@ -1409,6 +1429,8 @@ gst_schedule_show (GstSchedule *sched)
|
|||
chain = (GstScheduleChain *)(chains->data);
|
||||
chains = g_list_next(chains);
|
||||
|
||||
g_print("%p: ",chain);
|
||||
|
||||
elements = chain->disabled;
|
||||
while (elements) {
|
||||
element = GST_ELEMENT(elements->data);
|
||||
|
|
|
@ -77,6 +77,7 @@ struct _GstScheduleClass {
|
|||
|
||||
//#define GST_SCHEDULE_SAFETY if (sched)
|
||||
#define GST_SCHEDULE_SAFETY
|
||||
|
||||
#define GST_SCHEDULE_ADD_ELEMENT(sched,element) \
|
||||
GST_SCHEDULE_SAFETY ((sched)->add_element((sched),(element)))
|
||||
#define GST_SCHEDULE_REMOVE_ELEMENT(sched,element) \
|
||||
|
@ -85,14 +86,12 @@ struct _GstScheduleClass {
|
|||
GST_SCHEDULE_SAFETY ((sched)->enable_element((sched),(element)))
|
||||
#define GST_SCHEDULE_DISABLE_ELEMENT(sched,element) \
|
||||
GST_SCHEDULE_SAFETY ((sched)->disable_element((sched),(element)))
|
||||
|
||||
#define GST_SCHEDULE_LOCK_ELEMENT(sched,element) \
|
||||
if ((sched)->lock_element != NULL) \
|
||||
((sched)->lock_element((sched),(element)))
|
||||
GST_SCHEDULE_SAFETY if ((sched)->lock_element != NULL) \
|
||||
((sched)->lock_element((sched),(element)))
|
||||
#define GST_SCHEDULE_UNLOCK_ELEMENT(sched,element) \
|
||||
if ((sched)->unlock_element != NULL) \
|
||||
((sched)->unlock_element((sched),(element)))
|
||||
|
||||
GST_SCHEDULE_SAFETY if ((sched)->unlock_element != NULL) \
|
||||
((sched)->unlock_element((sched),(element)))
|
||||
#define GST_SCHEDULE_PAD_CONNECT(sched,srcpad,sinkpad) \
|
||||
GST_SCHEDULE_SAFETY ((sched)->pad_connect((sched),(srcpad),(sinkpad)))
|
||||
#define GST_SCHEDULE_PAD_DISCONNECT(sched,srcpad,sinkpad) \
|
||||
|
|
|
@ -4,7 +4,7 @@ libdir=@libdir@
|
|||
includedir=@includedir@
|
||||
|
||||
Name: GStreamer
|
||||
Description: Streamer-media framework
|
||||
Description: Streaming-media framework
|
||||
Requires:
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lgst
|
||||
|
|
|
@ -391,7 +391,7 @@ gst_queue_change_state (GstElement *element)
|
|||
// can't call this queue's _get (or whatever)
|
||||
GST_LOCK (queue);
|
||||
|
||||
GST_DEBUG (0,"gstqueue: state pending %d\n", GST_STATE_PENDING (element));
|
||||
GST_DEBUG (GST_CAT_STATES,"gstqueue: state pending %d\n", GST_STATE_PENDING (element));
|
||||
|
||||
/* if going down into NULL state, clear out buffers*/
|
||||
if (GST_STATE_PENDING (element) == GST_STATE_READY) {
|
||||
|
|
2
test/.gitignore
vendored
2
test/.gitignore
vendored
|
@ -28,6 +28,8 @@ buffer
|
|||
mp3parse
|
||||
mpeg2parse
|
||||
mpeg2parse2
|
||||
mpeg2parse3
|
||||
mpeg2parse4
|
||||
mp3play
|
||||
ac3parse
|
||||
ac3play
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
if HAVE_GNOME
|
||||
GNOME_PROGS = spectrum wave mpeg2parse mp1parse videotest aviparse \
|
||||
mpeg2parse2 videotest2 video2mp1 dvshow dv2mp1 mpeg2parse3
|
||||
mpeg2parse2 videotest2 video2mp1 dvshow dv2mp1 mpeg2parse3 mpeg2parse4
|
||||
else
|
||||
GNOME_PROGS =
|
||||
endif
|
||||
|
|
|
@ -19,7 +19,6 @@ gboolean idle_func(gpointer data) {
|
|||
void mpeg2parse_newpad(GstElement *parser,GstPad *pad, GstElement *pipeline) {
|
||||
|
||||
g_print("***** a new pad %s was created\n", gst_pad_get_name(pad));
|
||||
// gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PAUSED);
|
||||
|
||||
if (strncmp(gst_pad_get_name(pad), "video_", 6) == 0) {
|
||||
gst_pad_connect(pad, gst_element_get_pad(v_queue,"sink"));
|
||||
|
@ -30,7 +29,6 @@ void mpeg2parse_newpad(GstElement *parser,GstPad *pad, GstElement *pipeline) {
|
|||
gst_bin_add(GST_BIN(pipeline),a_thread);
|
||||
gst_element_set_state(a_thread,GST_STATE_PLAYING);
|
||||
}
|
||||
// gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
|
||||
}
|
||||
|
||||
void mpeg2parse_have_size(GstElement *videosink,gint width,gint height) {
|
||||
|
|
224
test/mpeg2parse4.c
Normal file
224
test/mpeg2parse4.c
Normal file
|
@ -0,0 +1,224 @@
|
|||
#include <gnome.h>
|
||||
#include <gst/gst.h>
|
||||
|
||||
GstElement *pipeline, *src, *parse;
|
||||
GstElement *v_decode_thread, *v_decode_queue, *v_decode, *v_color;
|
||||
GstElement *v_show_thread, *v_show_queue, *v_show;
|
||||
GstElement *a_decode_thread, *a_decode_queue, *a_decode;
|
||||
GstElement *a_sink_thread, *a_sink_queue, *a_sink;
|
||||
GtkWidget *appwindow;
|
||||
GtkWidget *gtk_socket;
|
||||
|
||||
void eof(GstElement *src) {
|
||||
fprintf(stderr,"have eos, quitting\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
gboolean idle_func(gpointer data) {
|
||||
gst_bin_iterate(GST_BIN(data));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int mpeg2parse_newpad(GstElement *parser,GstPad *pad, GstElement *pipeline) {
|
||||
|
||||
fprintf(stderr,"***** a new pad %s was created\n", gst_pad_get_name(pad));
|
||||
|
||||
if (strncmp(gst_pad_get_name(pad), "video_", 6) == 0) {
|
||||
|
||||
// build the decoder thread
|
||||
v_decode_thread = GST_ELEMENT(gst_thread_new("v_decode_thread"));
|
||||
g_return_val_if_fail(v_decode_thread != NULL, -1);
|
||||
|
||||
v_decode_queue = gst_elementfactory_make("queue","v_decode_queue");
|
||||
g_return_val_if_fail(v_decode_queue != NULL, -1);
|
||||
|
||||
v_decode = gst_elementfactory_make("mpeg2dec","v_decode");
|
||||
g_return_val_if_fail(v_decode != NULL, -1);
|
||||
|
||||
v_color = gst_elementfactory_make("colorspace","v_color");
|
||||
g_return_val_if_fail(v_color != NULL, -1);
|
||||
|
||||
gst_bin_add(GST_BIN(v_decode_thread),GST_ELEMENT(v_decode_queue));
|
||||
gst_bin_add(GST_BIN(v_decode_thread),GST_ELEMENT(v_decode));
|
||||
gst_bin_add(GST_BIN(v_decode_thread),GST_ELEMENT(v_color));
|
||||
|
||||
gst_element_connect(v_decode_queue,"src",v_decode,"sink");
|
||||
gst_element_connect(v_decode,"src",v_color,"sink");
|
||||
|
||||
gst_schedule_show(GST_ELEMENT_SCHED(v_decode_thread));
|
||||
|
||||
|
||||
// build the show thread
|
||||
v_show_thread = GST_ELEMENT(gst_thread_new("v_show_thread"));
|
||||
g_return_val_if_fail(v_show_thread != NULL, -1);
|
||||
|
||||
v_show_queue = gst_elementfactory_make("queue","v_show_queue");
|
||||
g_return_val_if_fail(v_show_queue != NULL, -1);
|
||||
|
||||
// v_show has ben created earlier
|
||||
|
||||
gst_bin_add(GST_BIN(v_show_thread),GST_ELEMENT(v_show_queue));
|
||||
gst_bin_add(GST_BIN(v_show_thread),GST_ELEMENT(v_show));
|
||||
|
||||
gst_element_connect(v_show_queue,"src",v_show,"sink");
|
||||
|
||||
|
||||
// now assemble the decoder threads
|
||||
gst_bin_add(GST_BIN(v_decode_thread),v_show_thread);
|
||||
gst_element_connect(v_color,"src",v_show_queue,"sink");
|
||||
|
||||
gst_schedule_show(GST_ELEMENT_SCHED(v_decode_thread));
|
||||
gst_schedule_show(GST_ELEMENT_SCHED(v_show_thread));
|
||||
|
||||
// connect the whole thing to the main pipeline
|
||||
gst_pad_connect(pad, gst_element_get_pad(v_decode_queue,"sink"));
|
||||
gst_bin_add(GST_BIN(pipeline),v_decode_thread);
|
||||
|
||||
gst_schedule_show(GST_ELEMENT_SCHED(v_decode_thread));
|
||||
gst_schedule_show(GST_ELEMENT_SCHED(v_show_thread));
|
||||
|
||||
// start it playing
|
||||
gst_element_set_state(v_decode_thread,GST_STATE_PLAYING);
|
||||
|
||||
} else if (strcmp(gst_pad_get_name(pad), "private_stream_1.0") == 0) {
|
||||
// build the decoder thread
|
||||
a_decode_thread = GST_ELEMENT(gst_thread_new("a_decode_thread"));
|
||||
g_return_val_if_fail(a_decode_thread != NULL, -1);
|
||||
|
||||
a_decode_queue = gst_elementfactory_make("queue","a_decode_queue");
|
||||
g_return_val_if_fail(a_decode_queue != NULL, -1);
|
||||
|
||||
a_decode = gst_elementfactory_make("ac3dec","a_decode");
|
||||
g_return_val_if_fail(a_decode != NULL, -1);
|
||||
|
||||
gst_bin_add(GST_BIN(a_decode_thread),GST_ELEMENT(a_decode_queue));
|
||||
gst_bin_add(GST_BIN(a_decode_thread),GST_ELEMENT(a_decode));
|
||||
|
||||
gst_element_connect(a_decode_queue,"src",a_decode,"sink");
|
||||
|
||||
gst_schedule_show(GST_ELEMENT_SCHED(a_decode_thread));
|
||||
|
||||
|
||||
// build the sink thread
|
||||
a_sink_thread = GST_ELEMENT(gst_thread_new("a_sink_thread"));
|
||||
g_return_val_if_fail(a_sink_thread != NULL, -1);
|
||||
|
||||
a_sink_queue = gst_elementfactory_make("queue","a_sink_queue");
|
||||
g_return_val_if_fail(a_sink_queue != NULL, -1);
|
||||
|
||||
a_sink = gst_elementfactory_make("esdsink","a_sink");
|
||||
g_return_val_if_fail(a_sink != NULL, -1);
|
||||
|
||||
gst_bin_add(GST_BIN(a_sink_thread),GST_ELEMENT(a_sink_queue));
|
||||
gst_bin_add(GST_BIN(a_sink_thread),GST_ELEMENT(a_sink));
|
||||
|
||||
gst_element_connect(a_sink_queue,"src",a_sink,"sink");
|
||||
|
||||
|
||||
// now assemble the decoder threads
|
||||
gst_bin_add(GST_BIN(a_decode_thread),a_sink_thread);
|
||||
gst_element_connect(a_decode,"src",a_sink_queue,"sink");
|
||||
|
||||
gst_schedule_show(GST_ELEMENT_SCHED(a_decode_thread));
|
||||
gst_schedule_show(GST_ELEMENT_SCHED(a_sink_thread));
|
||||
|
||||
// connect the whole thing to the main pipeline
|
||||
gst_pad_connect(pad, gst_element_get_pad(a_decode_queue,"sink"));
|
||||
gst_bin_add(GST_BIN(pipeline),a_decode_thread);
|
||||
|
||||
gst_schedule_show(GST_ELEMENT_SCHED(a_decode_thread));
|
||||
gst_schedule_show(GST_ELEMENT_SCHED(a_sink_thread));
|
||||
|
||||
// start it playing
|
||||
gst_element_set_state(a_decode_thread,GST_STATE_PLAYING);
|
||||
|
||||
}
|
||||
|
||||
if (v_decode_thread && a_decode_thread) {
|
||||
xmlSaveFile("mpeg2parse4.gst", gst_xml_write(GST_ELEMENT(pipeline)));
|
||||
fprintf(stderr,"DUMP OF ALL SCHEDULES!!!:\n");
|
||||
gst_schedule_show(GST_ELEMENT_SCHED(pipeline));
|
||||
gst_schedule_show(GST_ELEMENT_SCHED(v_decode_thread));
|
||||
gst_schedule_show(GST_ELEMENT_SCHED(v_show_thread));
|
||||
gst_schedule_show(GST_ELEMENT_SCHED(a_decode_thread));
|
||||
gst_schedule_show(GST_ELEMENT_SCHED(a_sink_thread));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mpeg2parse_have_size(GstElement *videosink,gint width,gint height) {
|
||||
gtk_widget_set_usize(gtk_socket,width,height);
|
||||
gtk_widget_show_all(appwindow);
|
||||
}
|
||||
|
||||
int main(int argc,char *argv[]) {
|
||||
|
||||
g_print("have %d args\n",argc);
|
||||
|
||||
gst_init(&argc,&argv);
|
||||
gnome_init("MPEG2 Video player","0.0.1",argc,argv);
|
||||
|
||||
// ***** construct the main pipeline *****
|
||||
pipeline = gst_pipeline_new("pipeline");
|
||||
g_return_val_if_fail(pipeline != NULL, -1);
|
||||
|
||||
if (strstr(argv[1],"video_ts")) {
|
||||
src = gst_elementfactory_make("dvdsrc","src");
|
||||
g_print("using DVD source\n");
|
||||
} else {
|
||||
src = gst_elementfactory_make("disksrc","src");
|
||||
}
|
||||
|
||||
g_return_val_if_fail(src != NULL, -1);
|
||||
gtk_object_set(GTK_OBJECT(src),"location",argv[1],NULL);
|
||||
if (argc >= 3) {
|
||||
gtk_object_set(GTK_OBJECT(src),"bytesperread",atoi(argv[2]),NULL);
|
||||
g_print("block size is %d\n",atoi(argv[2]));
|
||||
}
|
||||
g_print("should be using file '%s'\n",argv[1]);
|
||||
|
||||
parse = gst_elementfactory_make("mpeg2parse","parse");
|
||||
//parse = gst_elementfactory_make("mpeg1parse","parse");
|
||||
g_return_val_if_fail(parse != NULL, -1);
|
||||
|
||||
gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(src));
|
||||
gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(parse));
|
||||
|
||||
gst_element_connect(src,"src",parse,"sink");
|
||||
|
||||
|
||||
// create v_show early so we can get and connect stuff
|
||||
v_show = gst_elementfactory_make("xvideosink","v_show");
|
||||
g_return_val_if_fail(v_show != NULL, -1);
|
||||
|
||||
|
||||
|
||||
// ***** construct the GUI *****
|
||||
appwindow = gnome_app_new("MPEG player","MPEG player");
|
||||
|
||||
gtk_socket = gtk_socket_new ();
|
||||
gtk_widget_show (gtk_socket);
|
||||
|
||||
gnome_app_set_contents(GNOME_APP(appwindow),
|
||||
GTK_WIDGET(gtk_socket));
|
||||
|
||||
gtk_widget_realize (gtk_socket);
|
||||
gtk_socket_steal (GTK_SOCKET (gtk_socket),
|
||||
gst_util_get_int_arg (GTK_OBJECT(v_show), "xid"));
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(parse),"new_pad",mpeg2parse_newpad, pipeline);
|
||||
gtk_signal_connect(GTK_OBJECT(src),"eos",GTK_SIGNAL_FUNC(eof),NULL);
|
||||
gtk_signal_connect(GTK_OBJECT(v_show),"have_size",mpeg2parse_have_size, pipeline);
|
||||
|
||||
fprintf(stderr,"setting to PLAYING state\n");
|
||||
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
|
||||
|
||||
gtk_idle_add(idle_func,pipeline);
|
||||
|
||||
gdk_threads_enter();
|
||||
gtk_main();
|
||||
gdk_threads_leave();
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -45,7 +45,7 @@ int main(int argc,char *argv[]) {
|
|||
pipeline = gst_pipeline_new("pipeline");
|
||||
sourcethread = gst_elementfactory_make("thread","sourcethread");
|
||||
src = gst_elementfactory_make("disksrc","src");
|
||||
gtk_object_set(GTK_OBJECT(src),"location","/opt/data/AlienSong.mpg",NULL);
|
||||
gtk_object_set(GTK_OBJECT(src),"location","/home/omega/media/AlienSong.mpg",NULL);
|
||||
parse = gst_elementfactory_make("mpeg1parse","parse");
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(parse),"new_pad",
|
||||
|
@ -65,8 +65,10 @@ int main(int argc,char *argv[]) {
|
|||
|
||||
while (1) {
|
||||
// sleep(1);
|
||||
fprintf(stderr,"setting to PAUSED\n");
|
||||
gst_element_set_state(pipeline,GST_STATE_PAUSED);fprintf(stderr,"paused... ");
|
||||
// sleep(1);
|
||||
fprintf(stderr,"setting to PLAYING\n");
|
||||
gst_element_set_state(pipeline,GST_STATE_PLAYING);fprintf(stderr,"playing.\n");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue