Tizen 2.0 Release
[framework/multimedia/gst-plugins-bad0.10.git] / sys / applemedia / cvapi.h
1 /*
2  * Copyright (C) 2010 Ole André Vadla Ravnås <oravnas@cisco.com>
3  *
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.
8  *
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.
13  *
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.
18  */
19
20 #ifndef __GST_CV_API_H__
21 #define __GST_CV_API_H__
22
23 #include "dynapi.h"
24
25 #include <CoreFoundation/CoreFoundation.h>
26
27 G_BEGIN_DECLS
28
29 typedef struct _GstCVApi GstCVApi;
30 typedef struct _GstCVApiClass GstCVApiClass;
31
32 typedef int32_t CVReturn;
33
34 typedef uint64_t CVOptionFlags;
35
36 typedef struct _CVBuffer * CVBufferRef;
37 typedef CVBufferRef CVImageBufferRef;
38 typedef CVImageBufferRef CVPixelBufferRef;
39
40 typedef void (* CVPixelBufferReleaseBytesCallback) (void * releaseRefCon,
41     const void * baseAddress);
42
43 enum _CVReturn
44 {
45   kCVReturnSuccess = 0
46 };
47
48 enum _CVPixelFormatType
49 {
50   kCVPixelFormatType_420YpCbCr8Planar             = 'y420',
51   kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange = '420v',
52   kCVPixelFormatType_422YpCbCr8Deprecated         = 'yuvs',
53   kCVPixelFormatType_422YpCbCr8                   = '2vuy'
54 };
55
56 enum _CVPixelBufferLockFlags
57 {
58   kCVPixelBufferLock_ReadOnly = 0x00000001
59 };
60
61 struct _GstCVApi
62 {
63   GstDynApi parent;
64
65   void (* CVBufferRelease) (CVBufferRef buffer);
66   CVBufferRef (* CVBufferRetain) (CVBufferRef buffer);
67
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);
107
108   CFStringRef * kCVPixelBufferPixelFormatTypeKey;
109   CFStringRef * kCVPixelBufferWidthKey;
110   CFStringRef * kCVPixelBufferHeightKey;
111   CFStringRef * kCVPixelBufferBytesPerRowAlignmentKey;
112   CFStringRef * kCVPixelBufferPlaneAlignmentKey;
113 };
114
115 struct _GstCVApiClass
116 {
117   GstDynApiClass parent_class;
118 };
119
120 GType gst_cv_api_get_type (void);
121
122 GstCVApi * gst_cv_api_obtain (GError ** error);
123
124 G_END_DECLS
125
126 #endif