mirror of https://github.com/mpv-player/mpv
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".
This commit is contained in:
parent
021d012c97
commit
e00f4992b8
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue