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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 7th December 2002, 17:55   #1  |  Link
scmccarthy
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
scmccarthy is offline   Reply With Quote
Old 7th December 2002, 18:40   #2  |  Link
dividee
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
dividee is offline   Reply With Quote
Old 7th December 2002, 21:07   #3  |  Link
scmccarthy
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
scmccarthy is offline   Reply With Quote
Old 7th December 2002, 22:00   #4  |  Link
scmccarthy
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
scmccarthy is offline   Reply With Quote
Old 8th December 2002, 05:54   #5  |  Link
dividee
Registered User
 
Join Date: Oct 2001
Location: Brussels
Posts: 358
Quote:
Media Player trys to download an activex component and then goes ahead and plays the clip.
That's probably because you forgot to tell that the clip has no audio:
vi.audio_samples_per_second = 0;
__________________
dividee
dividee is offline   Reply With Quote
Old 8th December 2002, 06:04   #6  |  Link
scmccarthy
Registered User
 
Join Date: Oct 2002
Posts: 462
I am going to post before I try it. Certainly, that is right.

Thank you very much.

Trying to follow the internal ColorBars as an example didn't work, because it has audio.

Stephen
scmccarthy is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 19:36.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.