Changeset 70252 in webkit
- Timestamp:
- Oct 21, 2010 11:19:04 AM (13 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r70251 r70252 1 2010-10-20 Jer Noble <jer.noble@apple.com> 2 3 Reviewed by Eric Carlson. 4 5 Video -> Canvas doesn't work on Windows 6 https://bugs.webkit.org/show_bug.cgi?id=47996 7 rdar://problem/7884690 8 9 * WebCore.vcproj/QTMovieWin.vcproj: Added QTDecompressionSession.{cpp,h} 10 * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp: 11 (WebCore::MediaPlayerPrivateQuickTimeVisualContext::paint): Create a 12 QTDecompressionSession if necessary and convert the QTPixelBuffer 13 into a CG-compatible one. 14 * platform/graphics/win/QTDecompressionSession.cpp: Added. 15 * platform/graphics/win/QTDecompressionSession.h: Added. 16 * platform/graphics/win/QTPixelBuffer.cpp: 17 (SetNumberValue): Moved from QTMovieVisualContext. 18 (QTPixelBuffer::createPixelBufferAttributesDictionary): Moved from inside 19 QTMovieVisualContext::createPixelBufferOptionsDictionary(). 20 * platform/graphics/win/QTPixelBuffer.h: Moved the Type enum 21 from QTMovieVisualContext.h. 22 1 23 2010-10-21 Carlos Garcia Campos <cgarcia@igalia.com> 2 24 -
trunk/WebCore/WebCore.vcproj/QTMovieWin.vcproj
r67285 r70252 319 319 </File> 320 320 <File 321 RelativePath="..\platform\graphics\win\QTDecompressionSession.cpp" 322 > 323 </File> 324 <File 321 325 RelativePath="..\platform\graphics\win\QTMovie.cpp" 322 326 > … … 357 361 </File> 358 362 <File 363 RelativePath="..\platform\graphics\win\QTDecompressionSession.h" 364 > 365 </File> 366 <File 359 367 RelativePath="..\platform\graphics\win\QTMovie.h" 360 368 > -
trunk/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp
r70084 r70252 37 37 #include "MediaPlayerPrivateTaskTimer.h" 38 38 #include "QTCFDictionary.h" 39 #include "QTDecompressionSession.h" 39 40 #include "QTMovie.h" 40 41 #include "QTMovieTask.h" … … 729 730 return; 730 731 731 #if USE(ACCELERATED_COMPOSITING)732 if (m_qtVideoLayer)733 return;734 #endif735 732 QTPixelBuffer buffer = m_visualContext->imageForTime(0); 736 733 if (buffer.pixelBufferRef()) { 734 #if USE(ACCELERATED_COMPOSITING) 735 if (m_qtVideoLayer) { 736 // We are probably being asked to render the video into a canvas, but 737 // there's a good chance the QTPixelBuffer is not ARGB and thus can't be 738 // drawn using CG. If so, fire up an ICMDecompressionSession and convert 739 // the current frame into something which can be rendered by CG. 740 if (!buffer.pixelFormatIs32ARGB() && !buffer.pixelFormatIs32BGRA()) { 741 // The decompression session will only decompress a specific pixelFormat 742 // at a specific width and height; if these differ, the session must be 743 // recreated with the new parameters. 744 if (!m_decompressionSession || !m_decompressionSession->canDecompress(buffer)) 745 m_decompressionSession = QTDecompressionSession::create(buffer.pixelFormatType(), buffer.width(), buffer.height()); 746 } 747 748 buffer = m_decompressionSession->decompress(buffer); 749 } 750 #endif 737 751 CGImageRef image = CreateCGImageFromPixelBuffer(buffer); 738 752 … … 1090 1104 #endif 1091 1105 1092 QT MovieVisualContext::Type contextType = requiredDllsAvailable() && preferredMode == MediaRenderingMovieLayer ? QTMovieVisualContext::ConfigureForCAImageQueue : QTMovieVisualContext::ConfigureForCGImage;1106 QTPixelBuffer::Type contextType = requiredDllsAvailable() && preferredMode == MediaRenderingMovieLayer ? QTPixelBuffer::ConfigureForCAImageQueue : QTPixelBuffer::ConfigureForCGImage; 1093 1107 m_visualContext = QTMovieVisualContext::create(m_visualContextClient.get(), contextType); 1094 1108 m_visualContext->setMovie(m_movie.get()); -
trunk/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h
r70084 r70252 43 43 class QTMovie; 44 44 class QTMovieVisualContext; 45 class QTDecompressionSession; 45 46 46 47 namespace WebCore { … … 179 180 OwnPtr<GraphicsLayer> m_transformLayer; 180 181 OwnPtr<WKCAImageQueue> m_imageQueue; 182 OwnPtr<QTDecompressionSession> m_decompressionSession; 181 183 CGAffineTransform m_movieTransform; 182 184 #endif -
trunk/WebCore/platform/graphics/win/QTMovieVisualContext.cpp
r60317 r70252 40 40 class QTMovieVisualContextPriv { 41 41 public: 42 QTMovieVisualContextPriv(QTMovieVisualContext* parent, QTMovieVisualContextClient* client, QT MovieVisualContext::Type contextType);42 QTMovieVisualContextPriv(QTMovieVisualContext* parent, QTMovieVisualContextClient* client, QTPixelBuffer::Type contextType); 43 43 ~QTMovieVisualContextPriv(); 44 44 … … 62 62 }; 63 63 64 static OSStatus SetNumberValue(CFMutableDictionaryRef inDict, CFStringRef inKey, SInt32 inValue) 65 { 66 CFNumberRef number; 67 68 number = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &inValue); 69 if (!number) 70 return coreFoundationUnknownErr; 71 72 CFDictionarySetValue(inDict, inKey, number); 73 CFRelease(number); 74 75 return noErr; 76 } 77 78 static CFDictionaryRef createPixelBufferOptionsDictionary(QTMovieVisualContext::Type contextType) 79 { 80 static const CFStringRef kDirect3DCompatibilityKey = CFSTR("Direct3DCompatibility"); 81 82 CFMutableDictionaryRef pixelBufferOptions = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); 83 84 CFMutableDictionaryRef pixelBufferAttributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); 85 if (contextType == QTMovieVisualContext::ConfigureForCAImageQueue) { 86 // Ask for D3D compatible pixel buffers so no further work is needed. 87 CFDictionarySetValue(pixelBufferAttributes, kDirect3DCompatibilityKey, kCFBooleanTrue); 88 } else { 89 // Use the k32BGRAPixelFormat, as QuartzCore will be able to use the pixels directly, 90 // without needing an additional copy or rendering pass. 91 SetNumberValue(pixelBufferAttributes, kCVPixelBufferPixelFormatTypeKey, k32BGRAPixelFormat); 92 93 // Set kCVPixelBufferBytesPerRowAlignmentKey to 16 to ensure that each row of pixels 94 // starts at a 16 byte aligned address for most efficient data reading. 95 SetNumberValue(pixelBufferAttributes, kCVPixelBufferBytesPerRowAlignmentKey, 16); 96 CFDictionarySetValue(pixelBufferAttributes, kCVPixelBufferCGImageCompatibilityKey, kCFBooleanTrue); 97 } 98 99 CFDictionarySetValue(pixelBufferOptions, kQTVisualContextPixelBufferAttributesKey, pixelBufferAttributes); 100 101 CFRelease(pixelBufferAttributes); 102 64 static CFDictionaryRef createPixelBufferOptionsDictionary(QTPixelBuffer::Type contextType) 65 { 66 const void* key = kQTVisualContextPixelBufferAttributesKey; 67 const void* value = QTPixelBuffer::createPixelBufferAttributesDictionary(contextType); 68 CFDictionaryRef pixelBufferOptions = CFDictionaryCreate(kCFAllocatorDefault, &key, &value, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); 69 CFRelease(value); 103 70 return pixelBufferOptions; 104 71 } 105 72 106 static CFDictionaryRef pixelBufferCreationOptions(QT MovieVisualContext::Type contextType)107 { 108 if (contextType == QT MovieVisualContext::ConfigureForCAImageQueue) {73 static CFDictionaryRef pixelBufferCreationOptions(QTPixelBuffer::Type contextType) 74 { 75 if (contextType == QTPixelBuffer::ConfigureForCAImageQueue) { 109 76 static CFDictionaryRef imageQueueOptions = createPixelBufferOptionsDictionary(contextType); 110 77 return imageQueueOptions; 111 78 } 112 79 113 ASSERT(contextType == QT MovieVisualContext::ConfigureForCGImage);80 ASSERT(contextType == QTPixelBuffer::ConfigureForCGImage); 114 81 static CFDictionaryRef cgImageOptions = createPixelBufferOptionsDictionary(contextType); 115 82 return cgImageOptions; 116 83 } 117 84 118 QTMovieVisualContextPriv::QTMovieVisualContextPriv(QTMovieVisualContext* parent, QTMovieVisualContextClient* client, QT MovieVisualContext::Type contextType)85 QTMovieVisualContextPriv::QTMovieVisualContextPriv(QTMovieVisualContext* parent, QTMovieVisualContextClient* client, QTPixelBuffer::Type contextType) 119 86 : m_parent(parent) 120 87 , m_client(client) … … 207 174 } 208 175 209 PassRefPtr<QTMovieVisualContext> QTMovieVisualContext::create(QTMovieVisualContextClient* client, Type contextType)176 PassRefPtr<QTMovieVisualContext> QTMovieVisualContext::create(QTMovieVisualContextClient* client, QTPixelBuffer::Type contextType) 210 177 { 211 178 return adoptRef(new QTMovieVisualContext(client, contextType)); 212 179 } 213 180 214 QTMovieVisualContext::QTMovieVisualContext(QTMovieVisualContextClient* client, Type contextType)181 QTMovieVisualContext::QTMovieVisualContext(QTMovieVisualContextClient* client, QTPixelBuffer::Type contextType) 215 182 : m_private(new QTMovieVisualContextPriv(this, client, contextType)) 216 183 { -
trunk/WebCore/platform/graphics/win/QTMovieVisualContext.h
r60317 r70252 55 55 class QTMOVIEWIN_API QTMovieVisualContext : public RefCounted<QTMovieVisualContext> { 56 56 public: 57 enum Type { ConfigureForCGImage, ConfigureForCAImageQueue }; 58 59 static PassRefPtr<QTMovieVisualContext> create(QTMovieVisualContextClient*, Type); 57 static PassRefPtr<QTMovieVisualContext> create(QTMovieVisualContextClient*, QTPixelBuffer::Type); 60 58 ~QTMovieVisualContext(); 61 59 … … 72 70 73 71 protected: 74 QTMovieVisualContext(QTMovieVisualContextClient*, Type);72 QTMovieVisualContext(QTMovieVisualContextClient*, QTPixelBuffer::Type); 75 73 void setupVisualContext(); 76 74 -
trunk/WebCore/platform/graphics/win/QTPixelBuffer.cpp
r60110 r70252 27 27 #include "QTPixelBuffer.h" 28 28 29 #include <CFNumber.h> 29 30 #include <CFString.h> 30 31 #include <CGColorSpace.h> … … 34 35 #include <memory.h> 35 36 37 static OSStatus SetNumberValue(CFMutableDictionaryRef inDict, CFStringRef inKey, SInt32 inValue) 38 { 39 CFNumberRef number; 40 41 number = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &inValue); 42 if (!number) 43 return coreFoundationUnknownErr; 44 45 CFDictionarySetValue(inDict, inKey, number); 46 CFRelease(number); 47 48 return noErr; 49 } 50 51 CFDictionaryRef QTPixelBuffer::createPixelBufferAttributesDictionary(QTPixelBuffer::Type contextType) 52 { 53 static const CFStringRef kDirect3DCompatibilityKey = CFSTR("Direct3DCompatibility"); 54 55 CFMutableDictionaryRef pixelBufferAttributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); 56 if (contextType == QTPixelBuffer::ConfigureForCAImageQueue) { 57 // Ask for D3D compatible pixel buffers so no further work is needed. 58 CFDictionarySetValue(pixelBufferAttributes, kDirect3DCompatibilityKey, kCFBooleanTrue); 59 } else { 60 // Use the k32BGRAPixelFormat, as QuartzCore will be able to use the pixels directly, 61 // without needing an additional copy or rendering pass. 62 SetNumberValue(pixelBufferAttributes, kCVPixelBufferPixelFormatTypeKey, k32BGRAPixelFormat); 63 64 // Set kCVPixelBufferBytesPerRowAlignmentKey to 16 to ensure that each row of pixels 65 // starts at a 16 byte aligned address for most efficient data reading. 66 SetNumberValue(pixelBufferAttributes, kCVPixelBufferBytesPerRowAlignmentKey, 16); 67 CFDictionarySetValue(pixelBufferAttributes, kCVPixelBufferCGImageCompatibilityKey, kCFBooleanTrue); 68 } 69 return pixelBufferAttributes; 70 } 71 36 72 QTPixelBuffer::QTPixelBuffer() 37 73 : m_pixelBuffer(0) -
trunk/WebCore/platform/graphics/win/QTPixelBuffer.h
r60110 r70252 45 45 class QTMOVIEWIN_API QTPixelBuffer { 46 46 public: 47 enum Type { ConfigureForCGImage, ConfigureForCAImageQueue }; 48 static CFDictionaryRef createPixelBufferAttributesDictionary(Type); 49 47 50 QTPixelBuffer(); 48 51 QTPixelBuffer(const QTPixelBuffer&);
Note: See TracChangeset
for help on using the changeset viewer.