mirror of
https://github.com/mpv-player/mpv
synced 2025-03-24 20:31:37 +00:00
Add -ao pcm suboptions and remove -aofile and -waveheader options.
Base on idea by Olivier Rolland (billl at users dot sf dot net) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14299 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
e73aadd97b
commit
eca47b1a5e
@ -1669,10 +1669,6 @@ Specify the VOBsub subtitle ID.
|
||||
Override audio driver/\:card buffer size detection.
|
||||
.
|
||||
.TP
|
||||
.B \-aofile <filename>
|
||||
Override the default filename employed by \-ao pcm.
|
||||
.
|
||||
.TP
|
||||
.B \-aop <list=plugin1,plugin2...:option1=value1:opt2=val2...>
|
||||
Specify audio plugin(s) and their options
|
||||
(also see the audio plugins section of the documentation).
|
||||
@ -1770,11 +1766,6 @@ With values below 100 the initial volume (which is 100%) will be above
|
||||
the maximum, which e.g.\& the OSD cannot display correctly.
|
||||
.
|
||||
.TP
|
||||
.B \-nowaveheader (\-ao pcm only)
|
||||
Don't include wave header.
|
||||
Used for raw PCM.
|
||||
.
|
||||
.TP
|
||||
.B \-volstep <0\-100>
|
||||
Set the step size of mixer volume changes in percent of the whole range
|
||||
(default: 3).
|
||||
@ -1908,9 +1899,24 @@ Produces no audio output but maintains video playback speed.
|
||||
Use \-nosound for benchmarking.
|
||||
.
|
||||
.TP
|
||||
.B pcm (also see \-aofile)
|
||||
.B pcm
|
||||
Raw PCM/\:wave file writer audio output.
|
||||
Writes the sound to ./audiodump.wav.
|
||||
.PD 0
|
||||
.RSs
|
||||
.IPs (no)waveheader
|
||||
Include or do not include the wave header (default: included).
|
||||
When not included, raw PCM will be generated.
|
||||
.IPs file=<filename>
|
||||
Write the sound to <filename> instead of the default
|
||||
audiodump.wav.
|
||||
.REss
|
||||
.PD 1
|
||||
.RS
|
||||
.sp 1
|
||||
.I NOTE:
|
||||
If you do not specify any option the output is progressive
|
||||
(i.e.\& not interlaced).
|
||||
.RE
|
||||
.
|
||||
.TP
|
||||
.B plugin\ \
|
||||
|
@ -167,9 +167,9 @@ m_option_t mplayer_opts[]={
|
||||
{"abs", &ao_data.buffersize, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
|
||||
|
||||
// -ao pcm options:
|
||||
{"aofile", &ao_outputfilename, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
{"waveheader", &ao_pcm_waveheader, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
||||
{"nowaveheader", &ao_pcm_waveheader, CONF_TYPE_FLAG, 0, 1, 0, NULL},
|
||||
{"aofile", "-aofile is deprecated. Use -ao pcm:file=<filename> instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
|
||||
{"waveheader", "-waveheader is deprecated. Use -ao pcm:waveheader instead.\n", CONF_TYPE_PRINT, 0, 0, 1, NULL},
|
||||
{"nowaveheader", "-nowaveheader is deprecated. Use -ao pcm:nowaveheader instead.\n", CONF_TYPE_PRINT, 0, 1, 0, NULL},
|
||||
|
||||
{"alsa", "-alsa has been removed. Remove it from your config file.\n",
|
||||
CONF_TYPE_PRINT, 0, 0, 0, NULL},
|
||||
|
@ -58,10 +58,8 @@
|
||||
<e name="abs"/>
|
||||
<e name="af"/>
|
||||
<e name="ao"/>
|
||||
<e name="aofile"/>
|
||||
<e name="delay"/>
|
||||
<e name="mixer"/>
|
||||
<e name="nowaveheader"/>
|
||||
</pref>
|
||||
|
||||
<pref name="video_pref" title="Video">
|
||||
|
@ -55,10 +55,8 @@
|
||||
<e name="abs"/>
|
||||
<e name="af"/>
|
||||
<e name="ao"/>
|
||||
<e name="aofile"/>
|
||||
<e name="delay"/>
|
||||
<e name="mixer"/>
|
||||
<e name="nowaveheader"/>
|
||||
</pref>
|
||||
|
||||
<pref name="video_pref" title="Video">
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "bswap.h"
|
||||
#include "subopt-helper.h"
|
||||
#include "libaf/af_format.h"
|
||||
#include "audio_out.h"
|
||||
#include "audio_out_internal.h"
|
||||
@ -24,8 +25,8 @@ LIBAO_EXTERN(pcm)
|
||||
|
||||
extern int vo_pts;
|
||||
|
||||
char *ao_outputfilename = NULL;
|
||||
int ao_pcm_waveheader = 1;
|
||||
static char *ao_outputfilename = NULL;
|
||||
static int ao_pcm_waveheader = 1;
|
||||
|
||||
#define WAV_ID_RIFF 0x46464952 /* "RIFF" */
|
||||
#define WAV_ID_WAVE 0x45564157 /* "WAVE" */
|
||||
@ -79,9 +80,20 @@ static int control(int cmd,void *arg){
|
||||
// return: 1=success 0=fail
|
||||
static int init(int rate,int channels,int format,int flags){
|
||||
int bits;
|
||||
if(!ao_outputfilename) {
|
||||
ao_outputfilename = strdup(ao_pcm_waveheader ? "audiodump.wav" : "audiodump.pcm");
|
||||
strarg_t file;
|
||||
opt_t subopts[] = {
|
||||
{"waveheader", OPT_ARG_BOOL, &ao_pcm_waveheader, NULL},
|
||||
{"file", OPT_ARG_STR, &file, NULL},
|
||||
{NULL}
|
||||
}
|
||||
// set defaults
|
||||
ao_pcm_waveheader = 1;
|
||||
file.str = "audiodump.wav";
|
||||
file.len = 13;
|
||||
if (subopt_parse(ao_subdevice, subopts) != 0) {
|
||||
return 0;
|
||||
}
|
||||
ao_outputfilename = strndup(file.str, file.len);
|
||||
|
||||
/* bits is only equal to format if (format == 8) or (format == 16);
|
||||
this means that the following "if" is a kludge and should
|
||||
@ -142,6 +154,9 @@ static void uninit(int immed){
|
||||
fwrite(&wavhdr,sizeof(wavhdr),1,fp);
|
||||
}
|
||||
fclose(fp);
|
||||
if (ao_outputfilename)
|
||||
free(ao_outputfilename);
|
||||
ao_outputfilename = NULL;
|
||||
}
|
||||
|
||||
// stop playing and empty buffers (for seeking/pause)
|
||||
|
Loading…
Reference in New Issue
Block a user