From 7093cf278ca023a3b43959f15202c7eabd3f9856 Mon Sep 17 00:00:00 2001 From: Richard Mudgett Date: Thu, 16 Feb 2012 19:51:15 +0000 Subject: Fix compile problem when old version of libvorbisfile v1.1.2 is used. The principle difference between libvorbisfile v1.1.2 and newer (at least v1.2.0) is the addition of the predefined callbacks OV_CALLBACKS_xxx in vorbis/vorbisfile.h used for ov_open_callbacks(). * Updated the configure script to detect if libvorbisfile.h declares OV_CALLBACKS_NOCLOSE. * Copied the declaration of OV_CALLBACKS_NOCLOSE from v1.2.0 to allow v1.1.2 to compile. (closes issue ASTERISK-19370) Reported by: Jonn Taylor ........ Merged revisions 355608 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 355620 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355621 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- formats/format_ogg_vorbis.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'formats') diff --git a/formats/format_ogg_vorbis.c b/formats/format_ogg_vorbis.c index e316d7780..bbd053e98 100644 --- a/formats/format_ogg_vorbis.c +++ b/formats/format_ogg_vorbis.c @@ -80,6 +80,27 @@ struct ogg_vorbis_desc { /* format specific parameters */ int eos; }; +#if !defined(HAVE_VORBIS_OPEN_CALLBACKS) +/* + * Declared for backward compatibility with vorbisfile v1.1.2. + * Code taken from vorbisfile.h v1.2.0. + */ +static int _ov_header_fseek_wrap(FILE *f, ogg_int64_t off, int whence) +{ + if (f == NULL) { + return -1; + } + return fseek(f, off, whence); +} + +static ov_callbacks OV_CALLBACKS_NOCLOSE = { + (size_t (*)(void *, size_t, size_t, void *)) fread, + (int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap, + (int (*)(void *)) NULL, + (long (*)(void *)) ftell +}; +#endif /* !defined(HAVE_VORBIS_OPEN_CALLBACKS) */ + /*! * \brief Create a new OGG/Vorbis filestream and set it up for reading. * \param s File that points to on disk storage of the OGG/Vorbis data. -- cgit v1.2.3