Pawin Vongmasa | eeac97b | 2017-01-18 05:03:07 -0800 | [diff] [blame] | 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 | |
Pawin Vongmasa | ac7d412 | 2017-03-01 05:48:42 -0800 | [diff] [blame] | 17 | #include <media/omx/1.0/WGraphicBufferSource.h> |
| 18 | #include <media/omx/1.0/WOmxNode.h> |
| 19 | #include <media/omx/1.0/Conversion.h> |
Pawin Vongmasa | 0d3a5ed | 2017-02-22 03:19:35 -0800 | [diff] [blame] | 20 | |
Pawin Vongmasa | eeac97b | 2017-01-18 05:03:07 -0800 | [diff] [blame] | 21 | namespace android { |
| 22 | namespace hardware { |
| 23 | namespace media { |
| 24 | namespace omx { |
| 25 | namespace V1_0 { |
| 26 | namespace utils { |
| 27 | |
Pawin Vongmasa | eeac97b | 2017-01-18 05:03:07 -0800 | [diff] [blame] | 28 | // LWGraphicBufferSource |
| 29 | LWGraphicBufferSource::LWGraphicBufferSource( |
| 30 | sp<TGraphicBufferSource> const& base) : mBase(base) { |
| 31 | } |
| 32 | |
Robert Shih | d095e65 | 2017-03-11 01:20:43 +0000 | [diff] [blame] | 33 | BnStatus LWGraphicBufferSource::configure( |
Pawin Vongmasa | eeac97b | 2017-01-18 05:03:07 -0800 | [diff] [blame] | 34 | const sp<IOMXNode>& omxNode, int32_t dataSpace) { |
Pawin Vongmasa | ac7d412 | 2017-03-01 05:48:42 -0800 | [diff] [blame] | 35 | sp<IOmxNode> hOmxNode = omxNode->getHalInterface(); |
Pawin Vongmasa | eeac97b | 2017-01-18 05:03:07 -0800 | [diff] [blame] | 36 | return toBinderStatus(mBase->configure( |
Pawin Vongmasa | ac7d412 | 2017-03-01 05:48:42 -0800 | [diff] [blame] | 37 | hOmxNode == nullptr ? new TWOmxNode(omxNode) : hOmxNode, |
| 38 | toHardwareDataspace(dataSpace))); |
Pawin Vongmasa | eeac97b | 2017-01-18 05:03:07 -0800 | [diff] [blame] | 39 | } |
| 40 | |
Robert Shih | d095e65 | 2017-03-11 01:20:43 +0000 | [diff] [blame] | 41 | BnStatus LWGraphicBufferSource::setSuspend( |
Hangyu Kuang | 764d945 | 2016-12-13 13:07:45 -0800 | [diff] [blame] | 42 | bool suspend, int64_t timeUs) { |
| 43 | return toBinderStatus(mBase->setSuspend(suspend, timeUs)); |
Pawin Vongmasa | eeac97b | 2017-01-18 05:03:07 -0800 | [diff] [blame] | 44 | } |
| 45 | |
Robert Shih | d095e65 | 2017-03-11 01:20:43 +0000 | [diff] [blame] | 46 | BnStatus LWGraphicBufferSource::setRepeatPreviousFrameDelayUs( |
Pawin Vongmasa | eeac97b | 2017-01-18 05:03:07 -0800 | [diff] [blame] | 47 | int64_t repeatAfterUs) { |
| 48 | return toBinderStatus(mBase->setRepeatPreviousFrameDelayUs(repeatAfterUs)); |
| 49 | } |
| 50 | |
Robert Shih | d095e65 | 2017-03-11 01:20:43 +0000 | [diff] [blame] | 51 | BnStatus LWGraphicBufferSource::setMaxFps(float maxFps) { |
Pawin Vongmasa | eeac97b | 2017-01-18 05:03:07 -0800 | [diff] [blame] | 52 | return toBinderStatus(mBase->setMaxFps(maxFps)); |
| 53 | } |
| 54 | |
Robert Shih | d095e65 | 2017-03-11 01:20:43 +0000 | [diff] [blame] | 55 | BnStatus LWGraphicBufferSource::setTimeLapseConfig( |
Pawin Vongmasa | 22dc508 | 2017-04-20 05:12:55 -0700 | [diff] [blame] | 56 | double fps, double captureFps) { |
| 57 | return toBinderStatus(mBase->setTimeLapseConfig(fps, captureFps)); |
Pawin Vongmasa | eeac97b | 2017-01-18 05:03:07 -0800 | [diff] [blame] | 58 | } |
| 59 | |
Robert Shih | d095e65 | 2017-03-11 01:20:43 +0000 | [diff] [blame] | 60 | BnStatus LWGraphicBufferSource::setStartTimeUs( |
Pawin Vongmasa | eeac97b | 2017-01-18 05:03:07 -0800 | [diff] [blame] | 61 | int64_t startTimeUs) { |
| 62 | return toBinderStatus(mBase->setStartTimeUs(startTimeUs)); |
| 63 | } |
| 64 | |
Robert Shih | d095e65 | 2017-03-11 01:20:43 +0000 | [diff] [blame] | 65 | BnStatus LWGraphicBufferSource::setStopTimeUs( |
Hangyu Kuang | 764d945 | 2016-12-13 13:07:45 -0800 | [diff] [blame] | 66 | int64_t stopTimeUs) { |
| 67 | return toBinderStatus(mBase->setStopTimeUs(stopTimeUs)); |
| 68 | } |
| 69 | |
Hangyu Kuang | f72cefd | 2017-04-05 11:07:08 -0700 | [diff] [blame] | 70 | BnStatus LWGraphicBufferSource::getStopTimeOffsetUs( |
| 71 | int64_t *stopTimeOffsetUs) { |
| 72 | return toBinderStatus(mBase->getStopTimeOffsetUs( |
| 73 | [stopTimeOffsetUs](auto, auto offsetUs) { |
| 74 | *stopTimeOffsetUs = offsetUs; |
| 75 | })); |
| 76 | } |
| 77 | |
Robert Shih | d095e65 | 2017-03-11 01:20:43 +0000 | [diff] [blame] | 78 | BnStatus LWGraphicBufferSource::setColorAspects( |
Pawin Vongmasa | eeac97b | 2017-01-18 05:03:07 -0800 | [diff] [blame] | 79 | int32_t aspects) { |
| 80 | return toBinderStatus(mBase->setColorAspects( |
| 81 | toHardwareColorAspects(aspects))); |
| 82 | } |
| 83 | |
Robert Shih | d095e65 | 2017-03-11 01:20:43 +0000 | [diff] [blame] | 84 | BnStatus LWGraphicBufferSource::setTimeOffsetUs( |
Pawin Vongmasa | eeac97b | 2017-01-18 05:03:07 -0800 | [diff] [blame] | 85 | int64_t timeOffsetsUs) { |
| 86 | return toBinderStatus(mBase->setTimeOffsetUs(timeOffsetsUs)); |
| 87 | } |
| 88 | |
Robert Shih | d095e65 | 2017-03-11 01:20:43 +0000 | [diff] [blame] | 89 | BnStatus LWGraphicBufferSource::signalEndOfInputStream() { |
Pawin Vongmasa | eeac97b | 2017-01-18 05:03:07 -0800 | [diff] [blame] | 90 | return toBinderStatus(mBase->signalEndOfInputStream()); |
| 91 | } |
| 92 | |
Pawin Vongmasa | eeac97b | 2017-01-18 05:03:07 -0800 | [diff] [blame] | 93 | } // namespace utils |
| 94 | } // namespace V1_0 |
| 95 | } // namespace omx |
| 96 | } // namespace media |
| 97 | } // namespace hardware |
| 98 | } // namespace android |