blob: e3bac1446445f4a7e317151b84f5deaaac479a80
1 | diff --git a/tv_input.cpp b/tv_input.cpp |
2 | old mode 100644 |
3 | new mode 100755 |
4 | index 822c7c8..b67e359 |
5 | --- a/tv_input.cpp |
6 | +++ b/tv_input.cpp |
7 | @@ -23,16 +23,10 @@ |
8 | |
9 | #include <hardware/tv_input.h> |
10 | #include <tv/CTv.h> |
11 | +#include <tvin/CTvin.h> |
12 | #include <tvserver/TvService.h> |
13 | /*****************************************************************************/ |
14 | |
15 | -#define ATV_DEV_ID 1 |
16 | -#define DTV_DEV_ID 2 |
17 | -#define AV_DEV_ID 3 |
18 | -#define HDMI1_DEV_ID 4 |
19 | -#define HDMI2_DEV_ID 5 |
20 | -#define HDMI3_DEV_ID 6 |
21 | - |
22 | typedef struct tv_input_private { |
23 | tv_input_device_t device; |
24 | |
25 | @@ -46,7 +40,7 @@ typedef struct tv_input_private { |
26 | static int notify_ATV_device_available(tv_input_private_t *priv) |
27 | { |
28 | tv_input_event_t event; |
29 | - event.device_info.device_id = ATV_DEV_ID; |
30 | + event.device_info.device_id = SOURCE_TV; |
31 | event.device_info.type = TV_INPUT_TYPE_TUNER; |
32 | event.type = TV_INPUT_EVENT_DEVICE_AVAILABLE; |
33 | event.device_info.audio_type = AUDIO_DEVICE_NONE; |
34 | @@ -57,7 +51,7 @@ static int notify_ATV_device_available(tv_input_private_t *priv) |
35 | static int notify_DTV_device_available(tv_input_private_t *priv) |
36 | { |
37 | tv_input_event_t event; |
38 | - event.device_info.device_id = DTV_DEV_ID; |
39 | + event.device_info.device_id = SOURCE_DTV; |
40 | event.device_info.type = TV_INPUT_TYPE_TUNER; |
41 | event.type = TV_INPUT_EVENT_DEVICE_AVAILABLE; |
42 | event.device_info.audio_type = AUDIO_DEVICE_NONE; |
43 | @@ -68,7 +62,7 @@ static int notify_DTV_device_available(tv_input_private_t *priv) |
44 | static int notify_AV_device_available(tv_input_private_t *priv) |
45 | { |
46 | tv_input_event_t event; |
47 | - event.device_info.device_id = AV_DEV_ID; |
48 | + event.device_info.device_id = SOURCE_AV1; |
49 | event.device_info.type = TV_INPUT_TYPE_COMPONENT; |
50 | event.type = TV_INPUT_EVENT_DEVICE_AVAILABLE; |
51 | event.device_info.audio_type = AUDIO_DEVICE_NONE; |
52 | @@ -95,48 +89,48 @@ static int get_stream_configs(int dev_id, int *num_configurations, const tv_stre |
53 | return -1; |
54 | } |
55 | switch (dev_id) { |
56 | - case ATV_DEV_ID: |
57 | - mconfig->stream_id = ATV_DEV_ID; |
58 | + case SOURCE_TV: |
59 | + mconfig->stream_id = SOURCE_TV; |
60 | mconfig->type = TV_STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE ; |
61 | mconfig->max_video_width = 1920; |
62 | mconfig->max_video_height = 1080; |
63 | *num_configurations = 1; |
64 | *configs = mconfig; |
65 | break; |
66 | - case DTV_DEV_ID: |
67 | - mconfig->stream_id = DTV_DEV_ID; |
68 | + case SOURCE_DTV: |
69 | + mconfig->stream_id = SOURCE_DTV; |
70 | mconfig->type = TV_STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE ; |
71 | mconfig->max_video_width = 1920; |
72 | mconfig->max_video_height = 1080; |
73 | *num_configurations = 1; |
74 | *configs = mconfig; |
75 | break; |
76 | - case AV_DEV_ID: |
77 | - mconfig->stream_id = AV_DEV_ID; |
78 | + case SOURCE_AV1: |
79 | + mconfig->stream_id = SOURCE_AV1; |
80 | mconfig->type = TV_STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE ; |
81 | mconfig->max_video_width = 1920; |
82 | mconfig->max_video_height = 1080; |
83 | *num_configurations = 1; |
84 | *configs = mconfig; |
85 | break; |
86 | - case HDMI1_DEV_ID: |
87 | - mconfig->stream_id = HDMI1_DEV_ID; |
88 | + case SOURCE_HDMI1: |
89 | + mconfig->stream_id = SOURCE_HDMI1; |
90 | mconfig->type = TV_STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE ; |
91 | mconfig->max_video_width = 1920; |
92 | mconfig->max_video_height = 1080; |
93 | *num_configurations = 1; |
94 | *configs = mconfig; |
95 | break; |
96 | - case HDMI2_DEV_ID: |
97 | - mconfig->stream_id = HDMI2_DEV_ID; |
98 | + case SOURCE_HDMI2: |
99 | + mconfig->stream_id = SOURCE_HDMI2; |
100 | mconfig->type = TV_STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE ; |
101 | mconfig->max_video_width = 1920; |
102 | mconfig->max_video_height = 1080; |
103 | *num_configurations = 1; |
104 | *configs = mconfig; |
105 | break; |
106 | - case HDMI3_DEV_ID: |
107 | - mconfig->stream_id = HDMI3_DEV_ID; |
108 | + case SOURCE_HDMI3: |
109 | + mconfig->stream_id = SOURCE_HDMI3; |
110 | mconfig->type = TV_STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE ; |
111 | mconfig->max_video_width = 1920; |
112 | mconfig->max_video_height = 1080; |
113 | @@ -197,11 +191,11 @@ static int tv_input_initialize(struct tv_input_device *dev, |
114 | /* AV_DEVICE_AVAILABLE */ |
115 | notify_AV_device_available(priv); |
116 | /* HDMI1_DEVICE_AVAILABLE */ |
117 | - notify_hdmi_device_available(priv, HDMI1_DEV_ID, 1); |
118 | + notify_hdmi_device_available(priv, SOURCE_HDMI1, 1); |
119 | /* HDMI2_DEVICE_AVAILABLE */ |
120 | - notify_hdmi_device_available(priv, HDMI2_DEV_ID, 2); |
121 | + notify_hdmi_device_available(priv, SOURCE_HDMI2, 2); |
122 | /* HDMI3_DEVICE_AVAILABLE */ |
123 | - notify_hdmi_device_available(priv, HDMI3_DEV_ID, 3); |
124 | + notify_hdmi_device_available(priv, SOURCE_HDMI3, 3); |
125 | |
126 | return 0; |
127 | } |
128 | @@ -216,13 +210,19 @@ static int tv_input_get_stream_configurations(const struct tv_input_device *dev, |
129 | return -EINVAL; |
130 | } |
131 | |
132 | -static int tv_input_open_stream(struct tv_input_device *, int, tv_stream_t *) |
133 | +static int tv_input_open_stream(struct tv_input_device* dev, int device_id, |
134 | + tv_stream_t* stream) |
135 | { |
136 | + tv_input_private_t *priv = (tv_input_private_t *)dev; |
137 | + priv->pTv->SetSourceSwitchInput((tv_source_input_t) device_id); |
138 | return -EINVAL; |
139 | } |
140 | |
141 | -static int tv_input_close_stream(struct tv_input_device *, int, int) |
142 | +static int tv_input_close_stream(struct tv_input_device* dev, int device_id, |
143 | + int stream_id) |
144 | { |
145 | + tv_input_private_t *priv = (tv_input_private_t *)dev; |
146 | + priv->pTv->StopTvLock(); |
147 | return -EINVAL; |
148 | } |
149 | |
150 |