| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#ifndef FFAVSSOURCES_H |
| 22 |
#define FFAVSSOURCES_H |
| 23 |
|
| 24 |
#include <vector> |
| 25 |
#ifdef _WIN32 |
| 26 |
#include <windows.h> |
| 27 |
#endif |
| 28 |
#include <avisynth.h> |
| 29 |
#include "ffms.h" |
| 30 |
|
| 31 |
struct ErrorInfo : FFMS_ErrorInfo { |
| 32 |
char ErrorBuffer[1024]; |
| 33 |
ErrorInfo() { |
| 34 |
Buffer = ErrorBuffer; |
| 35 |
BufferSize = sizeof(ErrorBuffer); |
| 36 |
} |
| 37 |
}; |
| 38 |
|
| 39 |
class AvisynthVideoSource : public IClip { |
| 40 |
VideoInfo VI; |
| 41 |
bool HighBitDepth; |
| 42 |
FFMS_VideoSource *V; |
| 43 |
int64_t FPSNum; |
| 44 |
int64_t FPSDen; |
| 45 |
const char *VarPrefix; |
| 46 |
bool has_at_least_v8; |
| 47 |
|
| 48 |
void InitOutputFormat(int ResizeToWidth, int ResizeToHeight, |
| 49 |
const char *ResizerName, const char *ConvertToFormatName, IScriptEnvironment *Env); |
| 50 |
void OutputFrame(const FFMS_Frame *Frame, PVideoFrame &Dst, IScriptEnvironment *Env); |
| 51 |
void OutputField(const FFMS_Frame *Frame, PVideoFrame &Dst, int Field, IScriptEnvironment *Env); |
| 52 |
public: |
| 53 |
AvisynthVideoSource(const char *SourceFile, int Track, FFMS_Index *Index, |
| 54 |
int FPSNum, int FPSDen, int Threads, int SeekMode, |
| 55 |
int ResizeToWidth, int ResizeToHeight, const char *ResizerName, |
| 56 |
const char *ConvertToFormatName, const char *VarPrefix, IScriptEnvironment* Env); |
| 57 |
~AvisynthVideoSource(); |
| 58 |
bool __stdcall GetParity(int n); |
| 59 |
int __stdcall SetCacheHints(int cachehints, int frame_range) { return 0; } |
| 60 |
const VideoInfo& __stdcall GetVideoInfo() { return VI; } |
| 61 |
void __stdcall GetAudio(void* Buf, int64_t Start, int64_t Count, IScriptEnvironment *Env) {} |
| 62 |
PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment *Env); |
| 63 |
}; |
| 64 |
|
| 65 |
class AvisynthAudioSource : public IClip { |
| 66 |
VideoInfo VI; |
| 67 |
FFMS_AudioSource *A; |
| 68 |
public: |
| 69 |
AvisynthAudioSource(const char *SourceFile, int Track, FFMS_Index *Index, |
| 70 |
int AdjustDelay, int FillGaps, double DrcScale, const char *VarPrefix, IScriptEnvironment* Env); |
| 71 |
~AvisynthAudioSource(); |
| 72 |
bool __stdcall GetParity(int n) { return false; } |
| 73 |
int __stdcall SetCacheHints(int cachehints, int frame_range) { return 0; } |
| 74 |
const VideoInfo& __stdcall GetVideoInfo() { return VI; } |
| 75 |
void __stdcall GetAudio(void* Buf, int64_t Start, int64_t Count, IScriptEnvironment *Env); |
| 76 |
PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment *Env) { return nullptr; }; |
| 77 |
}; |
| 78 |
|
| 79 |
#endif |