diff options
Diffstat (limited to 'audio/out/ao_pcm.c')
-rw-r--r-- | audio/out/ao_pcm.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/audio/out/ao_pcm.c b/audio/out/ao_pcm.c index 3e23920bd6..71650c39e3 100644 --- a/audio/out/ao_pcm.c +++ b/audio/out/ao_pcm.c @@ -19,8 +19,6 @@ * License along with mpv. If not, see <http://www.gnu.org/licenses/>. */ -#include "config.h" - #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -44,8 +42,8 @@ struct priv { char *outputfilename; - int waveheader; - int append; + bool waveheader; + bool append; uint64_t data_length; FILE *fp; }; @@ -88,7 +86,7 @@ static void write_wave_header(struct ao *ao, FILE *fp, uint64_t data_length) fput16le(WAV_ID_FORMAT_EXTENSIBLE, fp); fput16le(ao->channels.num, fp); fput32le(ao->samplerate, fp); - fput32le(ao->bps, fp); + fput32le(MPCLAMP(ao->bps, 0, UINT32_MAX), fp); fput16le(ao->channels.num * (bits / 8), fp); fput16le(bits, fp); @@ -147,7 +145,7 @@ static int init(struct ao *ao) if (!ao_chmap_sel_adjust(ao, &sel, &ao->channels)) return -1; - ao->bps = ao->channels.num * ao->samplerate * af_fmt_to_bytes(ao->format); + ao->bps = ao->channels.num * (int64_t)ao->samplerate * af_fmt_to_bytes(ao->format); MP_INFO(ao, "File: %s (%s)\nPCM: Samplerate: %d Hz Channels: %d Format: %s\n", outputfilename, @@ -239,11 +237,11 @@ const struct ao_driver audio_out_pcm = { .start = start, .reset = reset, .priv_size = sizeof(struct priv), - .priv_defaults = &(const struct priv) { .waveheader = 1 }, + .priv_defaults = &(const struct priv) { .waveheader = true }, .options = (const struct m_option[]) { {"file", OPT_STRING(outputfilename), .flags = M_OPT_FILE}, - {"waveheader", OPT_FLAG(waveheader)}, - {"append", OPT_FLAG(append)}, + {"waveheader", OPT_BOOL(waveheader)}, + {"append", OPT_BOOL(append)}, {0} }, .options_prefix = "ao-pcm", |