QTMovieCurrentSizeAttribute and QTMovieSizeDidChangeNotification replacements

纵饮孤独 提交于 2019-12-13 13:12:58

问题


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 Sizes 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!