input_stream: size==-1 means unknown size
Define the special value "-1" as "unknown size". Previously, there was no indicator for streams with unknown size, which might confuse some decoders.
This commit is contained in:
parent
8882f06200
commit
7591403566
@ -186,7 +186,7 @@ static void aac_parse_header(AacBuffer * b, float *length)
|
||||
if (length)
|
||||
*length = -1;
|
||||
|
||||
fileread = b->inStream->size;
|
||||
fileread = b->inStream->size >= 0 ? b->inStream->size : 0;
|
||||
|
||||
fillAacBuffer(b);
|
||||
|
||||
|
@ -75,6 +75,9 @@ static flac_length_status flacLength(mpd_unused const flac_decoder * flacDec,
|
||||
{
|
||||
FlacData *data = (FlacData *) fdata;
|
||||
|
||||
if (data->inStream->size < 0)
|
||||
return flac_length_status_unsupported;
|
||||
|
||||
*length = (size_t) (data->inStream->size);
|
||||
|
||||
return flac_length_status_ok;
|
||||
|
@ -92,6 +92,9 @@ static OggFLAC__SeekableStreamDecoderLengthStatus of_length_cb(mpd_unused const
|
||||
{
|
||||
FlacData *data = (FlacData *) fdata;
|
||||
|
||||
if (data->inStream->size < 0)
|
||||
return OggFLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR;
|
||||
|
||||
*length = (size_t) (data->inStream->size);
|
||||
|
||||
return OggFLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK;
|
||||
|
@ -410,6 +410,9 @@ wavpack_input_push_back_byte(void *id, int c)
|
||||
static uint32_t
|
||||
wavpack_input_get_length(void *id)
|
||||
{
|
||||
if (wpin(id)->is->size < 0)
|
||||
return 0;
|
||||
|
||||
return wpin(id)->is->size;
|
||||
}
|
||||
|
||||
|
@ -581,6 +581,10 @@ input_curl_seek(struct input_stream *is, off_t offset, int whence)
|
||||
break;
|
||||
|
||||
case SEEK_END:
|
||||
if (is->size < 0)
|
||||
/* stream size is not known */
|
||||
return false;
|
||||
|
||||
is->offset = is->size + offset;
|
||||
break;
|
||||
|
||||
|
@ -58,7 +58,7 @@ input_stream_open(struct input_stream *is, const char *url)
|
||||
is->seekable = false;
|
||||
is->ready = false;
|
||||
is->offset = 0;
|
||||
is->size = 0;
|
||||
is->size = -1;
|
||||
is->error = 0;
|
||||
is->mime = NULL;
|
||||
is->meta_name = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user