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

Reply
 
Thread Tools Search this Thread Display Modes
Old 26th March 2003, 16:22   #21  |  Link
Bidoche
Avisynth 3.0 Developer
 
Join Date: Jan 2002
Location: France
Posts: 639
Quote:
design generic plugin interfaces that will allow plugins to remain through API changes
That would be the work of COM.
But for now I ain't the guy to tell you much about it.
Avisynth already uses COM (from vfw), but does not exposes itself as COM objects.

Quote:
the best working cache implementation in 2.5 without breaking plugins
Arghhh...

Quote:
I assume they will not be needed for plugin compilation!?!
As long as we don't use them in avisynth.h (for 2.5)
For 3.0 it doesn't matter, plugins will be linked throught COM.

Quote:
For "AVI output" we are given a framebuffer by VFW, so we have to bitblit here anyway. I could however imagine that the image writer could use "specific pitch" images. Some way to create a new frame, where you can force pitch would be nice.
Can you be more descriptive.

Quote:
I'd just like to know what the advantages are
Here a simple example: comparison of T * and (one of the possible replacement) boost::scoped_ptr.

scoped_ptr is a template class, ie its needs a class parameter to be fully qualified, the same way when you define a pointer you precise to which object it points.

You write it like it : scoped_ptr<T> pT; //T is the template parameter
where before you wrote: T * pT; //T was a parameter too

Before you had to explicitely initialize pT to 0 avoid garbage.
scoped_ptr has a default constructor who set itself to 0, so you don't have to care about that.
(Already one line less to write).

In destructor, you had to do : if (pT) delete pT; (or just delete if you know != 0)
scoped_ptr automatically deletes the owned object when it leaves the context.
That means you don't have to worry about deletion of the object in the destructor (or elsewhere) (one more line less).

But there is more, it makes it exception-safe :
If you construct an object with new, then call some code who throws an exception.
If you excepted the exception for some treatment, you catch it, do what must and go on.
If you excepted the exception but cannot handle it, you catch it, delete your pointer (otherwise it's leaked) and rethrow the exception. It works, but it's a costly solution (in developpement time).
If the exception caught you unaware, your pointer is leaked and there is nothing you can do about it. :/

On the contrary, with a scoped_ptr, no possible leak.
The scoped_ptr destructor (which delete the object) will be automatically called in the stack unwinding process.


Conclusion : Besides being safer and faster to use than a regular ptr, so why not use it.
Imagine there were no PVideoFrame and you had to use VideoFrame * and handle the AddRef/Release calls by yourselves. That's the same idea.

NB: scoped_ptr is only one of the possible smart ptr , who do not share ownership, there are others.
Bidoche is offline   Reply With Quote
Old 26th March 2003, 18:17   #22  |  Link
Bidoche
Avisynth 3.0 Developer
 
Join Date: Jan 2002
Location: France
Posts: 639
On a completely different subject, I suggest we add this method somewhere :
Code:
//paint a memory rectangle of given width, height, pitch
//with the values of its first line
//(pitch allowed negative to paint from bottom to top)
void RectanglePaint(BYTE * dstp, int width, int height, int pitch)
{
  BitBlit(dstp, pitch, dstp, pitch, width, height);
}
I have continued reading of source.cpp and this would be an appreciable factorisation for ColorBars, BlankClip (maybe others)
Bidoche is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 10:13.


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