Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

libdv_codec.hh

00001 /*
00002  * PIAVE - PIAVE Is A Video Editor
00003  *
00004  * Copyright (C) 2002 Rolf Dubitzky, rolf@dubitzky.de
00005  *
00006  */
00007 
00008 /*
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software Foundation,
00021  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00022  */
00023 
00024 
00029 #if ! defined( LIBDV_CODEC_HH )
00030 #define LIBDV_CODEC_HH
00031 
00032 // PIAVE
00033 #include "libpiave/piave_base.hh"
00034 #include "libpiave/avstream.hh"
00035 
00036 // other libs
00037 #include <libdv/dv.h>
00038 #include <libdv/dv_types.h>
00039 
00040 
00041 namespace PIAVE {
00042 
00043     /*
00044      *    some constants
00045      */
00046     struct LibDV 
00047     {
00048         static const ssize_t       PAL_FRAMESIZE  = 144000;   
00049         static const ssize_t       NTSC_FRAMESIZE = 120000;   
00050         static const double        PAL_FPS        = 25;       
00051         static const unsigned int  PAL_WIDTH      = 720;      
00052         static const unsigned int  PAL_HEIGHT     = 576;      
00053         static const double        NTSC_FPS       = 29.97;    
00054         static const unsigned int  NTSC_WIDTH     = 720;      
00055         static const unsigned int  NTSC_HEIGHT    = 480;      
00056         static const double        ASPECT_4x3     = 4.0/3.0;  
00057         static const double        ASPECT_16x9    = 16.0/9.0; 
00058 
00059         /* that's more than enough dummy space  */
00060         static uint8_t             tmp_buffer[ 720 * 576 * 3 ];
00061     };
00062 
00063 
00064     /*
00065      *    plugin wrapper for raw DV codec
00066      */
00067     class LibDVDecoderPlugin : public Plugin
00068     {
00069       public:
00070         LibDVDecoderPlugin();
00071         virtual PluginBase * newElement( const PropertyNode * p = 0 );
00072     };
00073 
00074     class LibDVEncoderPlugin : public Plugin
00075     {
00076       public:
00077         LibDVEncoderPlugin();
00078         virtual PluginBase * newElement( const PropertyNode * p = 0 );
00079     };
00080 
00087     class LibDVDecoder : public AVDecoderIFace
00088     {
00089       public:
00090         LibDVDecoder();
00091 
00092         virtual void decodeMetaData( Frame & f, PropertyNode * p );
00093         virtual void decodeVideo( Frame & f, uint8_t * dest = 0 );
00094         virtual void decodeAudio( Frame & f, uint8_t * dest = 0 );
00095 
00096         virtual PropertyNode * getProperties( PropertyNode * p) const;
00097 //        virtual PropertyNode * getFrameProperties( PropertyNode * ) const;
00098 
00099         virtual bool init( uint8_t * data = 0 ) throw (exception);
00100         dv_decoder_t * get_dv_decoder() const { return _dv_decoder; }
00101         
00102         int  getFrameSize() const { return _frameSize; }
00103         bool isNewRecording( Frame * f ) const;
00104 
00105 
00106       private:
00107         dv_decoder_t     * _dv_decoder;
00108         dv_system_t        _dv_video_system;
00109         int                _frameSize;
00110 
00111         int                _pitches[3];
00112         uint8_t          * _pixels[3];
00113 
00114     };
00115 
00116     class LibDVEncoder : public AVEncoderIFace
00117     {
00118       public:
00119         LibDVEncoder();
00120         virtual void encodeVideo( Frame & f, uint8_t * dest = 0 ) ;
00121         virtual void encodeAudio( Frame & f, uint8_t * dest = 0 ) ;
00122         virtual PropertyNode * getProperties( PropertyNode * p ) const;
00123         int  getFrameSize() const { return _frameSize; }
00124 
00125         virtual bool init( uint8_t * data = 0 ) throw (exception);
00126                 
00127       private:
00128         dv_encoder_t *     _dv_encoder;
00129         dv_system_t        _dv_video_system;
00130         int                _frameSize;
00131 
00132         int                _pitches[3];
00133         uint8_t          * _pixels[3];
00134 
00135     };
00136 
00137 
00138 }
00139 
00140 #endif

Generated on Tue Oct 14 20:45:36 2003 for piave by doxygen1.2.18