[vlc-devel] [PATCH 06/17] Audio Output: Audio frames are now vlc_frame_t

Denis Charmet typx at dinauz.org
Mon Apr 22 19:10:35 CEST 2019


---
 modules/audio_output/adummy.c           |  4 +-
 modules/audio_output/alsa.c             | 18 ++++----
 modules/audio_output/amem.c             |  6 +--
 modules/audio_output/audiotrack.c       |  8 ++--
 modules/audio_output/audiounit_ios.m    |  6 +--
 modules/audio_output/coreaudio_common.c | 54 +++++++++++------------
 modules/audio_output/coreaudio_common.h |  6 +--
 modules/audio_output/directsound.c      | 16 +++----
 modules/audio_output/file.c             |  6 +--
 modules/audio_output/jack.c             | 20 ++++-----
 modules/audio_output/kai.c              |  8 ++--
 modules/audio_output/mmdevice.c         |  4 +-
 modules/audio_output/mmdevice.h         |  6 +--
 modules/audio_output/opensles_android.c | 24 +++++-----
 modules/audio_output/oss.c              | 14 +++---
 modules/audio_output/pulse.c            | 14 +++---
 modules/audio_output/sndio.c            | 58 ++++++++++++-------------
 modules/audio_output/wasapi.c           | 20 ++++-----
 modules/audio_output/waveout.c          | 26 +++++------
 modules/audio_output/winstore.c         |  4 +-
 20 files changed, 161 insertions(+), 161 deletions(-)

diff --git a/modules/audio_output/adummy.c b/modules/audio_output/adummy.c
index 0a804b9eb0..9c43f8fde1 100644
--- a/modules/audio_output/adummy.c
+++ b/modules/audio_output/adummy.c
@@ -41,9 +41,9 @@ vlc_module_end ()
 
 #define A52_FRAME_NB 1536
 
-static void Play(audio_output_t *aout, block_t *block, vlc_tick_t date)
+static void Play(audio_output_t *aout, vlc_frame_t *frame, vlc_tick_t date)
 {
-    block_Release( block );
+    vlc_frame_Release( frame );
     (void) aout; (void) date;
 }
 
diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c
index ccf9435b1d..ba871f1f8b 100644
--- a/modules/audio_output/alsa.c
+++ b/modules/audio_output/alsa.c
@@ -291,7 +291,7 @@ out:
 #endif
 
 static int TimeGet (audio_output_t *aout, vlc_tick_t *);
-static void Play(audio_output_t *, block_t *, vlc_tick_t);
+static void Play(audio_output_t *, vlc_frame_t *, vlc_tick_t);
 static void Pause (audio_output_t *, bool, vlc_tick_t);
 static void PauseDummy (audio_output_t *, bool, vlc_tick_t);
 static void Flush (audio_output_t *);
@@ -645,12 +645,12 @@ static int TimeGet (audio_output_t *aout, vlc_tick_t *restrict delay)
 /**
  * Queues one audio buffer to the hardware.
  */
-static void Play(audio_output_t *aout, block_t *block, vlc_tick_t date)
+static void Play(audio_output_t *aout, vlc_frame_t *frame, vlc_tick_t date)
 {
     aout_sys_t *sys = aout->sys;
 
     if (sys->chans_to_reorder != 0)
-        aout_ChannelReorder(block->p_buffer, block->i_buffer,
+        aout_ChannelReorder(frame->p_buffer, frame->i_buffer,
                            sys->chans_to_reorder, sys->chans_table, sys->format);
 
     snd_pcm_t *pcm = sys->pcm;
@@ -658,17 +658,17 @@ static void Play(audio_output_t *aout, block_t *block, vlc_tick_t date)
     /* TODO: better overflow handling */
     /* TODO: no period wake ups */
 
-    while (block->i_nb_samples > 0)
+    while (frame->i_nb_samples > 0)
     {
         snd_pcm_sframes_t frames;
 
-        frames = snd_pcm_writei (pcm, block->p_buffer, block->i_nb_samples);
+        frames = snd_pcm_writei (pcm, frame->p_buffer, frame->i_nb_samples);
         if (frames >= 0)
         {
             size_t bytes = snd_pcm_frames_to_bytes (pcm, frames);
-            block->i_nb_samples -= frames;
-            block->p_buffer += bytes;
-            block->i_buffer -= bytes;
+            frame->i_nb_samples -= frames;
+            frame->p_buffer += bytes;
+            frame->i_buffer -= bytes;
             // pts, length
         }
         else  
@@ -684,7 +684,7 @@ static void Play(audio_output_t *aout, block_t *block, vlc_tick_t date)
             msg_Warn (aout, "cannot write samples: %s", snd_strerror (frames));
         }
     }
-    block_Release (block);
+    vlc_frame_Release (frame);
     (void) date;
 }
 
diff --git a/modules/audio_output/amem.c b/modules/audio_output/amem.c
index f859a4b10a..a212179890 100644
--- a/modules/audio_output/amem.c
+++ b/modules/audio_output/amem.c
@@ -81,14 +81,14 @@ typedef struct
     vlc_mutex_t lock;
 } aout_sys_t;
 
-static void Play(audio_output_t *aout, block_t *block, vlc_tick_t date)
+static void Play(audio_output_t *aout, vlc_frame_t *frame, vlc_tick_t date)
 {
     aout_sys_t *sys = aout->sys;
 
     vlc_mutex_lock(&sys->lock);
-    sys->play(sys->opaque, block->p_buffer, block->i_nb_samples, date);
+    sys->play(sys->opaque, frame->p_buffer, frame->i_nb_samples, date);
     vlc_mutex_unlock(&sys->lock);
-    block_Release (block);
+    vlc_frame_Release (frame);
 }
 
 static void Pause (audio_output_t *aout, bool paused, vlc_tick_t date)
diff --git a/modules/audio_output/audiotrack.c b/modules/audio_output/audiotrack.c
index 1d39852343..6f706b5235 100644
--- a/modules/audio_output/audiotrack.c
+++ b/modules/audio_output/audiotrack.c
@@ -1884,7 +1884,7 @@ AudioTrack_Thread( void *p_data )
 }
 
 static int
-ConvertFromIEC61937( audio_output_t *p_aout, block_t *p_buffer )
+ConvertFromIEC61937( audio_output_t *p_aout, vlc_frame_t *p_buffer )
 {
     /* This function is only used for Android API 23 when AudioTrack is
      * configured with ENCODING_ AC3/E_AC3/DTS. In that case, only the codec
@@ -1924,7 +1924,7 @@ ConvertFromIEC61937( audio_output_t *p_aout, block_t *p_buffer )
 }
 
 static void
-Play( audio_output_t *p_aout, block_t *p_buffer, vlc_tick_t i_date )
+Play( audio_output_t *p_aout, vlc_frame_t *p_buffer, vlc_tick_t i_date )
 {
     JNIEnv *env = NULL;
     size_t i_buffer_offset = 0;
@@ -1933,7 +1933,7 @@ Play( audio_output_t *p_aout, block_t *p_buffer, vlc_tick_t i_date )
     if( p_sys->b_passthrough && !jfields.AudioFormat.has_ENCODING_IEC61937
      && ConvertFromIEC61937( p_aout, p_buffer ) != 0 )
     {
-        block_Release(p_buffer);
+        vlc_frame_Release(p_buffer);
         return;
     }
 
@@ -2006,7 +2006,7 @@ Play( audio_output_t *p_aout, block_t *p_buffer, vlc_tick_t i_date )
 
 bailout:
     vlc_mutex_unlock( &p_sys->lock );
-    block_Release( p_buffer );
+    vlc_frame_Release( p_buffer );
     (void) i_date;
 }
 
diff --git a/modules/audio_output/audiounit_ios.m b/modules/audio_output/audiounit_ios.m
index ea555c0c14..c5d6fd042a 100644
--- a/modules/audio_output/audiounit_ios.m
+++ b/modules/audio_output/audiounit_ios.m
@@ -429,14 +429,14 @@ MuteSet(audio_output_t *p_aout, bool mute)
 }
 
 static void
-Play(audio_output_t * p_aout, block_t * p_block, vlc_tick_t date)
+Play(audio_output_t * p_aout, vlc_frame_t * p_frame, vlc_tick_t date)
 {
     aout_sys_t * p_sys = p_aout->sys;
 
     if (p_sys->b_muted)
-        block_Release(p_block);
+        vlc_frame_Release(p_frame);
     else
-        ca_Play(p_aout, p_block, date);
+        ca_Play(p_aout, p_frame, date);
 }
 
 #pragma mark initialization
diff --git a/modules/audio_output/coreaudio_common.c b/modules/audio_output/coreaudio_common.c
index 4a714f5411..71369cedf2 100644
--- a/modules/audio_output/coreaudio_common.c
+++ b/modules/audio_output/coreaudio_common.c
@@ -53,7 +53,7 @@ ca_ClearOutBuffers(audio_output_t *p_aout)
 {
     struct aout_sys_common *p_sys = (struct aout_sys_common *) p_aout->sys;
 
-    block_ChainRelease(p_sys->p_out_chain);
+    vlc_frame_ChainRelease(p_sys->p_out_chain);
     p_sys->p_out_chain = NULL;
     p_sys->pp_out_last = &p_sys->p_out_chain;
 
@@ -159,28 +159,28 @@ ca_Render(audio_output_t *p_aout, uint32_t i_frames, uint64_t i_host_time,
         goto drop;
 
     size_t i_copied = 0;
-    block_t *p_block = p_sys->p_out_chain;
-    while (p_block != NULL && i_requested != 0)
+    vlc_frame_t *p_frame = p_sys->p_out_chain;
+    while (p_frame != NULL && i_requested != 0)
     {
-        size_t i_tocopy = __MIN(i_requested, p_block->i_buffer);
-        memcpy(&p_output[i_copied], p_block->p_buffer, i_tocopy);
+        size_t i_tocopy = __MIN(i_requested, p_frame->i_buffer);
+        memcpy(&p_output[i_copied], p_frame->p_buffer, i_tocopy);
         i_requested -= i_tocopy;
         i_copied += i_tocopy;
-        if (i_tocopy == p_block->i_buffer)
+        if (i_tocopy == p_frame->i_buffer)
         {
-            block_t *p_release = p_block;
-            p_block = p_block->p_next;
-            block_Release(p_release);
+            vlc_frame_t *p_release = p_frame;
+            p_frame = p_frame->p_next;
+            vlc_frame_Release(p_release);
         }
         else
         {
             assert(i_requested == 0);
 
-            p_block->p_buffer += i_tocopy;
-            p_block->i_buffer -= i_tocopy;
+            p_frame->p_buffer += i_tocopy;
+            p_frame->i_buffer -= i_tocopy;
         }
     }
-    p_sys->p_out_chain = p_block;
+    p_sys->p_out_chain = p_frame;
     if (!p_sys->p_out_chain)
         p_sys->pp_out_last = &p_sys->p_out_chain;
     p_sys->i_out_size -= i_copied;
@@ -264,13 +264,13 @@ ca_Pause(audio_output_t * p_aout, bool pause, vlc_tick_t date)
 }
 
 void
-ca_Play(audio_output_t * p_aout, block_t * p_block, vlc_tick_t date)
+ca_Play(audio_output_t * p_aout, vlc_frame_t * p_frame, vlc_tick_t date)
 {
     struct aout_sys_common *p_sys = (struct aout_sys_common *) p_aout->sys;
 
     /* Do the channel reordering */
     if (p_sys->chans_to_reorder)
-       aout_ChannelReorder(p_block->p_buffer, p_block->i_buffer,
+       aout_ChannelReorder(p_frame->p_buffer, p_frame->i_buffer,
                            p_sys->chans_to_reorder, p_sys->chan_table,
                            VLC_CODEC_FL32);
 
@@ -278,40 +278,40 @@ ca_Play(audio_output_t * p_aout, block_t * p_block, vlc_tick_t date)
     do
     {
         const size_t i_avalaible_bytes =
-            __MIN(p_block->i_buffer, p_sys->i_out_max_size - p_sys->i_out_size);
+            __MIN(p_frame->i_buffer, p_sys->i_out_max_size - p_sys->i_out_size);
 
-        if (unlikely(i_avalaible_bytes != p_block->i_buffer))
+        if (unlikely(i_avalaible_bytes != p_frame->i_buffer))
         {
             /* Not optimal but unlikely code path. */
 
             lock_unlock(p_sys);
 
-            block_t *p_new = block_Alloc(i_avalaible_bytes);
+            vlc_frame_t *p_new = vlc_frame_Alloc(i_avalaible_bytes);
             if (!p_new)
             {
-                block_Release(p_block);
+                vlc_frame_Release(p_frame);
                 return;
             }
 
-            memcpy(p_new->p_buffer, p_block->p_buffer, i_avalaible_bytes);
+            memcpy(p_new->p_buffer, p_frame->p_buffer, i_avalaible_bytes);
 
-            p_block->p_buffer += i_avalaible_bytes;
-            p_block->i_buffer -= i_avalaible_bytes;
+            p_frame->p_buffer += i_avalaible_bytes;
+            p_frame->i_buffer -= i_avalaible_bytes;
 
             lock_lock(p_sys);
 
-            block_ChainLastAppend(&p_sys->pp_out_last, p_new);
+            vlc_frame_ChainLastAppend(&p_sys->pp_out_last, p_new);
             p_sys->i_out_size += i_avalaible_bytes;
 
             if (p_sys->b_paused)
             {
                 lock_unlock(p_sys);
-                block_Release(p_block);
+                vlc_frame_Release(p_frame);
                 return;
             }
 
             const vlc_tick_t i_frame_us =
-                FramesToUs(p_sys, BytesToFrames(p_sys, p_block->i_buffer));
+                FramesToUs(p_sys, BytesToFrames(p_sys, p_frame->i_buffer));
 
             /* Wait for the render buffer to play the remaining data */
             lock_unlock(p_sys);
@@ -320,11 +320,11 @@ ca_Play(audio_output_t * p_aout, block_t * p_block, vlc_tick_t date)
         }
         else
         {
-            block_ChainLastAppend(&p_sys->pp_out_last, p_block);
+            vlc_frame_ChainLastAppend(&p_sys->pp_out_last, p_frame);
             p_sys->i_out_size += i_avalaible_bytes;
-            p_block = NULL;
+            p_frame = NULL;
         }
-    } while (p_block != NULL);
+    } while (p_frame != NULL);
 
     size_t i_underrun_size = p_sys->i_underrun_size;
     p_sys->i_underrun_size = 0;
diff --git a/modules/audio_output/coreaudio_common.h b/modules/audio_output/coreaudio_common.h
index a860a9aa51..936d3bebdd 100644
--- a/modules/audio_output/coreaudio_common.h
+++ b/modules/audio_output/coreaudio_common.h
@@ -55,8 +55,8 @@ struct aout_sys_common
 
     size_t              i_out_max_size;
     size_t              i_out_size;
-    block_t             *p_out_chain;
-    block_t             **pp_out_last;
+    vlc_frame_t             *p_out_chain;
+    vlc_frame_t             **pp_out_last;
     uint64_t            i_render_host_time;
     uint32_t            i_render_frames;
 
@@ -93,7 +93,7 @@ void ca_Flush(audio_output_t *p_aout);
 
 void ca_Pause(audio_output_t * p_aout, bool pause, vlc_tick_t date);
 
-void ca_Play(audio_output_t * p_aout, block_t * p_block, vlc_tick_t date);
+void ca_Play(audio_output_t * p_aout, vlc_frame_t * p_frame, vlc_tick_t date);
 
 int  ca_Initialize(audio_output_t *p_aout, const audio_sample_format_t *fmt,
                    vlc_tick_t i_dev_latency_us);
diff --git a/modules/audio_output/directsound.c b/modules/audio_output/directsound.c
index f93237a93a..a8766ace91 100644
--- a/modules/audio_output/directsound.c
+++ b/modules/audio_output/directsound.c
@@ -192,7 +192,7 @@ static int OutputTimeGet( audio_output_t *aout, vlc_tick_t *delay )
  * @return VLC_SUCCESS on success.
  */
 static HRESULT FillBuffer( vlc_object_t *obj, aout_stream_sys_t *p_sys,
-                           block_t *p_buffer )
+                           vlc_frame_t *p_buffer )
 {
     size_t towrite = (p_buffer != NULL) ? p_buffer->i_buffer : DS_BUF_SIZE;
     void *p_write_position, *p_wrap_around;
@@ -228,7 +228,7 @@ static HRESULT FillBuffer( vlc_object_t *obj, aout_stream_sys_t *p_sys,
     {
         msg_Warn( obj, "cannot lock buffer" );
         if( p_buffer != NULL )
-            block_Release( p_buffer );
+            vlc_frame_Release( p_buffer );
         vlc_mutex_unlock( &p_sys->lock );
         return dsresult;
     }
@@ -252,7 +252,7 @@ static HRESULT FillBuffer( vlc_object_t *obj, aout_stream_sys_t *p_sys,
         if( unlikely( ( l_bytes1 + l_bytes2 ) < p_buffer->i_buffer ) )
             msg_Err( obj, "Buffer overrun");
 
-        block_Release( p_buffer );
+        vlc_frame_Release( p_buffer );
     }
 
     /* Now the data has been copied, unlock the buffer */
@@ -268,7 +268,7 @@ static HRESULT FillBuffer( vlc_object_t *obj, aout_stream_sys_t *p_sys,
 }
 
 static HRESULT Play( vlc_object_t *obj, aout_stream_sys_t *sys,
-                     block_t *p_buffer )
+                     vlc_frame_t *p_buffer )
 {
     HRESULT dsresult;
     dsresult = FillBuffer( obj, sys, p_buffer );
@@ -297,15 +297,15 @@ static HRESULT Play( vlc_object_t *obj, aout_stream_sys_t *sys,
     return dsresult;
 }
 
-static HRESULT StreamPlay( aout_stream_t *s, block_t *block )
+static HRESULT StreamPlay( aout_stream_t *s, vlc_frame_t *frame )
 {
-    return Play( VLC_OBJECT(s), s->sys, block );
+    return Play( VLC_OBJECT(s), s->sys, frame );
 }
 
-static void OutputPlay( audio_output_t *aout, block_t *block, vlc_tick_t date )
+static void OutputPlay( audio_output_t *aout, vlc_frame_t *frame, vlc_tick_t date )
 {
     aout_sys_t *sys = aout->sys;
-    Play( VLC_OBJECT(aout), &sys->s, block );
+    Play( VLC_OBJECT(aout), &sys->s, frame );
     (void) date;
 }
 
diff --git a/modules/audio_output/file.c b/modules/audio_output/file.c
index 906b228548..4fa3e58742 100644
--- a/modules/audio_output/file.c
+++ b/modules/audio_output/file.c
@@ -73,7 +73,7 @@ static const int pi_channels_maps[CHANNELS_MAX+1] =
  * Local prototypes.
  *****************************************************************************/
 static int     Open        ( vlc_object_t * );
-static void    Play        ( audio_output_t *, block_t *, vlc_tick_t );
+static void    Play        ( audio_output_t *, vlc_frame_t *, vlc_tick_t );
 static void    Pause       ( audio_output_t *, bool, vlc_tick_t );
 static void    Flush       ( audio_output_t * );
 
@@ -315,7 +315,7 @@ static void Stop( audio_output_t *p_aout )
 /*****************************************************************************
  * Play: pretend to play a sound
  *****************************************************************************/
-static void Play( audio_output_t * p_aout, block_t *p_buffer, vlc_tick_t date )
+static void Play( audio_output_t * p_aout, vlc_frame_t *p_buffer, vlc_tick_t date )
 {
     aout_sys_t *p_sys = p_aout->sys;
     if( fwrite( p_buffer->p_buffer, p_buffer->i_buffer, 1,
@@ -330,7 +330,7 @@ static void Play( audio_output_t * p_aout, block_t *p_buffer, vlc_tick_t date )
         p_sys->waveh.DataLength += p_buffer->i_buffer;
     }
 
-    block_Release( p_buffer );
+    vlc_frame_Release( p_buffer );
     (void) date;
 }
 
diff --git a/modules/audio_output/jack.c b/modules/audio_output/jack.c
index d21150f2a4..b07481ca3d 100644
--- a/modules/audio_output/jack.c
+++ b/modules/audio_output/jack.c
@@ -69,7 +69,7 @@ typedef struct
  *****************************************************************************/
 static int  Open         ( vlc_object_t * );
 static void Close        ( vlc_object_t * );
-static void Play         ( audio_output_t * p_aout, block_t *, vlc_tick_t );
+static void Play         ( audio_output_t * p_aout, vlc_frame_t *, vlc_tick_t );
 static void Pause        ( audio_output_t *aout, bool paused, vlc_tick_t date );
 static void Flush        ( audio_output_t *p_aout );
 static int  TimeGet      ( audio_output_t *, vlc_tick_t * );
@@ -282,33 +282,33 @@ error_out:
     return status;
 }
 
-static void Play(audio_output_t * p_aout, block_t * p_block, vlc_tick_t date)
+static void Play(audio_output_t * p_aout, vlc_frame_t * p_frame, vlc_tick_t date)
 {
     aout_sys_t *p_sys = p_aout->sys;
     jack_ringbuffer_t *rb = p_sys->p_jack_ringbuffer;
     const size_t bytes_per_frame = p_sys->i_channels * sizeof(jack_sample_t);
 
-    while (p_block->i_buffer > 0) {
+    while (p_frame->i_buffer > 0) {
 
         /* move data to buffer */
         const size_t write_space = jack_ringbuffer_write_space(rb);
-        const size_t bytes = p_block->i_buffer < write_space ?
-            p_block->i_buffer : write_space;
+        const size_t bytes = p_frame->i_buffer < write_space ?
+            p_frame->i_buffer : write_space;
 
         /* If our audio thread is not reading fast enough */
         if( unlikely( bytes == 0 ) ) {
             msg_Warn( p_aout, "%"PRIuPTR " frames of audio dropped",
-                    p_block->i_buffer /  bytes_per_frame );
+                    p_frame->i_buffer /  bytes_per_frame );
             break;
         }
 
-        jack_ringbuffer_write( rb, (const char *) p_block->p_buffer, bytes );
+        jack_ringbuffer_write( rb, (const char *) p_frame->p_buffer, bytes );
 
-        p_block->p_buffer += bytes;
-        p_block->i_buffer -= bytes;
+        p_frame->p_buffer += bytes;
+        p_frame->i_buffer -= bytes;
     }
 
-    block_Release(p_block);
+    vlc_frame_Release(p_frame);
     (void) date;
 }
 
diff --git a/modules/audio_output/kai.c b/modules/audio_output/kai.c
index dd75e367d8..9335bf9054 100644
--- a/modules/audio_output/kai.c
+++ b/modules/audio_output/kai.c
@@ -72,7 +72,7 @@ typedef struct
  *****************************************************************************/
 static int  Open    ( vlc_object_t * );
 static void Close   ( vlc_object_t * );
-static void Play    ( audio_output_t *_p_aout, block_t *block, vlc_tick_t );
+static void Play    ( audio_output_t *_p_aout, vlc_frame_t *frame, vlc_tick_t );
 static void Pause   ( audio_output_t *, bool, vlc_tick_t );
 static void Flush   ( audio_output_t * );
 static int  TimeGet ( audio_output_t *, vlc_tick_t *restrict );
@@ -233,15 +233,15 @@ exit_kai_done :
 /*****************************************************************************
  * Play: play a sound samples buffer
  *****************************************************************************/
-static void Play(audio_output_t *p_aout, block_t *block, vlc_tick_t date)
+static void Play(audio_output_t *p_aout, vlc_frame_t *frame, vlc_tick_t date)
 {
     aout_sys_t *p_sys = p_aout->sys;
 
     kaiPlay( p_sys->hkai );
 
-    WriteBuffer( p_aout, block->p_buffer, block->i_buffer );
+    WriteBuffer( p_aout, frame->p_buffer, frame->i_buffer );
 
-    block_Release( block );
+    vlc_frame_Release( frame );
     (void) date;
 }
 
diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c
index 3d9f7a718c..fc053cd0a8 100644
--- a/modules/audio_output/mmdevice.c
+++ b/modules/audio_output/mmdevice.c
@@ -136,13 +136,13 @@ static int TimeGet(audio_output_t *aout, vlc_tick_t *restrict delay)
     return SUCCEEDED(hr) ? 0 : -1;
 }
 
-static void Play(audio_output_t *aout, block_t *block, vlc_tick_t date)
+static void Play(audio_output_t *aout, vlc_frame_t *frame, vlc_tick_t date)
 {
     aout_sys_t *sys = aout->sys;
     HRESULT hr;
 
     EnterMTA();
-    hr = aout_stream_Play(sys->stream, block);
+    hr = aout_stream_Play(sys->stream, frame);
     LeaveMTA();
 
     vlc_FromHR(aout, hr);
diff --git a/modules/audio_output/mmdevice.h b/modules/audio_output/mmdevice.h
index c027367ec8..36fbea4046 100644
--- a/modules/audio_output/mmdevice.h
+++ b/modules/audio_output/mmdevice.h
@@ -37,7 +37,7 @@ struct aout_stream
     void *sys;
 
     HRESULT (*time_get)(aout_stream_t *, vlc_tick_t *);
-    HRESULT (*play)(aout_stream_t *, block_t *);
+    HRESULT (*play)(aout_stream_t *, vlc_frame_t *);
     HRESULT (*pause)(aout_stream_t *, bool);
     HRESULT (*flush)(aout_stream_t *);
 
@@ -67,9 +67,9 @@ static inline HRESULT aout_stream_TimeGet(aout_stream_t *s, vlc_tick_t *delay)
     return (s->time_get)(s, delay);
 }
 
-static inline HRESULT aout_stream_Play(aout_stream_t *s, block_t *block)
+static inline HRESULT aout_stream_Play(aout_stream_t *s, vlc_frame_t *frame)
 {
-    return (s->play)(s, block);
+    return (s->play)(s, frame);
 }
 
 static inline HRESULT aout_stream_Pause(aout_stream_t *s, bool paused)
diff --git a/modules/audio_output/opensles_android.c b/modules/audio_output/opensles_android.c
index b1c2a0d985..44abb3a9ae 100644
--- a/modules/audio_output/opensles_android.c
+++ b/modules/audio_output/opensles_android.c
@@ -115,8 +115,8 @@ typedef struct
     bool                            started;
 
     /* audio not yet buffered through opensles */
-    block_t                        *p_buffer_chain;
-    block_t                       **pp_buffer_last;
+    vlc_frame_t                        *p_buffer_chain;
+    vlc_frame_t                       **pp_buffer_last;
     size_t                          samples;
 } aout_sys_t;
 
@@ -187,7 +187,7 @@ static void Flush(audio_output_t *aout)
     SetPlayState(sys->playerPlay, SL_PLAYSTATE_PLAYING);
 
     /* release audio data not yet written to opensles */
-    block_ChainRelease(sys->p_buffer_chain);
+    vlc_frame_ChainRelease(sys->p_buffer_chain);
     sys->p_buffer_chain = NULL;
     sys->pp_buffer_last = &sys->p_buffer_chain;
 
@@ -240,16 +240,16 @@ static int WriteBuffer(audio_output_t *aout)
     aout_sys_t *sys = aout->sys;
     const size_t unit_size = sys->samples_per_buf * bytesPerSample();
 
-    block_t *b = sys->p_buffer_chain;
+    vlc_frame_t *b = sys->p_buffer_chain;
     if (!b)
         return false;
 
-    /* Check if we can fill at least one buffer unit by chaining blocks */
+    /* Check if we can fill at least one buffer unit by chaining frames */
     if (b->i_buffer < unit_size) {
         if (!b->p_next)
             return false;
         ssize_t needed = unit_size - b->i_buffer;
-        for (block_t *next = b->p_next; next; next = next->p_next) {
+        for (vlc_frame_t *next = b->p_next; next; next = next->p_next) {
             needed -= next->i_buffer;
             if (needed <= 0)
                 break;
@@ -280,9 +280,9 @@ static int WriteBuffer(audio_output_t *aout)
         b->p_buffer += cur;
         done += cur;
 
-        block_t *next = b->p_next;
+        vlc_frame_t *next = b->p_next;
         if (b->i_buffer == 0) {
-            block_Release(b);
+            vlc_frame_Release(b);
             b = NULL;
         }
 
@@ -317,7 +317,7 @@ static int WriteBuffer(audio_output_t *aout)
 /*****************************************************************************
  * Play: play a sound
  *****************************************************************************/
-static void Play(audio_output_t *aout, block_t *p_buffer, vlc_tick_t date)
+static void Play(audio_output_t *aout, vlc_frame_t *p_buffer, vlc_tick_t date)
 {
     aout_sys_t *sys = aout->sys;
 
@@ -326,8 +326,8 @@ static void Play(audio_output_t *aout, block_t *p_buffer, vlc_tick_t date)
 
     sys->samples += p_buffer->i_buffer / bytesPerSample();
 
-    /* Hold this block until we can write it into the OpenSL buffer */
-    block_ChainLastAppend(&sys->pp_buffer_last, p_buffer);
+    /* Hold this frame until we can write it into the OpenSL buffer */
+    vlc_frame_ChainLastAppend(&sys->pp_buffer_last, p_buffer);
 
     /* Fill OpenSL buffer */
     while (WriteBuffer(aout))
@@ -501,7 +501,7 @@ static void Stop(audio_output_t *aout)
     Clear(sys->playerBufferQueue);
 
     free(sys->buf);
-    block_ChainRelease(sys->p_buffer_chain);
+    vlc_frame_ChainRelease(sys->p_buffer_chain);
 
     Destroy(sys->playerObject);
     sys->playerObject = NULL;
diff --git a/modules/audio_output/oss.c b/modules/audio_output/oss.c
index 5bada6857d..9ac706acf1 100644
--- a/modules/audio_output/oss.c
+++ b/modules/audio_output/oss.c
@@ -88,7 +88,7 @@ vlc_module_begin ()
 vlc_module_end ()
 
 static int TimeGet (audio_output_t *, vlc_tick_t *);
-static void Play(audio_output_t *, block_t *, vlc_tick_t);
+static void Play(audio_output_t *, vlc_frame_t *, vlc_tick_t);
 static void Pause (audio_output_t *, bool, vlc_tick_t);
 static void Flush (audio_output_t *);
 
@@ -269,23 +269,23 @@ static int TimeGet (audio_output_t *aout, vlc_tick_t *restrict pts)
 /**
  * Queues one audio buffer to the hardware.
  */
-static void Play(audio_output_t *aout, block_t *block, vlc_tick_t date)
+static void Play(audio_output_t *aout, vlc_frame_t *frame, vlc_tick_t date)
 {
     aout_sys_t *sys = aout->sys;
     int fd = sys->fd;
 
-    while (block->i_buffer > 0)
+    while (frame->i_buffer > 0)
     {
-        ssize_t bytes = write (fd, block->p_buffer, block->i_buffer);
+        ssize_t bytes = write (fd, frame->p_buffer, frame->i_buffer);
         if (bytes >= 0)
         {
-            block->p_buffer += bytes;
-            block->i_buffer -= bytes;
+            frame->p_buffer += bytes;
+            frame->i_buffer -= bytes;
         }
         else
             msg_Err (aout, "cannot write samples: %s", vlc_strerror_c(errno));
     }
-    block_Release (block);
+    vlc_frame_Release (frame);
     (void) date;
 }
 
diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index 1091affcac..2944d6fb78 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -461,7 +461,7 @@ static int TimeGet(audio_output_t *aout, vlc_tick_t *restrict delay)
 /**
  * Queue one audio frame to the playback stream
  */
-static void Play(audio_output_t *aout, block_t *block, vlc_tick_t date)
+static void Play(audio_output_t *aout, vlc_frame_t *frame, vlc_tick_t date)
 {
     aout_sys_t *sys = aout->sys;
     pa_stream *s = sys->stream;
@@ -486,23 +486,23 @@ static void Play(audio_output_t *aout, block_t *block, vlc_tick_t date)
         pa_operation_unref(pa_stream_flush(s, NULL, NULL));
     }
 #endif
-    while (block->i_buffer > 0)
+    while (frame->i_buffer > 0)
     {
         void *ptr;
-        size_t len = block->i_buffer;
+        size_t len = frame->i_buffer;
 
         if (pa_stream_begin_write(s, &ptr, &len))
             vlc_pa_error(aout, "cannot begin write", sys->context);
 
-        memcpy(ptr, block->p_buffer, len);
-        block->p_buffer += len;
-        block->i_buffer -= len;
+        memcpy(ptr, frame->p_buffer, len);
+        frame->p_buffer += len;
+        frame->i_buffer -= len;
 
         if (pa_stream_write(s, ptr, len, NULL, 0, PA_SEEK_RELATIVE) < 0)
             vlc_pa_error(aout, "cannot write", sys->context);
     }
 
-    block_Release(block);
+    vlc_frame_Release(frame);
 
     pa_threaded_mainloop_unlock(sys->mainloop);
 }
diff --git a/modules/audio_output/sndio.c b/modules/audio_output/sndio.c
index 642113a487..e9091c48ee 100644
--- a/modules/audio_output/sndio.c
+++ b/modules/audio_output/sndio.c
@@ -1,22 +1,22 @@
 /*****************************************************************************
- * sndio.c : sndio plugin for VLC
- *****************************************************************************
- * Copyright (C) 2012 Rémi Denis-Courmont
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
+* sndio.c : sndio plugin for VLC
+*****************************************************************************
+* Copyright (C) 2012 Rémi Denis-Courmont
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation; either version 2.1 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+*****************************************************************************/
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -35,16 +35,16 @@ static int Open (vlc_object_t *);
 static void Close (vlc_object_t *);
 
 vlc_module_begin ()
-    set_shortname ("sndio")
-    set_description (N_("OpenBSD sndio audio output"))
-    set_category (CAT_AUDIO)
-    set_subcategory (SUBCAT_AUDIO_AOUT)
-    set_capability ("audio output", 120)
-    set_callbacks (Open, Close)
+set_shortname ("sndio")
+set_description (N_("OpenBSD sndio audio output"))
+set_category (CAT_AUDIO)
+set_subcategory (SUBCAT_AUDIO_AOUT)
+set_capability ("audio output", 120)
+set_callbacks (Open, Close)
 vlc_module_end ()
 
 static int TimeGet (audio_output_t *, vlc_tick_t *);
-static void Play(audio_output_t *, block_t *, vlc_tick_t);
+static void Play(audio_output_t *, vlc_frame_t *, vlc_tick_t);
 static void Flush (audio_output_t *);
 static int VolumeSet (audio_output_t *, float);
 static int MuteSet (audio_output_t *, bool);
@@ -230,13 +230,13 @@ static int TimeGet (audio_output_t *aout, vlc_tick_t *restrict delay)
     return 0;
 }
 
-static void Play(audio_output_t *aout, block_t *block, vlc_tick_t date)
+static void Play(audio_output_t *aout, vlc_frame_t *frame, vlc_tick_t date)
 {
     aout_sys_t *sys = aout->sys;
 
-    sio_write (sys->hdl, block->p_buffer, block->i_buffer);
-    sys->delay += block->i_nb_samples;
-    block_Release (block);
+    sio_write (sys->hdl, frame->p_buffer, frame->i_buffer);
+    sys->delay += frame->i_nb_samples;
+    vlc_frame_Release (frame);
     (void) date;
 }
 
diff --git a/modules/audio_output/wasapi.c b/modules/audio_output/wasapi.c
index 03ba2a46ea..7432fc266e 100644
--- a/modules/audio_output/wasapi.c
+++ b/modules/audio_output/wasapi.c
@@ -140,14 +140,14 @@ static HRESULT TimeGet(aout_stream_t *s, vlc_tick_t *restrict delay)
     return hr;
 }
 
-static HRESULT Play(aout_stream_t *s, block_t *block)
+static HRESULT Play(aout_stream_t *s, vlc_frame_t *frame)
 {
     aout_stream_sys_t *sys = s->sys;
     void *pv;
     HRESULT hr;
 
     if (sys->chans_to_reorder)
-        aout_ChannelReorder(block->p_buffer, block->i_buffer,
+        aout_ChannelReorder(frame->p_buffer, frame->i_buffer,
                           sys->chans_to_reorder, sys->chans_table, sys->format);
 
     hr = IAudioClient_GetService(sys->client, &IID_IAudioRenderClient, &pv);
@@ -170,8 +170,8 @@ static HRESULT Play(aout_stream_t *s, block_t *block)
 
         assert(frames <= sys->frames);
         frames = sys->frames - frames;
-        if (frames > block->i_nb_samples)
-            frames = block->i_nb_samples;
+        if (frames > frame->i_nb_samples)
+            frames = frame->i_nb_samples;
 
         BYTE *dst;
         hr = IAudioRenderClient_GetBuffer(render, frames, &dst);
@@ -183,7 +183,7 @@ static HRESULT Play(aout_stream_t *s, block_t *block)
 
         const size_t copy = frames * sys->block_align;
 
-        memcpy(dst, block->p_buffer, copy);
+        memcpy(dst, frame->p_buffer, copy);
         hr = IAudioRenderClient_ReleaseBuffer(render, frames, 0);
         if (FAILED(hr))
         {
@@ -192,11 +192,11 @@ static HRESULT Play(aout_stream_t *s, block_t *block)
         }
         IAudioClient_Start(sys->client);
 
-        block->p_buffer += copy;
-        block->i_buffer -= copy;
-        block->i_nb_samples -= frames;
+        frame->p_buffer += copy;
+        frame->i_buffer -= copy;
+        frame->i_nb_samples -= frames;
         sys->written += frames;
-        if (block->i_nb_samples == 0)
+        if (frame->i_nb_samples == 0)
             break; /* done */
 
         /* Out of buffer space, sleep */
@@ -204,7 +204,7 @@ static HRESULT Play(aout_stream_t *s, block_t *block)
     }
     IAudioRenderClient_Release(render);
 out:
-    block_Release(block);
+    vlc_frame_Release(frame);
 
     return hr;
 }
diff --git a/modules/audio_output/waveout.c b/modules/audio_output/waveout.c
index 736a5f016c..9be2f88a12 100644
--- a/modules/audio_output/waveout.c
+++ b/modules/audio_output/waveout.c
@@ -48,7 +48,7 @@
  *****************************************************************************/
 static int  Open         ( vlc_object_t * );
 static void Close        ( vlc_object_t * );
-static void Play         ( audio_output_t *, block_t *, vlc_tick_t );
+static void Play         ( audio_output_t *, vlc_frame_t *, vlc_tick_t );
 
 /*****************************************************************************
  * notification_thread_t: waveOut event thread
@@ -68,7 +68,7 @@ static int OpenWaveOut   ( audio_output_t *, uint32_t,
 static int OpenWaveOutPCM( audio_output_t *, uint32_t,
                            vlc_fourcc_t*, int, int, int, bool );
 static int PlayWaveOut   ( audio_output_t *, HWAVEOUT, struct lkwavehdr *,
-                           block_t *, bool );
+                           vlc_frame_t *, bool );
 
 static void CALLBACK WaveOutCallback ( HWAVEOUT, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR );
 
@@ -344,7 +344,7 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
  * This doesn't actually play the buffer. This just stores the buffer so it
  * can be played by the callback thread.
  *****************************************************************************/
-static void Play( audio_output_t *p_aout, block_t *block, vlc_tick_t date )
+static void Play( audio_output_t *p_aout, vlc_frame_t *frame, vlc_tick_t date )
 {
     aout_sys_t *sys = p_aout->sys;
 
@@ -353,25 +353,25 @@ static void Play( audio_output_t *p_aout, block_t *block, vlc_tick_t date )
     if(!p_waveheader)
     {
         msg_Err(p_aout, "Couldn't alloc WAVEHDR");
-        if( block )
-            block_Release( block );
+        if( frame )
+            vlc_frame_Release( frame );
         return;
     }
 
     p_waveheader->p_next = NULL;
 
-    if( block && sys->chans_to_reorder )
+    if( frame && sys->chans_to_reorder )
     {
-        aout_ChannelReorder( block->p_buffer, block->i_buffer,
+        aout_ChannelReorder( frame->p_buffer, frame->i_buffer,
                              sys->waveformat.Format.nChannels,
                              sys->chan_table, sys->format );
     }
-    while( PlayWaveOut( p_aout, sys->h_waveout, p_waveheader, block,
+    while( PlayWaveOut( p_aout, sys->h_waveout, p_waveheader, frame,
                         sys->b_spdif ) != VLC_SUCCESS )
 
     {
         msg_Warn( p_aout, "Couln't write frame... sleeping");
-        vlc_tick_sleep( block->i_length );
+        vlc_tick_sleep( frame->i_length );
     }
 
     WaveOutClean( sys );
@@ -379,7 +379,7 @@ static void Play( audio_output_t *p_aout, block_t *block, vlc_tick_t date )
 
     vlc_mutex_lock( &sys->lock );
     sys->i_frames++;
-    sys->i_played_length += block->i_length;
+    sys->i_played_length += frame->i_length;
     vlc_mutex_unlock( &sys->lock );
     (void) date;
 }
@@ -573,7 +573,7 @@ static int OpenWaveOutPCM( audio_output_t *p_aout, uint32_t i_device_id,
  * PlayWaveOut: play a buffer through the WaveOut device
  *****************************************************************************/
 static int PlayWaveOut( audio_output_t *p_aout, HWAVEOUT h_waveout,
-                        struct lkwavehdr *p_waveheader, block_t *p_buffer, bool b_spdif)
+                        struct lkwavehdr *p_waveheader, vlc_frame_t *p_buffer, bool b_spdif)
 {
     MMRESULT result;
     aout_sys_t *sys = p_aout->sys;
@@ -674,12 +674,12 @@ static void WaveOutClean( aout_sys_t * p_sys )
 
 static void WaveOutClearBuffer( HWAVEOUT h_waveout, WAVEHDR *p_waveheader )
 {
-    block_t *p_buffer = (block_t *)(p_waveheader->dwUser);
+    vlc_frame_t *p_buffer = (vlc_frame_t *)(p_waveheader->dwUser);
     /* Unprepare and free the buffers which has just been played */
     waveOutUnprepareHeader( h_waveout, p_waveheader, sizeof(WAVEHDR) );
 
     if( p_waveheader->dwUser != 1 )
-        block_Release( p_buffer );
+        vlc_frame_Release( p_buffer );
 }
 
 /*
diff --git a/modules/audio_output/winstore.c b/modules/audio_output/winstore.c
index 8ad1fa431f..e6bbf4b9b9 100644
--- a/modules/audio_output/winstore.c
+++ b/modules/audio_output/winstore.c
@@ -150,14 +150,14 @@ static int TimeGet(audio_output_t *aout, vlc_tick_t *restrict delay)
     return SUCCEEDED(hr) ? 0 : -1;
 }
 
-static void Play(audio_output_t *aout, block_t *block, vlc_tick_t date)
+static void Play(audio_output_t *aout, vlc_frame_t *frame, vlc_tick_t date)
 {
     aout_sys_t *sys = aout->sys;
     if( unlikely( sys->client == NULL ) )
         return;
 
     EnterMTA();
-    HRESULT hr = aout_stream_Play(sys->stream, block);
+    HRESULT hr = aout_stream_Play(sys->stream, frame);
     LeaveMTA();
 
     vlc_FromHR(aout, hr);
-- 
2.20.1





More information about the vlc-devel mailing list