Page 1 of 1

libVLC : most efficient way to access audio/video data

Posted: 02 Jan 2019 09:30
by MikOfClassX
Hello all,

I'm new to libVLC and my aim is to use it as general media-handling layer for my applications.

After reading tons docs and looking some test code, it seems that libVLC has the features I'm looking for.

In order do integrate libVLC, I would need to access to video/audio data at a very low-level, i.e. get (already converted) ARGB frames and PCM audio samples.

Now it seems there are 2 different ways to achieve this result: through callbacks (libvlc_video_set_callbacks(), libvlc_audio_set_callbacks()) or through SMEM.
The question is easy: which is the best/fastest/suggested/most efficient way ?

Thanks,

Mik

Re: libVLC : most efficient way to access audio/video data

Posted: 02 Jan 2019 09:50
by Rémi Denis-Courmont
Use the LibVLC API if it works for you. But getting ARGB is not efficient to begin with. If that's what you want to do, it's going to be slower than VLC, whether you use unsupported smem manually or use the LibVLC API.

Re: libVLC : most efficient way to access audio/video data

Posted: 02 Jan 2019 10:03
by MikOfClassX
Thanks for the hint. So libvlc_xxxx_set_callbacks() is the way.

Yep, ARGB is not that comfortable for hw accel, but I need it. And libVLC will have to do some yuv->ARGB conversions for me, probably.

So, SMEM is unsupported, right ? I didn't get it from the docs.

Re: libVLC : most efficient way to access audio/video data

Posted: 03 Jan 2019 08:52
by MikOfClassX
BTW my first implementation runs like hell with ARGB and callbacks (both audio and video). Too cool you decode into user-supplied buffers. This will open doors to a zero-copy implementation.
Now I'll have to check seeking capabilities and stability when using multiple libVLC instances from the same process.

Re: libVLC : most efficient way to access audio/video data

Posted: 03 Jan 2019 18:33
by Rémi Denis-Courmont
You cannot do zero copy with callbacks. It requires VLC to copy internally.

Re: libVLC : most efficient way to access audio/video data

Posted: 04 Jan 2019 09:21
by MikOfClassX
Yep, "almost" zero copy. I checked the VLC code. There's the color-space conversion copy, isn't it ?