Can't play video well using gstreamer

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Can't play video well using gstreamer

Honolulu-2

Hi, all
I have a pipeline . I use ximagesink for display.
It works fine in gst-launch..---->:
gst-launch-0.10 filesrc location=/home/lvwenwen/princess.avi ! decodebin !
Xvimagesink

but when I run the C program that looks like this :

int main(int argc,char *argv[])
{
    GMainLoop *loop;
    GstElement *pipeline,*source,*parser,*decoder,*con,*sink;
    GstBus *bus;
    char *path="/home/lvwenwen/princess.avi";

    gst_init(&argc,&argv);

    loop = g_main_loop_new(NULL,FALSE);

    pipeline=gst_pipeline_new("avi");
    source=gst_element_factory_make("filesrc","file-source");
    decoder=gst_element_factory_make("decodebin","decoder");
    sink=gst_element_factory_make("xvimagesink","file-output");

    if(!pipeline || !source || !decoder || !sink){
       g_print("One element could not be created\n");
       return -1;
    }

    g_object_set(G_OBJECT(source),"location",path,NULL);
    gst_bin_add_many(GST_BIN(pipeline),source,decoder,sink,NULL);
    gst_element_link_many(source,decoder,sink,NULL);
    g_print("Setting to play....\n");

    gst_element_set_state(pipeline,GST_STATE_PLAYING);
    g_print("Running...\n");

    g_main_loop_run(loop);

    return 0;
}

When I try to run this, it does not show the video image output. There is
just no response. What may be the issue ?


Any help will be useful.

Thanks & Best regards,

Honolulu
--
View this message in context: http://old.nabble.com/Can%27t-play-video-well-using-gstreamer-tp26489499p26489499.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Can't play video well using gstreamer

Thiago Sousa Santos-2


On Tue, Nov 24, 2009 at 12:14 AM, Honolulu <[hidden email]> wrote:

Hi, all
I have a pipeline . I use ximagesink for display.
It works fine in gst-launch..---->:
gst-launch-0.10 filesrc location=/home/lvwenwen/princess.avi ! decodebin !
Xvimagesink

but when I run the C program that looks like this :

int main(int argc,char *argv[])
{
   GMainLoop *loop;
   GstElement *pipeline,*source,*parser,*decoder,*con,*sink;
   GstBus *bus;
   char *path="/home/lvwenwen/princess.avi";

   gst_init(&argc,&argv);

   loop = g_main_loop_new(NULL,FALSE);

   pipeline=gst_pipeline_new("avi");
   source=gst_element_factory_make("filesrc","file-source");
   decoder=gst_element_factory_make("decodebin","decoder");
   sink=gst_element_factory_make("xvimagesink","file-output");

   if(!pipeline || !source || !decoder || !sink){
      g_print("One element could not be created\n");
      return -1;
   }

   g_object_set(G_OBJECT(source),"location",path,NULL);
   gst_bin_add_many(GST_BIN(pipeline),source,decoder,sink,NULL);
   gst_element_link_many(source,decoder,sink,NULL);

You can't link decodebin here, you'll need to listen for pad-added signals, read the chapter in the manual about dynamic pads and you'll understand.
 
   g_print("Setting to play....\n");

   gst_element_set_state(pipeline,GST_STATE_PLAYING);
   g_print("Running...\n");

   g_main_loop_run(loop);

   return 0;
}

When I try to run this, it does not show the video image output. There is
just no response. What may be the issue ?


Any help will be useful.

Thanks & Best regards,

Honolulu
--
View this message in context: http://old.nabble.com/Can%27t-play-video-well-using-gstreamer-tp26489499p26489499.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



--
Thiago Sousa Santos

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel