mirror of
https://github.com/mpv-player/mpv
synced 2025-02-20 14:56:55 +00:00
needed for a/v sync with compressed audio (e.g. raw .mp2 or .ac3 file)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12282 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
1162cbf129
commit
7c726367e6
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user