问题
Does anyone know the correct way to replace old QTMovieCurrentSizeAttribute
and QTMovieSizeDidChangeNotification
tasks? I'm trying to clean out old deprecated code.
I've found that QTMovieNaturalSizeDidChangeNotification
is not a replacement for QTMovieSizeDidChangeNotification
. Likewise QTMovieNaturalSizeAttribute
is not a replacement for QTMovieCurrentSizeAttribute
. Natural Size
refers to the QTMovie
's native resolution, while Current Size
refer to the resolution at which a QTMovie
is being displayed (this may also be the resolution to which the movie is being decoded, which can resize from native). For example, if the source was anamorphic or had non-square pixels, then Natural
and Current Size
s will not be the same. The difference is easily seen in the Movie Inspector Window of the QuickTime 7 Player.
As near as I can tell, QuickTime X allows multiple views into the same QTMovie
, so the notion of Current Size
needed to be replaced by something new. (Perhaps the Current Size
functionality was moved into QTMovieView
? Or a decoder query?) Can anyone refer me to documentation or sample code for the new way?
Any sample code of a Movie Inspector Window that has been updated to show Natural
and Current ('Actual') Sizes
, without using deprecated code, would be ideal. This has been very confusing to tackle, so far.
回答1:
Is this useful? http://opensource.apple.com/source/WebCore/WebCore-955.66/platform/graphics/mac/MediaPlayerPrivateQTKit.mm
IntSize MediaPlayerPrivate::naturalSize() const
{
if (!metaDataAvailable())
return IntSize();
// In spite of the name of this method, return QTMovieNaturalSizeAttribute transformed by the
// initial movie scale because the spec says intrinsic size is:
//
// ... the dimensions of the resource in CSS pixels after taking into account the resource's
// dimensions, aspect ratio, clean aperture, resolution, and so forth, as defined for the
// format used by the resource
NSSize naturalSize = [[m_qtMovie.get() attributeForKey:QTMovieNaturalSizeAttribute] sizeValue];
return IntSize(naturalSize.width * m_scaleFactor.width(), naturalSize.height * m_scaleFactor.height());
}
来源:https://stackoverflow.com/questions/6182760/qtmoviecurrentsizeattribute-and-qtmoviesizedidchangenotification-replacements