Home | History | Annotate | Download | only in 1.0
      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_WOMXBUFFERSOURCE_H
     18 #define ANDROID_HARDWARE_MEDIA_OMX_V1_0_WOMXBUFFERSOURCE_H
     19 
     20 #include <hidl/MQDescriptor.h>
     21 #include <hidl/Status.h>
     22 
     23 #include <binder/Binder.h>
     24 #include <media/OMXFenceParcelable.h>
     25 
     26 #include <android/hardware/media/omx/1.0/IOmxBufferSource.h>
     27 #include <android/BnOMXBufferSource.h>
     28 
     29 namespace android {
     30 namespace hardware {
     31 namespace media {
     32 namespace omx {
     33 namespace V1_0 {
     34 namespace utils {
     35 
     36 using ::android::hardware::media::omx::V1_0::IOmxBufferSource;
     37 using ::android::hidl::base::V1_0::IBase;
     38 using ::android::hardware::hidl_array;
     39 using ::android::hardware::hidl_memory;
     40 using ::android::hardware::hidl_string;
     41 using ::android::hardware::hidl_vec;
     42 using ::android::hardware::hidl_handle;
     43 using ::android::hardware::Return;
     44 using ::android::hardware::Void;
     45 using ::android::sp;
     46 
     47 using ::android::OMXFenceParcelable;
     48 using ::android::IOMXBufferSource;
     49 using ::android::BnOMXBufferSource;
     50 
     51 /**
     52  * Wrapper classes for conversion
     53  * ==============================
     54  *
     55  * Naming convention:
     56  * - LW = Legacy Wrapper --- It wraps a Treble object inside a legacy object.
     57  * - TW = Treble Wrapper --- It wraps a legacy object inside a Treble object.
     58  */
     59 
     60 struct LWOmxBufferSource : public BnOMXBufferSource {
     61     sp<IOmxBufferSource> mBase;
     62     LWOmxBufferSource(sp<IOmxBufferSource> const& base);
     63     ::android::binder::Status onOmxExecuting() override;
     64     ::android::binder::Status onOmxIdle() override;
     65     ::android::binder::Status onOmxLoaded() override;
     66     ::android::binder::Status onInputBufferAdded(int32_t bufferID) override;
     67     ::android::binder::Status onInputBufferEmptied(
     68             int32_t bufferID, OMXFenceParcelable const& fenceParcel) override;
     69 };
     70 
     71 struct TWOmxBufferSource : public IOmxBufferSource {
     72     sp<IOMXBufferSource> mBase;
     73     TWOmxBufferSource(sp<IOMXBufferSource> const& base);
     74     Return<void> onOmxExecuting() override;
     75     Return<void> onOmxIdle() override;
     76     Return<void> onOmxLoaded() override;
     77     Return<void> onInputBufferAdded(uint32_t buffer) override;
     78     Return<void> onInputBufferEmptied(
     79             uint32_t buffer, hidl_handle const& fence) override;
     80 };
     81 
     82 
     83 }  // namespace utils
     84 }  // namespace V1_0
     85 }  // namespace omx
     86 }  // namespace media
     87 }  // namespace hardware
     88 }  // namespace android
     89 
     90 #endif  // ANDROID_HARDWARE_MEDIA_OMX_V1_0_WOMXBUFFERSOURCE_H
     91