diff options
author | Max Kellermann <max@duempel.org> | 2010-06-30 19:24:41 +0000 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2010-06-30 19:24:41 +0000 |
commit | 4d6d372a5b8f7903bbcbec943587c593ac08df3c (patch) | |
tree | d04c24efccc6aa414663444462f0d4dfe951c5e3 /src | |
parent | 0aeec9059053bf724942831a45e07d43b99b5955 (diff) | |
download | mpd-4d6d372a5b8f7903bbcbec943587c593ac08df3c.tar.gz mpd-4d6d372a5b8f7903bbcbec943587c593ac08df3c.tar.xz mpd-4d6d372a5b8f7903bbcbec943587c593ac08df3c.zip |
decoder/vorbis: use single global ov_callbacks constant
Initialize the ov_callbacks struct at compile time.
Diffstat (limited to '')
-rw-r--r-- | src/decoder/vorbis_plugin.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/decoder/vorbis_plugin.c b/src/decoder/vorbis_plugin.c index 0ff898647..3da56bd5c 100644 --- a/src/decoder/vorbis_plugin.c +++ b/src/decoder/vorbis_plugin.c @@ -97,6 +97,13 @@ static long ogg_tell_cb(void *vdata) return (long)data->input_stream->offset; } +static const ov_callbacks vorbis_is_callbacks = { + .read_func = ogg_read_cb, + .seek_func = ogg_seek_cb, + .close_func = ogg_close_cb, + .tell_func = ogg_tell_cb, +}; + static const char * vorbis_comment_value(const char *comment, const char *needle) { @@ -241,7 +248,6 @@ vorbis_stream_decode(struct decoder *decoder, struct input_stream *input_stream) { OggVorbis_File vf; - ov_callbacks callbacks; OggCallbackData data; struct audio_format audio_format; int current_section; @@ -266,13 +272,9 @@ vorbis_stream_decode(struct decoder *decoder, data.input_stream = input_stream; data.seekable = input_stream->seekable && oggvorbis_seekable(decoder); - callbacks.read_func = ogg_read_cb; - callbacks.seek_func = ogg_seek_cb; - callbacks.close_func = ogg_close_cb; - callbacks.tell_func = ogg_tell_cb; - if ((ret = ov_open_callbacks(&data, &vf, NULL, 0, callbacks)) < 0) { + if ((ret = ov_open_callbacks(&data, &vf, NULL, 0, + vorbis_is_callbacks)) < 0) { const char *error; - if (decoder_get_command(decoder) != DECODE_COMMAND_NONE) return; |