decoder/vorbis: make VorbisInputStream::input_stream a reference
This commit is contained in:
parent
36c9e95969
commit
374c6a27db
@ -51,18 +51,18 @@
|
|||||||
struct VorbisInputStream {
|
struct VorbisInputStream {
|
||||||
Decoder *const decoder;
|
Decoder *const decoder;
|
||||||
|
|
||||||
InputStream *const input_stream;
|
InputStream &input_stream;
|
||||||
bool seekable;
|
bool seekable;
|
||||||
|
|
||||||
VorbisInputStream(Decoder *_decoder, InputStream &_is)
|
VorbisInputStream(Decoder *_decoder, InputStream &_is)
|
||||||
:decoder(_decoder), input_stream(&_is),
|
:decoder(_decoder), input_stream(_is),
|
||||||
seekable(input_stream->CheapSeeking()) {}
|
seekable(input_stream.CheapSeeking()) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
static size_t ogg_read_cb(void *ptr, size_t size, size_t nmemb, void *data)
|
static size_t ogg_read_cb(void *ptr, size_t size, size_t nmemb, void *data)
|
||||||
{
|
{
|
||||||
VorbisInputStream *vis = (VorbisInputStream *)data;
|
VorbisInputStream *vis = (VorbisInputStream *)data;
|
||||||
size_t ret = decoder_read(vis->decoder, *vis->input_stream,
|
size_t ret = decoder_read(vis->decoder, vis->input_stream,
|
||||||
ptr, size * nmemb);
|
ptr, size * nmemb);
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
@ -78,7 +78,7 @@ static int ogg_seek_cb(void *data, ogg_int64_t offset, int whence)
|
|||||||
return vis->seekable &&
|
return vis->seekable &&
|
||||||
(vis->decoder == nullptr ||
|
(vis->decoder == nullptr ||
|
||||||
decoder_get_command(*vis->decoder) != DecoderCommand::STOP) &&
|
decoder_get_command(*vis->decoder) != DecoderCommand::STOP) &&
|
||||||
vis->input_stream->LockSeek(offset, whence, error)
|
vis->input_stream.LockSeek(offset, whence, error)
|
||||||
? 0 : -1;
|
? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ static long ogg_tell_cb(void *data)
|
|||||||
{
|
{
|
||||||
VorbisInputStream *vis = (VorbisInputStream *)data;
|
VorbisInputStream *vis = (VorbisInputStream *)data;
|
||||||
|
|
||||||
return (long)vis->input_stream->GetOffset();
|
return (long)vis->input_stream.GetOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
static const ov_callbacks vorbis_is_callbacks = {
|
static const ov_callbacks vorbis_is_callbacks = {
|
||||||
|
Loading…
Reference in New Issue
Block a user