mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-30 11:57:27 +01:00
Fixed MP4 handler passing the end of the stream
This commit is contained in:
parent
b651b0884f
commit
1550f90139
@ -97,6 +97,7 @@
|
|||||||
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
|
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -44,6 +44,10 @@ void decode_mp4_aac(mp4_aac_codec_data * data, sample * outbuf, int32_t samples_
|
|||||||
samples_done += samples_remain;
|
samples_done += samples_remain;
|
||||||
|
|
||||||
while ( samples_done < samples_to_do ) {
|
while ( samples_done < samples_to_do ) {
|
||||||
|
if (data->sampleId >= data->numSamples) {
|
||||||
|
memset(outbuf, 0, (samples_to_do - samples_done) * stream_info->numChannels * sizeof(sample));
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (!MP4ReadSample( data->h_mp4file, data->track_id, ++data->sampleId, (uint8_t**)(&buffer), (uint32_t*)(&buffer_size), 0, 0, 0, 0)) return;
|
if (!MP4ReadSample( data->h_mp4file, data->track_id, ++data->sampleId, (uint8_t**)(&buffer), (uint32_t*)(&buffer_size), 0, 0, 0, 0)) return;
|
||||||
ubuffer_size = buffer_size;
|
ubuffer_size = buffer_size;
|
||||||
bytes_valid = buffer_size;
|
bytes_valid = buffer_size;
|
||||||
|
@ -34,8 +34,16 @@ int mp4_file_read( void* handle, void* buffer, int64_t size, int64_t* nin, int64
|
|||||||
mp4_streamfile * file = ( mp4_streamfile * ) handle;
|
mp4_streamfile * file = ( mp4_streamfile * ) handle;
|
||||||
int64_t max_size = file->size - file->offset - file->start;
|
int64_t max_size = file->size - file->offset - file->start;
|
||||||
if ( size > max_size ) size = max_size;
|
if ( size > max_size ) size = max_size;
|
||||||
*nin = read_streamfile( (uint8_t *) buffer, file->offset, size, file->streamfile );
|
if ( size > 0 )
|
||||||
file->offset += *nin;
|
{
|
||||||
|
*nin = read_streamfile( (uint8_t *) buffer, file->offset, size, file->streamfile );
|
||||||
|
file->offset += *nin;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*nin = 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user