[futurebasic] Re: [FB] fwd:Quicktime/Adding Toolbox calls

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 1999 : Group Archive : Group : All Groups

From: Derek Smith <dereksmi@...>
Date: Tue, 22 Jun 1999 12:24:27 -1000
On Tue, 22 Jun 1999 PRITCHA@... wrote:

> Last week...
> >Has anyone got a proforma showing how new toolbox calls are added?
> 
> Ok, Ok, the deafening silence tells me it's in the manual.
> But toolbox stuff is still tricky (for me, that is)

Thankfully, this is one of those things FB^3 will make a whole lot easier
when it appears.
 
> Like where do I get the "Trap" numbers? "0+00A8, 0+AAAA" type figures
> I've just looked through the Inside Mac on-line and I can't find them...
> Can anyone tell me where they are hidden away?

Apple has files available for download that usually come in the form of an
SDK for whatever manager you want to use.  The C files contain the toolbox
definitions and you can grab the trap codes from there most of the time.
 
> I've done about half of the calls below:
> FN CREATEMOVIEFILE
> FN NEWMOVIETRACK
> FN NEWTRACKMEDIA
> FN BEGINMEDIAEDITS
> FN GETMAXCOMPRESSIONSIZE
> FN COMPRESSIMAGE
> FN ADDMEDIASAMPLE
> FN ENDMEDIAEDITS
> FN GETMEDIADURATION
> FN INSERTMEDIAINTOTRACK
> FN ADDMOVIERESOURCES
> 
> But what about parameters that are  _"TVDO"?
> What is the assembler to accept those type of things?

This is no different than sending a long int.

> '0x303C,0x018E,0xAAAA - yes I've come across some Trap codes
> '- thanks, Robert!
> LOCAL MODE
> DIM theMedia&
> LOCAL FN NEWTRACKMEDIA (theTrack&, mediatype%, timescale%, movieDataRefH&,
> alais&)
>   `  subq.l      #2,sp
>   `  move.l      ^theTrack&,-(sp)
>   `  move.w      ^mediatype%,-(sp)
>   `  move.w      ^timescale%,-(sp)
>   `  move.l      ^movieDataRefH&,-(sp)
>   `  move.l      ^alais&,-(sp)
>   `  dc.w        $303C,$0030,$018E,$AAAA
>   `  move.w      (sp)+,^theMedia&
> END FN = theMedia&
> 
> Assembler gurus, does this look right?

Is the function not working?

I would write it this way:

LOCAL FN NEWTRACKMEDIA (theTrack&, mediatype&, timescale&, movieDataRefH&,
alais&)
   `  subq.l      #4,sp
   `  move.l      ^theTrack&,-(sp)
   `  move.l      ^mediatype&,-(sp)
   `  move.l      ^timescale&,-(sp)
   `  move.l      ^movieDataRefH&,-(sp)
   `  move.l      ^alais&,-(sp)
   `  dc.w        $303C,$0030,$018E,$AAAA
   `  move.l      (sp)+,D0
END FN   


Since NewMedia returns a long, whatever two byte value you were getting
back before was certainly not valid.  I bet you are wondering why there is
no END FN = code.  Well a function always returns whatever is in register
D0, so by moving the result into D0, you can still do this:

NewMedia& = FN NEWTRACKMEDIA (etc,etc)

FB will automagicaly fill the 4 bytes you popped off the stack into D0
into your variable.  If you are not comfortable with this, you can still
move the value into a variable.  However with this code, no local 
variables are required, hence no LOCAL MODE statement is needed either.


-Derek