summaryrefslogtreecommitdiffstats
path: root/timeline/tl_cue.c
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2012-02-26 21:38:03 +0100
committerwm4 <wm4@mplayer2.org>2012-02-26 21:38:03 +0100
commite00f4992b8debc2274e9165507d6e8130ac10289 (patch)
tree904aef0dd3d9de9392072e262836f872ff6d59f5 /timeline/tl_cue.c
parent021d012c9782dbbfc876f69b9f150754d5bbeb72 (diff)
downloadmpv-e00f4992b8debc2274e9165507d6e8130ac10289.tar.bz2
mpv-e00f4992b8debc2274e9165507d6e8130ac10289.tar.xz
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".
Diffstat (limited to 'timeline/tl_cue.c')
-rw-r--r--timeline/tl_cue.c14
1 files changed, 14 insertions, 0 deletions
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;