blob: 86322dac7aaa2e482c7897dc382988920d0e0776 [file] [log] [blame]
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -08001/*
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
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080020#include <hidl/MQDescriptor.h>
21#include <hidl/Status.h>
22
Pawin Vongmasa0d3a5ed2017-02-22 03:19:35 -080023#include <binder/Binder.h>
Pawin Vongmasaac7d4122017-03-01 05:48:42 -080024#include <OMXFenceParcelable.h>
Pawin Vongmasa0d3a5ed2017-02-22 03:19:35 -080025
26#include <android/hardware/media/omx/1.0/IOmxBufferSource.h>
Pawin Vongmasa8ff40182017-02-07 02:22:34 -080027#include <android/BnOMXBufferSource.h>
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080028
29namespace android {
30namespace hardware {
31namespace media {
32namespace omx {
33namespace V1_0 {
34namespace utils {
35
36using ::android::hardware::media::omx::V1_0::IOmxBufferSource;
37using ::android::hidl::base::V1_0::IBase;
38using ::android::hardware::hidl_array;
39using ::android::hardware::hidl_memory;
40using ::android::hardware::hidl_string;
41using ::android::hardware::hidl_vec;
42using ::android::hardware::hidl_handle;
43using ::android::hardware::Return;
44using ::android::hardware::Void;
45using ::android::sp;
46
47using ::android::OMXFenceParcelable;
48using ::android::IOMXBufferSource;
Pawin Vongmasa8ff40182017-02-07 02:22:34 -080049using ::android::BnOMXBufferSource;
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080050
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
Pawin Vongmasa8ff40182017-02-07 02:22:34 -080060struct LWOmxBufferSource : public BnOMXBufferSource {
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080061 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;
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080069};
70
71struct 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