tcpclientsrc and mpegtsdemux
Bernhard Graaf
bernhard.graaf at gmx.de
Fri Jun 3 03:20:50 PDT 2011
Hi,
I need help to generate my own ,C'-Program from a running pipe:
gst-launch-0.10 tcpclientsrc host='192.168.1.3' port=8080 ! mpegtsdemux
name=demux ! queue ! mpeg2dec ! xvimagesink force-aspect-ratio=TRUE demux. !
queue ! mad ! alsasink
With this pipe, I have no problem. It's running very well.
But if I try to compile this pipe in my own program, I'll get no results.
-----------------------------
#include <stdio.h>
#include <unistd.h>
#include <gst/gst.h>
#include <glib.h>
GstElement *tv_pipe, *tv_source, *tv_mux, *tv_queue, *tv_v_dec, *tv_v_sink,
*tv_a_dec, *tv_a_sink;
GstBus *tv_bus;
GMainLoop *loop;
static gboolean
tv_bus_call (GstBus *tmp_bus,
GstMessage *msg,
gpointer data)
{
GMainLoop *loop = (GMainLoop *) data;
switch (GST_MESSAGE_TYPE (msg)) {
case GST_MESSAGE_EOS:
g_print ("End of stream\n");
break;
case GST_MESSAGE_ERROR: {
gchar *debug;
GError *error;
gst_message_parse_error (msg, &error, &debug);
g_free (debug);
g_printerr ("Error: %s\n", error->message);
g_error_free (error);
break;
}
default:
break;
}
return TRUE;
}
int init_gst()
{
gst_init (0, NULL);
loop = g_main_loop_new (NULL, FALSE);
tv_pipe = gst_pipeline_new ("TV-Stream");
if(!tv_pipe) g_printerr("TV-Stream-Pipeline not created\n");
tv_source = gst_element_factory_make ("tcpclientsrc", "tv-source");
if(!tv_source) g_printerr("TV-Source not created\n");
tv_mux = gst_element_factory_make ("mpegtsdemux", "tv-mux");
if(!tv_mux) g_printerr("TV-Mux not created\n");
tv_queue = gst_element_factory_make ("queue", "tv-queue");
if(!tv_queue) g_printerr("TV-Queue not created\n");
tv_v_dec = gst_element_factory_make ("mpeg2dec", "tv-v-dec");
if(!tv_v_dec) g_printerr("TV-Video-Dec not created\n");
tv_v_sink = gst_element_factory_make ("xvimagesink", "tv-v-sink");
if(!tv_v_sink) g_printerr("TV-Video-Sink not created\n");
tv_a_dec = gst_element_factory_make ("mad", "tv-a-dec");
if(!tv_a_dec) g_printerr("TV-Audio-Dec not created\n");
tv_a_sink = gst_element_factory_make ("alsasink", "tv-a-sink");
if(!tv_a_sink) g_printerr("TV-Audio-Sink not created\n");
tv_bus = gst_pipeline_get_bus (GST_PIPELINE (tv_pipe));
gst_bus_add_watch (tv_bus, tv_bus_call, loop);
gst_object_unref (tv_bus);
gst_bin_add_many (GST_BIN (tv_pipe), tv_source, tv_mux, tv_queue,
tv_v_dec, tv_v_sink, tv_a_dec, tv_a_sink, NULL);
gst_element_link (tv_source, tv_mux);
gst_element_link (tv_mux, tv_queue);
gst_element_link (tv_queue, tv_v_dec);
gst_element_link (tv_v_dec, tv_v_sink);
gst_element_link (tv_queue, tv_a_dec);
gst_element_link (tv_a_dec, tv_a_sink);
return 1;
}
int send_tv()
{
gst_element_set_state (tv_pipe, GST_STATE_NULL);
g_object_set (G_OBJECT (tv_source), "host", "192.168.1.3", NULL);
g_object_set (G_OBJECT (tv_source), "port", 8080, NULL);
g_print ("Now playing: TV\n");
gst_element_set_state (tv_pipe, GST_STATE_PLAYING);
g_print ("Running...\n");
return 0;
}
int main()
{
if(!tv_pipe) init_gst();
send_tv();
g_main_loop_run (loop);
return(1);
}
-------------------------
I there anybody how can tell me what's wrong with this program?
Thank's a lot for helping!!!!
Bernhard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110603/ed1cbfe8/attachment-0001.html>
More information about the gstreamer-devel
mailing list