mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-08 08:25:33 +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_LIBXMMS, test "x$HAVE_LIBXMMS" = "xyes")
|
||||||
AM_CONDITIONAL(HAVE_LIBRTP, test "x$HAVE_LIBRTP" = "xyes")
|
AM_CONDITIONAL(HAVE_LIBRTP, test "x$HAVE_LIBRTP" = "xyes")
|
||||||
AM_CONDITIONAL(HAVE_ARTS, test "x$HAVE_ARTS" = "xyes")
|
AM_CONDITIONAL(HAVE_ARTS, test "x$HAVE_ARTS" = "xyes")
|
||||||
AM_CONDITIONAL(HAVE_RAW1394, test "x%HAVE_RAW1394" = "xyes")
|
AM_CONDITIONAL(HAVE_RAW1394, test "x$HAVE_RAW1394" = "xyes")
|
||||||
AM_CONDITIONAL(HAVE_LIBDV, test "x%HAVE_LIBDV" = "xyes")
|
AM_CONDITIONAL(HAVE_LIBDV, test "x$HAVE_LIBDV" = "xyes")
|
||||||
AM_CONDITIONAL(HAVE_LIBAA, test "x%HAVE_LIBAA" = "xyes")
|
AM_CONDITIONAL(HAVE_LIBAA, test "x$HAVE_LIBAA" = "xyes")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ noinst_HEADERS = \
|
||||||
gstsparc.h \
|
gstsparc.h \
|
||||||
gstpropsprivate.h
|
gstpropsprivate.h
|
||||||
|
|
||||||
CFLAGS = $(LIBGST_CFLAGS)
|
CFLAGS = $(LIBGST_CFLAGS) -D_GNU_SOURCE
|
||||||
LIBS = $(LIBGST_LIBS)
|
LIBS = $(LIBGST_LIBS)
|
||||||
libgst_la_LDFLAGS = -version-info $(GST_LIBVERSION)
|
libgst_la_LDFLAGS = -version-info $(GST_LIBVERSION)
|
||||||
|
|
||||||
|
|
27
gst/gstbin.c
27
gst/gstbin.c
|
@ -174,7 +174,6 @@ gst_bin_reset_element_sched (GstElement *element, GstSchedule *sched)
|
||||||
void
|
void
|
||||||
gst_bin_set_element_sched (GstElement *element,GstSchedule *sched)
|
gst_bin_set_element_sched (GstElement *element,GstSchedule *sched)
|
||||||
{
|
{
|
||||||
GstSchedule *realsched = NULL;
|
|
||||||
GList *children;
|
GList *children;
|
||||||
GstElement *child;
|
GstElement *child;
|
||||||
|
|
||||||
|
@ -189,15 +188,13 @@ gst_bin_set_element_sched (GstElement *element,GstSchedule *sched)
|
||||||
// if it's actually a Bin
|
// if it's actually a Bin
|
||||||
if (GST_IS_BIN(element)) {
|
if (GST_IS_BIN(element)) {
|
||||||
|
|
||||||
// figure out which element is the manager
|
|
||||||
if (GST_FLAG_IS_SET(element,GST_BIN_FLAG_MANAGER)) {
|
if (GST_FLAG_IS_SET(element,GST_BIN_FLAG_MANAGER)) {
|
||||||
realsched = GST_ELEMENT_SCHED(element);
|
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, element, "child is already a manager, not resetting");
|
||||||
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, element, "setting children's schedule to own sched");
|
return;
|
||||||
} else {
|
}
|
||||||
realsched = sched;
|
|
||||||
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, element, "setting children's schedule to parent's");
|
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, element, "setting children's schedule to parent's");
|
||||||
GST_SCHEDULE_ADD_ELEMENT (sched, element);
|
GST_SCHEDULE_ADD_ELEMENT (sched, element);
|
||||||
}
|
|
||||||
|
|
||||||
// set the children's schedule
|
// set the children's schedule
|
||||||
children = GST_BIN(element)->children;
|
children = GST_BIN(element)->children;
|
||||||
|
@ -205,12 +202,11 @@ gst_bin_set_element_sched (GstElement *element,GstSchedule *sched)
|
||||||
child = GST_ELEMENT (children->data);
|
child = GST_ELEMENT (children->data);
|
||||||
children = g_list_next(children);
|
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
|
// otherwise, if it's just a regular old element
|
||||||
} else {
|
} else {
|
||||||
//g_print("calling schedule_add_element (%p, \"%s\")\n",sched, GST_ELEMENT_NAME(element));
|
|
||||||
GST_SCHEDULE_ADD_ELEMENT (sched, 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 it's actually a Bin
|
||||||
if (GST_IS_BIN(element)) {
|
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
|
// for each child, remove them from their schedule
|
||||||
children = GST_BIN(element)->children;
|
children = GST_BIN(element)->children;
|
||||||
while (children) {
|
while (children) {
|
||||||
|
@ -239,6 +244,7 @@ gst_bin_unset_element_sched (GstElement *element)
|
||||||
|
|
||||||
// otherwise, if it's just a regular old element
|
// otherwise, if it's just a regular old element
|
||||||
} else {
|
} else {
|
||||||
|
// FIXME this check should be irrelevant
|
||||||
if (GST_ELEMENT_SCHED (element))
|
if (GST_ELEMENT_SCHED (element))
|
||||||
GST_SCHEDULE_REMOVE_ELEMENT (GST_ELEMENT_SCHED(element), 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 (element != NULL);
|
||||||
g_return_if_fail (GST_IS_ELEMENT (element));
|
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
|
// must be not be in PLAYING state in order to modify bin
|
||||||
// g_return_if_fail (GST_STATE (bin) != GST_STATE_PLAYING);
|
// g_return_if_fail (GST_STATE (bin) != GST_STATE_PLAYING);
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <dlfcn.h>
|
||||||
#include "gst_private.h"
|
#include "gst_private.h"
|
||||||
#include "gstelement.h"
|
#include "gstelement.h"
|
||||||
#include "gstpad.h"
|
#include "gstpad.h"
|
||||||
|
@ -50,7 +51,7 @@ static gchar *_gst_info_category_strings[] = {
|
||||||
"STATES",
|
"STATES",
|
||||||
"PLANNING",
|
"PLANNING",
|
||||||
"SCHEDULING",
|
"SCHEDULING",
|
||||||
"OPERATION",
|
"DATAFLOW",
|
||||||
"BUFFER",
|
"BUFFER",
|
||||||
"CAPS",
|
"CAPS",
|
||||||
"CLOCK",
|
"CLOCK",
|
||||||
|
@ -85,7 +86,7 @@ const gchar *_gst_category_colors[32] = {
|
||||||
[GST_CAT_AUTOPLUG_ATTEMPT] = "00;36;44",
|
[GST_CAT_AUTOPLUG_ATTEMPT] = "00;36;44",
|
||||||
[GST_CAT_PARENTAGE] = "01;37;41", // !!
|
[GST_CAT_PARENTAGE] = "01;37;41", // !!
|
||||||
[GST_CAT_STATES] = "00;31",
|
[GST_CAT_STATES] = "00;31",
|
||||||
[GST_CAT_PLANNING] = "00;35",
|
[GST_CAT_PLANNING] = "07;35",
|
||||||
[GST_CAT_SCHEDULING] = "00;35",
|
[GST_CAT_SCHEDULING] = "00;35",
|
||||||
[GST_CAT_DATAFLOW] = "00;32",
|
[GST_CAT_DATAFLOW] = "00;32",
|
||||||
[GST_CAT_BUFFER] = "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_ENABLED
|
||||||
#ifdef GST_DEBUG_COLOR
|
#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",
|
GST_DEBUG_CHAR_MODE ";%sm%s%s\033[00m %s\n",
|
||||||
pthread_color,pthread_id,cothread_color,cothread_id,
|
pthread_color,pthread_id,cothread_color,cothread_id,
|
||||||
_gst_category_colors[category],location,elementname,string);
|
_gst_category_colors[category],location,elementname,string);
|
||||||
#else
|
#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);
|
getpid(),cothread_id,location,elementname,string);
|
||||||
#endif /* GST_DEBUG_COLOR */
|
#endif /* GST_DEBUG_COLOR */
|
||||||
#else
|
#else
|
||||||
|
@ -381,3 +382,24 @@ gst_default_error_handler (gchar *file, gchar *function,
|
||||||
|
|
||||||
exit(1);
|
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
|
#ifdef _GST_COLOR_CODE
|
||||||
#warning have a coded debug
|
#warning have a coded debug
|
||||||
#define GST_DEBUG_PREFIX(cat,format,args...) \
|
#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
|
getpid() , cothread_getcurrent() , __LINE__ , ## args
|
||||||
#else
|
#else
|
||||||
#define GST_DEBUG_PREFIX(cat,format,args...) \
|
#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
|
getpid() , cothread_getcurrent() , _gst_category_colors[cat] , __LINE__ , ## args
|
||||||
#endif /* _GST_COLOR_CODE */
|
#endif /* _GST_COLOR_CODE */
|
||||||
#else
|
#else
|
||||||
#define GST_DEBUG_PREFIX(cat,format,args...) \
|
#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
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ getpid() , cothread_getcurrent() , _gst_category_colors[cat] , __LINE__ , ## arg
|
||||||
/********** function pointer stuff **********/
|
/********** function pointer stuff **********/
|
||||||
extern GHashTable *__gst_function_pointers;
|
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(ptr) _gst_debug_register_funcptr((void *)(ptr), #ptr)
|
||||||
#define GST_DEBUG_FUNCPTR_NAME(ptr) _gst_debug_nameof_funcptr((void *)ptr)
|
#define GST_DEBUG_FUNCPTR_NAME(ptr) _gst_debug_nameof_funcptr((void *)ptr)
|
||||||
#else
|
#else
|
||||||
|
@ -181,14 +181,7 @@ _gst_debug_register_funcptr (void *ptr, gchar *ptrname)
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline gchar *
|
gchar *_gst_debug_nameof_funcptr (void *ptr);
|
||||||
_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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
|
|
|
@ -391,7 +391,7 @@ gst_queue_change_state (GstElement *element)
|
||||||
// can't call this queue's _get (or whatever)
|
// can't call this queue's _get (or whatever)
|
||||||
GST_LOCK (queue);
|
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 going down into NULL state, clear out buffers*/
|
||||||
if (GST_STATE_PENDING (element) == GST_STATE_READY) {
|
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
|
/* this function will look at a pad and determine if the peer parent is
|
||||||
* a possible candidate for connecting up in the same chain. */
|
* a possible candidate for connecting up in the same chain. */
|
||||||
|
/* DEPRACATED !!!!
|
||||||
GstElement *gst_schedule_check_pad (GstSchedule *sched, GstPad *pad) {
|
GstElement *gst_schedule_check_pad (GstSchedule *sched, GstPad *pad) {
|
||||||
GstRealPad *peer;
|
GstRealPad *peer;
|
||||||
GstElement *peerelement;
|
GstElement *element, *peerelement;
|
||||||
|
|
||||||
GST_INFO (GST_CAT_SCHEDULING, "checking pad %s:%s for peer in scheduler",
|
GST_INFO (GST_CAT_SCHEDULING, "checking pad %s:%s for peer in scheduler",
|
||||||
GST_DEBUG_PAD_NAME(pad));
|
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);
|
peer = GST_PAD_PEER (pad);
|
||||||
if (peer == NULL) return NULL;
|
if (peer == NULL) return NULL;
|
||||||
peerelement = GST_ELEMENT(GST_PAD_PARENT (peer));
|
peerelement = GST_ELEMENT(GST_PAD_PARENT (peer));
|
||||||
|
if (peerelement == NULL) return NULL;
|
||||||
// first of all, if the peer element is decoupled, it will be in the same chain
|
GST_DEBUG(GST_CAT_SCHEDULING, "peer element is \"%s\"\n",GST_ELEMENT_NAME(peerelement));
|
||||||
if (GST_FLAG_IS_SET(peerelement,GST_ELEMENT_DECOUPLED))
|
|
||||||
return peerelement;
|
|
||||||
|
|
||||||
// now check to see if it's in the same schedule
|
// 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;
|
return peerelement;
|
||||||
|
}
|
||||||
|
|
||||||
// otherwise it's not a candidate
|
// otherwise it's not a candidate
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
GstScheduleChain *
|
GstScheduleChain *
|
||||||
gst_schedule_chain_new (GstSchedule *sched)
|
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->chains = g_list_prepend (sched->chains, chain);
|
||||||
sched->num_chains++;
|
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;
|
return chain;
|
||||||
}
|
}
|
||||||
|
@ -895,6 +901,8 @@ gst_schedule_chain_new (GstSchedule *sched)
|
||||||
void
|
void
|
||||||
gst_schedule_chain_destroy (GstScheduleChain *chain)
|
gst_schedule_chain_destroy (GstScheduleChain *chain)
|
||||||
{
|
{
|
||||||
|
GST_INFO (GST_CAT_SCHEDULING, "destroying chain %p",chain);
|
||||||
|
|
||||||
// remove the chain from the schedules' list of chains
|
// remove the chain from the schedules' list of chains
|
||||||
chain->sched->chains = g_list_remove (chain->sched->chains, chain);
|
chain->sched->chains = g_list_remove (chain->sched->chains, chain);
|
||||||
chain->sched->num_chains--;
|
chain->sched->num_chains--;
|
||||||
|
@ -908,7 +916,7 @@ gst_schedule_chain_destroy (GstScheduleChain *chain)
|
||||||
void
|
void
|
||||||
gst_schedule_chain_add_element (GstScheduleChain *chain, GstElement *element)
|
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
|
// set the sched pointer for the element
|
||||||
element->sched = chain->sched;
|
element->sched = chain->sched;
|
||||||
|
@ -921,7 +929,7 @@ gst_schedule_chain_add_element (GstScheduleChain *chain, GstElement *element)
|
||||||
void
|
void
|
||||||
gst_schedule_chain_enable_element (GstScheduleChain *chain, GstElement *element)
|
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
|
// remove from disabled list
|
||||||
chain->disabled = g_list_remove (chain->disabled, element);
|
chain->disabled = g_list_remove (chain->disabled, element);
|
||||||
|
@ -936,7 +944,7 @@ gst_schedule_chain_enable_element (GstScheduleChain *chain, GstElement *element)
|
||||||
void
|
void
|
||||||
gst_schedule_chain_disable_element (GstScheduleChain *chain, GstElement *element)
|
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
|
// remove from elements list
|
||||||
chain->elements = g_list_remove (chain->elements, element);
|
chain->elements = g_list_remove (chain->elements, element);
|
||||||
|
@ -952,7 +960,7 @@ gst_schedule_chain_disable_element (GstScheduleChain *chain, GstElement *element
|
||||||
void
|
void
|
||||||
gst_schedule_chain_remove_element (GstScheduleChain *chain, GstElement *element)
|
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 it's active, deactivate it
|
||||||
if (g_list_find (chain->elements, element)) {
|
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
|
// otherwise if both have chains already, join them
|
||||||
} else if ((chain1 != NULL) && (chain2 != NULL)) {
|
} 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
|
// take the contents of chain2 and merge them into chain1
|
||||||
chain1->disabled = g_list_concat (chain1->disabled, g_list_copy(chain2->disabled));
|
chain1->disabled = g_list_concat (chain1->disabled, g_list_copy(chain2->disabled));
|
||||||
chain1->elements = g_list_concat (chain1->elements, g_list_copy(chain2->elements));
|
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
|
void
|
||||||
gst_schedule_pad_connect (GstSchedule *sched, GstPad *srcpad, GstPad *sinkpad)
|
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_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,14 +1103,16 @@ gst_schedule_chain_recursive_add (GstScheduleChain *chain, GstElement *element)
|
||||||
pad = GST_PAD(pads->data);
|
pad = GST_PAD(pads->data);
|
||||||
pads = g_list_next (pads);
|
pads = g_list_next (pads);
|
||||||
|
|
||||||
// if it's a potential peer
|
// if the peer exists and could be in the same chain
|
||||||
if ((peerelement = gst_schedule_check_pad (chain->sched, pad))) {
|
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 it's not already in a chain, add it to this one
|
||||||
if (gst_schedule_find_chain (chain->sched, peerelement) == NULL) {
|
if (gst_schedule_find_chain (chain->sched, peerelement) == NULL) {
|
||||||
gst_schedule_chain_recursive_add (chain, peerelement);
|
gst_schedule_chain_recursive_add (chain, peerelement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1184,13 +1201,15 @@ gst_schedule_add_element (GstSchedule *sched, GstElement *element)
|
||||||
// set the pad's sched pointer
|
// set the pad's sched pointer
|
||||||
gst_pad_set_sched (pad, sched);
|
gst_pad_set_sched (pad, sched);
|
||||||
|
|
||||||
// if the peer element is a candidate
|
// if the peer element exists and is a candidate
|
||||||
if ((peerelement = gst_schedule_check_pad(sched,pad))) {
|
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");
|
GST_INFO (GST_CAT_SCHEDULING, "peer is in same schedule, chaining together");
|
||||||
// make sure that the two elements are in the same chain
|
// make sure that the two elements are in the same chain
|
||||||
gst_schedule_chain_elements (sched,element,peerelement);
|
gst_schedule_chain_elements (sched,element,peerelement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1282,17 +1301,16 @@ g_return_val_if_fail (chains != NULL, FALSE);
|
||||||
|
|
||||||
if (chain->elements) {
|
if (chain->elements) {
|
||||||
entry = NULL; //MattH ADDED?
|
entry = NULL; //MattH ADDED?
|
||||||
|
GST_DEBUG(GST_CAT_SCHEDULING,"there are %d elements in this chain\n",chain->num_elements);
|
||||||
elements = chain->elements;
|
elements = chain->elements;
|
||||||
//printf("searching for non-decoupled element\n");
|
|
||||||
while (elements) {
|
while (elements) {
|
||||||
entry = GST_ELEMENT(elements->data);
|
entry = GST_ELEMENT(elements->data);
|
||||||
elements = g_list_next(elements);
|
elements = g_list_next(elements);
|
||||||
//printf("checking %s\n",GST_ELEMENT_NAME(entry));
|
if (GST_FLAG_IS_SET(entry,GST_ELEMENT_DECOUPLED))
|
||||||
if (!GST_FLAG_IS_SET(entry,GST_ELEMENT_DECOUPLED)) break;
|
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) {
|
if (entry) {
|
||||||
GST_FLAG_SET (entry, GST_ELEMENT_COTHREAD_STOPPING);
|
GST_FLAG_SET (entry, GST_ELEMENT_COTHREAD_STOPPING);
|
||||||
GST_DEBUG (GST_CAT_DATAFLOW,"set COTHREAD_STOPPING flag on \"%s\"(@%p)\n",
|
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_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);
|
g_print("schedule has %d elements in it: ",sched->num_elements);
|
||||||
elements = sched->elements;
|
elements = sched->elements;
|
||||||
while (elements) {
|
while (elements) {
|
||||||
|
@ -1409,6 +1429,8 @@ gst_schedule_show (GstSchedule *sched)
|
||||||
chain = (GstScheduleChain *)(chains->data);
|
chain = (GstScheduleChain *)(chains->data);
|
||||||
chains = g_list_next(chains);
|
chains = g_list_next(chains);
|
||||||
|
|
||||||
|
g_print("%p: ",chain);
|
||||||
|
|
||||||
elements = chain->disabled;
|
elements = chain->disabled;
|
||||||
while (elements) {
|
while (elements) {
|
||||||
element = GST_ELEMENT(elements->data);
|
element = GST_ELEMENT(elements->data);
|
||||||
|
|
|
@ -77,6 +77,7 @@ struct _GstScheduleClass {
|
||||||
|
|
||||||
//#define GST_SCHEDULE_SAFETY if (sched)
|
//#define GST_SCHEDULE_SAFETY if (sched)
|
||||||
#define GST_SCHEDULE_SAFETY
|
#define GST_SCHEDULE_SAFETY
|
||||||
|
|
||||||
#define GST_SCHEDULE_ADD_ELEMENT(sched,element) \
|
#define GST_SCHEDULE_ADD_ELEMENT(sched,element) \
|
||||||
GST_SCHEDULE_SAFETY ((sched)->add_element((sched),(element)))
|
GST_SCHEDULE_SAFETY ((sched)->add_element((sched),(element)))
|
||||||
#define GST_SCHEDULE_REMOVE_ELEMENT(sched,element) \
|
#define GST_SCHEDULE_REMOVE_ELEMENT(sched,element) \
|
||||||
|
@ -85,14 +86,12 @@ struct _GstScheduleClass {
|
||||||
GST_SCHEDULE_SAFETY ((sched)->enable_element((sched),(element)))
|
GST_SCHEDULE_SAFETY ((sched)->enable_element((sched),(element)))
|
||||||
#define GST_SCHEDULE_DISABLE_ELEMENT(sched,element) \
|
#define GST_SCHEDULE_DISABLE_ELEMENT(sched,element) \
|
||||||
GST_SCHEDULE_SAFETY ((sched)->disable_element((sched),(element)))
|
GST_SCHEDULE_SAFETY ((sched)->disable_element((sched),(element)))
|
||||||
|
|
||||||
#define GST_SCHEDULE_LOCK_ELEMENT(sched,element) \
|
#define GST_SCHEDULE_LOCK_ELEMENT(sched,element) \
|
||||||
if ((sched)->lock_element != NULL) \
|
GST_SCHEDULE_SAFETY if ((sched)->lock_element != NULL) \
|
||||||
((sched)->lock_element((sched),(element)))
|
((sched)->lock_element((sched),(element)))
|
||||||
#define GST_SCHEDULE_UNLOCK_ELEMENT(sched,element) \
|
#define GST_SCHEDULE_UNLOCK_ELEMENT(sched,element) \
|
||||||
if ((sched)->unlock_element != NULL) \
|
GST_SCHEDULE_SAFETY if ((sched)->unlock_element != NULL) \
|
||||||
((sched)->unlock_element((sched),(element)))
|
((sched)->unlock_element((sched),(element)))
|
||||||
|
|
||||||
#define GST_SCHEDULE_PAD_CONNECT(sched,srcpad,sinkpad) \
|
#define GST_SCHEDULE_PAD_CONNECT(sched,srcpad,sinkpad) \
|
||||||
GST_SCHEDULE_SAFETY ((sched)->pad_connect((sched),(srcpad),(sinkpad)))
|
GST_SCHEDULE_SAFETY ((sched)->pad_connect((sched),(srcpad),(sinkpad)))
|
||||||
#define GST_SCHEDULE_PAD_DISCONNECT(sched,srcpad,sinkpad) \
|
#define GST_SCHEDULE_PAD_DISCONNECT(sched,srcpad,sinkpad) \
|
||||||
|
|
|
@ -4,7 +4,7 @@ libdir=@libdir@
|
||||||
includedir=@includedir@
|
includedir=@includedir@
|
||||||
|
|
||||||
Name: GStreamer
|
Name: GStreamer
|
||||||
Description: Streamer-media framework
|
Description: Streaming-media framework
|
||||||
Requires:
|
Requires:
|
||||||
Version: @VERSION@
|
Version: @VERSION@
|
||||||
Libs: -L${libdir} -lgst
|
Libs: -L${libdir} -lgst
|
||||||
|
|
|
@ -391,7 +391,7 @@ gst_queue_change_state (GstElement *element)
|
||||||
// can't call this queue's _get (or whatever)
|
// can't call this queue's _get (or whatever)
|
||||||
GST_LOCK (queue);
|
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 going down into NULL state, clear out buffers*/
|
||||||
if (GST_STATE_PENDING (element) == GST_STATE_READY) {
|
if (GST_STATE_PENDING (element) == GST_STATE_READY) {
|
||||||
|
|
2
test/.gitignore
vendored
2
test/.gitignore
vendored
|
@ -28,6 +28,8 @@ buffer
|
||||||
mp3parse
|
mp3parse
|
||||||
mpeg2parse
|
mpeg2parse
|
||||||
mpeg2parse2
|
mpeg2parse2
|
||||||
|
mpeg2parse3
|
||||||
|
mpeg2parse4
|
||||||
mp3play
|
mp3play
|
||||||
ac3parse
|
ac3parse
|
||||||
ac3play
|
ac3play
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
if HAVE_GNOME
|
if HAVE_GNOME
|
||||||
GNOME_PROGS = spectrum wave mpeg2parse mp1parse videotest aviparse \
|
GNOME_PROGS = spectrum wave mpeg2parse mp1parse videotest aviparse \
|
||||||
mpeg2parse2 videotest2 video2mp1 dvshow dv2mp1 mpeg2parse3
|
mpeg2parse2 videotest2 video2mp1 dvshow dv2mp1 mpeg2parse3 mpeg2parse4
|
||||||
else
|
else
|
||||||
GNOME_PROGS =
|
GNOME_PROGS =
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -19,7 +19,6 @@ gboolean idle_func(gpointer data) {
|
||||||
void mpeg2parse_newpad(GstElement *parser,GstPad *pad, GstElement *pipeline) {
|
void mpeg2parse_newpad(GstElement *parser,GstPad *pad, GstElement *pipeline) {
|
||||||
|
|
||||||
g_print("***** a new pad %s was created\n", gst_pad_get_name(pad));
|
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) {
|
if (strncmp(gst_pad_get_name(pad), "video_", 6) == 0) {
|
||||||
gst_pad_connect(pad, gst_element_get_pad(v_queue,"sink"));
|
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_bin_add(GST_BIN(pipeline),a_thread);
|
||||||
gst_element_set_state(a_thread,GST_STATE_PLAYING);
|
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) {
|
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");
|
pipeline = gst_pipeline_new("pipeline");
|
||||||
sourcethread = gst_elementfactory_make("thread","sourcethread");
|
sourcethread = gst_elementfactory_make("thread","sourcethread");
|
||||||
src = gst_elementfactory_make("disksrc","src");
|
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");
|
parse = gst_elementfactory_make("mpeg1parse","parse");
|
||||||
|
|
||||||
gtk_signal_connect(GTK_OBJECT(parse),"new_pad",
|
gtk_signal_connect(GTK_OBJECT(parse),"new_pad",
|
||||||
|
@ -65,8 +65,10 @@ int main(int argc,char *argv[]) {
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
// sleep(1);
|
// sleep(1);
|
||||||
|
fprintf(stderr,"setting to PAUSED\n");
|
||||||
gst_element_set_state(pipeline,GST_STATE_PAUSED);fprintf(stderr,"paused... ");
|
gst_element_set_state(pipeline,GST_STATE_PAUSED);fprintf(stderr,"paused... ");
|
||||||
// sleep(1);
|
// sleep(1);
|
||||||
|
fprintf(stderr,"setting to PLAYING\n");
|
||||||
gst_element_set_state(pipeline,GST_STATE_PLAYING);fprintf(stderr,"playing.\n");
|
gst_element_set_state(pipeline,GST_STATE_PLAYING);fprintf(stderr,"playing.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue