[vlc-commits] commit: Add functions to get/set audio delay. (Mark Lee )
git at videolan.org
git at videolan.org
Sun Jul 11 19:36:13 CEST 2010
vlc/vlc-1.1 | branch: master | Mark Lee <mark.lee at capricasoftware.co.uk> | Sun Jul 11 06:47:58 2010 +0100| [6f05b7ee3be9e2fbce8db8e3c2634fb70a7c9773] | committer: 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: Rémi Denis-Courmont <remi at remlab.net>
(cherry picked from commit b8a46d564f7d6c822b8dbe945af2bcb679a0e579)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=6f05b7ee3be9e2fbce8db8e3c2634fb70a7c9773
---
include/vlc/libvlc_media_player.h | 19 +++++++++++++++++++
src/control/audio.c | 34 ++++++++++++++++++++++++++++++++++
src/libvlc.sym | 2 ++
3 files changed, 55 insertions(+), 0 deletions(-)
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 33654a9..f593599 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -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 );
+/**
+ * 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 */
/** @} media_player */
diff --git a/src/control/audio.c b/src/control/audio.c
index 2c5ed8a..b7ebf34 100644
--- a/src/control/audio.c
+++ b/src/control/audio.c
@@ -478,3 +478,37 @@ int libvlc_audio_set_channel( libvlc_media_player_t *mp, int channel )
vlc_object_release( p_aout );
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;
+}
diff --git a/src/libvlc.sym b/src/libvlc.sym
index f7d8a3c..360398c 100644
--- a/src/libvlc.sym
+++ b/src/libvlc.sym
@@ -13,12 +13,14 @@ libvlc_audio_output_list_release
libvlc_audio_output_set
libvlc_audio_output_set_device_type
libvlc_audio_get_channel
+libvlc_audio_get_delay
libvlc_audio_get_mute
libvlc_audio_get_track
libvlc_audio_get_track_count
libvlc_audio_get_track_description
libvlc_audio_get_volume
libvlc_audio_set_channel
+libvlc_audio_set_delay
libvlc_audio_set_mute
libvlc_audio_set_track
libvlc_audio_set_volume
More information about the vlc-commits
mailing list