1 #ifndef THEORAENCODER_H_
2 #define THEORAENCODER_H_
3 
4 #ifdef HAVE_CONFIG_H
5 #include "config.h"
6 #else
7 #warning only use with autotools
8 #endif
9 
10 #ifdef HAVE_LIBTHEORAENC
11 
12 #include <list>
13 #include <vector>
14 #include <theora/codec.h>
15 #include <theora/theoraenc.h>
16 
17 #include "oggPacket.h"
18 #include "oggComment.h"
19 #include "mediaInputEncoder.h"
20 #include "theoraStreamParameter.h"
21 #include "streamConfig.h"
22 
23 class TheoraEncoder : public MediaInputEncoder {
24 
25 protected:
26 
27   uint64               packetCounter;
28 
29   th_enc_ctx*          theoraState;
30   th_comment           theoraComment;
31   th_info              theoraInfo;
32 
33   std::list<OggPacket> packetList;
34 
35   void createHeader(std::vector<OggPacket>& headerList, std::vector<OggComment>& oggComments);
36 
37 public:
38 
39   TheoraEncoder(uint8 streamNo = 0);
40   virtual ~TheoraEncoder();
41 
42   virtual MediaInputEncoder& operator>>(OggPacket& packet);
43   MediaInputEncoder& operator<<(th_ycbcr_buffer buffer);
44 
45   virtual void configureEncoder(StreamConfig& config, std::vector<OggComment>& oggComments);
46 
47   uint32 width() const;
48   uint32 height() const;
49 
50   th_info&   getInfo();
51 
52   virtual std::string configuration() const;
53 
54   virtual void reset();
55 
56 };
57 
58 #endif /* HAVE_LIBTHEORAENC */
59 
60 #endif /*THEORAENCODER_H_*/
61