[gst-devel] Getting width and height before sink instanciation

Emmanuel Raulo raulo at tamaris.tm.fr
Mon Jul 18 09:51:15 CEST 2005


It seems to me that all decent OpenGL drivers nowadays support 
non-power-of-two (NPOT) textures through the 
GL_ARB_texture_non_power_of_two extension (now part of GL 1.5 AFAIK) 
which just extends existing texturing-related functions to NPOT textures 
as well and adds no extra functions.

Anyway, I don't understand why you would need to know the resolution 
when constructing your element. You can postpone the actual allocation 
of the texture surface to the time when the texture is needed. It's 
possible to reallocate the surface associated with a GL texture object 
just by calling glTexImage2D(), so in your constructor you may just 
allocate the OpenGL texture object. If not reallocating the texture, one 
better use glTexSubImage2D() to change the image, which might be faster 
(because you're sure that the same "surface" is used).
Moreover in my understanding of GStreamer your element should stand 
having its sink disconnected and then connected to another video source 
with, say, a different resolution (well, that could be nice).
I don't know the details on how to actually code elements but when data 
is pushed on your sink, can't you just reallocate the surface when you 
realize that the source has changed (or was just set) ?

Sorry if my idea seems dumb, I'm just a user afterall ;)
An OpenGL sink would be nice though :)
Keep up the good work


Loïc Molinari a écrit :

>I am writing a little piece of software aimed to display video streams
>on OpenGL textures. Like the GStreamer manual advices, I choose to
>write my own sink element instead of using the fakesink way. My
>class_init takes two readable properties, the width and the height.
>OpenGL needs pow2 values, so I put width and height to the pow2 upper
>values in the sink.
>Here is my pipeline :
>gnomevfssrc <-> decodebin <-> ffmpegcolorspace <-> videoscale <-> mysink
>The problem is that I need to know width and height of the stream
>before the instanciation of the sink, and I do not find how to do that
>! I tried to get caps of the elements of the decodebin element when
>the new-decoded-pad signal fired, but I could not.
>Is anybody know how could I accomplish that ? Is this the good way ?
>Is adding a new property telling width and height destination values
>in the videoscale element a good idea ?
>    regards, Loïc.
>SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
>from IBM. Find simple to follow Roadmaps, straightforward articles,
>informative Webcasts and more! Get everything you need to get up to
>speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&opÌk
>gstreamer-devel mailing list
>gstreamer-devel at lists.sourceforge.net

More information about the gstreamer-devel mailing list