2 * Copyright (C) 2010 Ole André Vadla Ravnås <oravnas@cisco.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #ifndef __GST_CV_API_H__
21 #define __GST_CV_API_H__
25 #include <CoreFoundation/CoreFoundation.h>
29 typedef struct _GstCVApi GstCVApi;
30 typedef struct _GstCVApiClass GstCVApiClass;
32 typedef int32_t CVReturn;
34 typedef uint64_t CVOptionFlags;
36 typedef struct _CVBuffer * CVBufferRef;
37 typedef CVBufferRef CVImageBufferRef;
38 typedef CVImageBufferRef CVPixelBufferRef;
40 typedef void (* CVPixelBufferReleaseBytesCallback) (void * releaseRefCon,
41 const void * baseAddress);
48 enum _CVPixelFormatType
50 kCVPixelFormatType_420YpCbCr8Planar = 'y420',
51 kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange = '420v',
52 kCVPixelFormatType_422YpCbCr8Deprecated = 'yuvs',
53 kCVPixelFormatType_422YpCbCr8 = '2vuy'
56 enum _CVPixelBufferLockFlags
58 kCVPixelBufferLock_ReadOnly = 0x00000001
65 void (* CVBufferRelease) (CVBufferRef buffer);
66 CVBufferRef (* CVBufferRetain) (CVBufferRef buffer);
68 CVReturn (* CVPixelBufferCreateWithBytes)
69 (CFAllocatorRef allocator, size_t width, size_t height,
70 OSType pixelFormatType, void * baseAddress, size_t bytesPerRow,
71 CVPixelBufferReleaseBytesCallback releaseCallback,
72 void * releaseRefCon, CFDictionaryRef pixelBufferAttributes,
73 CVPixelBufferRef * pixelBufferOut);
74 CVReturn (* CVPixelBufferCreateWithPlanarBytes)
75 (CFAllocatorRef allocator, size_t width, size_t height,
76 OSType pixelFormatType, void * dataPtr, size_t dataSize,
77 size_t numberOfPlanes, void *planeBaseAddress[],
78 size_t planeWidth[], size_t planeHeight[],
79 size_t planeBytesPerRow[],
80 CVPixelBufferReleaseBytesCallback releaseCallback,
81 void * releaseRefCon, CFDictionaryRef pixelBufferAttributes,
82 CVPixelBufferRef * pixelBufferOut);
83 void * (* CVPixelBufferGetBaseAddress)
84 (CVPixelBufferRef pixelBuffer);
85 void * (* CVPixelBufferGetBaseAddressOfPlane)
86 (CVPixelBufferRef pixelBuffer, size_t planeIndex);
87 size_t (* CVPixelBufferGetBytesPerRow)
88 (CVPixelBufferRef pixelBuffer);
89 size_t (* CVPixelBufferGetBytesPerRowOfPlane)
90 (CVPixelBufferRef pixelBuffer, size_t planeIndex);
91 size_t (* CVPixelBufferGetHeight) (CVPixelBufferRef pixelBuffer);
92 size_t (* CVPixelBufferGetHeightOfPlane)
93 (CVPixelBufferRef pixelBuffer, size_t planeIndex);
94 void * (* CVPixelBufferGetIOSurface)
95 (CVPixelBufferRef pixelBuffer);
96 size_t (* CVPixelBufferGetPlaneCount)
97 (CVPixelBufferRef pixelBuffer);
98 CFTypeID (* CVPixelBufferGetTypeID) (void);
99 Boolean (* CVPixelBufferIsPlanar) (CVPixelBufferRef pixelBuffer);
100 CVReturn (* CVPixelBufferLockBaseAddress)
101 (CVPixelBufferRef pixelBuffer, CVOptionFlags lockFlags);
102 void (* CVPixelBufferRelease) (CVPixelBufferRef pixelBuffer);
103 CVPixelBufferRef (* CVPixelBufferRetain)
104 (CVPixelBufferRef pixelBuffer);
105 CVReturn (* CVPixelBufferUnlockBaseAddress)
106 (CVPixelBufferRef pixelBuffer, CVOptionFlags unlockFlags);
108 CFStringRef * kCVPixelBufferPixelFormatTypeKey;
109 CFStringRef * kCVPixelBufferWidthKey;
110 CFStringRef * kCVPixelBufferHeightKey;
111 CFStringRef * kCVPixelBufferBytesPerRowAlignmentKey;
112 CFStringRef * kCVPixelBufferPlaneAlignmentKey;
115 struct _GstCVApiClass
117 GstDynApiClass parent_class;
120 GType gst_cv_api_get_type (void);
122 GstCVApi * gst_cv_api_obtain (GError ** error);