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

kino_av_pipe.h

Go to the documentation of this file.
00001 /*
00002 * kino_av_pipe.h -- AV Export Pipe Utilities
00003 * Copyright (C) 2002 Charles Yates <charles.yates@pandora.be>
00004 * Copyright (C) 2002-2007 Dan Dennedy <dan@dennedy.org>
00005 *
00006 * This program is free software; you can redistribute it and/or modify
00007 * it under the terms of the GNU General Public License as published by
00008 * the Free Software Foundation; either version 2 of the License, or
00009 * (at your option) any later version.
00010 *
00011 * This program is distributed in the hope that it will be useful,
00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 * GNU General Public License for more details.
00015 *
00016 * You should have received a copy of the GNU General Public License
00017 * along with this program; if not, write to the Free Software Foundation,
00018 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef _KINO_AV_PIPE_H
00022 #define _KINO_AV_PIPE_H 1
00023 
00024 #include <stdio.h>
00025 #include <stdint.h>
00026 #include <stdlib.h>
00027 #include <sys/types.h>
00028 
00029 class KinoAudioInput
00030 {
00031 public:
00032     virtual ~KinoAudioInput() {}
00033     virtual bool Open( char *input ) = 0;
00034     virtual int GetChannels( ) = 0;
00035     virtual int GetFrequency( ) = 0;
00036     virtual int GetBytesPerSample( ) = 0;
00037     virtual long GetNumberOfSamples( ) = 0;
00038     virtual bool Seek( off_t offset ) = 0;
00039     virtual bool Get( int16_t *data, int numberofsamples ) = 0;
00040     virtual bool Close( ) = 0;
00041 };
00042 
00043 class KinoAudioInputFactory
00044 {
00045 public:
00046     static KinoAudioInput *CreateAudioInput( char *input );
00047 };
00048 
00049 class KinoAudioPipe
00050 {
00051 public:
00052     virtual ~KinoAudioPipe() {}
00053     virtual bool OpenAudio( char *output, int channels, int frequency, int bytespersample ) = 0;
00054     virtual bool OutputAudioFrame( int16_t *audio, int size ) = 0;
00055     virtual bool CloseAudio( ) = 0;
00056 };
00057 
00058 typedef enum {
00059     PIPE_AUDIO_WAV,
00060     PIPE_AUDIO_PCM
00061 } kino_audio_pipe;
00062 
00063 class KinoAudioFactory
00064 {
00065 public:
00066     static KinoAudioPipe *CreateAudioPipe( kino_audio_pipe );
00067 };
00068 
00069 class KinoVideoPipe
00070 {
00071 public:
00072     virtual ~KinoVideoPipe() {}
00073     virtual bool OpenVideoPipe( char *pipe, int width, int height, bool interlaced = true ) = 0;
00074     virtual bool OutputVideoFrame( uint8_t *frame, int size ) = 0;
00075     virtual bool CloseVideo( ) = 0;
00076 };
00077 
00078 typedef enum {
00079     PIPE_VIDEO_MJPEG,
00080     PIPE_VIDEO_DEINTERLACED_MJPEG,
00081     PIPE_VIDEO_DV_YUV,
00082     PIPE_VIDEO_DV_PGM
00083 } kino_video_pipe;
00084 
00085 class KinoVideoFactory
00086 {
00087 public:
00088     static KinoVideoPipe *CreateVideoPipe( kino_video_pipe );
00089 };
00090 
00091 class KinoAVPipe : public KinoAudioPipe, KinoVideoPipe
00092 {
00093 private:
00094     KinoAudioPipe *audio;
00095     KinoVideoPipe *video;
00096 
00097 public:
00098     KinoAVPipe( KinoAudioPipe *audio, KinoVideoPipe *video )
00099     {
00100         this->audio = audio;
00101         this->video = video;
00102     }
00103 
00104     bool OpenAudio( char *output, int channels, int frequency, int bytespersample )
00105     {
00106         return audio->OpenAudio( output, channels, frequency, bytespersample );
00107     }
00108 
00109     bool OpenVideoPipe( char *pipe, int width, int height, bool interlaced = true )
00110     {
00111         return video->OpenVideoPipe( pipe, width, height, interlaced );
00112     }
00113 
00114     bool OutputVideoFrame( uint8_t *frame, int size )
00115     {
00116         return video->OutputVideoFrame( frame, size );
00117     }
00118 
00119     bool OutputAudioFrame( int16_t *frame, int size )
00120     {
00121         return audio->OutputAudioFrame( frame, size );
00122     }
00123 
00124     bool CloseAudio( )
00125     {
00126         return audio->CloseAudio( );
00127     }
00128 
00129     bool CloseVideo( )
00130     {
00131         return video->CloseVideo( );
00132     }
00133 
00134     int ExecuteCommand( char *command )
00135     {
00136         return system( command );
00137     }
00138 };
00139 
00140 #endif
00141 

Generated on Sun Mar 11 22:11:45 2007 for Kino by  doxygen 1.4.2