movies: set length of unseekable ogg/Opus streams upon reaching EOF

This is one of a series of commits that will make it possible to loop compressed ogg and Opus streams.
This commit is contained in:
rdb 2019-04-29 18:02:56 +02:00
parent c329a41dd3
commit 2f2354550d
2 changed files with 6 additions and 0 deletions

View File

@ -240,6 +240,9 @@ read_samples(int n, int16_t *data) {
data += read_samples * _audio_channels;
_samples_read += read_samples;
} else {
if (read_samples == 0 && _length == 1.0E10) {
_length = op_pcm_tell(_op) / 48000.0;
}
break;
}

View File

@ -158,6 +158,9 @@ read_samples(int n, int16_t *data) {
buffer += read_bytes;
length -= read_bytes;
} else {
if (read_bytes == 0 && _length == 1.0E10) {
_length = ov_time_tell(&_ov);
}
break;
}