Error in my pipe?

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

Error in my pipe?

StyveA
I really don't understand where is my error...
I've launch this line :

gst-launch filesrc location=test.avi ! avidemux name=demux   demux.video_00  ! decodebin ! ffmpegcolorspace ! videoscale ! autovideosink

and my video works fine..

But when I do this :
//-----------------------------CODE--------------
int main (int argc, char *argv[])
{
   GstElement *pipe,*src, *dec,*ffm,*scale, *sink;
   GstMessage *msg;
   gst_init (&argc, &argv);
 
      loop = g_main_loop_new (NULL, FALSE);
   if (argc < 2)
       g_error ("Usage: %s <path to file>", argv[0]);
   
   pipe = gst_pipeline_new ("pipeline");
   src = gst_element_factory_make ("filesrc", "src");
   gst_bin_add (GST_BIN (pipe), src);
   g_object_set (src, "location", argv[1], NULL); //essayer avec dec au lieu de src
   dec = gst_element_factory_make ("decodebin", "decoder");
   gst_bin_add (GST_BIN (pipe), dec);
   ffm = gst_element_factory_make ("ffmpegcolorspace", NULL);
   gst_bin_add (GST_BIN (pipe), ffm);
   scale = gst_element_factory_make ("videoscale", NULL);
   gst_bin_add (GST_BIN (pipe), scale);
   sink = gst_element_factory_make ("autovideosink", "sink");
   gst_bin_add (GST_BIN (pipe), sink);
   g_signal_connect (dec, "pad-added", G_CALLBACK (on_new_pad), sink);
   
  gst_element_link_many (src,dec,ffm,scale,sink, NULL);
 
if(!pipe || !dec || !sink || !src || !scale || !ffm)
   g_print ("error...\n");
 
   gst_element_set_state (pipe, GST_STATE_PLAYING);
 
   g_print ("Running...\n");
   g_timeout_add (5000, get_me_out, NULL);
   g_main_loop_run (loop);
/* Out of the main loop, clean up nicely */
   g_print ("Returned, stopping playback\n");
   gst_element_set_state (pipe, GST_STATE_NULL);
   g_print ("Deleting pipeline\n");
   gst_object_unref (GST_OBJECT (pipe));
 
 
   return 0;
 
}
//-----------------------------END---------------

I have nothing that shows up ! Just the "running..." message, but no video..
I really don't get it..
Reply | Threaded
Open this post in threaded view
|

Re: Error in my pipe?

Wim Taymans
On 02/03/2011 05:57 PM, StyveA wrote:
> I really don't understand where is my error...
Check out the part in the manual about dynamic pads. You need to connect to
the pad-added signal from decodebin.

Wim

> I've launch this line :
>
> gst-launch filesrc location=test.avi ! avidemux name=demux   demux.video_00
> ! decodebin ! ffmpegcolorspace ! videoscale ! autovideosink
>
> and my video works fine..
>
> But when I do this :
> //-----------------------------CODE--------------
> int main (int argc, char *argv[])
> {
>     GstElement *pipe,*src, *dec,*ffm,*scale, *sink;
>     GstMessage *msg;
>     gst_init (&argc,&argv);
>
>        loop = g_main_loop_new (NULL, FALSE);
>     if (argc<  2)
>         g_error ("Usage: %s<path to file>", argv[0]);
>
>     pipe = gst_pipeline_new ("pipeline");
>     src = gst_element_factory_make ("filesrc", "src");
>     gst_bin_add (GST_BIN (pipe), src);
>     g_object_set (src, "location", argv[1], NULL); //essayer avec dec au lieu
> de src
>     dec = gst_element_factory_make ("decodebin", "decoder");
>     gst_bin_add (GST_BIN (pipe), dec);
>     ffm = gst_element_factory_make ("ffmpegcolorspace", NULL);
>     gst_bin_add (GST_BIN (pipe), ffm);
>     scale = gst_element_factory_make ("videoscale", NULL);
>     gst_bin_add (GST_BIN (pipe), scale);
>     sink = gst_element_factory_make ("autovideosink", "sink");
>     gst_bin_add (GST_BIN (pipe), sink);
>     g_signal_connect (dec, "pad-added", G_CALLBACK (on_new_pad), sink);
>
>    gst_element_link_many (src,dec,ffm,scale,sink, NULL);
>
> if(!pipe || !dec || !sink || !src || !scale || !ffm)
>     g_print ("error...\n");
>
>     gst_element_set_state (pipe, GST_STATE_PLAYING);
>
>     g_print ("Running...\n");
>     g_timeout_add (5000, get_me_out, NULL);
>     g_main_loop_run (loop);
> /* Out of the main loop, clean up nicely */
>     g_print ("Returned, stopping playback\n");
>     gst_element_set_state (pipe, GST_STATE_NULL);
>     g_print ("Deleting pipeline\n");
>     gst_object_unref (GST_OBJECT (pipe));
>
>
>     return 0;
>
> }
> //-----------------------------END---------------
>
> I have nothing that shows up ! Just the "running..." message, but no video..
> I really don't get it..


------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Error in my pipe?

StyveA
Wim Taymans wrote
On 02/03/2011 05:57 PM, StyveA wrote:
> I really don't understand where is my error...
Check out the part in the manual about dynamic pads. You need to connect to
the pad-added signal from decodebin.

Wim
If I understand, this is what I do here :

static void
on_new_pad (GstElement *element,
                 GstPad     *pad,
          gpointer    data)
{
 
  gchar *name;
  name = gst_pad_get_name (pad);
  GstPad *sinkpad;
  g_print ("Dynamic pad created, linking parser/decoder '%s'\n", name);
  sinkpad = gst_element_get_pad (video, "sink");
  gst_pad_link (pad, sinkpad);
  gst_object_unref (sinkpad);
 
}

and in the main code :

g_signal_connect (dec, "pad-added", G_CALLBACK (on_new_pad), sink);

It connects the pad added from the decodebin to the sink no?
Reply | Threaded
Open this post in threaded view
|

Re: Error in my pipe?

Luciana Fujii Pontello-2
On Thu, 2011-02-03 at 10:29 -0800, StyveA wrote:

>
> Wim Taymans wrote:
> >
> > On 02/03/2011 05:57 PM, StyveA wrote:
> >> I really don't understand where is my error...
> > Check out the part in the manual about dynamic pads. You need to connect
> > to
> > the pad-added signal from decodebin.
>
> If I understand, this is what I do here :

Quoting from your previous e-mail, this is where the wrong part starts:

> gst_element_link_many (src,dec,ffm,scale,sink, NULL);

Which points you to read the dynamic pads doc. Your callback is also not
right, because you're trying to link decodebin to sink, which should be
already linked to videoscale. Check the return of your linking attempt,
which would have told you it didn't work.

I also suggest that you use uridecodebin or even just use playbin2 in
your pipeline.

Regards,

Luciana Fujii


------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world?
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Error in my pipe?

StyveA
Hum thanks, I should have missed something...
I'll try it tomorrow.

For playbin, I can't 'cause I need to use an other sink (is it possible with playbin?), I need to use dfbvideosink..
For uridecodebin, I've tried it, but I need more practice I think..
Reply | Threaded
Open this post in threaded view
|

Re: Error in my pipe?

Thiago Sousa Santos
On Thu, 2011-02-03 at 13:01 -0800, StyveA wrote:
> Hum thanks, I should have missed something...
> I'll try it tomorrow.
>
> For playbin, I can't 'cause I need to use an other sink (is it possible with
> playbin?), I need to use dfbvideosink..
> For uridecodebin, I've tried it, but I need more practice I think..

Yes, you can set sinks to playbin2, check gst-inspect for the full list
of properties but there should be audio-sink and video-sink there (or
something alike).

>

--
Thiago Santos



------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world?
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Error in my pipe?

StyveA


Ah ! Really good news ! I'll check that so and hope that dfbvideosink work with it ^^

Thanks =)

Thiago Sousa Santos wrote
On Thu, 2011-02-03 at 13:01 -0800, StyveA wrote:
> Hum thanks, I should have missed something...
> I'll try it tomorrow.
>
> For playbin, I can't 'cause I need to use an other sink (is it possible with
> playbin?), I need to use dfbvideosink..
> For uridecodebin, I've tried it, but I need more practice I think..

Yes, you can set sinks to playbin2, check gst-inspect for the full list
of properties but there should be audio-sink and video-sink there (or
something alike).

>

--
Thiago Santos



------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world?
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Error in my pipe?

StyveA
Thanks ! It works with Playbin & Dfbvideosink =D
My only problem now is that the video is played with a blue tint...

but I'll check that ^^