blob: 247c540998fffcb83c2e483f18d40053c872426a [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
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080017#include <stagefright/foundation/ColorUtils.h>
18
Pawin Vongmasaac7d4122017-03-01 05:48:42 -080019#include <media/omx/1.0/WGraphicBufferSource.h>
20#include <media/omx/1.0/WOmxNode.h>
21#include <media/omx/1.0/Conversion.h>
Pawin Vongmasa0d3a5ed2017-02-22 03:19:35 -080022
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080023namespace android {
24namespace hardware {
25namespace media {
26namespace omx {
27namespace V1_0 {
28namespace utils {
29
30using android::ColorUtils;
31
32// LWGraphicBufferSource
33LWGraphicBufferSource::LWGraphicBufferSource(
34 sp<TGraphicBufferSource> const& base) : mBase(base) {
35}
36
37::android::binder::Status LWGraphicBufferSource::configure(
38 const sp<IOMXNode>& omxNode, int32_t dataSpace) {
Pawin Vongmasaac7d4122017-03-01 05:48:42 -080039 sp<IOmxNode> hOmxNode = omxNode->getHalInterface();
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080040 return toBinderStatus(mBase->configure(
Pawin Vongmasaac7d4122017-03-01 05:48:42 -080041 hOmxNode == nullptr ? new TWOmxNode(omxNode) : hOmxNode,
42 toHardwareDataspace(dataSpace)));
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080043}
44
Hangyu Kuang764d9452016-12-13 13:07:45 -080045::android::binder::Status LWGraphicBufferSource::setSuspend(
46 bool suspend, int64_t timeUs) {
47 return toBinderStatus(mBase->setSuspend(suspend, timeUs));
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080048}
49
50::android::binder::Status LWGraphicBufferSource::setRepeatPreviousFrameDelayUs(
51 int64_t repeatAfterUs) {
52 return toBinderStatus(mBase->setRepeatPreviousFrameDelayUs(repeatAfterUs));
53}
54
55::android::binder::Status LWGraphicBufferSource::setMaxFps(float maxFps) {
56 return toBinderStatus(mBase->setMaxFps(maxFps));
57}
58
59::android::binder::Status LWGraphicBufferSource::setTimeLapseConfig(
60 int64_t timePerFrameUs, int64_t timePerCaptureUs) {
61 return toBinderStatus(mBase->setTimeLapseConfig(
62 timePerFrameUs, timePerCaptureUs));
63}
64
65::android::binder::Status LWGraphicBufferSource::setStartTimeUs(
66 int64_t startTimeUs) {
67 return toBinderStatus(mBase->setStartTimeUs(startTimeUs));
68}
69
Hangyu Kuang764d9452016-12-13 13:07:45 -080070::android::binder::Status LWGraphicBufferSource::setStopTimeUs(
71 int64_t stopTimeUs) {
72 return toBinderStatus(mBase->setStopTimeUs(stopTimeUs));
73}
74
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080075::android::binder::Status LWGraphicBufferSource::setColorAspects(
76 int32_t aspects) {
77 return toBinderStatus(mBase->setColorAspects(
78 toHardwareColorAspects(aspects)));
79}
80
81::android::binder::Status LWGraphicBufferSource::setTimeOffsetUs(
82 int64_t timeOffsetsUs) {
83 return toBinderStatus(mBase->setTimeOffsetUs(timeOffsetsUs));
84}
85
86::android::binder::Status LWGraphicBufferSource::signalEndOfInputStream() {
87 return toBinderStatus(mBase->signalEndOfInputStream());
88}
89
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080090// TWGraphicBufferSource
91TWGraphicBufferSource::TWGraphicBufferSource(
92 sp<LGraphicBufferSource> const& base) : mBase(base) {
93}
94
95Return<void> TWGraphicBufferSource::configure(
96 const sp<IOmxNode>& omxNode, Dataspace dataspace) {
Pawin Vongmasa8ff40182017-02-07 02:22:34 -080097 mBase->configure(new LWOmxNode(omxNode), toRawDataspace(dataspace));
98 return Void();
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -080099}
100
Pawin Vongmasa0d3a5ed2017-02-22 03:19:35 -0800101Return<void> TWGraphicBufferSource::setSuspend(
102 bool suspend, int64_t timeUs) {
Hangyu Kuang764d9452016-12-13 13:07:45 -0800103 mBase->setSuspend(suspend, timeUs);
Pawin Vongmasa8ff40182017-02-07 02:22:34 -0800104 return Void();
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -0800105}
106
107Return<void> TWGraphicBufferSource::setRepeatPreviousFrameDelayUs(
108 int64_t repeatAfterUs) {
Pawin Vongmasa8ff40182017-02-07 02:22:34 -0800109 mBase->setRepeatPreviousFrameDelayUs(repeatAfterUs);
110 return Void();
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -0800111}
112
113Return<void> TWGraphicBufferSource::setMaxFps(float maxFps) {
Pawin Vongmasa8ff40182017-02-07 02:22:34 -0800114 mBase->setMaxFps(maxFps);
115 return Void();
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -0800116}
117
118Return<void> TWGraphicBufferSource::setTimeLapseConfig(
119 int64_t timePerFrameUs, int64_t timePerCaptureUs) {
Pawin Vongmasa8ff40182017-02-07 02:22:34 -0800120 mBase->setTimeLapseConfig(timePerFrameUs, timePerCaptureUs);
121 return Void();
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -0800122}
123
124Return<void> TWGraphicBufferSource::setStartTimeUs(int64_t startTimeUs) {
Pawin Vongmasa8ff40182017-02-07 02:22:34 -0800125 mBase->setStartTimeUs(startTimeUs);
126 return Void();
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -0800127}
128
Hangyu Kuang764d9452016-12-13 13:07:45 -0800129Return<void> TWGraphicBufferSource::setStopTimeUs(int64_t stopTimeUs) {
Pawin Vongmasa223b8e32017-02-22 20:32:25 -0800130 mBase->setStopTimeUs(stopTimeUs);
131 return Void();
Hangyu Kuang764d9452016-12-13 13:07:45 -0800132}
133
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -0800134Return<void> TWGraphicBufferSource::setColorAspects(
135 const ColorAspects& aspects) {
Pawin Vongmasa8ff40182017-02-07 02:22:34 -0800136 mBase->setColorAspects(toCompactColorAspects(aspects));
137 return Void();
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -0800138}
139
140Return<void> TWGraphicBufferSource::setTimeOffsetUs(int64_t timeOffsetUs) {
Pawin Vongmasa8ff40182017-02-07 02:22:34 -0800141 mBase->setTimeOffsetUs(timeOffsetUs);
142 return Void();
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -0800143}
144
145Return<void> TWGraphicBufferSource::signalEndOfInputStream() {
Pawin Vongmasa8ff40182017-02-07 02:22:34 -0800146 mBase->signalEndOfInputStream();
147 return Void();
Pawin Vongmasaeeac97b2017-01-18 05:03:07 -0800148}
149
150} // namespace utils
151} // namespace V1_0
152} // namespace omx
153} // namespace media
154} // namespace hardware
155} // namespace android