trunk 20080912
[gitenigma.git] / include / lib / codecs / codecmpg.h
blob91f33bd8beb7e2c08e33f96b8969962107aabde5
1 #ifndef DISABLE_FILE
3 #ifndef __lib_codecs_codecmpg_h
4 #define __lib_codecs_codecmpg_h
6 #include <map>
7 #include <set>
8 #include <lib/base/buffer.h>
9 #include <lib/codecs/codec.h>
11 struct syncAudioPacket
13 unsigned int pts;
14 int len;
15 __u8 *data;
18 // mpeg-2 ps demuxer.
19 class eDemux: public eAudioDecoder
21 protected:
22 eIOBuffer &input, &video, &audio;
23 int minFrameLength;
24 int mpegtype;
25 unsigned int curAudioStreamID;
27 unsigned long last, remaining;
28 unsigned long getLong();
29 void refill();
30 unsigned long getBits(unsigned int num);
31 void syncBits();
32 std::map<int,int> audiostreams;
33 std::set<unsigned char> videostreams;
34 int synced;
35 int fd;
36 std::list<syncAudioPacket> syncbuffer;
37 unsigned char *sheader;
38 unsigned int sheader_len;
39 public:
40 void extractSequenceHeader( unsigned char *buf, unsigned int len );
41 eDemux(eIOBuffer &input, eIOBuffer &video, eIOBuffer &audio, int fd);
42 ~eDemux();
43 virtual int decodeMore(int last, int maxsamples, Signal1<void, unsigned int>*newastreamid=0 )=0; // returns number of samples(!) written to IOBuffer (out)
44 void resync(); // clear (secondary) decoder buffers
45 int getMinimumFramelength();
46 int getAverageBitrate();
47 void setAudioStream( unsigned int id );
50 // mpeg-2 ps demuxer.
51 class eMPEGDemux: public eDemux
53 public:
54 eMPEGDemux(eIOBuffer &input, eIOBuffer &video, eIOBuffer &audio, int fd)
55 :eDemux(input, video, audio, fd)
57 int decodeMore(int last, int maxsamples, Signal1<void, unsigned int>*newastreamid=0 ); // returns number of samples(!) written to IOBuffer (out)
60 // PVA demuxer.
61 class ePVADemux: public eDemux
63 public:
64 ePVADemux(eIOBuffer &input, eIOBuffer &video, eIOBuffer &audio, int fd)
65 :eDemux(input, video, audio, fd)
67 int decodeMore(int last, int maxsamples, Signal1<void, unsigned int>*newastreamid=0 ); // returns number of samples(!) written to IOBuffer (out)
70 #endif
72 #endif //DISABLE_FILE