blob: 62809ec4e1e198db0477c17b5f3c4872c4a2b2b7
1 | /* |
2 | * Copyright (C) 2011 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 | * @author Tellen Yu |
16 | * @version 1.0 |
17 | * @date 2018/1/12 |
18 | * @par function description: |
19 | * - 1 tv_input hal to tvserver interface |
20 | */ |
21 | |
22 | #ifndef _ANDROID_TV_INPUT_INTERFACE_H_ |
23 | #define _ANDROID_TV_INPUT_INTERFACE_H_ |
24 | |
25 | #include "TvServerHidlClient.h" |
26 | |
27 | using namespace android; |
28 | |
29 | #define HDMI_MAX_SUPPORT_NUM 4 |
30 | |
31 | typedef enum tv_source_input_e { |
32 | SOURCE_INVALID = -1, |
33 | SOURCE_TV = 0, |
34 | SOURCE_AV1, |
35 | SOURCE_AV2, |
36 | SOURCE_YPBPR1, |
37 | SOURCE_YPBPR2, |
38 | SOURCE_HDMI1, |
39 | SOURCE_HDMI2, |
40 | SOURCE_HDMI3, |
41 | SOURCE_HDMI4, |
42 | SOURCE_VGA, |
43 | SOURCE_MPEG, |
44 | SOURCE_DTV, |
45 | SOURCE_SVIDEO, |
46 | SOURCE_IPTV, |
47 | SOURCE_DUMMY, |
48 | SOURCE_SPDIF, |
49 | SOURCE_ADTV, |
50 | SOURCE_MAX, |
51 | } tv_source_input_t; |
52 | |
53 | typedef struct source_connect_s { |
54 | int msgType; |
55 | int source; |
56 | int state; |
57 | } source_connect_t; |
58 | |
59 | class TvPlayObserver { |
60 | public: |
61 | TvPlayObserver() {}; |
62 | virtual ~TvPlayObserver() {}; |
63 | virtual void onTvEvent (const source_connect_t &scrConnect) = 0; |
64 | }; |
65 | |
66 | class TvInputIntf : public TvListener { |
67 | public: |
68 | TvInputIntf(); |
69 | ~TvInputIntf(); |
70 | int startTv(); |
71 | int stopTv(); |
72 | int switchSourceInput(tv_source_input_t source_input); |
73 | int getSourceConnectStatus(tv_source_input_t source_input); |
74 | int getCurrentSourceInput(); |
75 | int getHdmiAvHotplugDetectOnoff(); |
76 | int setTvObserver (TvPlayObserver *ob); |
77 | int getSupportInputDevices(int *devices, int *count); |
78 | int getHdmiPorts(); |
79 | int getHdmiPort(tv_source_input_t source_input); |
80 | virtual void notify(const tv_parcel_t &parcel); |
81 | |
82 | private: |
83 | sp<TvServerHidlClient> mTvSession; |
84 | TvPlayObserver *mpObserver; |
85 | |
86 | int mHdmiPorts[HDMI_MAX_SUPPORT_NUM];// the length of hdmi_port should be equal to max_port_num |
87 | }; |
88 | |
89 | #endif/*_ANDROID_TV_INPUT_INTERFACE_H_*/ |
90 |