gstreamer/sys/applemedia/cmapi.h
Ole André Vadla Ravnås 0e4e351b83 applemedia: New plugin for Apple multimedia APIs
Provides the following elements:

qtkitvideosrc: OS X video source relying on the QTKit API. Comes with
hard-coded caps as the API does not provide any way of querying for
formats supported by the hardware. Hasn't been tested a lot, but seems
to work.

miovideosrc: OS X video source which uses the undocumented/private
CoreMediaIOServices API, which is also the one used by iChat.
Present on latest version of Leopard and all versions of Snow Leopard.
Has been tested extensively with built-in cameras and TANDBERG's
PrecisionHD USB camera.

vtenc, vtdec: Generic codec wrappers which make use of the undocumented/
private VideoToolbox API on OS X and iOS. List of codecs are currently
hard-coded to H.264 for vtenc, and H.264 + JPEG for vtdec. Can easily be
expanded by adding new entries to the lists, but haven't yet had time to
do that. Should probably also implement probing as available codecs depend
on the OS and its version, and there doesn't seem to be any way to
enumerate the available codecs.

vth264decbin, vth264encbin: Wrapper bins to make it easier to use
vtdec_h264/vtenc_h264 in live scenarios.

iphonecamerasrc: iPhone camera source relying on the undocumented/private
Celestial API. Tested on iOS 3.1 running on an iPhone 3GS. Stops working
after a few minutes, presumably because of a resource leak. Needs some
love.

Note that the iOS parts haven't yet been ported to iOS 4.x.
2010-10-28 15:08:08 +02:00

193 lines
6.2 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 enum _FigStatus FigStatus;
typedef CFTypeRef FigBaseObjectRef;
typedef struct _FigBaseVTable FigBaseVTable;
typedef struct _FigBaseIface FigBaseIface;
typedef struct _FigFormatDescription FigFormatDescription;
typedef struct _FigVideoDimensions FigVideoDimensions;
typedef struct _FigTime FigTime;
typedef CFTypeRef FigBufferQueueRef;
typedef struct _FigSampleBuffer FigSampleBuffer;
typedef struct _FigDataBuffer FigDataBuffer;
typedef struct _FigBlockBuffer FigBlockBuffer;
typedef Boolean (* FigBufferQueueValidateFunc) (FigBufferQueueRef queue,
FigSampleBuffer *buf, void *refCon);
enum _FigStatus
{
kFigSuccess = 0,
kFigResourceBusy = -12780
};
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;
FigStatus (* Invalidate) (FigBaseObjectRef obj);
FigStatus (* Finalize) (FigBaseObjectRef obj);
gpointer unk4;
FigStatus (* CopyProperty) (FigBaseObjectRef obj, CFTypeRef key, void *unk,
CFTypeRef * value);
FigStatus (* SetProperty) (FigBaseObjectRef obj, CFTypeRef key,
CFTypeRef value);
};
struct _FigVideoDimensions
{
UInt32 width;
UInt32 height;
};
struct _FigTime
{
UInt8 data[24];
};
struct _GstCMApi
{
GstDynApi parent;
FigBaseVTable * (* FigBaseObjectGetVTable) (FigBaseObjectRef obj);
void * (* FigGetAttachment) (void * obj, CFStringRef attachmentKey,
UInt32 * foundWherePtr);
void (* FigFormatDescriptionRelease) (FigFormatDescription * desc);
FigFormatDescription * (* FigFormatDescriptionRetain) (
FigFormatDescription * desc);
Boolean (* FigFormatDescriptionEqual) (FigFormatDescription * desc1,
FigFormatDescription * desc2);
CFTypeRef (* FigFormatDescriptionGetExtension) (
const FigFormatDescription * desc, CFStringRef extensionKey);
UInt32 (* FigFormatDescriptionGetMediaType) (
const FigFormatDescription * desc);
UInt32 (* FigFormatDescriptionGetMediaSubType) (
const FigFormatDescription * desc);
FigStatus (* FigVideoFormatDescriptionCreate) (
CFAllocatorRef allocator, UInt32 formatId, UInt32 width, UInt32 height,
CFDictionaryRef extensions, FigFormatDescription ** desc);
FigStatus (* FigVideoFormatDescriptionCreateWithSampleDescriptionExtensionAtom)
(CFAllocatorRef allocator, UInt32 formatId, UInt32 width, UInt32 height,
UInt32 atomId, const UInt8 * data, CFIndex len,
FigFormatDescription ** formatDesc);
FigVideoDimensions (* FigVideoFormatDescriptionGetDimensions) (
const FigFormatDescription * desc);
FigTime (* FigTimeMake) (UInt64 numerator, UInt32 denominator);
FigStatus (* FigSampleBufferCreate) (CFAllocatorRef allocator,
FigBlockBuffer * blockBuf, Boolean unkBool, UInt32 unkDW1, UInt32 unkDW2,
FigFormatDescription * fmtDesc, UInt32 unkCountA, UInt32 unkCountB,
const void * unkTimeData, UInt32 unkCountC, const void * unkDWordData,
FigSampleBuffer ** sampleBuffer);
Boolean (* FigSampleBufferDataIsReady) (
const FigSampleBuffer * buf);
FigBlockBuffer * (* FigSampleBufferGetDataBuffer) (
const FigSampleBuffer * buf);
FigFormatDescription * (* FigSampleBufferGetFormatDescription) (
const FigSampleBuffer * buf);
CVImageBufferRef (* FigSampleBufferGetImageBuffer) (
const FigSampleBuffer * buf);
SInt32 (* FigSampleBufferGetNumSamples) (
const FigSampleBuffer * buf);
CFArrayRef (* FigSampleBufferGetSampleAttachmentsArray) (
const FigSampleBuffer * buf, SInt32 sampleIndex);
SInt32 (* FigSampleBufferGetSampleSize) (
const FigSampleBuffer * buf, SInt32 sampleIndex);
void (* FigSampleBufferRelease) (FigSampleBuffer * buf);
FigSampleBuffer * (* FigSampleBufferRetain) (FigSampleBuffer * buf);
FigStatus (* FigBlockBufferCreateWithMemoryBlock)
(CFAllocatorRef allocator, Byte * data, UInt32 size,
CFAllocatorRef dataAllocator, void *unk1, UInt32 sizeA, UInt32 sizeB,
Boolean unkBool, FigBlockBuffer ** blockBuffer);
SInt32 (* FigBlockBufferGetDataLength) (const FigBlockBuffer * buf);
FigStatus (* FigBlockBufferGetDataPointer) (
const FigBlockBuffer * buf, UInt32 unk1, UInt32 unk2, UInt32 unk3,
Byte ** dataPtr);
void (* FigBlockBufferRelease) (FigBlockBuffer * buf);
FigBlockBuffer * (* FigBlockBufferRetain) (FigBlockBuffer * buf);
FigSampleBuffer * (* FigBufferQueueDequeueAndRetain)
(FigBufferQueueRef queue);
CFIndex (* FigBufferQueueGetBufferCount) (FigBufferQueueRef queue);
Boolean (* FigBufferQueueIsEmpty) (FigBufferQueueRef queue);
void (* FigBufferQueueRelease) (FigBufferQueueRef queue);
FigStatus (* FigBufferQueueSetValidationCallback)
(FigBufferQueueRef queue, FigBufferQueueValidateFunc func, void *refCon);
CFStringRef * kFigFormatDescriptionExtension_SampleDescriptionExtensionAtoms;
CFStringRef * kFigSampleAttachmentKey_DependsOnOthers;
FigTime * kFigTimeInvalid;
};
struct _GstCMApiClass
{
GstDynApiClass parent_class;
};
GType gst_cm_api_get_type (void);
GstCMApi * gst_cm_api_obtain (GError ** error);
G_END_DECLS
#endif