Commit 14863071 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

LibVLC audio: take a player object for most functions, remove exceptions

parent d3472830
...@@ -928,12 +928,12 @@ VLC_PUBLIC_API void libvlc_audio_output_list_release( libvlc_audio_output_t * ); ...@@ -928,12 +928,12 @@ VLC_PUBLIC_API void libvlc_audio_output_list_release( libvlc_audio_output_t * );
* Set the audio output. * Set the audio output.
* Change will be applied after stop and play. * Change will be applied after stop and play.
* *
* \param p_instance libvlc instance * \param mp media player
* \param psz_name name of audio output, * \param psz_name name of audio output,
* use psz_name of \see libvlc_audio_output_t * use psz_name of \see libvlc_audio_output_t
* \return true if function succeded * \return true if function succeded
*/ */
VLC_PUBLIC_API int libvlc_audio_output_set( libvlc_instance_t *, VLC_PUBLIC_API int libvlc_audio_output_set( libvlc_media_player_t *,
const char * ); const char * );
/** /**
...@@ -972,13 +972,13 @@ VLC_PUBLIC_API char * libvlc_audio_output_device_id( libvlc_instance_t *, ...@@ -972,13 +972,13 @@ VLC_PUBLIC_API char * libvlc_audio_output_device_id( libvlc_instance_t *,
int ); int );
/** /**
* Set device for using * Set audio output device. Changes are only effective after stop and play.
* *
* \param p_instance libvlc instance * \param mp media player
* \param psz_audio_output - name of audio output, \see libvlc_audio_output_t * \param psz_audio_output - name of audio output, \see libvlc_audio_output_t
* \param psz_device_id device * \param psz_device_id device
*/ */
VLC_PUBLIC_API void libvlc_audio_output_device_set( libvlc_instance_t *, VLC_PUBLIC_API void libvlc_audio_output_device_set( libvlc_media_player_t *,
const char *, const char *,
const char * ); const char * );
...@@ -986,124 +986,115 @@ VLC_PUBLIC_API void libvlc_audio_output_device_set( libvlc_instance_t *, ...@@ -986,124 +986,115 @@ VLC_PUBLIC_API void libvlc_audio_output_device_set( libvlc_instance_t *,
* Get current audio device type. Device type describes something like * Get current audio device type. Device type describes something like
* character of output sound - stereo sound, 2.1, 5.1 etc * character of output sound - stereo sound, 2.1, 5.1 etc
* *
* \param p_instance vlc instance * \param mp media player
* \param p_e an initialized exception pointer
* \return the audio devices type \see libvlc_audio_output_device_types_t * \return the audio devices type \see libvlc_audio_output_device_types_t
*/ */
VLC_PUBLIC_API int libvlc_audio_output_get_device_type( VLC_PUBLIC_API int libvlc_audio_output_get_device_type(
libvlc_instance_t *, libvlc_exception_t * ); libvlc_media_player_t * );
/** /**
* Set current audio device type. * Set current audio device type.
* *
* \param p_instance vlc instance * \param mp vlc instance
* \param device_type the audio device type, * \param device_type the audio device type,
according to \see libvlc_audio_output_device_types_t according to \see libvlc_audio_output_device_types_t
* \param p_e an initialized exception pointer * \param p_e an initialized exception pointer
*/ */
VLC_PUBLIC_API void libvlc_audio_output_set_device_type( libvlc_instance_t *, VLC_PUBLIC_API void libvlc_audio_output_set_device_type( libvlc_media_player_t *,
int, int );
libvlc_exception_t * );
/** /**
* Toggle mute status. * Toggle mute status.
* *
* \param p_instance libvlc instance * \param mp media player
*/ */
VLC_PUBLIC_API void libvlc_audio_toggle_mute( libvlc_instance_t * ); VLC_PUBLIC_API void libvlc_audio_toggle_mute( libvlc_media_player_t * );
/** /**
* Get current mute status. * Get current mute status.
* *
* \param p_instance libvlc instance * \param mp media player
* \return the mute status (boolean) * \return the mute status (boolean)
*/ */
VLC_PUBLIC_API int libvlc_audio_get_mute( libvlc_instance_t * ); VLC_PUBLIC_API int libvlc_audio_get_mute( libvlc_media_player_t * );
/** /**
* Set mute status. * Set mute status.
* *
* \param p_instance libvlc instance * \param mp media player
* \param status If status is true then mute, otherwise unmute * \param status If status is true then mute, otherwise unmute
*/ */
VLC_PUBLIC_API void libvlc_audio_set_mute( libvlc_instance_t *, int ); VLC_PUBLIC_API void libvlc_audio_set_mute( libvlc_media_player_t *, int );
/** /**
* Get current audio level. * Get current audio level.
* *
* \param p_instance libvlc instance * \param mp media player
* \param p_e an initialized exception pointer * \param p_e an initialized exception pointer
* \return the audio level (int) * \return the audio level (int)
*/ */
VLC_PUBLIC_API int libvlc_audio_get_volume( libvlc_instance_t * ); VLC_PUBLIC_API int libvlc_audio_get_volume( libvlc_media_player_t * );
/** /**
* Set current audio level. * Set current audio level.
* *
* \param p_instance libvlc instance * \param mp media player
* \param i_volume the volume (int) * \param i_volume the volume (int)
* \param p_e an initialized exception pointer * \return 0 if the volume was set, -1 if it was out of range
*/ */
VLC_PUBLIC_API void libvlc_audio_set_volume( libvlc_instance_t *, int, libvlc_exception_t *); VLC_PUBLIC_API int libvlc_audio_set_volume( libvlc_media_player_t *, int );
/** /**
* Get number of available audio tracks. * Get number of available audio tracks.
* *
* \param p_mi media player * \param p_mi media player
* \param p_e an initialized exception * \return the number of available audio tracks (int), or -1 if unavailable
* \return the number of available audio tracks (int)
*/ */
VLC_PUBLIC_API int libvlc_audio_get_track_count( libvlc_media_player_t *, libvlc_exception_t * ); VLC_PUBLIC_API int libvlc_audio_get_track_count( libvlc_media_player_t * );
/** /**
* Get the description of available audio tracks. * Get the description of available audio tracks.
* *
* \param p_mi media player * \param p_mi media player
* \param p_e an initialized exception * \return list with description of available audio tracks, or NULL
* \return list with description of available audio tracks
*/ */
VLC_PUBLIC_API libvlc_track_description_t * VLC_PUBLIC_API libvlc_track_description_t *
libvlc_audio_get_track_description( libvlc_media_player_t *, libvlc_exception_t * ); libvlc_audio_get_track_description( libvlc_media_player_t * );
/** /**
* Get current audio track. * Get current audio track.
* *
* \param p_mi media player * \param p_mi media player
* \param p_e an initialized exception pointer * \return the audio track (int), or -1 if none.
* \return the audio track (int)
*/ */
VLC_PUBLIC_API int libvlc_audio_get_track( libvlc_media_player_t *, libvlc_exception_t * ); VLC_PUBLIC_API int libvlc_audio_get_track( libvlc_media_player_t * );
/** /**
* Set current audio track. * Set current audio track.
* *
* \param p_mi media player * \param p_mi media player
* \param i_track the track (int) * \param i_track the track (int)
* \param p_e an initialized exception pointer * \return 0 on success, -1 on error
*/ */
VLC_PUBLIC_API void libvlc_audio_set_track( libvlc_media_player_t *, int, libvlc_exception_t * ); VLC_PUBLIC_API int libvlc_audio_set_track( libvlc_media_player_t *, int );
/** /**
* Get current audio channel. * Get current audio channel.
* *
* \param p_instance vlc instance * \param mp media player
* \param p_e an initialized exception pointer
* \return the audio channel \see libvlc_audio_output_channel_t * \return the audio channel \see libvlc_audio_output_channel_t
*/ */
VLC_PUBLIC_API int VLC_PUBLIC_API int libvlc_audio_get_channel( libvlc_media_player_t * );
libvlc_audio_get_channel( libvlc_instance_t *, libvlc_exception_t * );
/** /**
* Set current audio channel. * Set current audio channel.
* *
* \param p_instance vlc instance * \param p_mi media player
* \param channel the audio channel, \see libvlc_audio_output_channel_t * \param channel the audio channel, \see libvlc_audio_output_channel_t
* \param p_e an initialized exception pointer * \return 0 on success, -1 on error
*/ */
VLC_PUBLIC_API void libvlc_audio_set_channel( libvlc_instance_t *, VLC_PUBLIC_API int libvlc_audio_set_channel( libvlc_media_player_t *, int );
int,
libvlc_exception_t * );
/** @} audio */ /** @} audio */
......
This diff is collapsed.
...@@ -132,6 +132,8 @@ input_thread_t *libvlc_get_input_thread( libvlc_media_player_t *p_mi ) ...@@ -132,6 +132,8 @@ input_thread_t *libvlc_get_input_thread( libvlc_media_player_t *p_mi )
p_input_thread = p_mi->p_input_thread; p_input_thread = p_mi->p_input_thread;
if( p_input_thread ) if( p_input_thread )
vlc_object_hold( p_input_thread ); vlc_object_hold( p_input_thread );
else
libvlc_printerr( "No active input" );
unlock(p_mi); unlock(p_mi);
return p_input_thread; return p_input_thread;
...@@ -354,6 +356,9 @@ libvlc_media_player_new( libvlc_instance_t *instance ) ...@@ -354,6 +356,9 @@ libvlc_media_player_new( libvlc_instance_t *instance )
var_SetBool (mp, "keyboard-events", true); var_SetBool (mp, "keyboard-events", true);
var_Create (mp, "mouse-events", VLC_VAR_BOOL); var_Create (mp, "mouse-events", VLC_VAR_BOOL);
/* Audio */
var_Create (mp, "aout", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
mp->p_md = NULL; mp->p_md = NULL;
mp->state = libvlc_NothingSpecial; mp->state = libvlc_NothingSpecial;
mp->p_libvlc_instance = instance; mp->p_libvlc_instance = instance;
......
...@@ -203,7 +203,8 @@ mediacontrol_sound_get_volume( mediacontrol_Instance *self, ...@@ -203,7 +203,8 @@ mediacontrol_sound_get_volume( mediacontrol_Instance *self,
mediacontrol_exception_init( exception ); mediacontrol_exception_init( exception );
i_ret = libvlc_audio_get_volume( self->p_instance ); //i_ret = libvlc_audio_get_volume( self->p_instance );
#warning FIXME: unimplented
/* FIXME: Normalize in [0..100] */ /* FIXME: Normalize in [0..100] */
return (unsigned short)i_ret; return (unsigned short)i_ret;
} }
...@@ -214,13 +215,10 @@ mediacontrol_sound_set_volume( mediacontrol_Instance *self, ...@@ -214,13 +215,10 @@ mediacontrol_sound_set_volume( mediacontrol_Instance *self,
mediacontrol_Exception *exception ) mediacontrol_Exception *exception )
{ {
/* FIXME: Normalize in [0..100] */ /* FIXME: Normalize in [0..100] */
libvlc_exception_t ex;
mediacontrol_exception_init( exception ); mediacontrol_exception_init( exception );
libvlc_exception_init( &ex );
libvlc_audio_set_volume( self->p_instance, volume, &ex ); //libvlc_audio_set_volume( self->p_instance, volume );
HANDLE_LIBVLC_EXCEPTION_VOID( &ex ); #warning FIXME: unimplented
} }
int mediacontrol_set_visual( mediacontrol_Instance *self, int mediacontrol_set_visual( mediacontrol_Instance *self,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment