1 /* 2 * Copyright (C) 2019 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_TV_TUNER_V1_0_TIMEFILTER_H_ 18 #define ANDROID_HARDWARE_TV_TUNER_V1_0_TIMEFILTER_H_ 19 20 #include <android/hardware/tv/tuner/1.0/ITimeFilter.h> 21 #include "Demux.h" 22 #include "time.h" 23 24 using namespace std; 25 26 namespace android { 27 namespace hardware { 28 namespace tv { 29 namespace tuner { 30 namespace V1_0 { 31 namespace implementation { 32 33 using ::android::hardware::tv::tuner::V1_0::IDemux; 34 using ::android::hardware::tv::tuner::V1_0::IFilterCallback; 35 using ::android::hardware::tv::tuner::V1_0::Result; 36 37 using FilterMQ = MessageQueue<uint8_t, kSynchronizedReadWrite>; 38 39 #define INVALID_TIME_STAMP -1 40 41 class Demux; 42 43 class TimeFilter : public ITimeFilter { 44 public: 45 TimeFilter(); 46 47 TimeFilter(sp<Demux> demux); 48 49 ~TimeFilter(); 50 51 virtual Return<Result> setTimeStamp(uint64_t timeStamp) override; 52 53 virtual Return<Result> clearTimeStamp() override; 54 55 virtual Return<void> getTimeStamp(getTimeStamp_cb _hidl_cb) override; 56 57 virtual Return<void> getSourceTime(getSourceTime_cb _hidl_cb) override; 58 59 virtual Return<Result> close() override; 60 61 private: 62 sp<Demux> mDemux; 63 uint64_t mTimeStamp = INVALID_TIME_STAMP; 64 time_t mBeginTime; 65 }; 66 67 } // namespace implementation 68 } // namespace V1_0 69 } // namespace tuner 70 } // namespace tv 71 } // namespace hardware 72 } // namespace android 73 74 #endif // ANDROID_HARDWARE_TV_TUNER_V1_0_TIMEFILTER_H_