[futurebasic] Re: [FB] how to read multimedia data in a data file

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2003 : Group Archive : Group : All Groups

From: Robert Covington <artlythere@...>
Date: Wed, 9 Apr 2003 15:11:58 -0400
On Wednesday, April 9, 2003, at 11:43  AM, Keiji Goto wrote:

> Now, although Ben's suggestion get me step forward,
> I still need to get the menu item 2 and 3 in File
> menu (to read QT Movie/Sound from Data fork and
> Handle, respectively). At this moment, they end up
> with errors which I cannot figure out the meanings.
> If anyone can try to open a QT Movie via these
> menu items and comprehend the erros, and shed a
> light on me, it would be most appreciated.
> -Keiji
>


Items 1 and 2 work fine here (though they play on the desktop) Item 3  
works after a change, but note: The movie is still playing from gMovie,  
not the handle.

You need to set a moviebox, and a port or Quicktime will not be happy.  
See the Nickelodeon example further below.

Your error may have been that the reference for the handle is bad,  
because NewMovieFromHandle needs also the call : PutMovieToHandle it  
seems.

<  
http://developer.apple.com/techpubs/quicktime/qtdevdocs/APIREF/ 
SOURCESII/newmoviefromhandle.htm >


Do you need the Movie in a handle to write it to a resource?

See the changed FN below...maybe a help in some way.


clear LOCAL FN OpenWithNewMovieFromHandle(FileName$,VRefNum%)
DIM ParamBlock.128
dim ResName$,OSErr%,FSParID&
dim @MovieResRefNum%,ResID%
DIM @ FSSpec as FSSpec
dim @DataRefChanged as boolean
DIM @MovieH as handle

LONG IF peek(@FileName$) > 0
FSSpec.vRefNum% = VRefNum%
FSSpec.name$ = FileName$

#If CarbonLib
FSParID& = 0
Fn FBFixDirAndVol(FSVRefNum%,FSParID&)
OSErr% = Fn FSMakeFSSpec(FSVRefNum%,FSParID&,FSName$,FSSpec)
#Else
ParamBlock.ioNamePtr&   = @FSSpec.name$
ParamBlock.ioVRefNum%   = FSSpec.vRefNum%
ParamBlock.ioFDirIndex% = 0
OSErr% = Fn GetCatInfo(ParamBlock)
FSParID& = [@ParamBlock + _ioFLParID]
#Endif

LONG IF FN OPENMOVIEFILE(FSSpec,MovieResRefNum%,_FSRdPerm) = _NoErr
LONG IF FN NEWMOVIEFROMFILE(gMovie&,MovieResRefNum%,ResID%,¬
ResName$,1,DataRefChanged) = _noErr
OSerr% = FN PutMovieIntoHandle (gMovie&,MovieH)
if OSerr% <> _noErr then stop STR$(OSErr%) + " 1"
// No errors here
// Handle now in format for writing as resource?
end if
END IF
END IF
END FN



Any help here?

// Simple Movie Player, FB 3 from Compositor (Quick rip-out)
// By Robert Covington (and a bit of Alain)
// Not a freestanding example; ignore cursor FN

/* Pass in the FSSpec of a Movie (.mov) file (MooV)
  from Files$ _FSSpecOpenPreview, or create an FSSpec
from a normal _fOpen.

Toolbox FNs may or may not need to be defined.
*/

Clear local
Local FN Nickelodeon(spec as ^FSSpec)
DIM as OSerr  err
DIM as short  @refNum,resID,vRef,clicked
DIM as Long   @wndPtr,movie,wndGW,wndDV,ticks,nuTicks
DIM as rect   m
DIM as FSSpec theFSSpec
DIM name$ // Taschen :)

ticks = FN TickCount
FN CurCycle // Animated cursor

theFSSpec = spec

name$ = theFSSpec.name

long if name$ <> ""
If FN EnterMovies then exit FN// no use going on
err = FN OpenMovieFile( @theFSSpec, @refNum, _fsRdPerm )
err = FN NewMovieFromFile( @movie, refNum, @resID, =_nil,¬
  _newMovieActive, =_nil )
err = FN CloseMovieFile( refNum ) : refNum = -1
GetMovieBox( movie, m )
OffsetRect( m ,-m.left%,-m.top%)
SetMovieBox( movie, m )
Window _MovieShow,name$,@m,_docNoGrow
FN CurCycle// Animated cursor
SetMovieGWorld( movie, window(_wndPort),0)
GoToBeginningOfMovie( movie) : StartMovie( movie )
while FN IsMovieDone( movie ) = _False and FN Canceled = _False  and  
clicked = 0
nuTicks = FN TickCount
long if nuTicks-ticks > 29
FN CurCycle// Animated cursor
ticks = nuTicks
End if
MoviesTask( 0, 0 )
clicked = FN Clicked
if clicked <> 0 then FlushEvents
Wend
StopMovie( movie ) : ExitMovies
if movie <> 0 then disposeMovie( movie )
FN CurCycle// Animated cursor
Window Close _MovieShow
End if

cursor _ArrowCursor

End FN