[gst-devel] udpsrc (newbie question #2)
Thomas Comiotto
comiotto at rcfmedia.ch
Thu Jan 8 11:07:03 CET 2004
Hi there,
I am experiencing some difficulties with the videowall how-to listed on the
gstreamer site; I get some ...
GStreamer-WARNING **: internal error: push on pad demux:sink but it has no
chainhandler (gstreamer 0.6 and 0.7.3)
... as soon as the client recieves some data.
starting the client before starting the feed gives me..
INFO GST_EVENT( 1041) gstelement.c(2197):gst_element_error: ERROR in
demux: NULL buffer during pull on demux:sink and a bunch of errors from
optimalscheduler
However, I _am_ able to run the video-only version successfully as in
gst-launch v4lsrc ! ffenc_mpeg1video ! udpsink
gst-launch udpsrc ! ffdec_mpeg1video ! xvideosink
I am working on a networked video-performance arts project and therefore I
would need the networking a/v part of gstreamer...
I am running Debian linux testing on a I386 box.
Any help would be really appreciated!
Regards,
Thomas
==
# include <string.h>
# include <gst/gst.h>
void
eof (GstElement *src)
{
g_print ("have eos, quitting\n");
exit (0);
}
gboolean
idle_func (gpointer data)
{
gst_bin_iterate (GST_BIN (data));
return TRUE;
}
void
new_pad_created (GstElement *parse, GstPad *pad, GstElement *pipeline)
{
GstElement *decode_video = NULL;
GstElement *decode_audio, *play, *color, *show;
GstElement *audio_queue, *video_queue;
GstElement *audio_thread, *video_thread;
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), "audio_", 6) == 0) {
decode_audio = gst_element_factory_make ("mad", "decode_audio");
g_return_if_fail (decode_audio != NULL);
play = gst_element_factory_make ("osssink", "play_audio");
g_return_if_fail (play != NULL);
audio_thread = gst_thread_new ("audio_thread");
g_return_if_fail (audio_thread != NULL);
audio_queue = gst_element_factory_make ("queue", "audio_queue");
g_return_if_fail (audio_queue != NULL);
gst_bin_add_many (GST_BIN (audio_thread), audio_queue, decode_audio, play,
NULL);
gst_element_add_ghost_pad (audio_thread, gst_element_get_pad (audio_queue,
"sink"), "sink");
gst_element_link (audio_queue, decode_audio);
gst_element_link (decode_audio, play);
gst_bin_add (GST_BIN (pipeline), audio_thread);
gst_pad_link (pad, gst_element_get_pad (audio_thread, "sink"));
g_print ("setting to READY state\n");
gst_element_set_state (GST_ELEMENT (audio_thread), GST_STATE_READY);
}
else if (strncmp (gst_pad_get_name (pad), "video_", 6) == 0) {
decode_video = gst_element_factory_make ("mpeg2dec", "decode_video");
g_return_if_fail (decode_video != NULL);
color = gst_element_factory_make ("colorspace", "color");
g_return_if_fail (color != NULL);
show = gst_element_factory_make ("xvideosink", "show");
g_return_if_fail (show != NULL);
video_queue = gst_element_factory_make ("queue", "video_queue");
g_return_if_fail (video_queue != NULL);
video_thread = gst_thread_new ("video_thread");
g_return_if_fail (video_thread != NULL);
gst_bin_add_many (GST_BIN (video_thread), video_queue, decode_video, color,
show, NULL);
gst_element_add_ghost_pad (video_thread, gst_element_get_pad (video_queue,
"sink"), "sink");
gst_element_link (video_queue, decode_video);
gst_element_link_many (decode_video, color, show, NULL);
gst_bin_add (GST_BIN (pipeline), video_thread);
gst_pad_link (pad, gst_element_get_pad (video_thread, "sink"));
g_print ("setting to READY state\n");
gst_element_set_state (GST_ELEMENT (video_thread), GST_STATE_READY);
}
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
}
int
main (int argc, char *argv[])
{
GstElement *pipeline, *src, *demux;
gst_init (&argc, &argv);
pipeline = gst_pipeline_new ("pipeline");
g_return_val_if_fail (pipeline != NULL, -1);
src = gst_element_factory_make ("udpsrc", "src");
g_return_val_if_fail (src != NULL, -1);
demux = gst_element_factory_make ("mpegdemux", "demux");
g_return_val_if_fail (demux != NULL, -1);
// Maximum discontinuity tolerated by the demuxer
g_object_set (G_OBJECT (demux), "max-discont", 1000, NULL);
gst_bin_add_many (GST_BIN (pipeline), src, demux, NULL);
g_signal_connect (G_OBJECT (demux), "new-pad", G_CALLBACK (new_pad_created),
pipeline);
g_signal_connect (G_OBJECT (src), "eos", G_CALLBACK (eof), NULL);
gst_element_link (src, demux);
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
g_idle_add (idle_func, pipeline);
gst_main ();
return 0;
}
More information about the gstreamer-devel
mailing list