[gst-devel] Please hepl me to ignore the error in code to run a mpeg file
soma dutta banik
dbsoma at gmail.com
Wed Aug 24 22:24:37 CEST 2005
Hi all.
Please help me about the code....I write the code to run a mpeg file....
The code is
=================================
#include <gst/gst.h>
#include <string.h>
static void
cb_signal(GstElement *demux, GstPad *pad, GstElement *main_thread)
{
g_print ("New pad %s created\n", gst_pad_get_name (pad));
if (!strncmp("video_", gst_pad_get_name (pad), 6)) {
GstElement *vid_q, *vid_dec, *vid_sink, *vid_bin , *vid_filter, *vid_sdlsink;
vid_bin = gst_thread_new ("vid_bin");
vid_q = gst_element_factory_make ("queue", "vid_q");
vid_dec = gst_element_factory_make ("mpeg2dec" , "vid_dec");
vid_sink = gst_element_factory_make ("videomixer", "vid_sink");
vid_filter = gst_element_factory_make ("alpha", "vid_filter");
vid_sdlsink = gst_element_factory_make ("sdlvideosink", "vid_sdlsink");
gst_bin_add_many(GST_BIN(vid_bin), vid_q, vid_dec,vid_filter, vid_sink, NULL);
//gst_element_link_many(vid_q, vid_dec, vid_filter, vid_sink,
vid_sdlsink, NULL);
gst_element_link(vid_q, vid_dec);
gst_element_link(vid_dec, vid_filter);
gst_pad_link(gst_element_get_pad(vid_filter, "src"),
gst_element_get_pad(vid_sink, "sink_00"));
gst_element_link(vid_sink, vid_sdlsink);
gst_element_add_ghost_pad(vid_bin,
gst_element_get_pad(vid_q, "sink"), "sink");
// gst_bin_add(GST_BIN(main_thread), vid_bin);
gst_pad_link(pad, gst_element_get_pad(vid_bin, "sink"));
g_print("%s:%d\n",__FUNCTION__,__LINE__);
gst_element_set_state(GST_ELEMENT(vid_bin), GST_STATE_PLAYING);
g_print("%s:%d\n",__FUNCTION__,__LINE__);
} else if (!strncmp("audio_", gst_pad_get_name (pad), 6)) {
GstElement *aud_q, *aud_dec, *aud_sink, *aud_bin;
aud_bin = gst_thread_new("aud_bin");
aud_q = gst_element_factory_make("queue", "aud_q");
aud_dec = gst_element_factory_make("mad" , "aud_dec");
aud_sink = gst_element_factory_make("osssink", "aud_sink");
gst_bin_add_many(GST_BIN(aud_bin), aud_q,
aud_dec, aud_sink, NULL);
gst_element_link_many(aud_q, aud_dec, aud_sink, NULL);
gst_element_add_ghost_pad(aud_bin,
gst_element_get_pad(aud_q, "sink"), "sink");
//gst_bin_add(GST_BIN(main_thread), GST_ELEMENT(aud_bin));
gst_pad_link(pad, gst_element_get_pad(aud_bin, "sink"));
gst_element_set_state(GST_ELEMENT(aud_bin), GST_STATE_PLAYING);
} else {
g_print("Unhandled case\n");
}
}
int main (int argc, char *argv[])
{
GstElement *src, *demux, *main_thread;
if (argc !=2) {
g_print("Usage: ./a.out <MPEG Filename>\n");
return 0;
}
gst_init(&argc, &argv);
main_thread = gst_thread_new("main_thread");
src = gst_element_factory_make ("filesrc", "src");
g_object_set(G_OBJECT(src), "location", argv[1], NULL);
demux = gst_element_factory_make ("mpegdemux", "demux");
g_print("%s:%d\n",__FUNCTION__,__LINE__);
g_signal_connect(G_OBJECT(demux), "new-pad",
G_CALLBACK(cb_signal), main_thread);
g_print("%s:%d\n",__FUNCTION__,__LINE__);
gst_bin_add(GST_BIN(main_thread), src);
gst_bin_add(GST_BIN(main_thread), demux);
gst_element_link(src, demux);
g_print("%s:%d\n",__FUNCTION__,__LINE__);
gst_element_set_state(GST_ELEMENT(main_thread), GST_STATE_PLAYING);
g_print("Iterating over pipeline\n");
while (gst_bin_iterate (GST_BIN (main_thread)));
gst_object_unref (GST_OBJECT (main_thread));
exit(0);
}
=================================
But it gives the following error message....in run time
(process:4126): GStreamer-WARNING **: internal error: push on pad
vid_sdlsink:sink but it has no chainhandler
(process:4126): GStreamer-WARNING **: pushing data on non-negotiated
pad demux:audio_00, not allowed.
Please suggest me what to do..
Thanks
More information about the gstreamer-devel
mailing list