3 * Copyright (C) 2000 Arne Schirmacher <arne@schirmacher.de>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef _FILEHANDLER_H
21 #define _FILEHANDLER_H
23 // enum { PAL_FORMAT, NTSC_FORMAT, AVI_DV1_FORMAT, AVI_DV2_FORMAT, QT_FORMAT, RAW_FORMAT, TEST_FORMAT, UNDEFINED };
33 #include <sys/types.h>
36 enum { AVI, PLAYLIST, RAW_DV, QT, UNKNOWN_FORMAT };
37 enum { PAL_FORMAT, NTSC_FORMAT, AVI_DV1_FORMAT, AVI_DV2_FORMAT, QT_FORMAT, RAW_FORMAT, TEST_FORMAT, UNDEFINED };
38 enum { DISPLAY_XX, DISPLAY_GDKRGB, DISPLAY_GDKRGB32, DISPLAY_XV, DISPLAY_SDL };
40 enum { NORM_UNSPECIFIED=0, NORM_PAL=1, NORM_NTSC=2 };
41 enum { AUDIO_32KHZ=0, AUDIO_44KHZ=1, AUDIO_48KHZ=2 };
42 enum { ASPECT_43=0, ASPECT_169=1 };
44 enum FileCaptureMode {
57 static FileTracker &GetInstance( );
58 void SetMode( FileCaptureMode );
59 FileCaptureMode GetMode( );
62 void Add( const char * );
65 static FileTracker *instance;
75 virtual ~FileHandler();
77 virtual bool GetAutoSplit() const;
78 virtual bool GetTimeStamp() const;
79 virtual string GetBaseName() const;
80 virtual string GetExtension() const;
81 virtual int GetMaxFrameCount() const;
82 virtual off_t GetMaxFileSize() const;
83 virtual off_t GetFileSize() = 0;
84 virtual int GetTotalFrames() = 0;
85 virtual string GetFilename() const;
87 virtual void SetAutoSplit( bool );
88 virtual void SetTimeStamp( bool );
89 virtual void SetBaseName( const string& base );
90 virtual void SetMaxFrameCount( int );
91 virtual void SetEveryNthFrame( int );
92 virtual void SetMaxFileSize( off_t );
93 //virtual void SetSampleFrame( const Frame& sample );
95 //virtual bool WriteFrame( const Frame& frame );
96 virtual bool FileIsOpen() = 0;
97 virtual bool Create( const string& filename ) = 0;
98 //virtual int Write( const Frame& frame ) = 0;
99 virtual int Close() = 0;
100 virtual bool Done( void );
102 virtual bool Open( const char *s ) = 0;
103 virtual int GetFrame( uint8_t *data, int frameNum ) = 0;
104 int GetFramesWritten() const
106 return framesWritten;
124 class RawHandler: public FileHandler
133 bool Create( const string& filename );
134 //int Write( const Frame& frame );
137 int GetTotalFrames();
138 bool Open( const char *s );
139 int GetFrame( uint8_t *data, int frameNum );
145 class AVIHandler: public FileHandler
148 AVIHandler( int format = AVI_DV1_FORMAT );
151 //void SetSampleFrame( const Frame& sample );
153 bool Create( const string& filename );
154 //int Write( const Frame& frame );
157 int GetTotalFrames();
158 bool Open( const char *s );
159 int GetFrame( uint8_t *data, int frameNum );
160 bool GetOpenDML() const;
161 void SetOpenDML( bool );
162 int GetFormat() const
170 //AudioInfo audioInfo;
171 //VideoInfo videoInfo;
176 bool isFullyInitialized;
177 int16_t *audioBuffer;
178 int16_t *audioChannels[ 4 ];
182 #ifdef HAVE_LIBQUICKTIME
183 #include <quicktime.h>
185 class QtHandler: public FileHandler
192 bool Create( const string& filename );
193 //int Write( const Frame& frame );
196 int GetTotalFrames();
197 bool Open( const char *s );
198 int GetFrame( uint8_t *data, int frameNum );
199 void AllocateAudioBuffers();
204 int samplesPerBuffer;
206 bool isFullyInitialized;
207 unsigned int audioBufferSize;
208 int16_t *audioBuffer;
209 short int** audioChannelBuffer;
212 inline void DeinterlaceStereo16( void* pInput, int iBytes, void* pLOutput, void* pROutput );