1 #ifndef GAME_SOUND_FFMPEG_DECODER_H
2 #define GAME_SOUND_FFMPEG_DECODER_H
7 #include <libavcodec/avcodec.h>
8 #include <libavformat/avformat.h>
13 #if AV_VERSION_INT(52, 2, 0) <= AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
14 LIBAVUTIL_VERSION_MINOR, LIBAVUTIL_VERSION_MICRO)
15 #include <libavutil/channel_layout.h>
18 #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1)
19 #define av_frame_alloc avcodec_alloc_frame
25 #include <libswresample/swresample.h>
62 static int readPacket(
void *user_data, uint8_t *
buf,
int buf_size);
63 static int writePacket(
void *user_data, uint8_t *
buf,
int buf_size);
64 static int64_t
seek(
void *user_data, int64_t offset,
int whence);
69 virtual void open(
const std::string &fname);
75 virtual size_t read(
char *buffer,
size_t bytes);
76 virtual void readAll(std::vector<char> &output);
79 void fail(
const std::string &msg);
90 #ifndef DEFAULT_DECODER
91 #define DEFAULT_DECODER (::MWSound::FFmpeg_Decoder)
virtual void readAll(std::vector< char > &output)
Definition: ffmpeg_decoder.cpp:378
int mFrameSize
Definition: ffmpeg_decoder.hpp:46
Files::IStreamPtr mDataStream
Definition: ffmpeg_decoder.hpp:60
bool getAVAudioData()
Definition: ffmpeg_decoder.cpp:95
SampleType
Definition: sound_decoder.hpp:14
void fail(const std::string &msg)
Definition: ffmpeg_decoder.cpp:14
virtual void open(const std::string &fname)
Definition: ffmpeg_decoder.cpp:183
SwrContext * mSwr
Definition: ffmpeg_decoder.hpp:51
virtual size_t getSampleOffset()
Definition: ffmpeg_decoder.cpp:392
uint8_t * mDataBuf
Definition: ffmpeg_decoder.hpp:54
int64_t mOutputChannelLayout
Definition: ffmpeg_decoder.hpp:53
FFmpeg_Decoder & operator=(const FFmpeg_Decoder &rhs)
FFmpeg_Decoder(const FFmpeg_Decoder &rhs)
Definition: ffmpeg_decoder.hpp:38
virtual std::string getName()
Definition: ffmpeg_decoder.cpp:292
int mFramePos
Definition: ffmpeg_decoder.hpp:47
double mNextPts
Definition: ffmpeg_decoder.hpp:49
AVPacket mPacket
Definition: ffmpeg_decoder.hpp:43
uint8_t ** mFrameData
Definition: ffmpeg_decoder.hpp:55
virtual ~FFmpeg_Decoder()
Definition: ffmpeg_decoder.cpp:427
AVFrame * mFrame
Definition: ffmpeg_decoder.hpp:44
AVFormatContext * mFormatCtx
Definition: ffmpeg_decoder.hpp:40
boost::shared_ptr< std::istream > IStreamPtr
Definition: constrainedfilestream.hpp:20
static int64_t seek(void *user_data, int64_t offset, int whence)
Definition: ffmpeg_decoder.cpp:39
virtual void getInfo(int *samplerate, ChannelConfig *chans, SampleType *type)
Definition: ffmpeg_decoder.cpp:297
static int writePacket(void *user_data, uint8_t *buf, int buf_size)
Definition: ffmpeg_decoder.cpp:34
AVStream ** mStream
Definition: ffmpeg_decoder.hpp:41
static int readPacket(void *user_data, uint8_t *buf, int buf_size)
Definition: ffmpeg_decoder.cpp:19
virtual void close()
Definition: ffmpeg_decoder.cpp:258
virtual size_t read(char *buffer, size_t bytes)
Definition: ffmpeg_decoder.cpp:371
bool getNextPacket()
Definition: ffmpeg_decoder.cpp:72
char buf[1024]
Definition: crashcatcher.cpp:54
Definition: soundmanagerimp.hpp:45
int mDataBufLen
Definition: ffmpeg_decoder.hpp:56
enum AVSampleFormat mOutputSampleFormat
Definition: ffmpeg_decoder.hpp:52
The main class responsible for loading files from a virtual file system.
Definition: manager.hpp:20
Definition: sound_decoder.hpp:33
ChannelConfig
Definition: sound_decoder.hpp:21
size_t readAVAudioData(void *data, size_t length)
Definition: ffmpeg_decoder.cpp:152