Fix file handle allocation in MP4 and HCA readers, reverting an incorrect change.
This commit is contained in:
parent
6077a5086e
commit
27e5402d88
2 changed files with 60 additions and 47 deletions
|
@ -13,6 +13,8 @@ VGMSTREAM * init_vgmstream_hca_offset(STREAMFILE *streamFile, uint64_t start, ui
|
|||
static const unsigned int ciphKey1=0x30DBE1AB;
|
||||
static const unsigned int ciphKey2=0xCC554639;
|
||||
|
||||
char filename[PATH_LIMIT];
|
||||
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
|
||||
hca_codec_data * hca_file = ( hca_codec_data * ) calloc(1, sizeof(hca_codec_data) + clHCA_sizeof());
|
||||
|
@ -53,16 +55,22 @@ VGMSTREAM * init_vgmstream_hca_offset(STREAMFILE *streamFile, uint64_t start, ui
|
|||
|
||||
if (clHCA_Decode(hca, hca_data, header_size, 0) < 0) goto fail;
|
||||
|
||||
free( hca_data );
|
||||
hca_data = NULL;
|
||||
|
||||
if (clHCA_getInfo(hca, &hca_file->info) < 0) goto fail;
|
||||
|
||||
hca_file->sample_ptr = clHCA_samplesPerBlock;
|
||||
hca_file->samples_discard = 0;
|
||||
|
||||
streamFile->get_name( streamFile, filename, sizeof(filename) );
|
||||
|
||||
hca_file->streamfile = streamFile->open(streamFile, filename, STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!hca_file->streamfile) goto fail;
|
||||
|
||||
vgmstream = allocate_vgmstream( hca_file->info.channelCount, 1 );
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
free( hca_data );
|
||||
|
||||
vgmstream->loop_flag = hca_file->info.loopEnabled;
|
||||
vgmstream->loop_start_sample = hca_file->info.loopStart * clHCA_samplesPerBlock;
|
||||
vgmstream->loop_end_sample = hca_file->info.loopEnd * clHCA_samplesPerBlock;
|
||||
|
|
|
@ -127,6 +127,11 @@ VGMSTREAM * init_vgmstream_mp4_aac_offset(STREAMFILE *streamFile, uint64_t start
|
|||
aac_file->samples_per_frame = stream_info->frameSize;
|
||||
aac_file->samples_discard = 0;
|
||||
|
||||
streamFile->get_name( streamFile, filename, sizeof(filename) );
|
||||
|
||||
aac_file->if_file.streamfile = streamFile->open(streamFile, filename, STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||
if (!aac_file->if_file.streamfile) goto fail;
|
||||
|
||||
vgmstream = allocate_vgmstream( stream_info->numChannels, 1 );
|
||||
if (!vgmstream) goto fail;
|
||||
|
||||
|
|
Loading…
Reference in a new issue