• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2021, 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 #define LOG_TAG "TunerTimeFilter"
18 
19 #include "TunerTimeFilter.h"
20 
21 #include <aidl/android/hardware/tv/tuner/Constant64Bit.h>
22 #include <aidl/android/hardware/tv/tuner/Result.h>
23 
24 using ::aidl::android::hardware::tv::tuner::Constant64Bit;
25 using ::aidl::android::hardware::tv::tuner::Result;
26 
27 namespace aidl {
28 namespace android {
29 namespace media {
30 namespace tv {
31 namespace tuner {
32 
TunerTimeFilter(shared_ptr<ITimeFilter> timeFilter)33 TunerTimeFilter::TunerTimeFilter(shared_ptr<ITimeFilter> timeFilter) {
34     mTimeFilter = timeFilter;
35 }
36 
~TunerTimeFilter()37 TunerTimeFilter::~TunerTimeFilter() {
38     close();
39     mTimeFilter = nullptr;
40 }
41 
setTimeStamp(int64_t timeStamp)42 ::ndk::ScopedAStatus TunerTimeFilter::setTimeStamp(int64_t timeStamp) {
43     return mTimeFilter->setTimeStamp(timeStamp);
44 }
45 
clearTimeStamp()46 ::ndk::ScopedAStatus TunerTimeFilter::clearTimeStamp() {
47     return mTimeFilter->clearTimeStamp();
48 }
49 
getSourceTime(int64_t * _aidl_return)50 ::ndk::ScopedAStatus TunerTimeFilter::getSourceTime(int64_t* _aidl_return) {
51     auto status = mTimeFilter->getSourceTime(_aidl_return);
52     if (!status.isOk()) {
53         *_aidl_return = (int64_t)Constant64Bit::INVALID_PRESENTATION_TIME_STAMP;
54     }
55     return status;
56 }
57 
getTimeStamp(int64_t * _aidl_return)58 ::ndk::ScopedAStatus TunerTimeFilter::getTimeStamp(int64_t* _aidl_return) {
59     auto status = mTimeFilter->getTimeStamp(_aidl_return);
60     if (!status.isOk()) {
61         *_aidl_return = (int64_t)Constant64Bit::INVALID_PRESENTATION_TIME_STAMP;
62     }
63     return status;
64 }
65 
close()66 ::ndk::ScopedAStatus TunerTimeFilter::close() {
67     return mTimeFilter->close();
68 }
69 
70 }  // namespace tuner
71 }  // namespace tv
72 }  // namespace media
73 }  // namespace android
74 }  // namespace aidl
75