blob: 65a9b0b8464b20ef902998b98881765a3ae0f0f8 [file] [log] [blame]
Hongguang093c5f32021-08-09 19:46:34 -07001/*
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_TUNERDVRHELPER_H
18#define ANDROID_MEDIA_TUNERDVRHELPER_H
19
Kensuke Miyagia5154b32022-11-07 15:08:05 -080020#include <aidl/android/media/tv/tunerresourcemanager/TunerDemuxInfo.h>
Hongguang093c5f32021-08-09 19:46:34 -070021#include <aidl/android/media/tv/tunerresourcemanager/TunerFrontendInfo.h>
22#include <utils/String16.h>
23
Kensuke Miyagia5154b32022-11-07 15:08:05 -080024using ::aidl::android::media::tv::tunerresourcemanager::TunerDemuxInfo;
Hongguang093c5f32021-08-09 19:46:34 -070025using ::aidl::android::media::tv::tunerresourcemanager::TunerFrontendInfo;
26using ::android::String16;
27
28using namespace std;
29
30namespace aidl {
31namespace android {
32namespace media {
33namespace tv {
34namespace tuner {
35
36const static int TUNER_HAL_VERSION_UNKNOWN = 0;
37const static int TUNER_HAL_VERSION_1_0 = 1 << 16;
38const static int TUNER_HAL_VERSION_1_1 = (1 << 16) | 1;
39const static int TUNER_HAL_VERSION_2_0 = 2 << 16;
40
Hongguang34a479e2021-10-04 16:14:47 -070041// Keep syncing with ShareFilter.java
42const static int STATUS_INACCESSIBLE = 1 << 7;
43
44const static String16 sSharedFilterPermission("android.permission.ACCESS_TV_SHARED_FILTER");
45
Hongguang093c5f32021-08-09 19:46:34 -070046typedef enum {
47 FRONTEND,
Hongguang093c5f32021-08-09 19:46:34 -070048 DEMUX,
49 DESCRAMBLER,
Kensuke Miyagibdf75a92021-11-10 01:07:57 -080050 LNB
Hongguang093c5f32021-08-09 19:46:34 -070051} TunerResourceType;
52
53class TunerHelper {
54public:
55 static bool checkTunerFeature();
56
57 // TODO: update Demux, Descrambler.
58 static void updateTunerResources(const vector<TunerFrontendInfo>& feInfos,
59 const vector<int32_t>& lnbHandles);
Kensuke Miyagia5154b32022-11-07 15:08:05 -080060
61 static void updateTunerResources(const vector<TunerFrontendInfo>& feInfos,
62 const vector<TunerDemuxInfo>& demuxInfos,
63 const vector<int32_t>& lnbHandles);
Hongguang093c5f32021-08-09 19:46:34 -070064 // TODO: create a map between resource id and handles.
65 static int getResourceIdFromHandle(int resourceHandle, int type);
66 static int getResourceHandleFromId(int id, int resourceType);
67
68private:
69 static int32_t sResourceRequestCount;
70};
71
72} // namespace tuner
73} // namespace tv
74} // namespace media
75} // namespace android
76} // namespace aidl
77
78#endif // ANDROID_MEDIA_TUNERDVRHELPER_H