• 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 #ifndef _ANDROID_MEDIA_TV_TIME_FILTER_CLIENT_H_
18 #define _ANDROID_MEDIA_TV_TIME_FILTER_CLIENT_H_
19 
20 #include <aidl/android/hardware/tv/tuner/Result.h>
21 #include <aidl/android/media/tv/tuner/ITunerTimeFilter.h>
22 #include <utils/RefBase.h>
23 
24 using Status = ::ndk::ScopedAStatus;
25 
26 using ::aidl::android::hardware::tv::tuner::Result;
27 using ::aidl::android::media::tv::tuner::ITunerTimeFilter;
28 
29 using namespace std;
30 
31 namespace android {
32 
33 struct TimeFilterClient : public RefBase {
34 
35 public:
36     TimeFilterClient(shared_ptr<ITunerTimeFilter> tunerTimeFilter);
37     ~TimeFilterClient();
38 
39     /**
40      * Set time stamp for time based filter.
41      */
42     Result setTimeStamp(int64_t timeStamp);
43 
44     /**
45      * Clear the time stamp in the time filter.
46      */
47     Result clearTimeStamp();
48 
49     /**
50      * Get the current time in the time filter.
51      */
52     int64_t getTimeStamp();
53 
54     /**
55      * Get the time from the beginning of current data source.
56      */
57     int64_t getSourceTime();
58 
59     /**
60      * Releases the Time Filter instance.
61      */
62     Result close();
63 
64 private:
65     /**
66      * An AIDL Tuner TimeFilter Singleton assigned at the first time the Tuner Client
67      * opens an TimeFilter. Default null when time filter is not opened.
68      */
69     shared_ptr<ITunerTimeFilter> mTunerTimeFilter;
70 };
71 }  // namespace android
72 
73 #endif  // _ANDROID_MEDIA_TV_TIME_FILTER_CLIENT_H_
74