1// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include <CoreFoundation/CoreFoundation.h>
6
7extern "C" {
8
9//
10// Declare CoreMedia types.
11//
12
13typedef signed long CMItemCount;
14typedef uint32_t CMBlockBufferFlags;
15typedef struct OpaqueCMBlockBuffer *CMBlockBufferRef;
16typedef const struct opaqueCMFormatDescription *CMFormatDescriptionRef;
17typedef CMFormatDescriptionRef CMVideoFormatDescriptionRef;
18typedef struct opaqueCMSampleBuffer *CMSampleBufferRef;
19
20typedef int64_t CMTimeValue;
21typedef int32_t CMTimeScale;
22typedef int64_t CMTimeEpoch;
23typedef uint32_t CMTimeFlags;
24
25typedef struct {
26  CMTimeValue value;
27  CMTimeScale timescale;
28  CMTimeFlags flags;
29  CMTimeEpoch epoch;
30} CMTime;
31
32typedef struct {
33  CMTime duration;
34  CMTime presentationTimeStamp;
35  CMTime decodeTimeStamp;
36} CMSampleTimingInfo;
37
38typedef struct {
39  int32_t width;
40  int32_t height;
41} CMVideoDimensions;
42
43typedef struct {
44  uint32_t version;
45  void *(*AllocateBlock)(void *refCon, size_t sizeInBytes);
46  void (*FreeBlock)(void *refCon, void *doomedMemoryBlock, size_t sizeInBytes);
47  void *refCon;
48} CMBlockBufferCustomBlockSource;
49
50typedef OSStatus (*CMSampleBufferMakeDataReadyCallback)(
51    CMSampleBufferRef sbuf,
52    void *makeDataReadyRefcon);
53
54//
55// Declare VideoToolbox types.
56//
57
58typedef struct __CVBuffer *CVBufferRef;
59typedef CVBufferRef CVImageBufferRef;
60typedef uint32_t VTDecodeFrameFlags;
61enum {
62  kVTDecodeFrame_EnableAsynchronousDecompression = 1 << 0,
63  kVTDecodeFrame_DoNotOutputFrame = 1 << 1,
64  kVTDecodeFrame_1xRealTimePlayback = 1 << 2,
65  kVTDecodeFrame_EnableTemporalProcessing = 1 << 3,
66};
67typedef UInt32 VTDecodeInfoFlags;
68typedef struct OpaqueVTDecompressionSession* VTDecompressionSessionRef;
69
70typedef void (*VTDecompressionOutputCallback)(
71    void *decompressionOutputRefCon,
72    void *sourceFrameRefCon,
73    OSStatus status,
74    VTDecodeInfoFlags infoFlags,
75    CVImageBufferRef imageBuffer,
76    CMTime presentationTimeStamp,
77    CMTime presentationDuration);
78
79typedef struct {
80  VTDecompressionOutputCallback decompressionOutputCallback;
81  void *decompressionOutputRefCon;
82} VTDecompressionOutputCallbackRecord;
83
84}  // extern "C"
85