QTMovieCurrentSizeAttribute和QTMovieSizeDidChangeNotification替换

Bri*_*ian 5 quicktime qtkit

有谁知道更换旧的QTMovieCurrentSizeAttributeQTMovieSizeDidChangeNotification任务的正确方法?我正在尝试清除旧的弃用代码.

我发现这QTMovieNaturalSizeDidChangeNotification不是替代品QTMovieSizeDidChangeNotification.同样QTMovieNaturalSizeAttribute不是替代品QTMovieCurrentSizeAttribute.Natural Size指的QTMovie是原始分辨率,同时Current Size指的QTMovie是显示a的分辨率(这也可能是电影被解码的分辨率,可以从原生调整大小).例如,如果源是变形的或具有非方形像素,则s NaturalCurrent Sizes将不相同.在QuickTime 7 Player的Movie Inspector窗口中很容易看出差异.

就像我所知,QuickTime X允许多个视图相同QTMovie,因此Current Size需要用新的东西替换.(也许Current Size功能被移入QTMovieView?或解码器查询?)任何人都可以向我推荐新方式的文档或示例代码吗?

电影检查器窗口的任何示例代码已经更新以显示,Natural并且Current ('Actual') Sizes不使用已弃用的代码,这将是理想的.到目前为止,这一直非常令人困惑.

Jer*_*ris 0

这有用吗?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());
}
Run Code Online (Sandbox Code Playgroud)