decoder/ogg_common: rename to ogg_codec.c

This commit is contained in:
Max Kellermann 2012-09-04 13:05:12 +02:00
parent 5a52e91350
commit ebf481e1a1
5 changed files with 20 additions and 20 deletions

View File

@ -588,7 +588,7 @@ endif
if HAVE_OGG_COMMON if HAVE_OGG_COMMON
libdecoder_plugins_a_SOURCES += \ libdecoder_plugins_a_SOURCES += \
src/decoder/ogg_common.c src/decoder/ogg_common.h src/decoder/ogg_codec.c src/decoder/ogg_codec.h
endif endif
if HAVE_FLAC_COMMON if HAVE_FLAC_COMMON

View File

@ -23,7 +23,7 @@
#include "flac_metadata.h" #include "flac_metadata.h"
#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7 #if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7
#include "ogg_common.h" #include "ogg_codec.h"
#endif #endif
#include <glib.h> #include <glib.h>
@ -433,10 +433,10 @@ oggflac_scan_file(const char *file,
static void static void
oggflac_decode(struct decoder *decoder, struct input_stream *input_stream) oggflac_decode(struct decoder *decoder, struct input_stream *input_stream)
{ {
if (ogg_stream_type_detect(decoder, input_stream) != FLAC) if (ogg_codec_detect(decoder, input_stream) != OGG_CODEC_FLAC)
return; return;
/* rewind the stream, because ogg_stream_type_detect() has /* rewind the stream, because ogg_codec_detect() has
moved it */ moved it */
input_stream_lock_seek(input_stream, 0, SEEK_SET, NULL); input_stream_lock_seek(input_stream, 0, SEEK_SET, NULL);

View File

@ -22,10 +22,10 @@
*/ */
#include "config.h" #include "config.h"
#include "ogg_common.h" #include "ogg_codec.h"
enum ogg_stream_type enum ogg_codec
ogg_stream_type_detect(struct decoder *decoder, struct input_stream *is) ogg_codec_detect(struct decoder *decoder, struct input_stream *is)
{ {
/* oggflac detection based on code in ogg123 and this post /* oggflac detection based on code in ogg123 and this post
* http://lists.xiph.org/pipermail/flac/2004-December/000393.html * http://lists.xiph.org/pipermail/flac/2004-December/000393.html
@ -33,13 +33,13 @@ ogg_stream_type_detect(struct decoder *decoder, struct input_stream *is)
unsigned char buf[41]; unsigned char buf[41];
size_t r = decoder_read(decoder, is, buf, sizeof(buf)); size_t r = decoder_read(decoder, is, buf, sizeof(buf));
if (r < sizeof(buf) || memcmp(buf, "OggS", 4) != 0) if (r < sizeof(buf) || memcmp(buf, "OggS", 4) != 0)
return VORBIS; return OGG_CODEC_VORBIS;
if ((memcmp(buf + 29, "FLAC", 4) == 0 && if ((memcmp(buf + 29, "FLAC", 4) == 0 &&
memcmp(buf + 37, "fLaC", 4) == 0) || memcmp(buf + 37, "fLaC", 4) == 0) ||
memcmp(buf + 28, "FLAC", 4) == 0 || memcmp(buf + 28, "FLAC", 4) == 0 ||
memcmp(buf + 28, "fLaC", 4) == 0) memcmp(buf + 28, "fLaC", 4) == 0)
return FLAC; return OGG_CODEC_FLAC;
return VORBIS; return OGG_CODEC_VORBIS;
} }

View File

@ -21,17 +21,17 @@
* Common functions used for Ogg data streams (Ogg-Vorbis and OggFLAC) * Common functions used for Ogg data streams (Ogg-Vorbis and OggFLAC)
*/ */
#ifndef MPD_OGG_COMMON_H #ifndef MPD_OGG_CODEC_H
#define MPD_OGG_COMMON_H #define MPD_OGG_CODEC_H
#include "decoder_api.h" #include "decoder_api.h"
enum ogg_stream_type { enum ogg_codec {
VORBIS, OGG_CODEC_VORBIS,
FLAC, OGG_CODEC_FLAC,
}; };
enum ogg_stream_type enum ogg_codec
ogg_stream_type_detect(struct decoder *decoder, struct input_stream *is); ogg_codec_detect(struct decoder *decoder, struct input_stream *is);
#endif /* _OGG_COMMON_H */ #endif /* _OGG_COMMON_H */

View File

@ -19,7 +19,7 @@
#include "config.h" #include "config.h"
#include "vorbis_comments.h" #include "vorbis_comments.h"
#include "ogg_common.h" #include "ogg_codec.h"
#include "audio_check.h" #include "audio_check.h"
#include "uri.h" #include "uri.h"
#include "tag_handler.h" #include "tag_handler.h"
@ -184,10 +184,10 @@ vorbis_stream_decode(struct decoder *decoder,
const vorbis_info *vi; const vorbis_info *vi;
enum decoder_command cmd = DECODE_COMMAND_NONE; enum decoder_command cmd = DECODE_COMMAND_NONE;
if (ogg_stream_type_detect(decoder, input_stream) != VORBIS) if (ogg_codec_detect(decoder, input_stream) != OGG_CODEC_VORBIS)
return; return;
/* rewind the stream, because ogg_stream_type_detect() has /* rewind the stream, because ogg_codec_detect() has
moved it */ moved it */
input_stream_lock_seek(input_stream, 0, SEEK_SET, NULL); input_stream_lock_seek(input_stream, 0, SEEK_SET, NULL);