Player/Image Object "always buffer" Problems

Dave dave at looktowindward.com
Wed Jun 20 12:31:44 EDT 2007


Hi All,

More on this.

I changed the code to compare the current image data to the previous  
image data. When I do this, I find that the data returned from the  
snapshot command is the *same* on each iteration (the frames should  
all be different), so it's just moving the same image into the image  
object each time.

!!!!!STOP PRESS!!!!!

I put a breakpoint at the end of the function and I noticed that if I  
switch between Run Mode and IDE Mode then continue, it works!!!

So, why should this have an effect? It seems that the correct image  
is NOT transfered if the run mode isn't changed between frames. Also  
I can't set the "alwaysBuffer" property since if I do it causes a crash!

I've added the code to the function (see below) and it seems to work  
*sometimes* but it still looks like its losing a frame buffer  
somewhere, the Compare Test hit the breakpoint (see function below)

Is there any work--around for this? Help please!!! Deadline rapidly  
approaching.

All the Best
Dave


local sgOldImageData

------------------------------------------------------------------------ 
------------
--
--  PDFGetFrameThumbnail
--
------------------------------------------------------------------------ 
------------
function PDFGetFrameThumbnail theFrameNumber,theThumbnailFilePathName
   local myCurrentTime
   local myImageData
   local myFrameRect
   local myWindowID
   local myMovieFilePathName

   --
   --  Set up the Rectangle for the Player Frame
   --
   put the rect of player "PlayerThumbnail" of card 1 of me into  
myFrameRect
   put the windowID of this stack into myWindowID

   --
   --  Calculate the Position in the Movie and Play the Frame
   --
   put the fileName of player "PlayerThumbnail" of card 1 of me into  
myMovieFilePathName
   --set the filename of player "PlayerThumbnail" of card 1 of me to  
empty
   --set the fileName of player "PlayerThumbnail" of card 1 of me to  
myMovieFilePathName

   put theFrameNumber * 24 into myCurrentTime
   set the playSelection of player "PlayerThumbnail" of card 1 of me  
to true
   set the startTime of player "PlayerThumbnail" of card 1 of me to  
myCurrentTime
   set the endTime of player "PlayerThumbnail" of card 1 of me to  
(myCurrentTime + 1)
   start player "PlayerThumbnail" of card 1 of me

   choose pointer tool
   wait .5 seconds with messages

   --
   --  Grab the Frame
   --
   put empty into image "ImageThumbnail" of card 1 of me
   put empty into myImageData
   set the alwaysBuffer of the templateImage to false
   export snapshot from rect myFrameRect of window myWindowID to  
myImageData as JPEG

   choose browse tool

   put myImageData into image "ImageThumbnail" of card 1 of me
   if myImageData = sgOldImageData then
     breakpoint
   end if

   put myImageData into sgOldImageData
   return myImageData
end PDFGetFrameThumbnail
-----------------------------

On 20 Jun 2007, at 11:53, Dave wrote:

> Hi,
>
> I have a stack with a player object and am image object. I am  
> trying to capture fames from a movie. I want to play the movie for  
> the one frame, then copy that one into the Image Object/  The  
> following function does this job, however only the first frame is  
> captured, e.g. it looks like the put myImageData into image  
> "ImageThumbnail"  does not work after the first image has been set.
>
> I've had this before and found that the "always buffer" property  
> has to be set correctly for it to work. However, as far as I know,  
> the "always buffer" on the Player object should be set to true, but  
> when I do this RunRev Crashes. Why is this?
>
> Again, something that should have taken a few minutes to do is  
> taking up way too much time. Seems like as soon as a I string a few  
> "exotic" objects together and try to do something that should be  
> possible, get 95% of the way there and then RunRev crashes in some  
> strange manner and I spend at least double the amount of time  
> trying to fix it!
>
> How can I get this to work? Why is "always buffer" causing such a  
> problem?
>
> Anyway, the function is copied below, it works fine if:
>
> always buffer = true on Player Object
> always buffer = false on Image Object
>
> But since I can't set  "always buffer" on the Player (since it  
> crashes RunRev) it only copies the first frame into the image object.
>
> Anyone with any ideas I'd be really grateful.
>
> Thanks a lot
> All the Best
> Dave
>




More information about the Use-livecode mailing list