From e00f4992b8debc2274e9165507d6e8130ac10289 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 26 Feb 2012 21:38:03 +0100 Subject: [PATCH] cue: play .bin files as raw PCM audio (even if it means playing noise) The cue code will open the .bin file with demux_rawaudio if the file can't be opened otherwise. In case the .bin file isn't in the exact format demux_rawaudio uses (usually 44100 Hz, 2 ch, s16le PCM), noise will be played. This is done only if no other demuxer could open the file, and the file extension is ".bin". --- timeline/tl_cue.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/timeline/tl_cue.c b/timeline/tl_cue.c index e3fcbb56df..c02215ce11 100644 --- a/timeline/tl_cue.c +++ b/timeline/tl_cue.c @@ -204,6 +204,20 @@ static bool try_open(struct MPContext *mpctx, char *filename) mpctx->opts.video_id, mpctx->opts.sub_id, filename); + // Since .bin files are raw PCM data with no headers, we have to explicitly + // open them. Also, try to avoid to open files that are most likely not .bin + // files, as that would only play noise. Checking the file extension is + // fragile, but it's about the only way we have. + // TODO: maybe also could check if the .bin file is a multiple of the Audio + // CD sector size (2352 bytes) + if (!d && bstr_case_endswith(bfilename, bstr(".bin"))) { + mp_msg(MSGT_CPLAYER, MSGL_WARN, "CUE: Opening as BIN file!\n"); + d = demux_open(&mpctx->opts, s, DEMUXER_TYPE_RAWAUDIO, + mpctx->opts.audio_id, + mpctx->opts.video_id, + mpctx->opts.sub_id, + filename); + } if (d) { add_source(mpctx, s, d); return true;