mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-18 07:44:43 +01:00
Fix body_file with chunks
This commit is contained in:
parent
d7d838ab49
commit
c084a99337
@ -652,14 +652,15 @@ static void set_body_chunk(txth_header * txth) {
|
|||||||
if (txth->chunk_number > txth->chunk_count)
|
if (txth->chunk_number > txth->chunk_count)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
temp_streamFile = setup_txth_streamfile(txth->streamBody, txth->chunk_start, txth->chunk_size, txth->chunk_count, txth->chunk_number - 1);
|
temp_streamFile = setup_txth_streamfile(txth->streamBody, txth->chunk_start, txth->chunk_size, txth->chunk_count, txth->chunk_number - 1, txth->streambody_opened);
|
||||||
if (!temp_streamFile) return;
|
if (!temp_streamFile) return;
|
||||||
|
|
||||||
if (txth->streambody_opened) {
|
/* closing is handled by temp_streamFile */
|
||||||
close_streamfile(txth->streamBody);
|
//if (txth->streambody_opened) {
|
||||||
txth->streamBody = NULL;
|
// close_streamfile(txth->streamBody);
|
||||||
txth->streambody_opened = 0;
|
// txth->streamBody = NULL;
|
||||||
}
|
// txth->streambody_opened = 0;
|
||||||
|
//}
|
||||||
|
|
||||||
txth->streamBody = temp_streamFile;
|
txth->streamBody = temp_streamFile;
|
||||||
txth->streambody_opened = 1;
|
txth->streambody_opened = 1;
|
||||||
|
@ -95,7 +95,7 @@ static size_t txth_io_size(STREAMFILE *streamfile, txth_io_data* data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Handles deinterleaving of generic chunked streams */
|
/* Handles deinterleaving of generic chunked streams */
|
||||||
static STREAMFILE* setup_txth_streamfile(STREAMFILE *streamFile, off_t chunk_start, size_t chunk_size, int chunk_count, int chunk_number) {
|
static STREAMFILE* setup_txth_streamfile(STREAMFILE *streamFile, off_t chunk_start, size_t chunk_size, int chunk_count, int chunk_number, int is_opened_streamfile) {
|
||||||
STREAMFILE *temp_streamFile = NULL, *new_streamFile = NULL;
|
STREAMFILE *temp_streamFile = NULL, *new_streamFile = NULL;
|
||||||
txth_io_data io_data = {0};
|
txth_io_data io_data = {0};
|
||||||
size_t io_data_size = sizeof(txth_io_data);
|
size_t io_data_size = sizeof(txth_io_data);
|
||||||
@ -109,10 +109,16 @@ static STREAMFILE* setup_txth_streamfile(STREAMFILE *streamFile, off_t chunk_sta
|
|||||||
io_data.logical_offset = -1; /* force phys offset reset */
|
io_data.logical_offset = -1; /* force phys offset reset */
|
||||||
|
|
||||||
|
|
||||||
|
new_streamFile = streamFile;
|
||||||
|
|
||||||
/* setup subfile */
|
/* setup subfile */
|
||||||
new_streamFile = open_wrap_streamfile(streamFile);
|
if (!is_opened_streamfile) {
|
||||||
|
/* if streamFile was opened by txth code we MUST close it once done (as it's now "fused"),,
|
||||||
|
* otherwise it was external to txth and must be wrapped to avoid closing it */
|
||||||
|
new_streamFile = open_wrap_streamfile(new_streamFile);
|
||||||
if (!new_streamFile) goto fail;
|
if (!new_streamFile) goto fail;
|
||||||
temp_streamFile = new_streamFile;
|
temp_streamFile = new_streamFile;
|
||||||
|
}
|
||||||
|
|
||||||
new_streamFile = open_io_streamfile(new_streamFile, &io_data,io_data_size, txth_io_read,txth_io_size);
|
new_streamFile = open_io_streamfile(new_streamFile, &io_data,io_data_size, txth_io_read,txth_io_size);
|
||||||
if (!new_streamFile) goto fail;
|
if (!new_streamFile) goto fail;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user