decoder/flac: check "seekable" in libFLAC callbacks
Return FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED if this input stream does not support seeking.
This commit is contained in:
parent
37181c9181
commit
0fb877740b
|
@ -69,6 +69,9 @@ flac_seek_cb(G_GNUC_UNUSED const FLAC__StreamDecoder *fd,
|
|||
{
|
||||
struct flac_data *data = (struct flac_data *) fdata;
|
||||
|
||||
if (!data->input_stream->seekable)
|
||||
return FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED;
|
||||
|
||||
if (!input_stream_seek(data->input_stream, offset, SEEK_SET))
|
||||
return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
|
||||
|
||||
|
@ -81,6 +84,9 @@ flac_tell_cb(G_GNUC_UNUSED const FLAC__StreamDecoder *fd,
|
|||
{
|
||||
struct flac_data *data = (struct flac_data *) fdata;
|
||||
|
||||
if (!data->input_stream->seekable)
|
||||
return FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED;
|
||||
|
||||
*offset = (long)(data->input_stream->offset);
|
||||
|
||||
return FLAC__STREAM_DECODER_TELL_STATUS_OK;
|
||||
|
|
Loading…
Reference in New Issue