2010-02-09 05:18:39 +01:00
|
|
|
// Copyright (c) 2008-2010 Raynaldo (Wildicv) Rivera, Joshua (Dark_Kilauea) Jones
|
|
|
|
// This file is part of the "cAudio Engine"
|
|
|
|
// For conditions of distribution and use, see copyright notice in cAudio.h
|
|
|
|
|
2009-06-21 05:24:30 +02:00
|
|
|
#ifndef COGGDECODER_H_INCLUDED
|
|
|
|
#define COGGDECODER_H_INCLUDED
|
|
|
|
|
2010-02-13 03:34:50 +01:00
|
|
|
#include "../include/cAudioDefines.h"
|
|
|
|
|
|
|
|
#ifdef CAUDIO_COMPILE_WITH_OGG_DECODER
|
|
|
|
|
2009-06-21 05:24:30 +02:00
|
|
|
#include "../include/IAudioDecoder.h"
|
|
|
|
#include <ogg/ogg.h>
|
|
|
|
#include <vorbis/codec.h>
|
|
|
|
#include <vorbis/vorbisenc.h>
|
|
|
|
#include <vorbis/vorbisfile.h>
|
|
|
|
|
|
|
|
namespace cAudio
|
|
|
|
{
|
|
|
|
|
|
|
|
class cOggDecoder : public IAudioDecoder
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
cOggDecoder(IDataSource* stream);
|
|
|
|
~cOggDecoder();
|
|
|
|
|
|
|
|
virtual AudioFormats getFormat();
|
|
|
|
virtual int getFrequency();
|
|
|
|
virtual bool isSeekingSupported();
|
2009-12-07 23:25:08 +01:00
|
|
|
virtual bool isValid();
|
2009-06-21 05:24:30 +02:00
|
|
|
virtual int readAudioData(void* output, int amount);
|
|
|
|
virtual bool setPosition(int position, bool relative);
|
2009-08-08 07:51:32 +02:00
|
|
|
virtual bool seek(float seconds,bool relative);
|
2009-06-21 05:24:30 +02:00
|
|
|
|
2009-08-26 01:56:35 +02:00
|
|
|
protected:
|
2010-02-17 02:42:45 +01:00
|
|
|
//! Callbacks used for read memory
|
2009-08-26 01:56:35 +02:00
|
|
|
ov_callbacks vorbisCallbacks;
|
2010-02-17 02:42:45 +01:00
|
|
|
//! Format information
|
2009-08-26 01:56:35 +02:00
|
|
|
vorbis_info* vorbisInfo;
|
2010-02-17 02:42:45 +01:00
|
|
|
//! User Comments
|
2009-08-26 01:56:35 +02:00
|
|
|
vorbis_comment* vorbisComment;
|
2010-02-17 02:42:45 +01:00
|
|
|
//! Stream handle
|
2009-08-08 07:51:32 +02:00
|
|
|
OggVorbis_File oggStream;
|
2009-12-07 23:25:08 +01:00
|
|
|
bool Valid;
|
2009-06-21 05:24:30 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-02-13 03:34:50 +01:00
|
|
|
#endif
|
|
|
|
|
2009-06-21 05:24:30 +02:00
|
|
|
#endif //! COGGDECODER_H_INCLUDED
|