Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: In QuickTime 7.0,can not get MPEG4 file informations rightly



Dear All,

Now i have a question about QuickTime 7.0. Use GetMoviePict api, i can get a picture of MPEG4 file rightly. But under ...
...snip...
http://lists.apple.com/mailman/options/quicktime-api/email@hidden


This email sent to email@hidden

Hi!

I filed a bug report against this, but until there's an update I use the following code to get around it. Note that this is inside a PowerPlant application so I use LGWorld for my offscreen drawing, if you're not using PowerPlant, just allocate and use a GWorld directly.
Also, the movie is in PowerPlant movie controller class, so substitute your movie for all references to mMovieView->GetMovie().


// Get the current frame into a PicHandle
   PicHandle thePict;
   OSErr theErr = noErr;

// Let QuickTime get it for us if possible
thePict = ::GetMoviePict(mMovieView->GetMovie(),theCurTime);
if (thePict EQ NULL)
{
theErr = ::GetMoviesError();
// Fix for problem with QuickTime 7.0.1 and MPEG4 encoded .avis
if (theErr EQ cDepthErr) // If we get a cDepthErr, then do the heavy lifting ourselves
{
theErr = noErr; // Clear the error flag so we can fall through to the throw if necessary
Rect frame; // This will be the Rect for the movie and the pict
Rect globalFrame; // Only we also need it in global coords
LGWorld * lGWorld = nil;
CGrafPtr movieGWorld;


::GetMovieBox(mMovieView->GetMovie(),&frame); // Get the movies box frame
::GetMovieGWorld(mMovieView->GetMovie(),&movieGWorld,NULL); // Get the movie's GWorld
frame.bottom -= 20; // Adjust for the controller
globalFrame = frame;
::QDLocalToGlobalRect(movieGWorld,&globalFrame); // Must convert to global coords for movie port
lGWorld = new LGWorld(frame); // Make a GWorld to create the pict in
if (lGWorld EQ nil) // Only reason to fail is...
theErr = memFullErr; // ...we don't have enough memory
else
{
OpenCPicParams newHeader; // Set up the new pict
newHeader.srcRect = frame;
newHeader.hRes = 0x00480000;
newHeader.vRes = 0x00480000;
newHeader.version = -2;
newHeader.reserved1 = 0;
newHeader.reserved2 = 0;


       lGWorld->BeginDrawing(); // Now blast the movie frame into the pict

thePict = ::OpenCPicture(&newHeader);
if (thePict)
{
PixMapHandle lSrcPixMapH = ::GetGWorldPixMap(movieGWorld);
PixMapHandle lDstPixMapH = ::GetGWorldPixMap(lGWorld->GetMacGWorld());
::LockPixels(lSrcPixMapH);
::CopyBits((BitMapPtr)* lSrcPixMapH,(BitMapPtr)* lDstPixMapH,&globalFrame,&frame, srcCopy, nil);
::UnlockPixels(lSrcPixMapH);
::ClosePicture();
}
else
theErr = memFullErr;


        lGWorld->EndDrawing();
        delete lGWorld;
      }
   }

   ThrowIfOSErr_(theErr);
 }

Hope this helps!

- Craig
_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-api/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.