RE: AVI files

new topic     » goto parent     » topic index » view thread      » older message » newer message

At 11:50 AM 2/5/02 -0500, you wrote:
>
>
>> -----Original Message-----
>> From: jordah ferguson [mailto:jorfergie03 at yahoo.com]
>
>> i was wondering whether anyone knows how to wrap / if any one 
>> has code 
>> for inserting avi files/animations to a program
>
>There are a couple of libs on the RDS page (search on avi).  You could also
>do it through Exotica.  If it's just a simple avi (no sound), there is a
>common control (Animation) that can play avi's.  It hasn't been wrapped for
>win32lib, though.
>
>Matt Lewis
>


I did it last year and posted it with the suggestion that it be added
to the lib. Never heard anything more about it. Here it is again ....

NOTE: This only works with uncompressed avi files.

I had a look at doing CODECS, threw up my hands in horror and ran screaming
from the room....

hope this helps,

Graeme.







------- begin w32avi.ew --------


-- Win32lib Animate Class Extension                             G.Burke 01/01
global constant 
		ACS_CENTER              =#0001,
		ACS_TRANSPARENT         =#0002,
		ACS_AUTOPLAY            =#0004,


		ACM_OPENA               =(WM_USER+100),

		ACM_PLAY                =(WM_USER+101),
		ACM_STOP                =(WM_USER+102),

		ACN_START               =#0001,
		ACN_STOP                =#0002




global function animateCreate(  atom hParent,
				atom style   )
    
    integer szClassName,r
    
    szClassName=acquire_mem(0,"SysAnimate32")
    
    r= w32Func(xCreateWindow,{
				    NULL,
				    szClassName,
				    NULL,
				    style,
				    0,0,0,0,
				    getHandle(hParent),
				    NULL,
				    instance(),
				    NULL    })
    release_mem(szClassName)
    
	     -- WARNING
	     
    return r -- returns windows handle
	     -- NOT win32lib handle
end function

global function animateOpen(atom hAvi,sequence path)
    --returns 1-OK  0-fail
    atom r,szPath
    szPath=acquire_mem(0,path)
    r= w32Func(xSendMessage,{hAvi,ACM_OPENA,0,szPath})
    release_mem(szPath)
    return r
end function

global function animatePlay(atom hAvi,atom from,atom To,atom repeats)
    return w32Func(xSendMessage,{hAvi,ACM_PLAY,repeats,To*#10000+from})
end function

global function animateStop(atom hAvi)
    return w32Func(xSendMessage,{hAvi,ACM_STOP,0,0})
end function

global function animateClose(atom hAvi)
    return animateOpen(hAvi,NULL)
end function

global function animateSeek(atom hAvi,atom frame)
    return animatePlay(hAvi,frame,frame,1)
end function



------- code ends --------


------- begin avitest.exw --------



include win32lib.ew
include w32avi.ew


constant win=create(Window,"Test",0,Default,Default,300,300,0),
	 btn=create(PushButton,"Open",win,220,220,50,30,0)

atom a,b,c


a=animateCreate(win,or_all({WS_CHILD,WS_VISIBLE}))


procedure open_new()
    b=animateOpen(a,getOpenFileName(win,"",{"Avi Files","*.AVI"}))
    if not b then
	if message_box("Open Failed","Unsupported Format",0) then end if
    else
	c=animatePlay(a,1,100,1000)
    end if
end procedure



onClick[btn]=routine_id("open_new")

WinMain(win,Normal)


----- code ends ------

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu