blob: 7c80c2e7434c7012af07cd61f7b6b61e4ea61ece [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_WGRAPHICBUFFERSOURCE_H
18#define ANDROID_HARDWARE_MEDIA_OMX_V1_0_WGRAPHICBUFFERSOURCE_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 <media/IOMX.h>
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080025
26#include <android/hardware/graphics/common/1.0/types.h>
Pawin Vongmasa0d3a5ed2017-02-22 03:19:35 -080027#include <android/hardware/media/omx/1.0/IOmxNode.h>
28#include <android/hardware/media/omx/1.0/IGraphicBufferSource.h>
29
30#include <android/BnGraphicBufferSource.h>
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080031
32namespace android {
33namespace hardware {
34namespace media {
35namespace omx {
36namespace V1_0 {
37namespace utils {
38
39using ::android::hardware::graphics::common::V1_0::Dataspace;
40using ::android::hardware::media::omx::V1_0::ColorAspects;
41using ::android::hardware::media::omx::V1_0::IGraphicBufferSource;
42using ::android::hardware::media::omx::V1_0::IOmxNode;
43using ::android::hidl::base::V1_0::IBase;
44using ::android::hardware::hidl_array;
45using ::android::hardware::hidl_memory;
46using ::android::hardware::hidl_string;
47using ::android::hardware::hidl_vec;
48using ::android::hardware::Return;
49using ::android::hardware::Void;
50using ::android::sp;
51
52using ::android::IOMXNode;
53
54/**
55 * Wrapper classes for conversion
56 * ==============================
57 *
58 * Naming convention:
59 * - LW = Legacy Wrapper --- It wraps a Treble object inside a legacy object.
60 * - TW = Treble Wrapper --- It wraps a legacy object inside a Treble object.
61 */
62
63typedef ::android::IGraphicBufferSource LGraphicBufferSource;
Pawin Vongmasa8ff40182017-02-07 02:22:34 -080064typedef ::android::BnGraphicBufferSource BnGraphicBufferSource;
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080065typedef ::android::hardware::media::omx::V1_0::IGraphicBufferSource
66 TGraphicBufferSource;
67
Pawin Vongmasa8ff40182017-02-07 02:22:34 -080068struct LWGraphicBufferSource : public BnGraphicBufferSource {
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080069 sp<TGraphicBufferSource> mBase;
70 LWGraphicBufferSource(sp<TGraphicBufferSource> const& base);
71 ::android::binder::Status configure(
72 const sp<IOMXNode>& omxNode, int32_t dataSpace) override;
Hangyu Kuang764d9452016-12-13 13:07:45 -080073 ::android::binder::Status setSuspend(bool suspend, int64_t timeUs) override;
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080074 ::android::binder::Status setRepeatPreviousFrameDelayUs(
75 int64_t repeatAfterUs) override;
76 ::android::binder::Status setMaxFps(float maxFps) override;
77 ::android::binder::Status setTimeLapseConfig(
78 int64_t timePerFrameUs, int64_t timePerCaptureUs) override;
79 ::android::binder::Status setStartTimeUs(int64_t startTimeUs) override;
Hangyu Kuang764d9452016-12-13 13:07:45 -080080 ::android::binder::Status setStopTimeUs(int64_t stopTimeUs) override;
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080081 ::android::binder::Status setColorAspects(int32_t aspects) override;
82 ::android::binder::Status setTimeOffsetUs(int64_t timeOffsetsUs) override;
83 ::android::binder::Status signalEndOfInputStream() override;
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080084};
85
86struct TWGraphicBufferSource : public TGraphicBufferSource {
87 sp<LGraphicBufferSource> mBase;
88 TWGraphicBufferSource(sp<LGraphicBufferSource> const& base);
89 Return<void> configure(
90 const sp<IOmxNode>& omxNode, Dataspace dataspace) override;
Hangyu Kuang764d9452016-12-13 13:07:45 -080091 Return<void> setSuspend(bool suspend, int64_t timeUs) override;
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080092 Return<void> setRepeatPreviousFrameDelayUs(int64_t repeatAfterUs) override;
93 Return<void> setMaxFps(float maxFps) override;
94 Return<void> setTimeLapseConfig(
95 int64_t timePerFrameUs, int64_t timePerCaptureUs) override;
96 Return<void> setStartTimeUs(int64_t startTimeUs) override;
Hangyu Kuang764d9452016-12-13 13:07:45 -080097 Return<void> setStopTimeUs(int64_t stopTimeUs) override;
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080098 Return<void> setColorAspects(const ColorAspects& aspects) override;
99 Return<void> setTimeOffsetUs(int64_t timeOffsetUs) override;
100 Return<void> signalEndOfInputStream() override;
101};
102
103} // namespace utils
104} // namespace V1_0
105} // namespace omx
106} // namespace media
107} // namespace hardware
108} // namespace android
109
110#endif // ANDROID_HARDWARE_MEDIA_OMX_V1_0_WGRAPHICBUFFERSOURCE_H