libvlc_audio_set_channel and libvlc_audio_output_channel_t values

This forum is about all development around libVLC.
sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

libvlc_audio_set_channel and libvlc_audio_output_channel_t values

Postby sherington » 23 Feb 2019 10:02

I'm looking at this API function:

Code: Select all

/** * Set current audio channel. * * \param p_mi media player * \param channel the audio channel, \see libvlc_audio_output_channel_t * \return 0 on success, -1 on error */ LIBVLC_API int libvlc_audio_set_channel( libvlc_media_player_t *p_mi, int channel );
For the channel values, it refers to libvlc_media_player.h which declares this:

Code: Select all

typedef enum libvlc_audio_output_channel_t { libvlc_AudioChannel_Error = -1, libvlc_AudioChannel_Stereo = 1, libvlc_AudioChannel_RStereo = 2, libvlc_AudioChannel_Left = 3, libvlc_AudioChannel_Right = 4, libvlc_AudioChannel_Dolbys = 5 } libvlc_audio_output_channel_t;
vlc_aout.h declares this:

Code: Select all

/* Values used for the audio-channels object variable */ #define AOUT_VAR_CHAN_UNSET 0 /* must be zero */ #define AOUT_VAR_CHAN_STEREO 1 #define AOUT_VAR_CHAN_RSTEREO 2 #define AOUT_VAR_CHAN_LEFT 3 #define AOUT_VAR_CHAN_RIGHT 4 #define AOUT_VAR_CHAN_DOLBYS 5 #define AOUT_VAR_CHAN_HEADPHONES 6 #define AOUT_VAR_CHAN_MONO 7
Are the "headphones" and "mono" values, and I suppose "unset" too, supposed to be available via the API on the libvlc_audio_output_channel_t enum?

mfkl
Developer
Developer
Posts: 739
Joined: 13 Jun 2017 10:41

Re: libvlc_audio_set_channel and libvlc_audio_output_channel_t values

Postby mfkl » 25 Feb 2019 03:46

What are you trying to achieve?

Looking for this?

Code: Select all

typedef enum libvlc_audio_output_device_types_t { libvlc_AudioOutputDevice_Error = -1, libvlc_AudioOutputDevice_Mono = 1, libvlc_AudioOutputDevice_Stereo = 2, libvlc_AudioOutputDevice_2F2R = 4, libvlc_AudioOutputDevice_3F2R = 5, libvlc_AudioOutputDevice_5_1 = 6, libvlc_AudioOutputDevice_6_1 = 7, libvlc_AudioOutputDevice_7_1 = 8, libvlc_AudioOutputDevice_SPDIF = 10 } libvlc_audio_output_device_types_t;
https://mfkl.github.io

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: libvlc_audio_set_channel and libvlc_audio_output_channel_t values

Postby sherington » 25 Feb 2019 09:51

No, there is an existing API function, libvlc_audio_set_channel, that lets you set the stereo mode using the values in libvlc_audio_output_channel_t.

This is not the same API that uses the libvlc_audio_output_device_types_t you mention - that API is libvlc_audio_output_device_enum or libvlc_audio_output_device_list_get.

My question is if the public API, libvlc_audio_output_channel_t, currently defines all the allowable values or if it is missing some of them from vlc_aout.h, i.e. headphones and mono. Since it's an enum I can just pass the int value for those "missing" values, so it really isn't a big deal, but is it correct.

I don't think setting the audio channel (I think this is the "stereo-mode" variable in the VLC sources) is the same as setting the device type - there are separate API's for those two things.

mfkl
Developer
Developer
Posts: 739
Joined: 13 Jun 2017 10:41

Re: libvlc_audio_set_channel and libvlc_audio_output_channel_t values

Postby mfkl » 25 Feb 2019 11:34

My question is if the public API, libvlc_audio_output_channel_t, currently defines all the allowable values or if it is missing some of them from vlc_aout.h
I don't know.

Maybe related: Are you aware of the following libvlc options https://wiki.videolan.org/VLC_command-line_help/

Code: Select all

--stereo-mode={0 (Unset), 1 (Stereo), 2 (Reverse stereo), 3 (Left), 4 (Right), 5 (Dolby Surround), 6 (Headphones)} Stereo audio output mode
https://mfkl.github.io

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: libvlc_audio_set_channel and libvlc_audio_output_channel_t values

Postby sherington » 25 Feb 2019 12:35

It's the headphones one I was most interested in. It seems to me it should be OK to use those values.

This is not a big problem really, I just like to be thorough when I implement the API.

Thank you for your replies.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: libvlc_audio_set_channel and libvlc_audio_output_channel_t values

Postby Jean-Baptiste Kempf » 10 Mar 2019 11:41

Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 12 guests