1 /* 2 * Copyright 2016, The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef ANDROID_HARDWARE_MEDIA_OMX_V1_0_OMX_H 18 #define ANDROID_HARDWARE_MEDIA_OMX_V1_0_OMX_H 19 20 #include <hidl/MQDescriptor.h> 21 #include <hidl/Status.h> 22 23 #include <media/stagefright/xmlparser/MediaCodecsXmlParser.h> 24 #include <android/hardware/media/omx/1.0/IOmx.h> 25 #include <utils/KeyedVector.h> 26 #include <utils/Mutex.h> 27 28 namespace android { 29 30 struct OMXMaster; 31 struct OMXNodeInstance; 32 33 namespace hardware { 34 namespace media { 35 namespace omx { 36 namespace V1_0 { 37 namespace implementation { 38 39 using ::android::hardware::media::omx::V1_0::IOmx; 40 using ::android::hardware::media::omx::V1_0::IOmxNode; 41 using ::android::hardware::media::omx::V1_0::IOmxObserver; 42 using ::android::hardware::media::omx::V1_0::Status; 43 using ::android::hidl::base::V1_0::IBase; 44 using ::android::hardware::hidl_death_recipient; 45 using ::android::hardware::hidl_array; 46 using ::android::hardware::hidl_memory; 47 using ::android::hardware::hidl_string; 48 using ::android::hardware::hidl_vec; 49 using ::android::hardware::Return; 50 using ::android::hardware::Void; 51 using ::android::sp; 52 using ::android::wp; 53 54 using ::android::OMXMaster; 55 using ::android::OMXNodeInstance; 56 57 struct Omx : public IOmx, public hidl_death_recipient { 58 Omx(); 59 virtual ~Omx(); 60 61 // Methods from IOmx 62 Return<void> listNodes(listNodes_cb _hidl_cb) override; 63 Return<void> allocateNode( 64 const hidl_string& name, 65 const sp<IOmxObserver>& observer, 66 allocateNode_cb _hidl_cb) override; 67 Return<void> createInputSurface(createInputSurface_cb _hidl_cb) override; 68 69 // Method from hidl_death_recipient 70 void serviceDied(uint64_t cookie, const wp<IBase>& who) override; 71 72 // Method for OMXNodeInstance 73 status_t freeNode(sp<OMXNodeInstance> const& instance); 74 75 protected: 76 OMXMaster* mMaster; 77 Mutex mLock; 78 KeyedVector<wp<IBase>, sp<OMXNodeInstance> > mLiveNodes; 79 KeyedVector<OMXNodeInstance*, wp<IBase> > mNode2Observer; 80 MediaCodecsXmlParser mParser; 81 }; 82 83 extern "C" IOmx* HIDL_FETCH_IOmx(const char* name); 84 85 } // namespace implementation 86 } // namespace V1_0 87 } // namespace omx 88 } // namespace media 89 } // namespace hardware 90 } // namespace android 91 92 #endif // ANDROID_HARDWARE_MEDIA_OMX_V1_0_OMX_H 93