KVIrc 5.2.6
Developer APIs
KviOggTheoraEncoder Class Reference

An ogg/theora+irct encoder class; accepts argb32 images and binary text, outputs an ogg stream. More...

#include <KviOggTheoraEncoder.h>

Public Member Functions

void addTextFrame (unsigned char *textPkt, int textSize)
 Appends a text frame to the stream.
 
void addVideoFrame (QRgb *rgb32, int videoSize)
 Appends a video frame to the stream.
 
 KviOggTheoraEncoder (KviDataBuffer *stream, int iWidth=320, int iHeight=240, int iFpsN=5, int iFpsD=1, int iParN=4, int iParD=3)
 Constructs the KviOggTheoraEncoder object.
 
virtual ~KviOggTheoraEncoder ()
 Destroys the KviOggTheoraEncoder object.
 

Private Member Functions

int fetch_and_process_video (quint8 *videoYuv, ogg_page *videopage, ogg_stream_state *to, th_enc_ctx *td, int videoflag)
 Internal function that processes a video frame to create an ogg page.
 
int fetch_and_process_video_packet (quint8 *videoYuv, th_enc_ctx *td, ogg_packet *op)
 Internal function that processes a video frame to create an ogg packet.
 

Static Private Member Functions

static int ilog (unsigned _v)
 Internal function used to calculate our granule shift.
 

Private Attributes

int frame_state
 
KviOggTheoraGeometry geometry
 
KviDataBufferm_pStream
 
ogg_page og
 
ogg_packet op
 
th_comment tc
 
th_enc_ctx * td
 
ogg_int64_t text_sofar
 
int textflag
 
th_info ti
 
ogg_stream_state to
 
int videoflag
 
quint8 * videoYuv
 
size_t y4m_aux_buf_read_sz
 
size_t y4m_aux_buf_sz
 
size_t y4m_dst_buf_read_sz
 
size_t y4m_dst_buf_sz
 
unsigned char * yuvframe [3]
 
ogg_stream_state zo
 

Detailed Description

An ogg/theora+irct encoder class; accepts argb32 images and binary text, outputs an ogg stream.

Constructor & Destructor Documentation

◆ KviOggTheoraEncoder()

KviOggTheoraEncoder::KviOggTheoraEncoder ( KviDataBuffer * stream,
int iWidth = 320,
int iHeight = 240,
int iFpsN = 5,
int iFpsD = 1,
int iParN = 4,
int iParD = 3 )

Constructs the KviOggTheoraEncoder object.

Parameters
streamthe output stream object
iWidthwidth of the stream
iHeightheight of the stream
iFpsNframes per second: numerator
iFpsDframes per second: denominator
iParNaspect ratio: numerator
iParDaspect ratio: denominator
Returns
KviOggTheoraEncoder

References frame_state, geometry, ilog(), KviOggIrcText::irct_encode_headerout(), KviOggIrcText::irct_encode_init(), m_pStream, og, op, tc, td, text_sofar, ti, to, videoflag, videoYuv, y4m_aux_buf_read_sz, y4m_aux_buf_sz, y4m_dst_buf_read_sz, y4m_dst_buf_sz, and zo.

◆ ~KviOggTheoraEncoder()

KviOggTheoraEncoder::~KviOggTheoraEncoder ( )
virtual

Destroys the KviOggTheoraEncoder object.

References KviOggIrcText::irct_encode_clear(), tc, td, and to.

Member Function Documentation

◆ addTextFrame()

void KviOggTheoraEncoder::addTextFrame ( unsigned char * textPkt,
int textSize )

Appends a text frame to the stream.

Parameters
textPktbuffer containing the text
textSizesize of the text buffer
Returns
void

References KviOggIrcText::irct_encode_packetout(), m_pStream, op, text_sofar, textflag, and zo.

◆ addVideoFrame()

void KviOggTheoraEncoder::addVideoFrame ( QRgb * rgb32,
int videoSize )

Appends a video frame to the stream.

Parameters
rgb32video frame as a matrix of rgb32 pixels
videoSizesize of the video frame
Returns
void

References fetch_and_process_video(), geometry, m_pStream, rgb32toyuv444(), td, to, videoflag, videoYuv, and YUV444_BPP.

◆ fetch_and_process_video()

int KviOggTheoraEncoder::fetch_and_process_video ( quint8 * videoYuv,
ogg_page * videopage,
ogg_stream_state * to,
th_enc_ctx * td,
int videoflag )
private

Internal function that processes a video frame to create an ogg page.

Returns
int

References fetch_and_process_video_packet(), op, td, to, videoflag, and videoYuv.

Referenced by addVideoFrame().

◆ fetch_and_process_video_packet()

int KviOggTheoraEncoder::fetch_and_process_video_packet ( quint8 * videoYuv,
th_enc_ctx * td,
ogg_packet * op )
private

Internal function that processes a video frame to create an ogg packet.

Returns
int

References frame_state, geometry, op, td, videoYuv, y4m_aux_buf_read_sz, y4m_aux_buf_sz, y4m_dst_buf_read_sz, y4m_dst_buf_sz, and yuvframe.

Referenced by fetch_and_process_video().

◆ ilog()

int KviOggTheoraEncoder::ilog ( unsigned _v)
staticprivate

Internal function used to calculate our granule shift.

Returns
int

Referenced by KviOggTheoraEncoder().

Member Data Documentation

◆ frame_state

int KviOggTheoraEncoder::frame_state
private

Internal flag used in video frame processing

Referenced by fetch_and_process_video_packet(), and KviOggTheoraEncoder().

◆ geometry

KviOggTheoraGeometry KviOggTheoraEncoder::geometry
private

Stream geometry definition

Referenced by addVideoFrame(), fetch_and_process_video_packet(), and KviOggTheoraEncoder().

◆ m_pStream

KviDataBuffer* KviOggTheoraEncoder::m_pStream
private

Stream pointer

Referenced by addTextFrame(), addVideoFrame(), and KviOggTheoraEncoder().

◆ og

ogg_page KviOggTheoraEncoder::og
private

One Ogg bitstream page. Vorbis packets are inside

Referenced by KviOggTheoraEncoder().

◆ op

ogg_packet KviOggTheoraEncoder::op
private

◆ tc

th_comment KviOggTheoraEncoder::tc
private

Theora stream comments struct

Referenced by KviOggTheoraEncoder(), and ~KviOggTheoraEncoder().

◆ td

th_enc_ctx* KviOggTheoraEncoder::td
private

◆ text_sofar

ogg_int64_t KviOggTheoraEncoder::text_sofar
private

Number of transmitted text frames

Referenced by addTextFrame(), and KviOggTheoraEncoder().

◆ textflag

int KviOggTheoraEncoder::textflag
private

Internal flag used in text frame processing

Referenced by addTextFrame().

◆ ti

th_info KviOggTheoraEncoder::ti
private

Theora stream info struct

Referenced by KviOggTheoraEncoder().

◆ to

ogg_stream_state KviOggTheoraEncoder::to
private

Take physical pages, weld into a logical stream of theora packets

Referenced by addVideoFrame(), fetch_and_process_video(), KviOggTheoraEncoder(), and ~KviOggTheoraEncoder().

◆ videoflag

int KviOggTheoraEncoder::videoflag
private

Internal flag used in video frame processing

Referenced by addVideoFrame(), fetch_and_process_video(), and KviOggTheoraEncoder().

◆ videoYuv

quint8* KviOggTheoraEncoder::videoYuv
private

◆ y4m_aux_buf_read_sz

size_t KviOggTheoraEncoder::y4m_aux_buf_read_sz
private

The amount to read into the auxiliary buffer

Referenced by fetch_and_process_video_packet(), and KviOggTheoraEncoder().

◆ y4m_aux_buf_sz

size_t KviOggTheoraEncoder::y4m_aux_buf_sz
private

The size of the auxiliary buffer

Referenced by fetch_and_process_video_packet(), and KviOggTheoraEncoder().

◆ y4m_dst_buf_read_sz

size_t KviOggTheoraEncoder::y4m_dst_buf_read_sz
private

The amount to read directly into the converted frame buffer

Referenced by fetch_and_process_video_packet(), and KviOggTheoraEncoder().

◆ y4m_dst_buf_sz

size_t KviOggTheoraEncoder::y4m_dst_buf_sz
private

The size of each converted frame buffer

Referenced by fetch_and_process_video_packet(), and KviOggTheoraEncoder().

◆ yuvframe

unsigned char* KviOggTheoraEncoder::yuvframe[3]
private

Internal struct used in video frame processing

Referenced by fetch_and_process_video_packet().

◆ zo

ogg_stream_state KviOggTheoraEncoder::zo
private

Take physical pages, weld into a logical stream of irct packets

Referenced by addTextFrame(), and KviOggTheoraEncoder().


The documentation for this class was generated from the following files: