summaryrefslogtreecommitdiffstats
path: root/libao2
diff options
context:
space:
mode:
Diffstat (limited to 'libao2')
-rw-r--r--libao2/ao_alsa.c21
-rw-r--r--libao2/ao_ivtv.c2
-rw-r--r--libao2/ao_mpegpes.c4
-rw-r--r--libao2/ao_sdl.c2
-rw-r--r--libao2/ao_v4l2.c2
-rw-r--r--libao2/audio_out.c5
-rw-r--r--libao2/audio_out.h3
7 files changed, 22 insertions, 17 deletions
diff --git a/libao2/ao_alsa.c b/libao2/ao_alsa.c
index 032d1d132a..9541f9c553 100644
--- a/libao2/ao_alsa.c
+++ b/libao2/ao_alsa.c
@@ -84,6 +84,7 @@ static int ao_noblock = 0;
static int open_mode;
static int alsa_can_pause = 0;
+static snd_pcm_sframes_t prepause_frames;
#define ALSA_DEVICE_SIZE 256
@@ -348,6 +349,8 @@ static int init(int rate_hz, int channels, int format, int flags)
mp_msg(MSGT_AO,MSGL_V,"alsa-init: compiled for ALSA-%s\n", SND_LIB_VERSION_STR);
#endif
+ prepause_frames = 0;
+
snd_lib_error_set_handler(alsa_error_handler);
ao_data.samplerate = rate_hz;
@@ -767,6 +770,10 @@ static void audio_pause(void)
}
mp_msg(MSGT_AO,MSGL_V,"alsa-pause: pause supported by hardware\n");
} else {
+ if (snd_pcm_delay(alsa_handler, &prepause_frames) < 0
+ || prepause_frames < 0)
+ prepause_frames = 0;
+
if ((err = snd_pcm_drop(alsa_handler)) < 0)
{
mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_PcmDropError, snd_strerror(err));
@@ -796,6 +803,11 @@ static void audio_resume(void)
mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_PcmPrepareError, snd_strerror(err));
return;
}
+ if (prepause_frames) {
+ void *silence = calloc(prepause_frames, bytes_per_sample);
+ play(silence, prepause_frames * bytes_per_sample, 0);
+ free(silence);
+ }
}
}
@@ -804,6 +816,7 @@ static void reset(void)
{
int err;
+ prepause_frames = 0;
if ((err = snd_pcm_drop(alsa_handler)) < 0)
{
mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_PcmPrepareError, snd_strerror(err));
@@ -879,10 +892,10 @@ static int get_space(void)
return 0;
}
- ret = snd_pcm_status_get_avail(status) * bytes_per_sample;
- if (ret > ao_data.buffersize) // Buffer underrun?
- ret = ao_data.buffersize;
- return ret;
+ unsigned space = snd_pcm_status_get_avail(status) * bytes_per_sample;
+ if (space > ao_data.buffersize) // Buffer underrun?
+ space = ao_data.buffersize;
+ return space;
}
/* delay in seconds between first and last sample in buffer */
diff --git a/libao2/ao_ivtv.c b/libao2/ao_ivtv.c
index c2b367a414..2b182ff191 100644
--- a/libao2/ao_ivtv.c
+++ b/libao2/ao_ivtv.c
@@ -147,7 +147,7 @@ get_space (void)
static int
play (void *data, int len, int flags)
{
- int ivtv_write (unsigned char *data, int len);
+ int ivtv_write (const unsigned char *data, int len);
if (ao_data.format != AF_FORMAT_MPEG2)
return 0;
diff --git a/libao2/ao_mpegpes.c b/libao2/ao_mpegpes.c
index 3746d24b4e..88ab903ed1 100644
--- a/libao2/ao_mpegpes.c
+++ b/libao2/ao_mpegpes.c
@@ -208,7 +208,7 @@ static int preinit(const char *arg)
return vo_mpegpes_fd2;
}
-static int my_ao_write(unsigned char* data,int len){
+static int my_ao_write(const unsigned char* data,int len){
int orig_len = len;
#ifdef CONFIG_DVB
#define NFD 1
@@ -303,8 +303,6 @@ static void audio_resume(void)
{
}
-void send_pes_packet(unsigned char* data,int len,int id,int timestamp);
-void send_lpcm_packet(unsigned char* data,int len,int id,int timestamp,int freq_id);
extern int vo_pts;
// return: how many bytes can be played without blocking
diff --git a/libao2/ao_sdl.c b/libao2/ao_sdl.c
index d5652ccf09..63ddec6f29 100644
--- a/libao2/ao_sdl.c
+++ b/libao2/ao_sdl.c
@@ -115,7 +115,7 @@ static int control(int cmd,void *arg){
}
// SDL Callback function
-void outputaudio(void *unused, Uint8 *stream, int len) {
+static void outputaudio(void *unused, Uint8 *stream, int len) {
//SDL_MixAudio(stream, read_buffer(buffers, len), len, SDL_MIX_MAXVOLUME);
//if(!full_buffers) printf("SDL: Buffer underrun!\n");
diff --git a/libao2/ao_v4l2.c b/libao2/ao_v4l2.c
index 412899c405..a57cea91c3 100644
--- a/libao2/ao_v4l2.c
+++ b/libao2/ao_v4l2.c
@@ -144,7 +144,7 @@ get_space (void)
static int
play (void *data, int len, int flags)
{
- int v4l2_write (unsigned char *data, int len);
+ int v4l2_write (const unsigned char *data, int len);
if (ao_data.format != AF_FORMAT_MPEG2)
return 0;
diff --git a/libao2/audio_out.c b/libao2/audio_out.c
index 0e26e761fa..8c64abbb95 100644
--- a/libao2/audio_out.c
+++ b/libao2/audio_out.c
@@ -25,7 +25,6 @@
#include "mp_msg.h"
#include "help_mp.h"
-#include "mplayer.h" /* for exit_player() */
// there are some globals:
ao_data_t ao_data={0,0,0,0,OUTBURST,-1,0};
@@ -141,10 +140,6 @@ const ao_functions_t* init_best_audio_out(char** ao_list,int use_plugin,int rate
while(ao_list[0][0]){
char* ao=ao_list[0];
int ao_len;
- if (strncmp(ao, "alsa9", 5) == 0 || strncmp(ao, "alsa1x", 6) == 0) {
- mp_msg(MSGT_AO, MSGL_FATAL, MSGTR_AO_ALSA9_1x_Removed);
- exit_player(NULL);
- }
if (ao_subdevice) {
free(ao_subdevice);
ao_subdevice = NULL;
diff --git a/libao2/audio_out.h b/libao2/audio_out.h
index e1d36e78c7..b7f51e0ed8 100644
--- a/libao2/audio_out.h
+++ b/libao2/audio_out.h
@@ -47,8 +47,7 @@ typedef struct ao_functions_s
} ao_functions_t;
/* global data used by mplayer and plugins */
-typedef struct ao_data_s
-{
+typedef struct ao_data {
int samplerate;
int channels;
int format;