Home | History | Annotate | Download | only in media
      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 
      7 extern "C" {
      8 
      9 //
     10 // Declare CoreMedia types.
     11 //
     12 
     13 typedef signed long CMItemCount;
     14 typedef uint32_t CMBlockBufferFlags;
     15 typedef struct OpaqueCMBlockBuffer *CMBlockBufferRef;
     16 typedef const struct opaqueCMFormatDescription *CMFormatDescriptionRef;
     17 typedef CMFormatDescriptionRef CMVideoFormatDescriptionRef;
     18 typedef struct opaqueCMSampleBuffer *CMSampleBufferRef;
     19 
     20 typedef int64_t CMTimeValue;
     21 typedef int32_t CMTimeScale;
     22 typedef int64_t CMTimeEpoch;
     23 typedef uint32_t CMTimeFlags;
     24 
     25 typedef struct {
     26   CMTimeValue value;
     27   CMTimeScale timescale;
     28   CMTimeFlags flags;
     29   CMTimeEpoch epoch;
     30 } CMTime;
     31 
     32 typedef struct {
     33   CMTime duration;
     34   CMTime presentationTimeStamp;
     35   CMTime decodeTimeStamp;
     36 } CMSampleTimingInfo;
     37 
     38 typedef struct {
     39   int32_t width;
     40   int32_t height;
     41 } CMVideoDimensions;
     42 
     43 typedef 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 
     50 typedef OSStatus (*CMSampleBufferMakeDataReadyCallback)(
     51     CMSampleBufferRef sbuf,
     52     void *makeDataReadyRefcon);
     53 
     54 //
     55 // Declare VideoToolbox types.
     56 //
     57 
     58 typedef struct __CVBuffer *CVBufferRef;
     59 typedef CVBufferRef CVImageBufferRef;
     60 typedef uint32_t VTDecodeFrameFlags;
     61 enum {
     62   kVTDecodeFrame_EnableAsynchronousDecompression = 1 << 0,
     63   kVTDecodeFrame_DoNotOutputFrame = 1 << 1,
     64   kVTDecodeFrame_1xRealTimePlayback = 1 << 2,
     65   kVTDecodeFrame_EnableTemporalProcessing = 1 << 3,
     66 };
     67 typedef UInt32 VTDecodeInfoFlags;
     68 typedef struct OpaqueVTDecompressionSession* VTDecompressionSessionRef;
     69 
     70 typedef void (*VTDecompressionOutputCallback)(
     71     void *decompressionOutputRefCon,
     72     void *sourceFrameRefCon,
     73     OSStatus status,
     74     VTDecodeInfoFlags infoFlags,
     75     CVImageBufferRef imageBuffer,
     76     CMTime presentationTimeStamp,
     77     CMTime presentationDuration);
     78 
     79 typedef struct {
     80   VTDecompressionOutputCallback decompressionOutputCallback;
     81   void *decompressionOutputRefCon;
     82 } VTDecompressionOutputCallbackRecord;
     83 
     84 }  // extern "C"
     85