abergmeier
abergmeier

Reputation: 14052

Access camera via OpenMAX in Android

I currently try to figure out how to access the Camera via OpenMAX in Android 4.0. The documentation is not sufficient for me so I currently struggle with how I can retrieve the correct XADataSource for the following call.

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

And please spare me the just use Java-"answers".

Upvotes: 29

Views: 2946

Answers (2)

Lugyu
Lugyu

Reputation: 1

The implementation of android only supports CreateMediaPlayer and play MP2T H264 AAC stream.

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

Upvotes: 0

Ivan
Ivan

Reputation: 234

This is basically a definition of XADataSource, taken from http://www.khronos.org/registry/omxal/specs/OpenMAX_AL_1_1_Specification.pdf

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

Fields include:

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

Sorry couldn't format it better, but I suggest to check that document anyway if you haven't already done that.

Upvotes: 4

Related Questions