MAIATRAC3PLUS: use fact_samples if possible (manual calcs can be off)

This commit is contained in:
bnnm 2016-12-10 16:07:54 +01:00
parent cdfd47eb7b
commit e6334e72af

View File

@ -412,9 +412,12 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
#endif
#ifdef VGM_USE_MAIATRAC3PLUS
case coding_AT3plus:
/* rough total samples, not totally accurate since there are some skipped samples in the beginning
* channels shouldn't matter (mono and stereo encoding produces the same number of frames in ATRAC3plus) */
sample_count = (data_size / fmt.block_size) * 2048; /* number_of_frames by decoded_samples_per_frame */
/* rough total samples (block_size may be incorrect if not using joint stereo) */
sample_count = (data_size / fmt.block_size) * 2048;
/* favor fact_samples if available (skip isn't correctly handled for now) */
if (fact_sample_count > 0 && fact_sample_count + fact_sample_skip < sample_count)
sample_count = fact_sample_count + fact_sample_skip;
break;
#endif
default: