[gst-devel] How to play video using gstreamer/c++
Stefan Kost
ensonic at hora-obscura.de
Sat Oct 23 15:53:19 CEST 2010
Am 22.10.2010 20:56, schrieb Marlos C. Machado:
> Hello, I need to play this line on gstreamer using c++:
>
> filesrc location=Video2.avi ! decodebin2 name=dec ! queue ! ffmpegcolorspace !
> autovideosink dec. ! queue ! audioconvert ! audioresample ! autoaudiosink
>
> This code does this:
>
> /#include <gst/gst.h>
>
> int main(int argc, char *argv[])
> {
> char str [] = "filesrc location=Video2.avi ! decodebin2 name=dec ! \
> queue ! ffmpegcolorspace ! autovideosink dec. ! \
> queue ! audioconvert ! audioresample ! autoaudiosink";
> GError *error = NULL;
> GstElement *element;
>
> gst_init (&argc, &argv);
> element = gst_parse_launch(str, &error);
>
> gst_element_set_state (element, GST_STATE_PLAYING);
>
> if (!element) {
> fprintf (stderr, "Parse error: %s\n", error->message);
> exit(1);
> }
>
> while(1){}
>
> return 1;
> }/
>
> But I need to play this video on a texture, how do I bind the video with a
> texture in OpenGL, for example? I mean, I do not know how to access the stream,
> the code above plays on a window created by gstreamer.
> If I'm able to access the stream i'm able to bind it to OpenGL. I'd prefer to
> use no-specific OpenGL plugins since I do not know what rendering system I'm
> going to use.
You will need to write a video-sink for your rendering system. Why:
1.) if you just take out the frame and render it from your app, you kill/harm
A/V sink, as GSTreamer does not know when you actualy render.
2.) taking out the frame will introduce memory copies, you can't make the
decoder decoding into the final surface anymore.
If all that is not an issue in your case, using appsink is okay.
Stefan
>
> Thanks a lot!
>
> --
> Marlos Cholodovskis Machado
>
>
>
>
>
> ------------------------------------------------------------------------------
> Nokia and AT&T present the 2010 Calling All Innovators-North America contest
> Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
> http://p.sf.net/sfu/nokia-dev2dev
>
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
More information about the gstreamer-devel
mailing list