📄 avireadhandler.cpp
字号:
#include <crtdbg.h>
#include <windows.h>
#include "AVIReadHandler.h"
//#include "FastReadStream.h"
#include "AVIIndex.h"
#include "Error.h"
#include "List.h"
#include "Fixes.h"
#include "File64.h"
// These two functions translate VirtualDub exceptions to Avisynth exceptions.
FilterChainError MyError(const char* fmt, ...) {
static char buf[256];
va_list val;
va_start(val, fmt);
wvsprintf(buf, fmt, val);
va_end(val);
return FilterChainError(buf);
}
FilterChainError MyWin32Error(const char *format, DWORD err, ...) {
char szError[128];
char szTemp[256];
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
0, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), szError, sizeof szError, NULL);
if (szError[0]) {
long l = strlen(szError);
if (l>1 && szError[l-2] == '\r')
szError[l-2] = 0;
else if (szError[l-1] == '\n')
szError[l-1] = 0;
}
va_list val;
va_start(val, err);
wvsprintf(szTemp, format, val);
va_end(val);
return FilterChainError(Sprintf(szTemp, szError));
}
//#define STREAMING_DEBUG
// HACK!!!!
CRITICAL_SECTION g_diskcs;
bool g_disklockinited=false;
#pragma warning(disable: 4200) // zero-sized array in struct/union
#pragma warning(disable: 4244) // conversion from __int64, possible loss of data
///////////////////////////////////////////
typedef __int64 QUADWORD;
// The following comes from the OpenDML 1.0 spec for extended AVI files
// bIndexType codes
//
#define AVI_INDEX_OF_INDEXES 0x00 // when each entry in aIndex
// array points to an index chunk
#define AVI_INDEX_OF_CHUNKS 0x01 // when each entry in aIndex
// array points to a chunk in the file
#define AVI_INDEX_IS_DATA 0x80 // when each entry is aIndex is
// really the data
// bIndexSubtype codes for INDEX_OF_CHUNKS
#define AVI_INDEX_2FIELD 0x01 // when fields within frames
// are also indexed
struct _avisuperindex_entry {
QUADWORD qwOffset; // absolute file offset, offset 0 is
// unused entry??
DWORD dwSize; // size of index chunk at this offset
DWORD dwDuration; // time span in stream ticks
};
struct _avistdindex_entry {
DWORD dwOffset; // qwBaseOffset + this is absolute file offset
DWORD dwSize; // bit 31 is set if this is NOT a keyframe
};
struct _avifieldindex_entry {
DWORD dwOffset;
DWORD dwSize;
DWORD dwOffsetField2;
};
#pragma pack(push)
#pragma pack(2)
typedef struct _avisuperindex_chunk {
FOURCC fcc; // 抜x##
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -