summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libmpdemux/demux_rawaudio.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libmpdemux/demux_rawaudio.c b/libmpdemux/demux_rawaudio.c
index 9f23eb4391..ac31c9426d 100644
--- a/libmpdemux/demux_rawaudio.c
+++ b/libmpdemux/demux_rawaudio.c
@@ -17,6 +17,7 @@ extern int demuxer_type;
static int channels = 2;
static int samplerate = 44100;
static int samplesize = 2;
+static int bitrate = 0;
static int format = 0x1; // Raw PCM
m_option_t demux_rawaudio_opts[] = {
@@ -24,6 +25,7 @@ m_option_t demux_rawaudio_opts[] = {
{ "channels", &channels, CONF_TYPE_INT,CONF_RANGE,1,8, NULL },
{ "rate", &samplerate, CONF_TYPE_INT,CONF_RANGE,1000,8*48000, NULL },
{ "samplesize", &samplesize, CONF_TYPE_INT,CONF_RANGE,1,8, NULL },
+ { "bitrate", &bitrate, CONF_TYPE_INT,CONF_MIN,0,0, NULL },
{ "format", &format, CONF_TYPE_INT, CONF_MIN, 0 , 0, NULL },
{NULL, NULL, 0, 0, 0, 0, NULL}
};
@@ -40,7 +42,12 @@ int demux_rawaudio_open(demuxer_t* demuxer) {
w->wFormatTag = sh_audio->format = format;
w->nChannels = sh_audio->channels = channels;
w->nSamplesPerSec = sh_audio->samplerate = samplerate;
- w->nAvgBytesPerSec = samplerate*samplesize*channels;
+ if (bitrate > 999)
+ w->nAvgBytesPerSec = bitrate/8;
+ else if (bitrate > 0)
+ w->nAvgBytesPerSec = bitrate*125;
+ else
+ w->nAvgBytesPerSec = samplerate*samplesize*channels;
w->nBlockAlign = channels*samplesize;
sh_audio->samplesize = samplesize;
w->wBitsPerSample = 8*samplesize;