00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00029 #if ! defined( LIBDV_CODEC_HH )
00030 #define LIBDV_CODEC_HH
00031
00032
00033 #include "libpiave/piave_base.hh"
00034 #include "libpiave/avstream.hh"
00035
00036
00037 #include <libdv/dv.h>
00038 #include <libdv/dv_types.h>
00039
00040
00041 namespace PIAVE {
00042
00043
00044
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
00060 static uint8_t tmp_buffer[ 720 * 576 * 3 ];
00061 };
00062
00063
00064
00065
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
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