[vlc-commits] audio_output: Android compilation fixes

Edward Wang git at videolan.org
Thu Nov 1 10:45:45 CET 2012


vlc | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Wed Oct 31 20:33:07 2012 -0400| [8a62dea126caedaa899e0a5fde8cc45c7d40876b] | committer: Jean-Baptiste Kempf

audio_output: Android compilation fixes

Adjust the Android audio outputs to the latest aout core changes.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8a62dea126caedaa899e0a5fde8cc45c7d40876b
---

 modules/audio_output/audiotrack.c       |   22 +++++++++++-----------
 modules/audio_output/opensles_android.c |    5 ++++-
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/modules/audio_output/audiotrack.c b/modules/audio_output/audiotrack.c
index f039ae9..127fc32 100644
--- a/modules/audio_output/audiotrack.c
+++ b/modules/audio_output/audiotrack.c
@@ -114,7 +114,7 @@ static void *InitLibrary(struct aout_sys_t *p_sys);
 
 static int  Open(vlc_object_t *);
 static void Close(vlc_object_t *);
-static void Play(audio_output_t *, block_t *);
+static void Play(audio_output_t*, block_t*, mtime_t* restrict);
 static void Pause (audio_output_t *, bool, mtime_t);
 
 vlc_module_begin ()
@@ -176,7 +176,7 @@ static void *InitLibrary(struct aout_sys_t *p_sys)
 
 static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
 {
-    struct aout_sys_t *p_sys = aout->sys:
+    struct aout_sys_t *p_sys = aout->sys;
 
     int status, size;
     int afSampleRate, afFrameCount, afLatency, minBufCount, minFrameCount;
@@ -217,7 +217,7 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
         status ^= p_sys->as_getOutputFrameCount(&afFrameCount, stream_type);
         status ^= p_sys->as_getOutputLatency((uint32_t*)(&afLatency), stream_type);
         if (status != 0) {
-            msg_Err(p_aout, "Could not query the AudioStream parameters");
+            msg_Err(aout, "Could not query the AudioStream parameters");
             return VLC_EGENERIC;
         }
         minBufCount = afLatency / ((1000 * afFrameCount) / afSampleRate);
@@ -228,7 +228,7 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
     else {
         status = p_sys->at_getMinFrameCount(&minFrameCount, stream_type, rate);
         if (status != 0) {
-            msg_Err(p_aout, "Could not query the AudioTrack parameters");
+            msg_Err(aout, "Could not query the AudioTrack parameters");
             return VLC_EGENERIC;
         }
     }
@@ -260,14 +260,14 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
         status = p_sys->at_initCheck(p_sys->AudioTrack);
     }
     if (status != 0) {
-        msg_Err(p_aout, "Cannot create AudioTrack!");
+        msg_Err(aout, "Cannot create AudioTrack!");
         free(p_sys->AudioTrack);
         return VLC_EGENERIC;
     }
 
-    p_aout->sys = p_sys;
-    p_aout->play = Play;
-    p_aout->pause = Pause;
+    aout->sys = p_sys;
+    aout->play = Play;
+    aout->pause = Pause;
 
     p_sys->at_start(p_sys->AudioTrack);
 
@@ -276,9 +276,8 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
     return VLC_SUCCESS;
 }
 
-static void Close(vlc_object_t *p_this)
+static void Stop(audio_output_t* p_aout)
 {
-    audio_output_t *p_aout = (audio_output_t*)p_this;
     aout_sys_t *p_sys = p_aout->sys;
 
     p_sys->at_stop(p_sys->AudioTrack);
@@ -288,8 +287,9 @@ static void Close(vlc_object_t *p_this)
 }
 
 /* FIXME: lipsync */
-static void Play(audio_output_t *p_aout, block_t *p_buffer)
+static void Play(audio_output_t* p_aout, block_t* p_buffer, mtime_t* restrict drift)
 {
+    VLC_UNUSED(drift);
     aout_sys_t *p_sys = p_aout->sys;
 
     size_t length = 0;
diff --git a/modules/audio_output/opensles_android.c b/modules/audio_output/opensles_android.c
index fbde13d..701c55a 100644
--- a/modules/audio_output/opensles_android.c
+++ b/modules/audio_output/opensles_android.c
@@ -76,6 +76,7 @@ struct aout_sys_t
     mtime_t                         length;
 
     void                           *p_so_handle;
+    audio_sample_format_t           format;
 };
 
 /*****************************************************************************
@@ -155,7 +156,7 @@ static void Play( audio_output_t *p_aout, block_t *p_buffer,
     }
 
     if (!p_buffer->i_length) {
-        p_buffer->i_length = (mtime_t)(p_buffer->i_buffer / 2 / p_aout->format.i_channels) * CLOCK_FREQ / p_aout->format.i_rate;
+        p_buffer->i_length = (mtime_t)(p_buffer->i_buffer / 2 / p_sys->format.i_channels) * CLOCK_FREQ / p_sys->format.i_rate;
     }
 
     vlc_mutex_lock( &p_sys->lock );
@@ -374,6 +375,8 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
 
     aout_FormatPrepare( fmt );
 
+    p_sys->format = *fmt;
+
     return VLC_SUCCESS;
 error:
     Clean( p_sys );



More information about the vlc-commits mailing list