Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

DvEncoderVideoPipePGM Class Reference

PGM Pipe for encodedv. More...

Inheritance diagram for DvEncoderVideoPipePGM:

Inheritance graph
[legend]
Collaboration diagram for DvEncoderVideoPipePGM:

Collaboration graph
[legend]
List of all members.

Public Member Functions

bool OpenVideoPipe (char *pipe, int width, int height, bool interlaced=true)
 Open the video pipe.
bool OutputVideoFrame (uint8_t *frame, int size)
 Output a YUV420P image to the pipe.
bool CloseVideo ()
 Close DV Encode pipe.

Private Attributes

int width
int height
int m_pid
int m_writer
GError * m_error

Detailed Description

PGM Pipe for encodedv.

Definition at line 747 of file kino_av_pipe.cc.


Member Function Documentation

bool DvEncoderVideoPipePGM::CloseVideo  )  [virtual]
 

Close DV Encode pipe.

Implements KinoVideoPipe.

Definition at line 808 of file kino_av_pipe.cc.

References m_writer, sigpipe_clear(), and sigpipe_get().

00809 {
00810     sigpipe_clear();
00811     close( m_writer );
00812     return sigpipe_get() == 0;
00813 }

bool DvEncoderVideoPipePGM::OpenVideoPipe char *  pipe,
int  width,
int  height,
bool  interlaced = true
[virtual]
 

Open the video pipe.

Implements KinoVideoPipe.

Definition at line 764 of file kino_av_pipe.cc.

References m_error, m_pid, m_writer, sigpipe_clear(), and sigpipe_get().

00765 {
00766     sigpipe_clear();
00767     char * args[ 4 ];
00768 
00769     args[ 0 ] = "/bin/sh";
00770     args[ 1 ] = "-c";
00771     args[ 2 ] = ( char * )pipe;
00772     args[ 3 ] = NULL;
00773 
00774     g_spawn_async_with_pipes( ".", args, NULL, G_SPAWN_LEAVE_DESCRIPTORS_OPEN, NULL, NULL, &m_pid, &m_writer, NULL, NULL, &m_error );
00775     
00776     this->width = width;
00777     this->height = height;
00778     return m_writer != -1 && sigpipe_get() == 0;
00779 }

bool DvEncoderVideoPipePGM::OutputVideoFrame uint8_t *  frame,
int  size
[virtual]
 

Output a YUV420P image to the pipe.

Implements KinoVideoPipe.

Definition at line 784 of file kino_av_pipe.cc.

References height, m_writer, sigpipe_clear(), sigpipe_get(), and width.

00785 {
00786     sigpipe_clear();
00787     char output[ 256 ];
00788     sprintf( output, "P5\n%d %d\n255\n", width, height * 3 / 2 );
00789     write( m_writer, output, strlen( output ) );
00790     write( m_writer, frame, width * height );
00791     int h = height >> 1;
00792     int w = width >> 1;
00793     uint8_t *ptr1 = frame + width * height;
00794     uint8_t *ptr2 = ptr1 + ( w * h ) ;
00795     for ( int i = 0; i < h; i++ )
00796     {
00797         write( m_writer, ptr1, w );
00798         write( m_writer, ptr2, w );
00799         ptr1 += w;
00800         ptr2 += w;
00801     }
00802     return sigpipe_get() == 0;
00803 }


Member Data Documentation

int DvEncoderVideoPipePGM::height [private]
 

Definition at line 751 of file kino_av_pipe.cc.

Referenced by OutputVideoFrame().

GError* DvEncoderVideoPipePGM::m_error [private]
 

Definition at line 753 of file kino_av_pipe.cc.

Referenced by OpenVideoPipe().

int DvEncoderVideoPipePGM::m_pid [private]
 

Definition at line 752 of file kino_av_pipe.cc.

Referenced by OpenVideoPipe().

int DvEncoderVideoPipePGM::m_writer [private]
 

Definition at line 752 of file kino_av_pipe.cc.

Referenced by CloseVideo(), OpenVideoPipe(), and OutputVideoFrame().

int DvEncoderVideoPipePGM::width [private]
 

Definition at line 750 of file kino_av_pipe.cc.

Referenced by OutputVideoFrame().


The documentation for this class was generated from the following file:
Generated on Sun Mar 11 22:12:48 2007 for Kino by  doxygen 1.4.2