aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/audio.c
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2003-01-23 10:33:16 +0000
committerFabrice Bellard <fabrice@bellard.org>2003-01-23 10:33:16 +0000
commit7f172339fdcdeb0393c1a296da95acb6fc57d3b8 (patch)
treeed930c7e3f091d4bd816974e8da19c548eab08f9 /libavformat/audio.c
parent79a7c2683e12398725dbf2fa8984ea371a6965ce (diff)
downloadffmpeg-7f172339fdcdeb0393c1a296da95acb6fc57d3b8.tar.gz
grab device is in AVFormatParameter (at least better than global variable)
Originally committed as revision 1499 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/audio.c')
-rw-r--r--libavformat/audio.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libavformat/audio.c b/libavformat/audio.c
index 4fa155c85d..05055a1781 100644
--- a/libavformat/audio.c
+++ b/libavformat/audio.c
@@ -28,8 +28,6 @@
#include <sys/mman.h>
#include <sys/time.h>
-const char *audio_device = "/dev/dsp";
-
#define AUDIO_BLOCK_SIZE 4096
typedef struct {
@@ -43,13 +41,16 @@ typedef struct {
int buffer_ptr;
} AudioData;
-static int audio_open(AudioData *s, int is_output)
+static int audio_open(AudioData *s, int is_output, const char *audio_device)
{
int audio_fd;
int tmp, err;
char *flip = getenv("AUDIO_FLIP_LEFT");
/* open linux audio device */
+ if (!audio_device)
+ audio_device = "/dev/dsp";
+
if (is_output)
audio_fd = open(audio_device, O_WRONLY);
else
@@ -155,7 +156,7 @@ static int audio_write_header(AVFormatContext *s1)
st = s1->streams[0];
s->sample_rate = st->codec.sample_rate;
s->channels = st->codec.channels;
- ret = audio_open(s, 1);
+ ret = audio_open(s, 1, NULL);
if (ret < 0) {
return -EIO;
} else {
@@ -217,7 +218,7 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap)
s->sample_rate = ap->sample_rate;
s->channels = ap->channels;
- ret = audio_open(s, 0);
+ ret = audio_open(s, 0, ap->device);
if (ret < 0) {
av_free(st);
return -EIO;