get media pitch?

This forum is about all development around libVLC.
neosettler
Cone that earned his stripes
Cone that earned his stripes
Posts: 107
Joined: 18 Dec 2012 17:44

get media pitch?

Postby neosettler » 06 Oct 2019 03:26

Greeting,

I'm rendering the media video data to a texture.

The problem I'm having while setting libvlc_video_set_format as that the width and height are sometimes padded and we seems to have no function to get the pitch of the video.

something that would complement: libvlc_video_get_size like libvlc_video_get_pitch.

Anyone?

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: get media pitch?

Postby Rémi Denis-Courmont » 06 Oct 2019 09:02

The pitch is not an intrinsic property of the video ES. In fact, in most cases, there is no such a thing as "the" pitch of the media.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

neosettler
Cone that earned his stripes
Cone that earned his stripes
Posts: 107
Joined: 18 Dec 2012 17:44

Re: get media pitch?

Postby neosettler » 06 Oct 2019 18:32

Thank you for your feedback Remi. Your are right but still, it seems like a common concept. In any case, based on this note from libvlc_video_set_format:
For each pixels plane, the scanline pitch must be bigger than or equal to the number of bytes per pixel multiplied by the pixel width.
Similarly, the number of scanlines must be bigger than of equal to the pixel height. We recommend that pitches and lines be multiple of 32.
I managed to solved the issue like this:

Code: Select all

UInt l_height; UInt l_width; if (libvlc_video_get_size(m_MediaPlayer, 0, &l_width, &l_height) == 0) { UInt l_pitch = l_width + (l_width % 32); UInt l_channelCount = GetChannelCount(); libvlc_video_set_format(m_MediaPlayer, l_channelCount == 3 ? "RV24" : "RV32", l_pitch, l_height, l_pitch * l_channelCount); CreatePixels(l_pitch, l_height); }
Cheers,

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: get media pitch?

Postby Rémi Denis-Courmont » 06 Oct 2019 20:07

The point is, we cannot add a getter for a value that is not usually even defined.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

neosettler
Cone that earned his stripes
Cone that earned his stripes
Posts: 107
Joined: 18 Dec 2012 17:44

Re: get media pitch?

Postby neosettler » 06 Oct 2019 20:12

All good Remi, no worries.
What sparked the idea is that libvlc_video_setup_cb does return the pitch. It would have been nice to have the same pitch calculation as a convenience.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 18 guests