[MPlayer-cvslog] r38661 - in trunk/libao2: ao_dart.c ao_kai.c

komh subversion at mplayerhq.hu
Tue Oct 1 10:59:39 EEST 2024


Author: komh
Date: Tue Oct  1 10:59:39 2024
New Revision: 38661

Log:
ao_dart, ao_kai: fix compilation due to switch from AVFifoBuffer to AVFifo

Based on the changes to ao_sdl,

  http://lists.mplayerhq.hu/pipermail/mplayer-cvslog/2024-April/047665.html

Patch by Dave Yeo, dave.r.yeo gmail com

Modified:
   trunk/libao2/ao_dart.c
   trunk/libao2/ao_kai.c

Modified: trunk/libao2/ao_dart.c
==============================================================================
--- trunk/libao2/ao_dart.c	Sat Sep 21 12:30:18 2024	(r38660)
+++ trunk/libao2/ao_dart.c	Tue Oct  1 10:59:39 2024	(r38661)
@@ -54,7 +54,7 @@ LIBAO_EXTERN(dart)
 
 #define CHUNK_SIZE  ao_data.outburst
 
-static AVFifoBuffer *m_audioBuf;
+static AVFifo *m_audioBuf;
 
 static int m_nBufSize = 0;
 
@@ -62,22 +62,23 @@ static volatile int m_fQuit = FALSE;
 
 static int write_buffer(unsigned char *data, int len)
 {
-    int nFree = av_fifo_space(m_audioBuf);
+    int nFree = av_fifo_can_write(m_audioBuf);
 
     if (len > nFree)
         len = nFree;
 
-    return av_fifo_generic_write(m_audioBuf, data, len, NULL);
+    av_fifo_write(m_audioBuf, data, len);
+    return len;
 }
 
 static int read_buffer(unsigned char *data, int len)
 {
-    int nBuffered = av_fifo_size(m_audioBuf);
+    int nBuffered = av_fifo_can_read(m_audioBuf);
 
     if (len > nBuffered)
         len = nBuffered;
 
-    av_fifo_generic_read(m_audioBuf, data, len, NULL);
+    av_fifo_read(m_audioBuf, data, len);
     return len;
 }
 
@@ -199,7 +200,7 @@ static int init(int rate, int channels,
     // and one more chunk plus round up
     m_nBufSize += 2 * CHUNK_SIZE;
 
-    m_audioBuf = av_fifo_alloc(m_nBufSize);
+    m_audioBuf = av_fifo_alloc2(m_nBufSize, 1, 0);
 
     dartPlay();
 
@@ -223,7 +224,7 @@ static void uninit(int immed)
 
     dartClose();
 
-    av_fifo_free(m_audioBuf);
+    av_fifo_freep2(&m_audioBuf);
 }
 
 // stop playing and empty buffers (for seeking/pause)
@@ -232,7 +233,7 @@ static void reset(void)
     dartPause();
 
     // Reset ring-buffer state
-    av_fifo_reset(m_audioBuf);
+    av_fifo_reset2(m_audioBuf);
 
     dartResume();
 }
@@ -252,7 +253,7 @@ static void audio_resume(void)
 // return: how many bytes can be played without blocking
 static int get_space(void)
 {
-    return av_fifo_space(m_audioBuf);
+    return av_fifo_can_write(m_audioBuf);
 }
 
 // plays 'len' bytes of 'data'
@@ -270,7 +271,7 @@ static int play(void *data, int len, int
 // return: delay in seconds between first and last sample in buffer
 static float get_delay(void)
 {
-    int nBuffered = av_fifo_size(m_audioBuf); // could be less
+    int nBuffered = av_fifo_can_read(m_audioBuf); // could be less
 
     return (float)nBuffered / (float)ao_data.bps;
 }

Modified: trunk/libao2/ao_kai.c
==============================================================================
--- trunk/libao2/ao_kai.c	Sat Sep 21 12:30:18 2024	(r38660)
+++ trunk/libao2/ao_kai.c	Tue Oct  1 10:59:39 2024	(r38661)
@@ -55,7 +55,7 @@ LIBAO_EXTERN(kai)
 
 #define CHUNK_SIZE  ao_data.outburst
 
-static AVFifoBuffer *m_audioBuf;
+static AVFifo *m_audioBuf;
 
 static int m_nBufSize = 0;
 
@@ -67,20 +67,21 @@ static HKAI m_hkai;
 
 static int write_buffer(unsigned char *data, int len)
 {
-    int nFree = av_fifo_space(m_audioBuf);
+    int nFree = av_fifo_can_write(m_audioBuf);
 
     len = FFMIN(len, nFree);
 
-    return av_fifo_generic_write(m_audioBuf, data, len, NULL);
+    av_fifo_write(m_audioBuf, data, len);
+    return len;
 }
 
 static int read_buffer(unsigned char *data, int len)
 {
-    int nBuffered = av_fifo_size(m_audioBuf);
+    int nBuffered = av_fifo_can_read(m_audioBuf);
 
     len = FFMIN(len, nBuffered);
 
-    av_fifo_generic_read(m_audioBuf, data, len, NULL);
+    av_fifo_read(m_audioBuf, data, len);
     return len;
 }
 
@@ -255,7 +256,7 @@ static int init(int rate, int channels,
     mp_msg(MSGT_AO, MSGL_V, "KAI: internal audio buffer size = %d bytes\n",
            m_nBufSize);
 
-    m_audioBuf = av_fifo_alloc(m_nBufSize);
+    m_audioBuf = av_fifo_alloc2(m_nBufSize, 1, 0);
 
     kaiPlay(m_hkai);
 
@@ -280,7 +281,7 @@ static void uninit(int immed)
 
     kaiDone();
 
-    av_fifo_free(m_audioBuf);
+    av_fifo_freep2(&m_audioBuf);
 }
 
 // stop playing and empty buffers (for seeking/pause)
@@ -289,7 +290,7 @@ static void reset(void)
     kaiPause(m_hkai);
 
     // Reset ring-buffer state
-    av_fifo_reset(m_audioBuf);
+    av_fifo_reset2(m_audioBuf);
 
     kaiResume(m_hkai);
 }
@@ -309,7 +310,7 @@ static void audio_resume(void)
 // return: how many bytes can be played without blocking
 static int get_space(void)
 {
-    return av_fifo_space(m_audioBuf);
+    return av_fifo_can_write(m_audioBuf);
 }
 
 // plays 'len' bytes of 'data'
@@ -327,7 +328,7 @@ static int play(void *data, int len, int
 // return: delay in seconds between first and last sample in buffer
 static float get_delay(void)
 {
-    int nBuffered = av_fifo_size(m_audioBuf); // could be less
+    int nBuffered = av_fifo_can_read(m_audioBuf); // could be less
 
     return (float)nBuffered / (float)ao_data.bps;
 }


More information about the MPlayer-cvslog mailing list