Home | History | Annotate | Download | only in mac
      1 // Copyright 2013 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 #ifndef MEDIA_VIDEO_CAPTURE_MAC_COREMEDIA_GLUE_H_
      6 #define MEDIA_VIDEO_CAPTURE_MAC_COREMEDIA_GLUE_H_
      7 
      8 #import <CoreVideo/CoreVideo.h>
      9 #import <Foundation/Foundation.h>
     10 
     11 #include "base/basictypes.h"
     12 #include "media/base/media_export.h"
     13 
     14 // CoreMedia API is only introduced in Mac OS X > 10.6, the (potential) linking
     15 // with it has to happen in runtime. If it succeeds, subsequent clients can use
     16 // CoreMedia via the class declared in this file, where the original naming has
     17 // been kept as much as possible.
     18 class MEDIA_EXPORT CoreMediaGlue {
     19  public:
     20   // Originally from CMTime.h
     21   typedef int64_t CMTimeValue;
     22   typedef int32_t CMTimeScale;
     23   typedef int64_t CMTimeEpoch;
     24   typedef uint32_t CMTimeFlags;
     25   typedef struct {
     26     CMTimeValue value;
     27     CMTimeScale timescale;
     28     CMTimeFlags flags;
     29     CMTimeEpoch epoch;
     30   } CMTime;
     31 
     32   // Originally from CMFormatDescription.h.
     33   typedef const struct opaqueCMFormatDescription* CMFormatDescriptionRef;
     34   typedef CMFormatDescriptionRef CMVideoFormatDescriptionRef;
     35   typedef struct {
     36     int32_t width;
     37     int32_t height;
     38   } CMVideoDimensions;
     39   enum {
     40     kCMPixelFormat_422YpCbCr8_yuvs = 'yuvs',
     41   };
     42   enum {
     43     kCMVideoCodecType_JPEG_OpenDML = 'dmb1',
     44   };
     45 
     46   // Originally from CMSampleBuffer.h.
     47   typedef struct OpaqueCMSampleBuffer* CMSampleBufferRef;
     48 
     49   // Originally from CMTime.h.
     50   static CMTime CMTimeMake(int64_t value, int32_t timescale);
     51 
     52   // Originally from CMSampleBuffer.h.
     53   static CVImageBufferRef CMSampleBufferGetImageBuffer(
     54       CMSampleBufferRef buffer);
     55 
     56   // Originally from CMFormatDescription.h.
     57   static FourCharCode CMFormatDescriptionGetMediaSubType(
     58       CMFormatDescriptionRef desc);
     59   static CMVideoDimensions CMVideoFormatDescriptionGetDimensions(
     60       CMVideoFormatDescriptionRef videoDesc);
     61 
     62  private:
     63   DISALLOW_IMPLICIT_CONSTRUCTORS(CoreMediaGlue);
     64 };
     65 
     66 #endif  // MEDIA_VIDEO_CAPTURE_MAC_COREMEDIA_GLUE_H_
     67