RESOLVED FIXED 107732
Mac: Avoid using k32BGRAPixelFormat on certain platforms.
https://bugs.webkit.org/show_bug.cgi?id=107732
Summary Mac: Avoid using k32BGRAPixelFormat on certain platforms.
Jer Noble
Reported 2013-01-23 13:59:25 PST
Mac: Avoid using k32BGRAPixelFormat on certain platforms.
Attachments
Patch (2.22 KB, patch)
2013-01-23 14:03 PST, Jer Noble
no flags
Patch (6.79 KB, patch)
2013-01-23 17:02 PST, Jer Noble
no flags
Patch (6.68 KB, patch)
2013-01-24 09:51 PST, Jer Noble
eric.carlson: review+
Jer Noble
Comment 1 2013-01-23 14:03:50 PST
Jer Noble
Comment 2 2013-01-23 17:02:57 PST
Benjamin Poulain
Comment 3 2013-01-23 23:27:58 PST
Comment on attachment 184357 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=184357&action=review > Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:51 > +typedef struct OpaqueVTPixelTransferSession* VTPixelTransferSessionRef; Extra space. > Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:1019 > - NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:k32BGRAPixelFormat], kCVPixelBufferPixelFormatTypeKey, > + NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt: > +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 > + kCVPixelFormatType_422YpCbCr8 > +#else > + k32BGRAPixelFormat > +#endif > + ], kCVPixelBufferPixelFormatTypeKey, > nil]; > m_videoOutput.adoptNS([[AVPlayerItemVideoOutput alloc] initWithPixelBufferAttributes:attributes]); NSDictionary has a constructor for having a single key/object pair: dictionaryWithObject:forKey:. I would turn the code a bit differently: #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 unsigned pixelFormat = kCVPixelFormatType_422YpCbCr8; #else unsigned pixelFormat = k32BGRAPixelFormat #endif NSDictionary* attributes = [NSDictionary dictionaryWithObject:Foo forKey:Bar]
Jer Noble
Comment 4 2013-01-24 09:27:27 PST
(In reply to comment #3) > (From update of attachment 184357 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=184357&action=review > > > Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:51 > > +typedef struct OpaqueVTPixelTransferSession* VTPixelTransferSessionRef; > > Extra space. Fixed. > NSDictionary has a constructor for having a single key/object pair: dictionaryWithObject:forKey:. > > I would turn the code a bit differently: > #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 > unsigned pixelFormat = kCVPixelFormatType_422YpCbCr8; > #else > unsigned pixelFormat = k32BGRAPixelFormat > #endif > NSDictionary* attributes = [NSDictionary dictionaryWithObject:Foo forKey:Bar] NSDictionary has an even simpler notation: NSDictionary* attributes = @{ (NSString*)kCVPixelBufferPixelFormatTypeKey, @ kCVPixelFormatType_422YpCbCr8 } ...which we could safely use in the "#if 1090" block.
Jer Noble
Comment 5 2013-01-24 09:51:31 PST
Jer Noble
Comment 6 2013-01-24 12:20:17 PST
Tim Horton
Comment 7 2013-01-24 12:51:34 PST
Comment on attachment 184517 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=184517&action=review > Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:56 > +#import <VideoToolbox/VideoToolbox.h> VideoToolbox was introduced in Mountain Lion, so this breaks the Lion build.
Jer Noble
Comment 8 2013-01-24 13:12:28 PST
Note You need to log in before you can comment on or make changes to this bug.