aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-05-30 23:52:05 +0200
committerMax Kellermann <max@duempel.org>2010-05-30 23:59:36 +0200
commit28f5803d34eb84b2699866be52b185c1a5f139fd (patch)
tree4e85bb25f7004b2de1b59368e72f86312c89bed8 /src
parent0b722998575eb3d12299283daa468d19848d2d25 (diff)
downloadmpd-28f5803d34eb84b2699866be52b185c1a5f139fd.tar.gz
mpd-28f5803d34eb84b2699866be52b185c1a5f139fd.tar.xz
mpd-28f5803d34eb84b2699866be52b185c1a5f139fd.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_decoder_plugin.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/decoder/vorbis_decoder_plugin.c b/src/decoder/vorbis_decoder_plugin.c
index 65d86cdc8..cf05626f2 100644
--- a/src/decoder/vorbis_decoder_plugin.c
+++ b/src/decoder/vorbis_decoder_plugin.c
@@ -97,6 +97,13 @@ static long ogg_tell_cb(void *data)
return (long)vis->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_strerror(int code)
{
@@ -251,7 +258,6 @@ vorbis_stream_decode(struct decoder *decoder,
{
GError *error = NULL;
OggVorbis_File vf;
- ov_callbacks callbacks;
struct vorbis_input_stream vis;
struct audio_format audio_format;
float total_time;
@@ -275,11 +281,8 @@ vorbis_stream_decode(struct decoder *decoder,
vis.input_stream = input_stream;
vis.seekable = oggvorbis_seekable(input_stream);
- 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(&vis, &vf, NULL, 0, callbacks)) < 0) {
+ if ((ret = ov_open_callbacks(&vis, &vf, NULL, 0,
+ vorbis_is_callbacks)) < 0) {
if (decoder_get_command(decoder) != DECODE_COMMAND_NONE)
return;