2011-05-31 30 views
5

有誰知道替換舊的QTMovieCurrentSizeAttributeQTMovieSizeDidChangeNotification任務的正確方法嗎?我正在嘗試清除舊的棄用代碼。我們發現QTMovieNaturalSizeDidChangeNotification不是QTMovieSizeDidChangeNotification的替代品。同樣QTMovieNaturalSizeAttribute不是QTMovieCurrentSizeAttribute的替代品。 Natural Size指的是QTMovie的原始分辨率,而Current Size指的是顯示QTMovie時的分辨率(這也可能是電影正在解碼的分辨率,可以從本機重新調整分辨率)。例如,如果源是變形的或者具有非方形像素,則NaturalCurrent Size將不會相同。在QuickTime 7 Player的Movie Inspector窗口中很容易看到不同之處。QTMovieCurrentSizeAttribute和QTMovieSizeDidChangeNotification替換

就我所知,QuickTime X允許將多個視圖放入同一個QTMovie,因此Current Size的概念需要被新的東西所取代。 (也許Current Size功能被移到QTMovieView?或解碼器查詢?)任何人都可以引用我的文檔或示例代碼的新方法?

已更新爲顯示NaturalCurrent ('Actual') Sizes且未使用棄用代碼的Movie Inspector窗口的任何示例代碼都是理想的。到目前爲止,這已經非常令人困惑。

回答

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()); 
} 
+0

可能更相關的是在同一個文件'cacheMovieScale',而它與關鍵'無證屬性的定義@「QTMoviePreferredTransformAttribute」',它的值是一個NSAffineTransform。 – 2011-12-30 00:53:03