android中OpenMax的实现【2】AwesomePlayer中openmax的入口
AwesomePlayer 中有个变量
- OMXClient mClient;
- class OMXClient {
- public:
- OMXClient();
- status_t connect();
- void disconnect();
- sp<IOMX> interface() {
- return mOMX;
- }
- private:
- sp<IOMX> mOMX;
- OMXClient(const OMXClient &);
- OMXClient &operator=(const OMXClient &);
- };
- CHECK_EQ(mClient.connect(), (status_t)OK);
- status_t OMXClient::connect() {
- sp<IServiceManager> sm = defaultServiceManager();
- sp<IBinder> binder = sm->getService(String16("media.player"));
- sp<IMediaPlayerService> service = interface_cast<IMediaPlayerService>(binder);
- CHECK(service.get() != NULL);
- mOMX = service->getOMX();
- CHECK(mOMX.get() != NULL);
- if (!mOMX->livesLocally(NULL /* node */, getpid())) {
- ALOGI("Using client-side OMX mux.");
- mOMX = new MuxOMX(mOMX);
- }
- return OK;
- }
- sp<IOMX> MediaPlayerService::getOMX() {
- Mutex::Autolock autoLock(mLock);
- if (mOMX.get() == NULL) {
- mOMX = new OMX;
- }
- return mOMX;
- }
- sp<IOMX> interface() {
- return mOMX;
- }
- mAudioSource = OMXCodec::Create(
- mClient.interface(), mAudioTrack->getFormat(),
- false, // createEncoder
- mAudioTrack);
- mVideoSource = OMXCodec::Create(
- mClient.interface(), mVideoTrack->getFormat(),
- false, // createEncoder
- mVideoTrack,
- NULL, flags, USE_SURFACE_ALLOC ? mNativeWindow : NULL);
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。