通过Android中的OpenMAX访问摄像头

我目前试图找出如何通过Android 4.0中的OpenMAX访问摄像机。 文档对我来说是不够的,所以我现在正在努力如何为以下调用检索正确的XADataSource

 (*_engine)->CreateMediaRecorder(_engine, &_mediaRecorder, //pRecorder nullptr, //pAudioSrc XADataSource *, //pImageVideoSrc XADataSink *, //pDataSnk XAuint32, // numInterfaces const XAInterfaceID *, //pInterfaceIds const XAboolean *, //pInterfaceRequired ); 

并请让我只使用Java – “答案”。

Solutions Collecting From Web of "通过Android中的OpenMAX访问摄像头"

这基本上是XADataSource的定义,取自http://www.khronos.org/registry/omxal/specs/OpenMAX_AL_1_1_Specification.pdf

 typedef struct XADataSource_ { void * pLocator; void * pFormat; } XADataSource; 

领域包括:

 Field Description pLocator Pointer to the specified data locator structure. This may point to any of the following structures. XADataLocator_Address XADataLocator_IODevice XADataLocator_URI XADataLocator_MediaObject XADataLocator_Null XADataLocator_ContentPipe The first field of each of these structures includes the 32 bit locatorType field, which identifies the locator type (see XA_DATALOCATOR definitions) and hence the structure pointed to. Note: The available XA_DATALOCATOR definitions may be extended through an API extension. pFormat A pointer to the specified format structure. This may point to any of the following structures. XADataFormat_PCM (Deprecated) XADataFormat_PCM_EX XADataFormat_MIME XADataFormat_RawImage The first field of each of these structures includes the 32 bit formatType field, which identifies the format type (XA_DATAFORMAT definitions) and hence the structure pointed to. pFormat is ignored if pLocator is XADataLocator_IODevice 

抱歉不能格式化它,但我build议检查该文件,如果你还没有这样做。

http://mobilepearls.com/labs/native-android-api/ndk/docs/openmaxal/

android的实现只支持CreateMediaPlayer并且播放MP2T H264的AACstream。