gstreamer/sys/applemedia/cmapi.h
Ole André Vadla Ravnås 2e349576eb applemedia: support public version of CoreMedia
Also rename the relevant API so we mirror the public API more closely, and
switch to CoreFoundation CFTypeRef style typedefs. We still support the old
private CoreMedia in order to not break OS X support.

This means that vtenc and vtdec are now compatible with iOS 4.x, and in
theory also future versions of OS X, where this API may turn public like
it has on iOS.
2010-11-02 23:14:26 +01:00

183 lines
6 KiB
C

/*
* Copyright (C) 2010 Ole André Vadla Ravnås <oravnas@cisco.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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_CM_API_H__
#define __GST_CM_API_H__
#include "dynapi.h"
#include <CoreFoundation/CoreFoundation.h>
#include "cvapi.h"
G_BEGIN_DECLS
typedef struct _GstCMApi GstCMApi;
typedef struct _GstCMApiClass GstCMApiClass;
typedef CFTypeRef FigBaseObjectRef;
typedef struct _FigBaseVTable FigBaseVTable;
typedef struct _FigBaseIface FigBaseIface;
typedef CFTypeRef CMFormatDescriptionRef;
typedef struct _CMVideoDimensions CMVideoDimensions;
typedef struct _CMTime CMTime;
typedef CFTypeRef CMBufferQueueRef;
typedef CFTypeRef CMSampleBufferRef;
typedef CFTypeRef CMBlockBufferRef;
typedef Boolean (* CMBufferQueueValidateFunc) (CMBufferQueueRef queue,
CMSampleBufferRef buf, void *refCon);
enum _FigMediaType
{
kFigMediaTypeVideo = 'vide'
};
enum _FigCodecType
{
kComponentVideoUnsigned = 'yuvs',
kFigVideoCodecType_JPEG_OpenDML = 'dmb1',
kYUV420vCodecType = '420v'
};
struct _FigBaseVTable
{
gsize unk;
FigBaseIface * base;
void * derived;
};
struct _FigBaseIface
{
gsize unk1;
gsize unk2;
gsize unk3;
OSStatus (* Invalidate) (FigBaseObjectRef obj);
OSStatus (* Finalize) (FigBaseObjectRef obj);
gpointer unk4;
OSStatus (* CopyProperty) (FigBaseObjectRef obj, CFTypeRef key, void *unk,
CFTypeRef * value);
OSStatus (* SetProperty) (FigBaseObjectRef obj, CFTypeRef key,
CFTypeRef value);
};
struct _CMVideoDimensions
{
UInt32 width;
UInt32 height;
};
struct _CMTime
{
UInt8 data[24];
};
struct _GstCMApi
{
GstDynApi parent;
FigBaseVTable * (* FigBaseObjectGetVTable) (FigBaseObjectRef obj);
void * (* CMGetAttachment) (CFTypeRef obj, CFStringRef attachmentKey,
UInt32 * foundWherePtr);
void (* FigFormatDescriptionRelease) (CMFormatDescriptionRef desc);
CMFormatDescriptionRef (* FigFormatDescriptionRetain) (
CMFormatDescriptionRef desc);
Boolean (* CMFormatDescriptionEqual) (CMFormatDescriptionRef desc1,
CMFormatDescriptionRef desc2);
CFTypeRef (* CMFormatDescriptionGetExtension) (
const CMFormatDescriptionRef desc, CFStringRef extensionKey);
UInt32 (* CMFormatDescriptionGetMediaType) (
const CMFormatDescriptionRef desc);
UInt32 (* CMFormatDescriptionGetMediaSubType) (
const CMFormatDescriptionRef desc);
OSStatus (* CMVideoFormatDescriptionCreate) (
CFAllocatorRef allocator, UInt32 formatId, UInt32 width, UInt32 height,
CFDictionaryRef extensions, CMFormatDescriptionRef * desc);
OSStatus (* FigVideoFormatDescriptionCreateWithSampleDescriptionExtensionAtom)
(CFAllocatorRef allocator, UInt32 formatId, UInt32 width, UInt32 height,
UInt32 atomId, const UInt8 * data, CFIndex len,
CMFormatDescriptionRef * formatDesc);
CMVideoDimensions (* CMVideoFormatDescriptionGetDimensions) (
const CMFormatDescriptionRef desc);
CMTime (* CMTimeMake) (int64_t value, int32_t timescale);
OSStatus (* CMSampleBufferCreate) (CFAllocatorRef allocator,
CMBlockBufferRef blockBuf, Boolean unkBool, UInt32 unkDW1, UInt32 unkDW2,
CMFormatDescriptionRef fmtDesc, UInt32 unkCountA, UInt32 unkCountB,
const void * unkTimeData, UInt32 unkCountC, const void * unkDWordData,
CMSampleBufferRef * sampleBuffer);
Boolean (* CMSampleBufferDataIsReady) (
const CMSampleBufferRef buf);
CMBlockBufferRef (* CMSampleBufferGetDataBuffer) (
const CMSampleBufferRef buf);
CMFormatDescriptionRef (* CMSampleBufferGetFormatDescription) (
const CMSampleBufferRef buf);
CVImageBufferRef (* CMSampleBufferGetImageBuffer) (
const CMSampleBufferRef buf);
SInt32 (* CMSampleBufferGetNumSamples) (
const CMSampleBufferRef buf);
CFArrayRef (* CMSampleBufferGetSampleAttachmentsArray) (
const CMSampleBufferRef buf, SInt32 sampleIndex);
SInt32 (* CMSampleBufferGetSampleSize) (
const CMSampleBufferRef buf, SInt32 sampleIndex);
void (* FigSampleBufferRelease) (CMSampleBufferRef buf);
CMSampleBufferRef (* FigSampleBufferRetain) (CMSampleBufferRef buf);
OSStatus (* CMBlockBufferCreateWithMemoryBlock)
(CFAllocatorRef allocator, Byte * data, UInt32 size,
CFAllocatorRef dataAllocator, void *unk1, UInt32 sizeA, UInt32 sizeB,
Boolean unkBool, CMBlockBufferRef * blockBuffer);
SInt32 (* CMBlockBufferGetDataLength) (const CMBlockBufferRef buf);
OSStatus (* CMBlockBufferGetDataPointer) (
const CMBlockBufferRef buf, UInt32 unk1, UInt32 unk2, UInt32 unk3,
Byte ** dataPtr);
void (* FigBlockBufferRelease) (CMBlockBufferRef buf);
CMBlockBufferRef (* FigBlockBufferRetain) (CMBlockBufferRef buf);
CMSampleBufferRef (* CMBufferQueueDequeueAndRetain)
(CMBufferQueueRef queue);
CFIndex (* CMBufferQueueGetBufferCount) (CMBufferQueueRef queue);
Boolean (* CMBufferQueueIsEmpty) (CMBufferQueueRef queue);
void (* FigBufferQueueRelease) (CMBufferQueueRef queue);
OSStatus (* CMBufferQueueSetValidationCallback)
(CMBufferQueueRef queue, CMBufferQueueValidateFunc func, void *refCon);
CFStringRef * kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms;
CFStringRef * kCMSampleAttachmentKey_DependsOnOthers;
CMTime * kCMTimeInvalid;
};
struct _GstCMApiClass
{
GstDynApiClass parent_class;
};
GType gst_cm_api_get_type (void);
GstCMApi * gst_cm_api_obtain (GError ** error);
G_END_DECLS
#endif