summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-14 22:14:56 +0100
committerwm4 <wm4@nowhere>2015-01-14 22:14:56 +0100
commitc8ecb662697cd3b023f9a71c9b38dea7fbd64525 (patch)
tree592724ffd639a6362d3cead5ee73ffb5098cadbc
parent4cabd08e8a54c201f153ce28c783f2e7d4ee413a (diff)
downloadmpv-c8ecb662697cd3b023f9a71c9b38dea7fbd64525.tar.bz2
mpv-c8ecb662697cd3b023f9a71c9b38dea7fbd64525.tar.xz
ao_pcm: add append mode
Pretty useful for debugging, although a bit useless or possibly misleading too (see comments in the manpage).
-rw-r--r--DOCS/man/ao.rst4
-rw-r--r--audio/out/ao_pcm.c4
2 files changed, 7 insertions, 1 deletions
diff --git a/DOCS/man/ao.rst b/DOCS/man/ao.rst
index c78d812002..e16309afb8 100644
--- a/DOCS/man/ao.rst
+++ b/DOCS/man/ao.rst
@@ -257,6 +257,10 @@ Available audio output drivers are:
Write the sound to ``<filename>`` instead of the default
``audiodump.wav``. If ``no-waveheader`` is specified, the default is
``audiodump.pcm``.
+ ``(no-)append``
+ Append to the file, instead of overwriting it. Always use this with the
+ ``no-waveheader`` option - with ``waveheader`` it's broken, because
+ it will write a WAVE header every time the file is opened.
``rsound``
Audio output to an RSound daemon
diff --git a/audio/out/ao_pcm.c b/audio/out/ao_pcm.c
index ae45def230..c077c8e1b0 100644
--- a/audio/out/ao_pcm.c
+++ b/audio/out/ao_pcm.c
@@ -46,6 +46,7 @@
struct priv {
char *outputfilename;
int waveheader;
+ int append;
uint64_t data_length;
FILE *fp;
};
@@ -155,7 +156,7 @@ static int init(struct ao *ao)
MP_INFO(ao, "Info: Faster dumping is achieved with --no-video\n");
MP_INFO(ao, "Info: To write WAVE files use --ao=pcm:waveheader (default).\n");
- priv->fp = fopen(priv->outputfilename, "wb");
+ priv->fp = fopen(priv->outputfilename, priv->append ? "ab" : "wb");
if (!priv->fp) {
MP_ERR(ao, "Failed to open %s for writing!\n", priv->outputfilename);
return -1;
@@ -223,6 +224,7 @@ const struct ao_driver audio_out_pcm = {
.options = (const struct m_option[]) {
OPT_STRING("file", outputfilename, 0),
OPT_FLAG("waveheader", waveheader, 0),
+ OPT_FLAG("append", append, 0),
{0}
},
};