00001 #ifndef SPDIFENCODER_H_
00002 #define SPDIFENCODER_H_
00003
00004 #include <QString>
00005
00006 #include "output.h"
00007
00008 extern "C" {
00009 #include "libavcodec/avcodec.h"
00010 #include "libavformat/avformat.h"
00011 #include "libavcodec/audioconvert.h"
00012 }
00013
00014 class MPUBLIC SPDIFEncoder
00015 {
00016 public:
00017 SPDIFEncoder(QString muxer, int codec_id);
00018 ~SPDIFEncoder();
00019 void WriteFrame(unsigned char *data, int size);
00020 int GetData(unsigned char *buffer, int &dest_size);
00021 int GetProcessedSize() { return m_size; };
00022 unsigned char *GetProcessedBuffer() { return m_buffer; };
00023 void Reset();
00024 bool Succeeded() { return m_complete; };
00025 bool SetMaxHDRate(int rate);
00026
00027 private:
00028 static int funcIO(void *opaque, unsigned char *buf, int size);
00029 void Destroy();
00030
00031 private:
00032 bool m_complete;
00033 AVFormatContext *m_oc;
00034 AVStream *m_stream;
00035 unsigned char m_buffer[AVCODEC_MAX_AUDIO_FRAME_SIZE];
00036 long m_size;
00037 };
00038
00039 #endif