home *** CD-ROM | disk | FTP | other *** search
/ PC World Interactive 11 / PC World Interactive 11.iso / share / multimed / effect / Common Files / QTUtilities.c next >
Encoding:
C/C++ Source or Header  |  1998-03-12  |  18.2 KB  |  697 lines

  1. //////////
  2. //
  3. //    File:        QTUtilities.c
  4. //
  5. //    Contains:    Some utilities for working with QuickTime movies.
  6. //                All utilities start with the prefix "QTUtils_".
  7. //
  8. //    Written by:    Tim Monroe
  9. //                Based heavily on the DTSQTUtilities package by Apple DTS.
  10. //                This began as essentially a subset of that package, revised for cross-platform use.
  11. //
  12. //    Copyright:    ⌐ 1996-1998 by Apple Computer, Inc., all rights reserved.
  13. //
  14. //    Change History (most recent first):
  15. //
  16. //       <9>         02/28/98    rtm        fixed QTUtils_GetMovieFileLoopingInfo and the like
  17. //       <8>         01/14/98    rtm        added QTUtils_ConvertFloatToBigEndian
  18. //       <7>         12/19/97    rtm        added QTUtils_AddUserDataTextToMovie and associated routines;
  19. //                                    added QTUtils_GetMovieFileLoopingInfo and the like
  20. //       <6>         11/06/97    rtm        added QTUtils_MakeSampleDescription
  21. //       <5>         10/29/97    rtm        modified QTUtils_IsMediaTypeInMovie and similar routines to use GetMovieIndTrackType
  22. //       <4>         10/27/97    rtm        added QTUtils_HasQuickTimeVideoEffects
  23. //       <3>         10/17/97    rtm        added QTUtils_MovieHasSoundTrack
  24. //       <2>         09/23/97    rtm        added endian adjustment to QTUtils_PrintMoviePICT
  25. //       <1>         09/10/97    rtm        first file
  26. //       
  27. //////////
  28.  
  29. // header files
  30.  
  31. #ifndef __QTUtilities__
  32. #include "QTUtilities.h"
  33.  
  34. #include <sound.h>
  35.  
  36. ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  37. //
  38. // General utilities.
  39. //
  40. // Use these functions to get information about the availability/features of QuickTime or other services.
  41. //
  42. ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  43.  
  44. //////////
  45. //
  46. // QTUtils_IsQuickTimeInstalled
  47. // Is QuickTime installed?
  48. //
  49. //////////
  50.  
  51. Boolean QTUtils_IsQuickTimeInstalled (void) 
  52. {
  53.     Boolean     myQTAvail = false;
  54.     long        myAttrs;
  55.     OSErr         myErr = noErr;
  56.  
  57.     myErr = Gestalt(gestaltQuickTime, &myAttrs);
  58.     if (myErr == noErr)
  59.         myQTAvail = true;
  60.  
  61.     return(myQTAvail);
  62. }
  63.  
  64.  
  65. //////////
  66. //
  67. // QTUtils_IsQuickTimeCFMInstalled
  68. // Are the QuickTime CFM libraries installed?
  69. //
  70. //////////
  71.  
  72. #if TARGET_OS_MAC
  73. #ifdef powerc
  74. Boolean QTUtils_IsQuickTimeCFMInstalled (void) 
  75. {
  76.     Boolean     myQTCFMAvail = false;
  77.     long        myAttrs;
  78.     OSErr         myErr = noErr;
  79.  
  80.     // test whether the library is registered.
  81.     myErr = Gestalt(gestaltQuickTimeFeatures, &myAttrs);
  82.     if (myErr == noErr)
  83.         if (myAttrs & (1L << gestaltPPCQuickTimeLibPresent))
  84.             myQTCFMAvail = true;
  85.  
  86.     // test whether a function is available (the library is not moved from the Extension folder);
  87.     // this is the trick to be used when testing if a function is available via CFM
  88.     if (!CompressImage)
  89.         myQTCFMAvail = false;     
  90.  
  91.     return(myQTCFMAvail);
  92. }
  93. #endif    // powerc
  94. #endif
  95.  
  96.  
  97. //////////
  98. //
  99. // QTUtils_GetQTVersion
  100. // Get the version of QuickTime installed.
  101. // The high-order word of the returned long integer contains the version number,
  102. // so you can test a version like this:
  103. //
  104. //        if ((QTUtils_GetQTVersion() >> 16) & 0xffff >= 0x0210)        // we require QT 2.1 or greater
  105. //            return;
  106. //
  107. //////////
  108.  
  109. long QTUtils_GetQTVersion (void) 
  110. {
  111.     long         myVersion = 0L;
  112.     OSErr         myErr = noErr;
  113.  
  114.     myErr = Gestalt(gestaltQuickTime, &myVersion);
  115.     if (myErr == noErr)
  116.         return(myVersion);
  117.     else
  118.         return(0L);
  119. }
  120.  
  121.  
  122. //////////
  123. //
  124. // QTUtils_HasQuickTimeVideoEffects
  125. // Does the installed version of QuickTime support video effects?
  126. //
  127. //////////
  128.  
  129. Boolean QTUtils_HasQuickTimeVideoEffects (void) 
  130. {
  131.     return(((QTUtils_GetQTVersion() >> 16) & 0xffff) >= kQTVideoEffectsMinVers);
  132. }
  133.  
  134.  
  135. //////////
  136. //
  137. // QTUtils_HasFullScreenSupport
  138. // Does the installed version of QuickTime support the full-screen routines?
  139. //
  140. //////////
  141.  
  142. Boolean QTUtils_HasFullScreenSupport (void) 
  143. {
  144.     return(((QTUtils_GetQTVersion() >> 16) & 0xffff) >= kQTFullScreeMinVers);
  145. }
  146.  
  147.  
  148. //////////
  149. //
  150. // QTUtils_GetMovie
  151. // Open the specified movie file; if none is specified, query the user to select a file.
  152. //
  153. //////////
  154.  
  155. Movie QTUtils_GetMovie (FSSpec *theFSSpec, short *theRefNum, short *theResID)
  156. {
  157.     SFTypeList                myTypeList = {MovieFileType, 0, 0, 0};
  158.     StandardFileReply        myReply;
  159.     Movie                    myMovie = NULL;
  160.     OSErr                    myErr = noErr;
  161.  
  162.     // if we are provided with an FSSpec then use it; otherwise elicit a file from the user
  163.     if (theFSSpec == NULL || theFSSpec->vRefNum == 0) {    
  164.         StandardGetFilePreview(NULL, 1, myTypeList, &myReply);
  165.         if (!myReply.sfGood)
  166.             return(NULL);
  167.         
  168.         *theFSSpec = myReply.sfFile;
  169.     }
  170.  
  171.     // we should have now a usable FSSpec; just double check this before continuing
  172.     if (theFSSpec == NULL)
  173.         return NULL;
  174.     
  175.     // open the movie file
  176.     myErr = OpenMovieFile(theFSSpec, theRefNum, fsRdPerm);
  177.     if (myErr == noErr) {
  178.         Str255        myMovieName;
  179.         Boolean        wasChanged;
  180.         
  181.         *theResID = 0;                    // we want the first movie
  182.         
  183.         myErr = NewMovieFromFile(&myMovie, *theRefNum, theResID, myMovieName, newMovieActive, &wasChanged);
  184.         CloseMovieFile(*theRefNum);
  185.     }
  186.     
  187.     if (myErr != noErr)
  188.         return(NULL);
  189.     else
  190.         return(myMovie);
  191. }
  192.  
  193.  
  194. //////////
  195. //
  196. // QTUtils_SaveMovie
  197. // Save and flatten a movie resource into a file.
  198. //
  199. // QTUtils_SaveMovie will provide a user dialog asking for a file name, and will then save the movie
  200. // into this file. Note that this function will also automatically flatten the movie so that it's 
  201. // self-contained, and also make it cross-platform (by adding any possible resource forks to
  202. // the end of the data fork). The default name of the movie is also NEWMOVIE.MOV, this reflects
  203. // the way movie file names should be named for cross-platform support (Windows). The default
  204. // creator type is also 'TVOD' so that MoviePlayer will be the default application that opens the
  205. // movie file. If there's an existing movie file with the same name, it will be deleted.
  206. // 
  207. //////////
  208.  
  209. OSErr QTUtils_SaveMovie (Movie theMovie)
  210. {
  211.     StandardFileReply    mySFReply;
  212.     OSErr                myErr = noErr;
  213.     
  214.     if (theMovie == NULL)
  215.         return(invalidMovie);
  216.     
  217.     StandardPutFile("\pSave Movie as:" , "\pNEWMOVIE.MOV", &mySFReply); 
  218.     if (mySFReply.sfGood) {
  219.         FlattenMovieData(theMovie, flattenAddMovieToDataFork, &mySFReply.sfFile, FOUR_CHAR_CODE('TVOD'), smSystemScript, createMovieFileDeleteCurFile);
  220.         myErr = GetMoviesError();
  221.     }
  222.  
  223.     return(myErr);
  224. }
  225.  
  226.  
  227. ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  228. //
  229. // Media utilities.
  230. //
  231. ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  232.  
  233. //////////
  234. //
  235. // QTUtils_IsMediaTypeInMovie
  236. // Determine whether a specific media type is in a movie.
  237. // 
  238. //////////
  239.  
  240. Boolean QTUtils_IsMediaTypeInMovie (Movie theMovie, OSType theMediaType)
  241. {
  242.     return(GetMovieIndTrackType(theMovie, 1, theMediaType, movieTrackMediaType | movieTrackEnabledOnly) != NULL);
  243. }
  244.  
  245.  
  246. //////////
  247. //
  248. // QTUtils_MovieHasSoundTrack
  249. // Determine whether a movie contains a sound track.
  250. // 
  251. //////////
  252.  
  253. Boolean QTUtils_MovieHasSoundTrack (Movie theMovie)
  254. {
  255.     return(GetMovieIndTrackType(theMovie, 1, AudioMediaCharacteristic, movieTrackCharacteristic | movieTrackEnabledOnly) != NULL);
  256. }
  257.  
  258.  
  259. //////////
  260. //
  261. // QTUtils_GetSoundMediaHandler
  262. // Return the sound media handler for a movie.
  263. // 
  264. //////////
  265.  
  266. MediaHandler QTUtils_GetSoundMediaHandler (Movie theMovie)
  267. {
  268.     Track        myTrack;
  269.     Media        myMedia;
  270.  
  271.     myTrack = GetMovieIndTrackType(theMovie, 1, AudioMediaCharacteristic, movieTrackCharacteristic | movieTrackEnabledOnly);
  272.     if (myTrack != NULL) {
  273.         myMedia = GetTrackMedia(myTrack);
  274.         return(GetMediaHandler(myMedia));
  275.     } 
  276.         
  277.     return(NULL);
  278. }
  279.  
  280.  
  281. //////////
  282. //
  283. // QTUtils_PrintMoviePICT
  284. // Print the existing movie frame pict.
  285. // 
  286. // Note that in a real application we should put the PrStlDialog code into the Print Setup╔ menu
  287. // function. The reason it's inside this function is that we use this code for quick testing of printing.
  288. //
  289. //////////
  290.  
  291. OSErr QTUtils_PrintMoviePICT (Movie theMovie, short x, short y, long PICTUsed)
  292. {
  293.     PicHandle         myPictHandle = NULL;
  294.     THPrint            myTHPrint = NULL;
  295.     GrafPtr             mySavedPort;
  296.     TPPrPort        myPrintPort;
  297.     Boolean         myResult;
  298.     Boolean            isPrinting = false;
  299.     Rect            myPictRect;
  300.     OSErr            myErr = noErr;
  301.     
  302.     if (theMovie == NULL)
  303.         return(invalidMovie);
  304.     
  305.     GetPort(&mySavedPort);
  306.  
  307.     // get the PICT to be printed, either the poster pict or the current frame pict.
  308.     switch (PICTUsed) {
  309.         case kPrintFrame:
  310.             myPictHandle = GetMoviePict(theMovie, GetMovieTime(theMovie, 0L));
  311.             break;
  312.             
  313.         case kPrintPoster:
  314.             myPictHandle = GetMoviePosterPict(theMovie); 
  315.             break;
  316.  
  317.         default:
  318.             goto Closure;
  319.     }
  320.  
  321.     if (myPictHandle == NULL)
  322.         goto Closure;
  323.  
  324. #if TARGET_RT_LITTLE_ENDIAN
  325.     // change the fields of the Picture structure,
  326.     // if the target runtime environment uses little-endian format for integers
  327.     (**myPictHandle).picSize = EndianS16_BtoL((**myPictHandle).picSize);
  328.     
  329.     (**myPictHandle).picFrame.top = EndianS16_BtoL((**myPictHandle).picFrame.top);
  330.     (**myPictHandle).picFrame.left = EndianS16_BtoL((**myPictHandle).picFrame.left);
  331.     (**myPictHandle).picFrame.bottom = EndianS16_BtoL((**myPictHandle).picFrame.bottom);
  332.     (**myPictHandle).picFrame.right = EndianS16_BtoL((**myPictHandle).picFrame.right);
  333. #endif        
  334.  
  335.     // get the Print record
  336.     myTHPrint = (THPrint)NewHandleClear(sizeof(TPrint));
  337.     if (myTHPrint == NULL)
  338.         goto Closure;
  339.  
  340.     PrOpen();
  341.     isPrinting = true;
  342.     myErr = PrError();
  343.     if (myErr != noErr)
  344.         goto Closure;
  345.  
  346.     PrintDefault(myTHPrint);
  347.  
  348.     // move this to Print Setup╔ if you want to make this look really cool
  349.     myResult = PrStlDialog(myTHPrint);
  350.     if (!myResult)
  351.         goto Closure;
  352.     
  353.     myResult = PrJobDialog(myTHPrint);
  354.     if (!myResult)
  355.         goto Closure;
  356.     
  357.     myPrintPort = PrOpenDoc(myTHPrint, NULL, NULL);
  358.     PrOpenPage(myPrintPort, NULL);
  359.     myErr = PrError();
  360.     if (myErr != noErr)
  361.         goto Closure;
  362.     
  363.     // print at x,y position
  364.     myPictRect = (*myPictHandle)->picFrame;
  365.     MacOffsetRect(&myPictRect, x - myPictRect.left,  y - myPictRect.top);
  366.     
  367.     DrawPicture(myPictHandle, &myPictRect);
  368.  
  369.     // if you want to do additional drawing, do it here.
  370.     
  371.     PrClosePage(myPrintPort);
  372.     PrCloseDoc(myPrintPort);
  373.     myErr = PrError();
  374.     if (myErr != noErr)
  375.         goto Closure;
  376.     
  377.     if ((*myTHPrint)->prJob.bJDocLoop == bSpoolLoop)
  378.         PrPicFile(myTHPrint, NULL, NULL, NULL, NULL);
  379.     
  380.     // our closure handling
  381. Closure:
  382.     MacSetPort(mySavedPort);
  383.     
  384.     if (isPrinting)
  385.         PrClose();
  386.     if (myPictHandle)
  387.         KillPicture(myPictHandle);
  388.     if (myTHPrint)
  389.         DisposeHandle((Handle)myTHPrint);
  390.  
  391.     return(myErr);
  392. }
  393.  
  394.  
  395. //////////
  396. //
  397. // QTUtils_SelectAllMovie
  398. // Select the entire movie associated with the specified movie controller.
  399. // 
  400. //////////
  401.  
  402. OSErr QTUtils_SelectAllMovie (MovieController theMC)
  403. {
  404.     TimeRecord        myTimeRecord;
  405.     Movie             myMovie = NULL;
  406.     OSErr             myErr = noErr;
  407.     
  408.     if (theMC == NULL)
  409.         return(paramErr);
  410.     
  411.     myMovie = MCGetMovie(theMC);
  412.     if (myMovie == NULL)
  413.         return(paramErr);
  414.     
  415.     myTimeRecord.value.hi = 0;
  416.     myTimeRecord.value.lo = 0;
  417.     myTimeRecord.base = 0;
  418.     myTimeRecord.scale = GetMovieTimeScale(myMovie);
  419.     myErr = GetMoviesError();
  420.     if (myErr != noErr)
  421.         return(myErr);
  422.     
  423.     myErr = MCDoAction(theMC, mcActionSetSelectionBegin, &myTimeRecord);
  424.     if (myErr != noErr)
  425.         return(myErr);
  426.     
  427.     myTimeRecord.value.lo = GetMovieDuration(myMovie);
  428.     myErr = GetMoviesError();
  429.     if (myErr != noErr)
  430.         return(myErr);
  431.     
  432.     myErr = MCDoAction(theMC, mcActionSetSelectionDuration, &myTimeRecord);
  433.     
  434.     return(myErr);
  435. }
  436.  
  437.  
  438. //////////
  439. //
  440. // QTUtils_MakeSampleDescription
  441. // Return a new image description with default and specified values.
  442. // 
  443. //////////
  444.  
  445. ImageDescriptionHandle QTUtils_MakeSampleDescription (long theEffectType, short theWidth, short theHeight)
  446. {
  447.     ImageDescriptionHandle        mySampleDesc = NULL;
  448.     OSErr                        myErr = noErr;
  449.  
  450.     // create a new sample description
  451.     mySampleDesc = (ImageDescriptionHandle)NewHandleClear(sizeof(ImageDescription));
  452.     if (mySampleDesc == NULL)
  453.         return(NULL);
  454.     
  455.     // fill in the fields of the sample description
  456.     (**mySampleDesc).idSize = sizeof(ImageDescription);
  457.     (**mySampleDesc).cType = theEffectType;
  458.     (**mySampleDesc).vendor = kAppleManufacturer;
  459.     (**mySampleDesc).temporalQuality = codecNormalQuality;
  460.     (**mySampleDesc).spatialQuality = codecNormalQuality;
  461.     (**mySampleDesc).width = theWidth;
  462.     (**mySampleDesc).height = theHeight;
  463.     (**mySampleDesc).hRes = 72L << 16;
  464.     (**mySampleDesc).vRes = 72L << 16;
  465.     (**mySampleDesc).dataSize = 0L;
  466.     (**mySampleDesc).frameCount = 1;
  467.     (**mySampleDesc).depth = 24;
  468.     (**mySampleDesc).clutID = -1;
  469.     
  470.     return(mySampleDesc);
  471. }
  472.  
  473.  
  474. ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  475. //
  476. // User data utilities.
  477. //
  478. ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  479.  
  480. //////////
  481. //
  482. // QTUtils_AddUserDataTextToMovie
  483. // Add a user data item, of the specified type, containing the specified text to a movie.
  484. //
  485. // This function adds the specified text to the movie's user data;
  486. // the updated user data is written to the movie file when the movie is next updated
  487. // (by calling UpdateMovieResource).
  488. // 
  489. //////////
  490.  
  491. OSErr QTUtils_AddUserDataTextToMovie (Movie theMovie, char *theText, OSType theType)
  492. {
  493.     UserData                    myUserData;
  494.     Handle                        myHandle;
  495.     short                        myIndex = 0;
  496.     OSErr                        myErr = noErr;
  497.  
  498.     // get the movie's user data list
  499.     myUserData = GetMovieUserData(theMovie);
  500.     if (myUserData == NULL)
  501.         return(paramErr);
  502.     
  503.     // copy the specified text into a new handle
  504.     myHandle = NewHandleClear(theText[0]);
  505.     if (myHandle == NULL)
  506.         return(MemError());
  507.  
  508.     BlockMove(&theText[1], *myHandle, theText[0]);
  509.  
  510.     // for simplicity, we assume that we want only one user data item of the specified type in the movie;
  511.     // as a result, we won't worry about overwriting any existing item of that type....
  512.     //
  513.     // if you need multiple user data items of a given type (for example, a copyright notice
  514.     // in several different languages), you would need to modify this code; this is left as an exercise
  515.     // for the reader....
  516.  
  517.     // add the data to the movie's user data
  518.     myErr = AddUserDataText(myUserData, myHandle, theType, myIndex + 1, smSystemScript);
  519.  
  520.     // clean up
  521.     DisposeHandle(myHandle);
  522.     return(myErr);
  523. }
  524.  
  525.  
  526. //////////
  527. //
  528. // QTUtils_AddCopyrightToMovie
  529. // Add a user data item containing the specified copyright text to a movie.
  530. //
  531. //////////
  532.  
  533. OSErr QTUtils_AddCopyrightToMovie (Movie theMovie, char *theText)
  534. {
  535.     return(QTUtils_AddUserDataTextToMovie(theMovie, theText, kUserDataTextCopyright));
  536. }
  537.  
  538.  
  539. //////////
  540. //
  541. // QTUtils_AddMovieNameToMovie
  542. // Add a user data item containing the specified name to a movie.
  543. //
  544. //////////
  545.  
  546. OSErr QTUtils_AddMovieNameToMovie (Movie theMovie, char *theText)
  547. {
  548.     return(QTUtils_AddUserDataTextToMovie(theMovie, theText, kUserDataTextFullName));
  549. }
  550.  
  551.  
  552. //////////
  553. //
  554. // QTUtils_AddMovieInfoToMovie
  555. // Add a user data item containing the specified information to a movie.
  556. //
  557. //////////
  558.  
  559. OSErr QTUtils_AddMovieInfoToMovie (Movie theMovie, char *theText)
  560. {
  561.     return(QTUtils_AddUserDataTextToMovie(theMovie, theText, kUserDataTextInformation));
  562. }
  563.  
  564.  
  565. //////////
  566. //
  567. // QTUtils_GetMovieFileLoopingInfo
  568. // Get the looping state of a movie file.
  569. //
  570. // A movie file can have information about its looping state in a user data item of type 'LOOP'.
  571. // If the movie doesn't contain an item of this type, then we'll assume that it isn't looping.
  572. // If it does contain an item of this type, then the item data (a long integer) is 0 for normal
  573. // looping and 1 for palindrome looping. Accordingly, this function returns the following values
  574. // in the theLoopInfo parameter:
  575. //
  576. //        0 == normal looping
  577. //        1 == palindrome looping
  578. //        2 == no looping
  579. //
  580. //////////
  581.  
  582. OSErr QTUtils_GetMovieFileLoopingInfo (Movie theMovie, long *theLoopInfo)
  583. {
  584.     UserData        myUserData;
  585.     long            myInfo = kNoLooping;
  586.     OSErr            myErr = paramErr;
  587.  
  588.     // make sure we've got a movie
  589.     if (theMovie == NULL)
  590.         goto bail;
  591.         
  592.     // get the movie's user data list
  593.     myUserData = GetMovieUserData(theMovie);
  594.     if (myUserData != NULL)
  595.         myErr = GetUserDataItem(myUserData, &myInfo, sizeof(myInfo), FOUR_CHAR_CODE('LOOP'), 0);
  596.  
  597. bail:
  598.     *theLoopInfo = myInfo;
  599.  
  600.     return(myErr);
  601. }
  602.  
  603.  
  604. //////////
  605. //
  606. // QTUtils_SetMovieFileLoopingInfo
  607. // Set the looping state for a movie file.
  608. //
  609. //////////
  610.  
  611. OSErr QTUtils_SetMovieFileLoopingInfo (Movie theMovie, long theLoopInfo)
  612. {
  613.     UserData        myUserData;
  614.     short            myCount = 0;
  615.     OSErr            myErr = paramErr;
  616.  
  617.     // get the movie's user data
  618.     myUserData = GetMovieUserData(theMovie);
  619.     if (myUserData == NULL)
  620.         goto bail;
  621.  
  622.     // we want to end up with at most one user data item of type 'LOOP',
  623.     // so let's remove any existing ones
  624.     myCount = CountUserDataType(myUserData, FOUR_CHAR_CODE('LOOP'));
  625.     while (myCount--)
  626.         RemoveUserData(myUserData, FOUR_CHAR_CODE('LOOP'), 1);
  627.  
  628.     switch (theLoopInfo) {
  629.         case kNormalLooping:
  630.         case kPalindromeLooping:
  631.             myErr = SetUserDataItem(myUserData, &theLoopInfo, sizeof(long), FOUR_CHAR_CODE('LOOP'), 0);
  632.             break;
  633.  
  634.         case kNoLooping:
  635.         default:
  636.             myErr = noErr;
  637.             break;
  638.     }
  639.  
  640. bail:
  641.     return(myErr);
  642. }
  643.  
  644.  
  645. //////////
  646. //
  647. // QTUtils_SetLoopingStateFromFile
  648. // Set the looping state for a movie based on the looping information in the movie file.
  649. //
  650. //////////
  651.  
  652. OSErr QTUtils_SetLoopingStateFromFile (Movie theMovie, MovieController theMC)
  653. {
  654.     long             myLoopInfo;
  655.     OSErr            myErr = noErr;
  656.  
  657.     myErr = QTUtils_GetMovieFileLoopingInfo(theMovie, &myLoopInfo);
  658.     switch (myLoopInfo) {
  659.  
  660.         case kNormalLooping:
  661.             MCDoAction(theMC, mcActionSetLooping, (void *)true);
  662.             MCDoAction(theMC, mcActionSetLoopIsPalindrome, (void *)false);
  663.             break;
  664.  
  665.         case kPalindromeLooping:
  666.             MCDoAction(theMC, mcActionSetLooping, (void *)true);
  667.             MCDoAction(theMC, mcActionSetLoopIsPalindrome, (void *)true);
  668.             break;
  669.  
  670.         case kNoLooping:
  671.         default:
  672.             MCDoAction(theMC, mcActionSetLooping, (void *)false);
  673.             MCDoAction(theMC, mcActionSetLoopIsPalindrome, (void *)false);
  674.             break;
  675.     }
  676.  
  677.     return(myErr);
  678. }
  679.  
  680.  
  681. //////////
  682. //
  683. // QTUtils_ConvertFloatToBigEndian
  684. // Convert the specified floating-point number to big-endian format.
  685. //
  686. //////////
  687.  
  688. void QTUtils_ConvertFloatToBigEndian (float *theFloat)
  689. {
  690.     unsigned long        *myLongPtr;
  691.     
  692.     myLongPtr = (unsigned long *)theFloat;
  693.     *myLongPtr = EndianU32_NtoB(*myLongPtr);
  694. }
  695.  
  696.  
  697. #endif    // ifndef __QTUtilities__