Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

159 lines
8.5 KiB

  1. /*
  2. * CVImageBuffer.h
  3. * CoreVideo
  4. *
  5. * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  6. *
  7. */
  8. /*! @header CVImageBuffer.h
  9. @copyright 2004 Apple Computer, Inc. All rights reserved.
  10. @availability Mac OS X 10.4 or later
  11. @discussion CVImageBufferRef types are abstract and define various attachments and convenience
  12. calls for retreiving image related bits of data.
  13. */
  14. #if !defined(__COREVIDEO_CVIMAGEBUFFER_H__)
  15. #define __COREVIDEO_CVIMAGEBUFFER_H__ 1
  16. #include <TargetConditionals.h>
  17. #if TARGET_OS_MAC
  18. #include <ApplicationServices/ApplicationServices.h>
  19. #include <QuartzCore/CVBuffer.h>
  20. #else
  21. #pragma warning (disable: 4068) // ignore unknown pragmas
  22. #include <CVBuffer.h>
  23. #include <CGGeometry.h>
  24. #endif
  25. #if defined(__cplusplus)
  26. extern "C" {
  27. #endif
  28. #pragma mark CVImageBufferRef attachment keys
  29. #if TARGET_OS_MAC
  30. CV_EXPORT const CFStringRef kCVImageBufferCGColorSpaceKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CGColorSpaceRef
  31. CV_EXPORT const CFStringRef kCVImageBufferCleanApertureKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFDictionary containing the following four keys
  32. CV_EXPORT const CFStringRef kCVImageBufferCleanApertureWidthKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFNumber
  33. CV_EXPORT const CFStringRef kCVImageBufferCleanApertureHeightKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFNumber
  34. CV_EXPORT const CFStringRef kCVImageBufferCleanApertureHorizontalOffsetKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFNumber
  35. CV_EXPORT const CFStringRef kCVImageBufferCleanApertureVerticalOffsetKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFNumber
  36. CV_EXPORT const CFStringRef kCVImageBufferPreferredCleanApertureKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFDictionary containing same keys as kCVImageBufferCleanApertureKey
  37. CV_EXPORT const CFStringRef kCVImageBufferFieldCountKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFNumber
  38. CV_EXPORT const CFStringRef kCVImageBufferFieldDetailKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFString with one of the following four values
  39. CV_EXPORT const CFStringRef kCVImageBufferFieldDetailTemporalTopFirst AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFString
  40. CV_EXPORT const CFStringRef kCVImageBufferFieldDetailTemporalBottomFirst AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFString
  41. CV_EXPORT const CFStringRef kCVImageBufferFieldDetailSpatialFirstLineEarly AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFString
  42. CV_EXPORT const CFStringRef kCVImageBufferFieldDetailSpatialFirstLineLate AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFString
  43. CV_EXPORT const CFStringRef kCVImageBufferPixelAspectRatioKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFDictionary with the following two keys
  44. CV_EXPORT const CFStringRef kCVImageBufferPixelAspectRatioHorizontalSpacingKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFNumber
  45. CV_EXPORT const CFStringRef kCVImageBufferPixelAspectRatioVerticalSpacingKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFNumber
  46. CV_EXPORT const CFStringRef kCVImageBufferDisplayDimensionsKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFDictionary with the following two keys
  47. CV_EXPORT const CFStringRef kCVImageBufferDisplayWidthKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFNumber
  48. CV_EXPORT const CFStringRef kCVImageBufferDisplayHeightKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFNumber
  49. CV_EXPORT const CFStringRef kCVImageBufferGammaLevelKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFNumber describing the gamma level
  50. CV_EXPORT const CFStringRef kCVImageBufferYCbCrMatrixKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFString describing the color matrix for YCbCr->RGB. This key can be one of the following values:
  51. CV_EXPORT const CFStringRef kCVImageBufferYCbCrMatrix_ITU_R_709_2 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFString
  52. CV_EXPORT const CFStringRef kCVImageBufferYCbCrMatrix_ITU_R_601_4 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFString
  53. CV_EXPORT const CFStringRef kCVImageBufferYCbCrMatrix_SMPTE_240M_1995 AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // CFString
  54. #else
  55. #define kCVImageBufferCGColorSpaceKey CFSTR("CGColorSpace")
  56. #define kCVImageBufferCleanApertureKey CFSTR("CVCleanAperture")
  57. #define kCVImageBufferCleanApertureWidthKey CFSTR("Width")
  58. #define kCVImageBufferCleanApertureHeightKey CFSTR("Height")
  59. #define kCVImageBufferCleanApertureHorizontalOffsetKey CFSTR("HorizontalOffset")
  60. #define kCVImageBufferCleanApertureVerticalOffsetKey CFSTR("VerticalOffset")
  61. #define kCVImageBufferPreferredCleanApertureKey CFSTR("CVPreferredCleanAperture")
  62. #define kCVImageBufferFieldCountKey CFSTR("CVFieldCount")
  63. #define kCVImageBufferFieldDetailKey CFSTR("CVFieldDetail")
  64. #define kCVImageBufferFieldDetailTemporalTopFirst CFSTR("TemporalTopFirst")
  65. #define kCVImageBufferFieldDetailTemporalBottomFirst CFSTR("TemporalBottomFirst")
  66. #define kCVImageBufferFieldDetailSpatialFirstLineEarly CFSTR("SpatialFirstLineEarly")
  67. #define kCVImageBufferFieldDetailSpatialFirstLineLate CFSTR("SpatialFirstLineLate")
  68. #define kCVImageBufferPixelAspectRatioKey CFSTR("CVPixelAspectRatio")
  69. #define kCVImageBufferPixelAspectRatioHorizontalSpacingKey CFSTR("HorizontalSpacing")
  70. #define kCVImageBufferPixelAspectRatioVerticalSpacingKey CFSTR("VerticalSpacing")
  71. #define kCVImageBufferDisplayDimensionsKey CFSTR("CVDisplayDimensions")
  72. #define kCVImageBufferDisplayWidthKey CFSTR("Width")
  73. #define kCVImageBufferDisplayHeightKey CFSTR("Height")
  74. #define kCVImageBufferGammaLevelKey CFSTR("CVImageBufferGammaLevel")
  75. #define kCVImageBufferYCbCrMatrixKey CFSTR("CVImageBufferYCbCrMatrix")
  76. #define kCVImageBufferYCbCrMatrix_ITU_R_709_2 CFSTR("CVImageBufferYCbCrMatrix_ITU_R_709_2")
  77. #define kCVImageBufferYCbCrMatrix_ITU_R_601_4 CFSTR("CVImageBufferYCbCrMatrix_ITU_R_601_4")
  78. #define kCVImageBufferYCbCrMatrix_SMPTE_240M_1995 CFSTR("CVImageBufferYCbCrMatrix_SMPTE_240M_1995")
  79. #endif
  80. #pragma mark CVImageBufferRef
  81. /*!
  82. @typedef CVImageBufferRef
  83. @abstract Base type for all CoreVideo image buffers
  84. */
  85. typedef CVBufferRef CVImageBufferRef;
  86. /*!
  87. @function CVImageBufferGetEncodedSize
  88. @abstract Returns the full encoded dimensions of a CVImageBuffer. For example, for an NTSC DV frame this would be 720x480
  89. @discussion Note: When creating a CIImage from a CVImageBuffer, this is the call you should use for retrieving the image size.
  90. @param imageBuffer A CVImageBuffer that you wish to retrieve the encoded size from.
  91. @result A CGSize returning the full encoded size of the buffer
  92. Returns zero size if called with a non-CVImageBufferRef type or NULL.
  93. */
  94. CV_EXPORT CGSize CVImageBufferGetEncodedSize(CVImageBufferRef imageBuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
  95. /*!
  96. @function CVImageBufferGetDisplaySize
  97. @abstract Returns the nominal output display size (in square pixels) of a CVImageBuffer.
  98. For example, for an NTSC DV frame this would be 640x480
  99. @param imageBuffer A CVImageBuffer that you wish to retrieve the display size from.
  100. @result A CGSize returning the nominal display size of the buffer
  101. Returns zero size if called with a non-CVImageBufferRef type or NULL.
  102. */
  103. CV_EXPORT CGSize CVImageBufferGetDisplaySize(CVImageBufferRef imageBuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
  104. /*!
  105. @function CVImageBufferGetCleanRect
  106. @abstract Returns the source rectangle of a CVImageBuffer that represents the clean aperture
  107. of the buffer in encoded pixels. For example, an NTSC DV frame would return a CGRect with an
  108. origin of 8,0 and a size of 704,480.
  109. Note that the origin of this rect always the lower left corner. This is the same coordinate system as
  110. used by CoreImage.
  111. @param imageBuffer A CVImageBuffer that you wish to retrieve the display size from.
  112. @result A CGSize returning the nominal display size of the buffer
  113. Returns zero rect if called with a non-CVImageBufferRef type or NULL.
  114. */
  115. CV_EXPORT CGRect CVImageBufferGetCleanRect(CVImageBufferRef imageBuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
  116. #if TARGET_OS_MAC
  117. /*!
  118. @function CVImageBufferGetColorSpace
  119. @abstract Returns the color space of a CVImageBuffer.
  120. @param imageBuffer A CVImageBuffer that you wish to retrieve the color space from.
  121. @result A CGColorSpaceRef representing the color space of the buffer.
  122. Returns NULL if called with a non-CVImageBufferRef type or NULL.
  123. */
  124. CV_EXPORT CGColorSpaceRef CVImageBufferGetColorSpace(CVImageBufferRef imageBuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
  125. #endif
  126. #if defined(__cplusplus)
  127. }
  128. #endif
  129. #endif