View Full Version : GetWritePtr()
Ignus2
30th November 2006, 20:36
Can I call GetWritePtr() multiple times in the same plugin? Will I get the same result on 2nd, 3rd call? (In particular, I'm actually curious about the C interface version avs_get_write_ptr, but I assume it applies to GetWritePtr as well).
I see that some sequence_number is incremented every time I call GetWritePtr(). What kind of effect does it have?
--
Thanks in advance!
Fizick
30th November 2006, 21:44
may be it help?
http://forum.doom9.org/showthread.php?t=118164
Ignus2
1st December 2006, 00:50
Excellent, thanks. Wrong search terms I tried it seems :)
Ignus2
7th May 2007, 23:37
Well, actually I read wrongly.
foxyshadis wrote an answer, which was later stated incorrect in that thread. He was actually thinking of MakeWritable(), not GetWritePtr().
So, I ask again as I haven't found an adequate yes/no: can I make multiple GetWritePtr() calls in a single frame processor? Are there any side-effects?
(What is sequence_number btw?)
--
Greets,
I.
Yes you can do as many GetWritePtr() calls as you like. The sequence number increment is so the Cache knows that a VFB has been modified and cannot reuse it (sequence != oldsequence). So +1 or +100 means it is still different.
Ignus2
8th May 2007, 00:46
Thanks! This will make lot's of my code much simpler :)
There is real code behind GetWritePtr() so don't call it repeatadly inside a loop. As always move constant expression outside loops. Don't rely on the compiler to maybe notice and do it for you.
Ignus2
8th May 2007, 12:16
Sure. I just asked, because I wrote functions which did some processing, and until now I passed both the frame and the write pointer. Now I know it is enough to just pass the frame, and inside the function I can get the write pointer, even if I get it outside the function as well.
--
Greets,
I.
Be carefull passing around PVideoFrame's, these are smart pointer and manage the use count of VFB's and if you ever have 2 or more for the same VFB then GerWritePtr will fail because IsWriteable will be false.
For subroutines arguments use the '&' alias operator or use a PvideoFrame* pointer.
Ignus2
8th May 2007, 19:37
Thanks for the warning, but I actually use the avisynth C interface :)
It has AVS_VideoFrame* type, which is simple pointer.
I asked GetWritePtr(), because it's C counterpart avs_get_write_ptr() works exactly the same way.
--
Greets,
I.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.