Page 1 of 1

Most efficient way to play into textures with libvlc/VLCKit

Posted: 20 Nov 2011 04:38
by lagnat
I'm currently using libvlc and have taken the simple way out of requesting video frames in RGBA. From there it's easy work to create textures and I'm off to the races, except for that fact the the VLC engine is sucking down gobs of CPU trying to uncompress video. On the other hand, the VLC application doesn't seem to suffer from the same CPU load when playing the same content which would imply to me that VLC is making better use of the GPU, perhaps using something like GL_YCBCR_422_APPLE? I poked around VLCKit but I didn't see the secret sauce there for getting video into OpenGL. It seems to rely on something in libvlc for doing it..?

Can anyone point me in the right direction on this?

Thanks..

Re: Most efficient way to play into textures with libvlc/VLC

Posted: 21 Nov 2011 10:50
by fkuehne
VLCKit uses the opengl video output in modules/video_output. The general opengl vout renders converts the video frames to a correct color space and renders the result in a texture. That texture is passed on to the Mac specific opengl vout, which puts the texture in a NSView, which was created by VLCKit in advance.
This way, the frames are never copied within VLC's memory space.

If you switch to the stabilizing code base of VLC 1.2, you will notice dramatic speed improvements to the OpenGL video output when playing a certain set of files, since we are using a shader for the chroma conversation now.

Re: Most efficient way to play into textures with libvlc/VLC

Posted: 21 Nov 2011 13:26
by lagnat
Yes.. that's exactly what I want! Thanks for the reply. I have been using the vlc-git nightly for the libvlc.dylib. Is that the 1.2 code base?

As for the opengl vout, how do I make use of that with libvlc? Right now I'm using libvlc_video_set_callbacks, and libvlc_video_set_format_callbacks which is where I've been specifying RGBA. I got that sequence from the examples and a little bit of googling. I'm assuming there's a different calling sequence to make use of the opengl vout?

Thanks again!

Re: Most efficient way to play into textures with libvlc/VLC

Posted: 08 Apr 2012 15:58
by lagnat
Hi again. I spent some time on this, but I haven't gotten very far. I've read through the source code a bit and the best I can determine is that I should copy macos.m and start modifying it to render to a given context. Is there a simpler way? Could you suggest a starting point for me?

Thanks.