Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
7th December 2002, 17:55 | #1 | Link |
Registered User
Join Date: Oct 2002
Posts: 462
|
How Do I Write a Filter with no clip argument
I started writing a filter that creates color bars in YUY2 instead of RGB. But I stuck it in an old script I was using to test an RGB conversion filter.
After I got it working, I created an example script for it and discovered my problem. It won't work unless I open a clip even though it does nothing with the clip. Once I remove the IClip* argument, GenericVideoFilter does not have a valid argument and can't be used. So the real question becomes: How do you replace GenericVideoFilter or the argument it needs? Stephen |
7th December 2002, 18:40 | #2 | Link |
Registered User
Join Date: Oct 2001
Location: Brussels
Posts: 358
|
When writing a source filter, it's better to inherit from IClip directly, not from GenericVideoFilter. Don't forget to initialize vi yourself then, and to implement each pure virtual function of IClip.
__________________
dividee |
7th December 2002, 21:07 | #3 | Link |
Registered User
Join Date: Oct 2002
Posts: 462
|
@dividee
I was hoping I could side step implementing each pure virtual function. There are four of them now: GetParity(int) GetAudio(void *,__int64,__int64,IScriptEnvironment *) SetCacheHints(int,int) GetVideoInfo(void) I tried this before after looking at source.cpp. Is this how I should start it then? #include "avisynth.h" class ColorBars_YV12 : public IClip { VideoInfo vi; public: ColorBars_YV12(int _w, int _h) { vi.width = _w; vi.height = _h; } PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env); }; Stephen |
7th December 2002, 22:00 | #4 | Link |
Registered User
Join Date: Oct 2002
Posts: 462
|
Here's an update of my progress. This sort of works:
#include "avisynth.h" class YUVColorBars : public IClip { VideoInfo vi; public: YUVColorBars(int _h) { vi.width = 720; vi.height = _h; vi.fps_numerator = 4; vi.fps_denominator = 1; vi.num_frames = 188; vi.pixel_type = VideoInfo::CS_YUY2; SetCacheHints(CACHE_NOTHING,0); } PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env); bool __stdcall GetParity(int n) { return false; } void __stdcall GetAudio(void* buf, __int64 start, __int64 count, IScriptEnvironment* env) { } void __stdcall SetCacheHints(int cachehints,int frame_range) { }; const VideoInfo& __stdcall GetVideoInfo() { return vi; } }; Media Player trys to download an activex component and then goes ahead and plays the clip. Stephen |
8th December 2002, 05:54 | #5 | Link | |
Registered User
Join Date: Oct 2001
Location: Brussels
Posts: 358
|
Quote:
vi.audio_samples_per_second = 0;
__________________
dividee |
|
|
|