1 // VirtualDub - Video processing and capture application 2 // Copyright (C) 1998-2001 Avery Lee 3 // 4 // This program is free software; you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation; either version 2 of the License, or 7 // (at your option) any later version. 8 // 9 // This program is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with this program; if not, write to the Free Software 16 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 18 #ifndef f_AVIREADHANDLER_H 19 #define f_AVIREADHANDLER_H 20 21 #ifdef _MSC_VER 22 #pragma once 23 #endif 24 25 #include <utility> 26 #include <list> 27 28 #ifndef f_VD2_RIZA_AVI_H 29 #include <vd2/Riza/avi.h> 30 #endif 31 32 #ifndef f_VD2_SYSTEM_VDSTRING_H 33 #include <vd2/system/VDString.h> 34 #endif 35 36 struct IAVIFile; 37 38 // These are meant as AVIFile replacements. They're not quite to AVIFile 39 // specs, but they'll do for now. 40 41 class IAVIReadStream { 42 public: 43 virtual ~IAVIReadStream(); 44 45 // Temporary replacements for AVIERR_OK and AVIERR_BUFFERTOOSMALL 46 enum { 47 kOK = 0, 48 kBufferTooSmall = 0x80044074, 49 kFileReadError = 0x8004406d 50 }; 51 52 enum { 53 kConvenient = -1 54 }; 55 56 virtual sint32 BeginStreaming(VDPosition lStart, VDPosition lEnd, long lRate)=0; 57 virtual sint32 EndStreaming()=0; 58 virtual sint32 Info(VDAVIStreamInfo *pasi)=0; 59 virtual bool IsKeyFrame(VDPosition lFrame)=0; 60 virtual sint32 Read(VDPosition lStart, long lSamples, void *lpBuffer, long cbBuffer, long *plBytes, long *plSamples)=0; 61 virtual VDPosition Start()=0; 62 virtual VDPosition End()=0; 63 virtual VDPosition PrevKeyFrame(VDPosition lFrame)=0; 64 virtual VDPosition NextKeyFrame(VDPosition lFrame)=0; 65 virtual VDPosition NearestKeyFrame(VDPosition lFrame)=0; 66 virtual sint32 FormatSize(VDPosition lFrame, long *plSize)=0; 67 virtual sint32 ReadFormat(VDPosition lFrame, void *pFormat, long *plSize)=0; 68 virtual bool isStreaming()=0; 69 virtual bool isKeyframeOnly()=0; 70 71 virtual bool getVBRInfo(double& bitrate_mean, double& bitrate_stddev, double& maxdev)=0; 72 virtual sint64 getSampleBytePosition(VDPosition sample_num) = 0; 73 74 virtual VDPosition TimeToPosition(VDTime timeInMicroseconds) = 0; 75 virtual VDTime PositionToTime(VDPosition pos) = 0; 76 }; 77 78 class IAVIReadHandler { 79 public: 80 virtual void AddRef()=0; 81 virtual void Release()=0; 82 virtual IAVIReadStream *GetStream(uint32 fccType, int lParam)=0; 83 virtual void EnableFastIO(bool)=0; 84 virtual bool isOptimizedForRealtime()=0; 85 virtual bool isStreaming()=0; 86 virtual bool isIndexFabricated()=0; 87 virtual bool AppendFile(const wchar_t *pszFile)=0; 88 virtual bool getSegmentHint(const char **ppszPath)=0; 89 90 typedef std::list<std::pair<uint32, VDStringA> > tTextInfo; 91 virtual void GetTextInfo(tTextInfo& textInfo) = 0; 92 virtual void GetTextInfoEncoding(int& codePage, int& countryCode, int& language, int& dialect) = 0; 93 }; 94 95 IAVIReadHandler *CreateAVIReadHandler(IAVIFile *paf); 96 IAVIReadHandler *CreateAVIReadHandler(const wchar_t *pszFile); 97 98 #endif 99