Build Command
./configure --enable-debug=3 --enable-profile --prefix=/home/xgu/mplayer --yasm=''
A Raw Audio Problem
How to reproduce the problem:
try to play a raw pcm will below command :
mplayer -demuxer rawaudio -rawaudio
samplesize=2:channels=1:rate=44100:format=0x10001
http://res.wordjp.com/mplayer/rawaudio_patch/B-LPCM-1.pcm
From the console output, we can see that the dvdpcm codec is using the
default setting, all the setting on the command line were ignored.
And audio is not played correctly.
===============
Opening audio decoder: [dvdpcm] Uncompressed DVD/VOB LPCM audio decoder
AUDIO: 48000 Hz, 2 ch, s16be, 1536.0 kbit/100.00% (ratio: 192000->192000)
Selected audio codec: [dvdpcm] afm: dvdpcm (Uncompressed DVD/VOB LPCM)
===============
After the fix, we can play the the same content like
./mplayer -demuxer rawaudio -rawaudio
sampleformat=0x8:samplesize=2:channels=1:rate=44100:format=0x10001
http://res.wordjp.com/mplayer/rawaudio_patch/B-LPCM-1.pcm
Description of the patch:
1. a new sampleformat config was added
the value of the sampleformat was defined in af_format.h, the value 8
here means AF_FORMAT_S16_BE.
2. make sure other configsare not ignored, default value will not
overwrite the pre-set values from configuration.
The Patch
----------
Index: libmpcodecs/ad_dvdpcm.c
===================================================================
--- libmpcodecs/ad_dvdpcm.c (revision 34980)
+++ libmpcodecs/ad_dvdpcm.c (working copy)
@@ -67,12 +67,27 @@
sh->samplesize = 2;
}
} else {
- // use defaults:
+ // use defaults only if there is no setting
+ // which may come from the user command line
+ mp_msg(MSGT_DECAUDIO, MSGL_DBG2, "Preset Meta: channels %d, samplerate %d, sampleformat %d, samplesize %d",
+ sh->channels, sh->samplerate, sh->sample_format, sh->samplesize);
+ if(0 == sh->channels){
sh->channels=2;
+ }
+ if(0 == sh->samplerate ){
sh->samplerate=48000;
+ }
+ if(0 == sh->sample_format)
+ {
sh->sample_format = AF_FORMAT_S16_BE;
+ }
+ if(0 == sh->samplesize)
+ {
sh->samplesize = 2;
}
+ mp_msg(MSGT_DECAUDIO, MSGL_DBG2, "Initialized meta Info: channels %d, samplerate %d, sampleformat %d, samplesize %d",
+ sh->channels, sh->samplerate, sh->sample_format, sh->samplesize);
+ }
if (!sh->i_bps)
sh->i_bps = sh->samplesize * sh->channels * sh->samplerate;
return 1;
Index: libmpdemux/demux_rawaudio.c
===================================================================
--- libmpdemux/demux_rawaudio.c (revision 34980)
+++ libmpdemux/demux_rawaudio.c (working copy)
@@ -35,6 +35,7 @@
static int samplesize = 2;
static int bitrate = 0;
static int format = 0x1; // Raw PCM
+static int sampleformat = 0;
const m_option_t demux_rawaudio_opts[] = {
{ "channels", &channels, CONF_TYPE_INT,CONF_RANGE,1,8, NULL },
@@ -42,6 +43,7 @@
{ "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 },
+ { "sampleformat", &sampleformat, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
{NULL, NULL, 0, 0, 0, 0, NULL}
};
@@ -55,6 +57,7 @@
w->wFormatTag = sh_audio->format = format;
w->nChannels = sh_audio->channels = channels;
w->nSamplesPerSec = sh_audio->samplerate = samplerate;
+ sh_audio->sample_format = sampleformat;
if (bitrate > 999)
w->nAvgBytesPerSec = bitrate/8;
else if (bitrate > 0)
----------
Subscribe to:
Post Comments (Atom)
Post Code on Blogger
Simplest way to post code to blogger for me: <pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black;overflow-x:...
-
Explain There is not interrupt PIN for PCIe interrupt. When device wants to raise an interrupt, an interrupt message is sent to host via ...
-
Configure Space Addressing One of the major improvements the PCI Local Bus had over other I/O architectures was its configuration mechanism...
-
What is LMA and VMA Every loadable or allocatable output section has two addresses. The first is the VMA, or virtual memory address. This ...
No comments:
Post a Comment