KVIrc  4.9.2
DeveloperAPIs
KviOggTheoraEncoder.h
Go to the documentation of this file.
1 #ifndef _KVIOGGTHEORAENCODER_H_
2 #define _KVIOGGTHEORAENCODER_H_
3 
4 //=============================================================================
5 //
6 // File : KviOggTheoraEncoder.h
7 // Creation date : Wed Dec 29 2010 15:51:21 CEST by Elvio Basello
8 //
9 // This file is part of the KVIrc IRC client distribution
10 // Copyright (C) 2010 Elvio Basello (hellvis69 at gmail dot com)
11 //
12 // This program is FREE software. You can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the HOPE that it will be USEFUL,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 // See the GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program. If not, write to the Free Software Foundation,
24 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 //
26 //=============================================================================
27 
36 #ifndef COMPILE_DISABLE_OGG_THEORA
37 
38 #include "kvi_settings.h"
39 #include "KviOggTheoraGeometry.h"
40 
41 #include "theora/theoraenc.h"
42 
43 #include <QColor>
44 
45 class KviDataBuffer;
46 
50 #define YUV444_BPP 3
51 
57 {
58 public:
70  KviOggTheoraEncoder(KviDataBuffer * stream, int iWidth = 320, int iHeight = 240, int iFpsN = 5, int iFpsD = 1, int iParN = 4, int iParD = 3);
71 
75  virtual ~KviOggTheoraEncoder();
76 
77 private:
80  quint8 * videoYuv;
82  ogg_int64_t text_sofar;
85  unsigned char * yuvframe[3];
87  size_t y4m_dst_buf_sz;
89  size_t y4m_aux_buf_sz;
92  ogg_stream_state zo;
93  ogg_stream_state to;
94  ogg_page og;
95  ogg_packet op;
97  th_enc_ctx * td;
98  th_info ti;
99  th_comment tc;
101  int textflag;
102  int videoflag;
103 public:
110  void addVideoFrame(QRgb * rgb32, int videoSize);
111 
118  void addTextFrame(unsigned char * textPkt, int textSize);
119 
120 private:
125  int fetch_and_process_video(quint8 * videoYuv, ogg_page * videopage, ogg_stream_state * to, th_enc_ctx * td, int videoflag);
126 
131  int fetch_and_process_video_packet(quint8 * videoYuv, th_enc_ctx * td, ogg_packet * op);
132 
137  static int ilog(unsigned _v);
138 };
139 
140 #endif // COMPILE_DISABLE_OGG_THEORA
141 #endif // _KVIOGGTHEORAENCODER_H_
int videoflag
Definition: KviOggTheoraEncoder.h:102
quint8 * videoYuv
Definition: KviOggTheoraEncoder.h:80
size_t y4m_dst_buf_sz
Definition: KviOggTheoraEncoder.h:87
ogg_packet op
Definition: KviOggTheoraEncoder.h:95
size_t y4m_aux_buf_read_sz
Definition: KviOggTheoraEncoder.h:90
KviDataBuffer * m_pStream
Definition: KviOggTheoraEncoder.h:79
Definition: KviDataBuffer.h:30
This file was originally part of KviTheoraDecoder.h.
th_comment tc
Definition: KviOggTheoraEncoder.h:99
ogg_int64_t text_sofar
Definition: KviOggTheoraEncoder.h:82
ogg_stream_state to
Definition: KviOggTheoraEncoder.h:93
KviOggTheoraGeometry geometry
Definition: KviOggTheoraEncoder.h:78
int frame_state
Definition: KviOggTheoraEncoder.h:84
ogg_stream_state zo
Definition: KviOggTheoraEncoder.h:92
size_t y4m_aux_buf_sz
Definition: KviOggTheoraEncoder.h:89
ogg_page og
Definition: KviOggTheoraEncoder.h:94
th_info ti
Definition: KviOggTheoraEncoder.h:98
int textflag
Definition: KviOggTheoraEncoder.h:101
This file contains compile time settings.
An ogg/theora+irct encoder class; accepts argb32 images and binary text, outputs an ogg stream...
Definition: KviOggTheoraEncoder.h:56
Definition: KviOggTheoraGeometry.h:40
#define KVILIB_API
Definition: kvi_settings.h:125
th_enc_ctx * td
Definition: KviOggTheoraEncoder.h:97
size_t y4m_dst_buf_read_sz
Definition: KviOggTheoraEncoder.h:88