summaryrefslogtreecommitdiff
path: root/sys/applemedia-nonpublic/cvapi.h
blob: 63c8cba576fc38fbf92dfb8eab00c1cbbb81a586 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
 * Copyright (C) 2010 Ole André Vadla Ravnås <oleavr@soundrop.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef __GST_CV_API_H__
#define __GST_CV_API_H__

#include "dynapi.h"

#include <CoreFoundation/CoreFoundation.h>

G_BEGIN_DECLS

typedef struct _GstCVApi GstCVApi;
typedef struct _GstCVApiClass GstCVApiClass;

typedef int32_t CVReturn;

typedef uint64_t CVOptionFlags;

typedef struct _CVBuffer * CVBufferRef;
typedef CVBufferRef CVImageBufferRef;
typedef CVImageBufferRef CVPixelBufferRef;

typedef void (* CVPixelBufferReleaseBytesCallback) (void * releaseRefCon,
    const void * baseAddress);

enum _CVReturn
{
  kCVReturnSuccess = 0
};

enum _CVPixelFormatType
{
  kCVPixelFormatType_420YpCbCr8Planar             = 'y420',
  kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange = '420v',
  kCVPixelFormatType_422YpCbCr8Deprecated         = 'yuvs',
  kCVPixelFormatType_422YpCbCr8                   = '2vuy'
};

enum _CVPixelBufferLockFlags
{
  kCVPixelBufferLock_ReadOnly = 0x00000001
};

struct _GstCVApi
{
  GstDynApi parent;

  void (* CVBufferRelease) (CVBufferRef buffer);
  CVBufferRef (* CVBufferRetain) (CVBufferRef buffer);

  CVReturn (* CVPixelBufferCreateWithBytes)
      (CFAllocatorRef allocator, size_t width, size_t height,
      OSType pixelFormatType, void * baseAddress, size_t bytesPerRow,
      CVPixelBufferReleaseBytesCallback releaseCallback,
      void * releaseRefCon, CFDictionaryRef pixelBufferAttributes,
      CVPixelBufferRef * pixelBufferOut);
  CVReturn (* CVPixelBufferCreateWithPlanarBytes)
      (CFAllocatorRef allocator, size_t width, size_t height,
      OSType pixelFormatType, void * dataPtr, size_t dataSize,
      size_t numberOfPlanes, void *planeBaseAddress[],
      size_t planeWidth[], size_t planeHeight[],
      size_t planeBytesPerRow[],
      CVPixelBufferReleaseBytesCallback releaseCallback,
      void * releaseRefCon, CFDictionaryRef pixelBufferAttributes,
      CVPixelBufferRef * pixelBufferOut);
  void * (* CVPixelBufferGetBaseAddress)
      (CVPixelBufferRef pixelBuffer);
  void * (* CVPixelBufferGetBaseAddressOfPlane)
      (CVPixelBufferRef pixelBuffer, size_t planeIndex);
  size_t (* CVPixelBufferGetBytesPerRow)
      (CVPixelBufferRef pixelBuffer);
  size_t (* CVPixelBufferGetBytesPerRowOfPlane)
      (CVPixelBufferRef pixelBuffer, size_t planeIndex);
  size_t (* CVPixelBufferGetHeight) (CVPixelBufferRef pixelBuffer);
  size_t (* CVPixelBufferGetHeightOfPlane)
      (CVPixelBufferRef pixelBuffer, size_t planeIndex);
  void * (* CVPixelBufferGetIOSurface)
      (CVPixelBufferRef pixelBuffer);
  size_t (* CVPixelBufferGetPlaneCount)
      (CVPixelBufferRef pixelBuffer);
  CFTypeID (* CVPixelBufferGetTypeID) (void);
  Boolean (* CVPixelBufferIsPlanar) (CVPixelBufferRef pixelBuffer);
  CVReturn (* CVPixelBufferLockBaseAddress)
      (CVPixelBufferRef pixelBuffer, CVOptionFlags lockFlags);
  void (* CVPixelBufferRelease) (CVPixelBufferRef pixelBuffer);
  CVPixelBufferRef (* CVPixelBufferRetain)
      (CVPixelBufferRef pixelBuffer);
  CVReturn (* CVPixelBufferUnlockBaseAddress)
      (CVPixelBufferRef pixelBuffer, CVOptionFlags unlockFlags);

  CFStringRef * kCVPixelBufferPixelFormatTypeKey;
  CFStringRef * kCVPixelBufferWidthKey;
  CFStringRef * kCVPixelBufferHeightKey;
  CFStringRef * kCVPixelBufferBytesPerRowAlignmentKey;
  CFStringRef * kCVPixelBufferPlaneAlignmentKey;
};

struct _GstCVApiClass
{
  GstDynApiClass parent_class;
};

GType gst_cv_api_get_type (void);

GstCVApi * gst_cv_api_obtain (GError ** error);

G_END_DECLS

#endif