[gst-devel] Error : App hangs when I try to test my source plugin

Thabelo Mmbengeni cafenite at gmail.com
Wed Jun 10 11:12:27 CEST 2009


try changing the source to "videotestsrc" , this will use the test source

eg.   launch

gst-launch videotestsrc ! xvimagesink   /* this shows your test source*/

On Wed, Jun 10, 2009 at 10:21 AM, Krishnakumar Ramachandran <
krishnakumar.ramachandran at gmail.com> wrote:

> Hi All,
>
>      I am very new to gstreamer and started working only 2 days back. I am
> trying to create a sample source plugin with 2 source pads. (My large idea
> is to include a demux also in the source plugin and at that point in time
> one pad will push audio and the other will push video. But as of now both
> pads are of type "ANY"). To test my plugin, I am trying to connect it to two
> filesinks (i.e each source pad is connected to the sink pad of a filesink).
> So the pipeline has 3 plugins. My test source  and 2 filesinks. After
> creating the pipeline, I call gst_element_set_state with GST_STATE_PLAYING.
> After this initially all 3 of the plugins and pipeline move to READY state
> (I get bus_call callback with state changed confirmation). Then my source
> plugin changes to PAUSED state and then the entire app hangs. I have
> attached the sample app code I am working on. Please tell me what I am doing
> wrong here.
>
> Thanks in advance
> KK
>
> #include <gst/gst.h>
>
> #include <glib.h>
>
> GstElement *mypipeline = NULL;
> static int ccount = 0;
>
> static gboolean bus_call (GstBus     *bus,
>                           GstMessage *msg,
>                           gpointer    data)
> {
>       g_print("Got one bus call:%d\n", GST_MESSAGE_TYPE(msg));
>           GMainLoop *loop = (GMainLoop *) data;
>             switch (GST_MESSAGE_TYPE (msg))
>             {
>                 case GST_MESSAGE_EOS:
>                       g_print ("End of stream\n");
>                       g_main_loop_quit (loop);
>                       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);
>                             g_main_loop_quit (loop);
>                             break;
>                       }
>
>         case GST_MESSAGE_STATE_CHANGED:
>               {
>             ccount++;
>             printf("State change:%d\n", ccount);
>             printf("Element:%s\n", msg->src->name);
>             break;
>               }
>                 default:
>                    break;
>             }
>             return TRUE;
> }
>
>
> int main(int argc, char* argv[])
> {
>     GMainLoop* loop = NULL;
>     GstElement *pipeline, *source, *fsink1, *fsink2;
>     GstBus *bus;
>
>     gst_init(&argc, &argv);
>
>     loop = g_main_loop_new (NULL, FALSE);
>
>     pipeline = gst_pipeline_new("TstPipeLine");
>
>     if(!pipeline)
>     {
>         g_print("Could not create pipeline\n");
>         return -1;
>     }
>
>     source = gst_element_factory_make("tstsrc", "tstsrcplug");
>     if(!source)
>     {
>         g_print("Did not get ur source\n");
>         return -1;
>     }
>
>     fsink1 = gst_element_factory_make ("filesink","asink");
>     fsink2 = gst_element_factory_make ("filesink","vsink");
>     if((!fsink1) || (!fsink2))
>     {
>         g_print("Could not create at least one sink\n");
>         return -1;
>     }
>
>     g_object_set(G_OBJECT (fsink1), "location", "afile.dmp", NULL);
>     g_object_set(G_OBJECT (fsink2), "location", "vfile.dmp", NULL);
>
>     bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
>         gst_bus_add_watch (bus, bus_call, loop);
>         gst_object_unref (bus);
>
>     gst_bin_add_many (GST_BIN (pipeline),source, fsink1, fsink2, NULL);
>
>     gboolean bret = gst_element_link_pads(source, "asrc", fsink1, "sink");
>     printf("Bool ret = %d\n", bret);
>     bret = gst_element_link_pads(source, "vsrc", fsink2, "sink");
>     printf("Bool ret = %d\n", bret);
>
>     GstStateChangeReturn myretval = 0;
>     g_print("Now playing\n");
>     myretval = gst_element_set_state(pipeline, GST_STATE_PLAYING);
>
>     printf("State of source:%d \n", GST_STATE(source));
>     printf("State of asink:%d \n", GST_STATE(fsink1));
>     printf("State of vsink:%d \n", GST_STATE(fsink2));
>     printf("Retval%d\n", myretval);
>
>     g_print ("Running...\n");
>         g_main_loop_run (loop);
>     return 0;
> }
>
> <gstreamer-devel at lists.sourceforge.net>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables unlimited
> royalty-free distribution of the report engine for externally facing
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20090610/3b729b50/attachment.htm>


More information about the gstreamer-devel mailing list