Use interleaved MPEG FSB decoder [Timeshift, DJ Hero]

This commit is contained in:
bnnm 2017-03-13 20:05:28 +01:00
parent 0e10b75beb
commit 5763a1a229

View File

@ -279,34 +279,26 @@ VGMSTREAM * init_vgmstream_fsb_offset(STREAMFILE *streamFile, off_t offset) {
#if defined(VGM_USE_MPEG) #if defined(VGM_USE_MPEG)
mpeg_codec_data *mpeg_data = NULL; mpeg_codec_data *mpeg_data = NULL;
coding_t mpeg_coding_type; coding_t mpeg_coding_type;
#if 0
int fsb_padding = 0; int fsb_padding = 0;
//VGM_ASSERT(fsbh.mode & FSOUND_MPEG_LAYER2, "FSB FSOUND_MPEG_LAYER2 found\n");/* not always set anyway */
VGM_ASSERT(fsbh.mode & FSOUND_IGNORETAGS, "FSB FSOUND_IGNORETAGS found\n");
if (fsbh.flags & FMOD_FSB_SOURCE_MPEG_PADDED) if (fsbh.flags & FMOD_FSB_SOURCE_MPEG_PADDED)
fsb_padding = fsbh.numchannels > 2 ? 16 : 2; fsb_padding = fsbh.numchannels > 2 ? 16 : 2;
else if (fsbh.flags & FMOD_FSB_SOURCE_MPEG_PADDED4) else if (fsbh.flags & FMOD_FSB_SOURCE_MPEG_PADDED4)
fsb_padding = fsbh.numchannels > 2 ? 16 : 4; fsb_padding = fsbh.numchannels > 2 ? 16 : 4;
else /* seems to be needed with no flag */ else /* needed by multichannel with no flags */
fsb_padding = fsbh.numchannels > 2 ? 16 : 0; fsb_padding = fsbh.numchannels > 2 ? 16 : 0;
mpeg_data = init_mpeg_codec_data_interleaved(streamFile, start_offset, &mpeg_coding_type, vgmstream->channels, 0, fsb_padding); mpeg_data = init_mpeg_codec_data_interleaved(streamFile, start_offset, &mpeg_coding_type, vgmstream->channels, 0, fsb_padding);
if (!mpeg_data) goto fail; if (!mpeg_data) goto fail;
vgmstream->interleave_block_size = mpeg_data->current_frame_size + mpeg_data->current_padding;
if (vgmstream->channels > 2) vgmstream->loop_flag = 0;//todo not implemented yet
#endif
VGM_ASSERT(fsbh.mode & FSOUND_MPEG_LAYER2, "FSB FSOUND_MPEG_LAYER2 found\n");
VGM_ASSERT(fsbh.mode & FSOUND_IGNORETAGS, "FSB FSOUND_IGNORETAGS found\n");
mpeg_data = init_mpeg_codec_data(streamFile, start_offset, &mpeg_coding_type, vgmstream->channels);
if (!mpeg_data) goto fail;
vgmstream->codec_data = mpeg_data; vgmstream->codec_data = mpeg_data;
vgmstream->coding_type = mpeg_coding_type; vgmstream->coding_type = mpeg_coding_type;
vgmstream->layout_type = layout_mpeg; vgmstream->layout_type = layout_mpeg;
mpeg_set_error_logging(mpeg_data, 0); vgmstream->interleave_block_size = mpeg_data->current_frame_size + mpeg_data->current_padding;
//mpeg_set_error_logging(mpeg_data, 0); /* should not be needed anymore with the interleave decoder */
#elif defined(VGM_USE_FFMPEG) #elif defined(VGM_USE_FFMPEG)
/* FFmpeg can't properly read FSB4 or FMOD's 0-padded MPEG data @ start_offset */ /* FFmpeg can't properly read FSB4 or FMOD's 0-padded MPEG data @ start_offset */