Page 1 of 1

libvlc_audio_set_channel and libvlc_audio_output_channel_t values

Posted: 23 Feb 2019 10:02
by sherington
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?

Re: libvlc_audio_set_channel and libvlc_audio_output_channel_t values

Posted: 25 Feb 2019 03:46
by mfkl
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;

Re: libvlc_audio_set_channel and libvlc_audio_output_channel_t values

Posted: 25 Feb 2019 09:51
by sherington
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.

Re: libvlc_audio_set_channel and libvlc_audio_output_channel_t values

Posted: 25 Feb 2019 11:34
by mfkl
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

Re: libvlc_audio_set_channel and libvlc_audio_output_channel_t values

Posted: 25 Feb 2019 12:35
by sherington
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.

Re: libvlc_audio_set_channel and libvlc_audio_output_channel_t values

Posted: 10 Mar 2019 11:41
by Jean-Baptiste Kempf