Commit 6f05b7ee authored by Mark Lee's avatar Mark Lee Committed by Rémi Denis-Courmont

Add functions to get/set audio delay.

Two new functions added:

 * val = libvlc_audio_get_delay( p_mi )
 * libvlc_audio_set_delay( p_mi, i_delay )

The delay is measured in microseconds.
Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
(cherry picked from commit b8a46d564f7d6c822b8dbe945af2bcb679a0e579)
parent 57cb105e
...@@ -1259,6 +1259,25 @@ VLC_PUBLIC_API int libvlc_audio_get_channel( libvlc_media_player_t *p_mi ); ...@@ -1259,6 +1259,25 @@ VLC_PUBLIC_API int libvlc_audio_get_channel( libvlc_media_player_t *p_mi );
*/ */
VLC_PUBLIC_API int libvlc_audio_set_channel( libvlc_media_player_t *p_mi, int channel ); VLC_PUBLIC_API int libvlc_audio_set_channel( libvlc_media_player_t *p_mi, int channel );
/**
* Get current audio delay.
*
* \param p_mi media player
* \return the audio delay (microseconds)
* \version LibVLC 1.1.1 or later
*/
VLC_PUBLIC_API int64_t libvlc_audio_get_delay( libvlc_media_player_t *p_mi );
/**
* Set current audio delay. The audio delay will be reset to zero each time the media changes.
*
* \param p_mi media player
* \param i_delay the audio delay (microseconds)
* \return 0 on success, -1 on error
* \version LibVLC 1.1.1 or later
*/
VLC_PUBLIC_API int libvlc_audio_set_delay( libvlc_media_player_t *p_mi, int64_t i_delay );
/** @} audio */ /** @} audio */
/** @} media_player */ /** @} media_player */
......
...@@ -478,3 +478,37 @@ int libvlc_audio_set_channel( libvlc_media_player_t *mp, int channel ) ...@@ -478,3 +478,37 @@ int libvlc_audio_set_channel( libvlc_media_player_t *mp, int channel )
vlc_object_release( p_aout ); vlc_object_release( p_aout );
return ret; return ret;
} }
/*****************************************************************************
* libvlc_audio_get_delay : Get the current audio delay
*****************************************************************************/
int64_t libvlc_audio_get_delay( libvlc_media_player_t *p_mi )
{
input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi );
int64_t val = 0;
if( p_input_thread != NULL )
{
val = var_GetTime( p_input_thread, "audio-delay" );
vlc_object_release( p_input_thread );
}
return val;
}
/*****************************************************************************
* libvlc_audio_set_delay : Set the current audio delay
*****************************************************************************/
int libvlc_audio_set_delay( libvlc_media_player_t *p_mi, int64_t i_delay )
{
input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi );
int ret = 0;
if( p_input_thread != NULL )
{
var_SetTime( p_input_thread, "audio-delay", i_delay );
vlc_object_release( p_input_thread );
}
else
{
ret = -1;
}
return ret;
}
...@@ -13,12 +13,14 @@ libvlc_audio_output_list_release ...@@ -13,12 +13,14 @@ libvlc_audio_output_list_release
libvlc_audio_output_set libvlc_audio_output_set
libvlc_audio_output_set_device_type libvlc_audio_output_set_device_type
libvlc_audio_get_channel libvlc_audio_get_channel
libvlc_audio_get_delay
libvlc_audio_get_mute libvlc_audio_get_mute
libvlc_audio_get_track libvlc_audio_get_track
libvlc_audio_get_track_count libvlc_audio_get_track_count
libvlc_audio_get_track_description libvlc_audio_get_track_description
libvlc_audio_get_volume libvlc_audio_get_volume
libvlc_audio_set_channel libvlc_audio_set_channel
libvlc_audio_set_delay
libvlc_audio_set_mute libvlc_audio_set_mute
libvlc_audio_set_track libvlc_audio_set_track
libvlc_audio_set_volume libvlc_audio_set_volume
......
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