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

KinoMJPEGVideoPipe Class Reference

Pipe for MJPEG lav tools. More...

Inheritance diagram for KinoMJPEGVideoPipe:

Inheritance graph
[legend]
Collaboration diagram for KinoMJPEGVideoPipe:

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 video frame - the input is assumed to be YUV422 and output is YUV420P.
bool CloseVideo ()
 Close the video pipe.

Protected Attributes

FILE * output
int width
int height
int pitches [3]
uint8_t * frame [3]

Detailed Description

Pipe for MJPEG lav tools.

Definition at line 588 of file kino_av_pipe.cc.


Member Function Documentation

bool KinoMJPEGVideoPipe::CloseVideo  )  [virtual]
 

Close the video pipe.

Implements KinoVideoPipe.

Definition at line 648 of file kino_av_pipe.cc.

References frame, output, sigpipe_clear(), and sigpipe_get().

00649 {
00650     sigpipe_clear();
00651     pclose( output );
00652     delete[] frame[ 0 ];
00653     delete[] frame[ 1 ];
00654     delete[] frame[ 2 ];
00655     return sigpipe_get() == 0;
00656 }

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

Open the video pipe.

Implements KinoVideoPipe.

Definition at line 606 of file kino_av_pipe.cc.

References frame, output, pitches, sigpipe_clear(), and sigpipe_get().

00607 {
00608     sigpipe_clear();
00609     output = popen( pipe, "w" );
00610 
00611     this->width = width;
00612     this->height = height;
00613 
00614     pitches[ 0 ] = width * 2;
00615     pitches[ 1 ] = 0;
00616     pitches[ 2 ] = 0;
00617 
00618     frame[ 0 ] = new uint8_t[ width * height ];
00619     frame[ 1 ] = new uint8_t[ width * height / 4 ];
00620     frame[ 2 ] = new uint8_t[ width * height / 4 ];
00621 
00622     int written = 0;
00623     if ( output != NULL )
00624         written = fprintf( output, "YUV4MPEG2 W%d H%d F%s %s\n", width, height, 
00625             height == 576 ? "25:1 A118:81" : "30000:1001 A40:33", interlaced ? "Ib" : "Ip" );
00626 
00627     return written != 0 && sigpipe_get() == 0;
00628 }

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

Output a video frame - the input is assumed to be YUV422 and output is YUV420P.

Implements KinoVideoPipe.

Reimplemented in KinoDeinterlacedMJPEGVideoPipe.

Definition at line 634 of file kino_av_pipe.cc.

References frame, frame_YUV422_to_YUV420P(), height, output, sigpipe_clear(), sigpipe_get(), and width.

00635 {
00636     sigpipe_clear();
00637     fprintf( output, "FRAME\n" );
00638     frame_YUV422_to_YUV420P( frame, pixels, width, height );
00639     fwrite( frame[ 0 ], width * height, 1, output );
00640     fwrite( frame[ 1 ], width * height / 4, 1, output );
00641     fwrite( frame[ 2 ], width * height / 4, 1, output );
00642     return sigpipe_get() == 0;
00643 }


Member Data Documentation

uint8_t* KinoMJPEGVideoPipe::frame[3] [protected]
 

Definition at line 595 of file kino_av_pipe.cc.

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

int KinoMJPEGVideoPipe::height [protected]
 

Definition at line 593 of file kino_av_pipe.cc.

Referenced by KinoDeinterlacedMJPEGVideoPipe::OutputVideoFrame(), and OutputVideoFrame().

FILE* KinoMJPEGVideoPipe::output [protected]
 

Definition at line 591 of file kino_av_pipe.cc.

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

int KinoMJPEGVideoPipe::pitches[3] [protected]
 

Definition at line 594 of file kino_av_pipe.cc.

Referenced by OpenVideoPipe().

int KinoMJPEGVideoPipe::width [protected]
 

Definition at line 592 of file kino_av_pipe.cc.

Referenced by KinoDeinterlacedMJPEGVideoPipe::OutputVideoFrame(), and OutputVideoFrame().


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