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.

171 lines
7.9 KiB

  1. /*
  2. * CVBuffer.h
  3. * CoreVideo
  4. *
  5. * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
  6. *
  7. */
  8. /*! @header CVBuffer.h
  9. @copyright 2004 Apple Computer, Inc. All rights reserved.
  10. @availability Mac OS X 10.4 or later
  11. @discussion CVBufferRef types are abstract and only define ways to attach meta data to buffers (such as timestamps,
  12. colorspace information, etc.). CVBufferRefs do not imply any particular kind of data storage. It could
  13. be compressed data, image data, etc.
  14. */
  15. #if !defined(__COREVIDEO_CVBUFFER_H__)
  16. #define __COREVIDEO_CVBUFFER_H__ 1
  17. #include <TargetConditionals.h>
  18. #if TARGET_OS_MAC
  19. #include <QuartzCore/CVBase.h>
  20. #include <QuartzCore/CVReturn.h>
  21. #include <CoreFoundation/CFDictionary.h>
  22. #include <stddef.h>
  23. #include <stdint.h>
  24. #else
  25. #pragma warning (disable: 4068) // ignore unknown pragmas
  26. #include <CVBase.h>
  27. #include <CVReturn.h>
  28. #include <CFDictionary.h>
  29. #endif
  30. #if defined(__cplusplus)
  31. extern "C" {
  32. #endif
  33. #pragma mark CVBufferRef attribute keys
  34. /* The following two keys are useful with the CoreVideo pool and texture cache APIs so that you can specify
  35. an initial set of default buffer attachments to automatically be attached to the buffer when it is created. */
  36. #if TARGET_OS_MAC
  37. CV_EXPORT const CFStringRef kCVBufferPropagatedAttachmentsKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
  38. CV_EXPORT const CFStringRef kCVBufferNonPropagatedAttachmentsKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
  39. #else
  40. #define kCVBufferPropagatedAttachmentsKey CFSTR("PropagatedAttachments")
  41. #define kCVBufferNonPropagatedAttachmentsKey CFSTR("NonPropagatedAttachments")
  42. #endif
  43. #pragma mark CVBufferRef attachment keys
  44. #if TARGET_OS_MAC
  45. CV_EXPORT const CFStringRef kCVBufferMovieTimeKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; // Generally only available for frames emitted by QuickTime; CFDictionary containing these two keys:
  46. CV_EXPORT const CFStringRef kCVBufferTimeValueKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
  47. CV_EXPORT const CFStringRef kCVBufferTimeScaleKey AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
  48. #else
  49. #define kCVBufferMovieTimeKey CFSTR("QTMovieTime")
  50. #define kCVBufferTimeValueKey CFSTR("TimeValue")
  51. #define kCVBufferTimeScaleKey CFSTR("TimeScale")
  52. #endif
  53. #pragma mark CVBufferRef
  54. enum {
  55. kCVAttachmentMode_ShouldNotPropagate = 0,
  56. kCVAttachmentMode_ShouldPropagate = 1,
  57. };
  58. typedef uint32_t CVAttachmentMode;
  59. /*!
  60. @typedef CVBufferRef
  61. @abstract Base type for all CoreVideo buffers
  62. */
  63. typedef struct __CVBuffer *CVBufferRef;
  64. /*!
  65. @function CVBufferRetain
  66. @abstract Retains a CVBuffer object
  67. @discussion Like CFRetain CVBufferRetain increments the retain count of a CVBuffer object. In contrast to the CF call it is NULL safe.
  68. @param buffer A CVBuffer object that you want to retain.
  69. @result A CVBuffer object that is the same as the passed in buffer.
  70. */
  71. CV_EXPORT CVBufferRef CVBufferRetain(CVBufferRef buffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
  72. /*!
  73. @function CVBufferRelease
  74. @abstract Release a CVBuffer object
  75. @discussion Like CFRetain CVBufferRetain decrements the retain count of a CVBuffer object. If that count consequently becomes zero the memory allocated to the object is deallocated and the object is destroyed. In contrast to the CF call it is NULL safe.
  76. @param buffer A CVBuffer object that you want to release.
  77. */
  78. CV_EXPORT void CVBufferRelease(CVBufferRef buffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
  79. #pragma mark CVBufferAttachment
  80. /*!
  81. @function CVBufferSetAttachment
  82. @abstract Sets or adds a attachment of a CVBuffer object
  83. @discussion You can attach any CF object to a CVBuffer object to store additional information. CVBufferGetAttachment stores an attachement identified by a key. If the key doesn't exist, the attachment will be added. If the key does exist, the existing attachment will be replaced. In bouth cases the retain count of the attachment will be incremented. The value can be any CFType but nil has no defined behavior.
  84. @param buffer Target CVBuffer object.
  85. @param key Key in form of a CFString identifying the desired attachment.
  86. @param value Attachment in form af a CF object.
  87. @param attachmentMode Specifies which attachment mode is desired for this attachment. A particular attachment key may only exist in
  88. a single mode at a time.
  89. */
  90. CV_EXPORT void CVBufferSetAttachment(CVBufferRef buffer, CFStringRef key, CFTypeRef value, CVAttachmentMode attachmentMode) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
  91. /*!
  92. @function CVBufferGetAttachment
  93. @abstract Returns a specific attachment of a CVBuffer object
  94. @discussion You can attach any CF object to a CVBuffer object to store additional information. CVBufferGetAttachment retrieves an attachement identified by a key.
  95. @param buffer Target CVBuffer object.
  96. @param key Key in form of a CFString identifying the desired attachment.
  97. @param attachmentMode. Returns the mode of the attachment, if desired. May be NULL.
  98. @result If found the attachment object
  99. */
  100. CV_EXPORT CFTypeRef CVBufferGetAttachment(CVBufferRef buffer, CFStringRef key, CVAttachmentMode *attachmentMode) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
  101. /*!
  102. @function CVBufferRemoveAttachment
  103. @abstract Removes a specific attachment of a CVBuffer object
  104. @discussion CVBufferRemoveAttachment removes an attachement identified by a key. If found the attachement is removed and the retain count decremented.
  105. @param buffer Target CVBuffer object.
  106. @param key Key in form of a CFString identifying the desired attachment.
  107. */
  108. CV_EXPORT void CVBufferRemoveAttachment(CVBufferRef buffer, CFStringRef key) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
  109. /*!
  110. @function CVBufferRemoveAllAttachments
  111. @abstract Removes all attachments of a CVBuffer object
  112. @discussion While CVBufferRemoveAttachment removes a specific attachement identified by a key CVBufferRemoveAllAttachments removes all attachments of a buffer and decrements their retain counts.
  113. @param buffer Target CVBuffer object.
  114. */
  115. CV_EXPORT void CVBufferRemoveAllAttachments(CVBufferRef buffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
  116. /*!
  117. @function CVBufferGetAttachments
  118. @abstract Returns all attachments of a CVBuffer object
  119. @discussion CVBufferGetAttachments is a convenience call that returns all attachments with their corresponding keys in a CFDictionary.
  120. @param buffer Target CVBuffer object.
  121. @result A CFDictionary with all buffer attachments identified by there keys. If no attachment is present, the dictionary is empty. Returns NULL
  122. for invalid attachment mode.
  123. */
  124. CV_EXPORT CFDictionaryRef CVBufferGetAttachments(CVBufferRef buffer, CVAttachmentMode attachmentMode) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
  125. /*!
  126. @function CVBufferSetAttachments
  127. @abstract Sets a set of attachments for a CVBuffer
  128. @discussion CVBufferSetAttachments is a convenience call that in turn calls CVBufferSetAttachment for each key and value in the given dictionary. All key value pairs must be in the root level of the dictionary.
  129. @param buffer Target CVBuffer object.
  130. */
  131. CV_EXPORT void CVBufferSetAttachments(CVBufferRef buffer, CFDictionaryRef theAttachments, CVAttachmentMode attachmentMode) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
  132. /*!
  133. @function CVBufferPropagateAttachments
  134. @abstract Copy all propagatable attachments from one buffer to another.
  135. @discussion CVBufferPropagateAttachments is a convenience call that copies all attachments with a mode of kCVAttachmentMode_ShouldPropagate from one
  136. buffer to another.
  137. @param sourceBuffer CVBuffer to copy attachments from.
  138. @param destinationBuffer CVBuffer to copy attachments to.
  139. */
  140. CV_EXPORT void CVBufferPropagateAttachments(CVBufferRef sourceBuffer, CVBufferRef destinationBuffer) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
  141. #if defined(__cplusplus)
  142. }
  143. #endif
  144. #endif