Mercurial > mplayer.hg
annotate stream/tv.c @ 23879:26a32eda1603
Cosmetics: move two routines up
to avoid requirement of forward declarations.
author | voroshil |
---|---|
date | Sun, 29 Jul 2007 03:33:39 +0000 |
parents | 9fb716ab06a3 |
children | 1c888cc4ebbb |
rev | line source |
---|---|
2790 | 1 /* |
3284 | 2 TV Interface for MPlayer |
2790 | 3 |
10368 | 4 (C) Alex Beregszaszi |
3284 | 5 |
6 API idea based on libvo2 | |
2790 | 7 |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
8 Feb 19, 2002: Significant rewrites by Charles R. Henrich (henrich@msu.edu) |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
9 to add support for audio, and bktr *BSD support. |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
10 |
2790 | 11 */ |
12 | |
13 #include <stdio.h> | |
14 #include <stdlib.h> | |
15 #include <unistd.h> | |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
16 #include <string.h> |
10242 | 17 #include <ctype.h> |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
18 #include <sys/time.h> |
2790 | 19 |
20 #include "config.h" | |
21 | |
2819
2e58962dc9fe
cleaned up some warnings, and tv_param_on moved out from #ifdef USE_TV
alex
parents:
2818
diff
changeset
|
22 |
2790 | 23 #include "mp_msg.h" |
24 #include "help_mp.h" | |
25 | |
26 #include "stream.h" | |
19312
ab8d6b6deb63
proper inclusion of demuxer.h (including libmpdemux in Makefile only was to make previous split easier)
ben
parents:
19271
diff
changeset
|
27 #include "libmpdemux/demuxer.h" |
ab8d6b6deb63
proper inclusion of demuxer.h (including libmpdemux in Makefile only was to make previous split easier)
ben
parents:
19271
diff
changeset
|
28 #include "libmpdemux/stheader.h" |
2830 | 29 |
17012 | 30 #include "libaf/af_format.h" |
19431
ac69ba536915
Explicitly include libmpcodecs/img_format.h and libvo/fastmemcpy.h.
diego
parents:
19312
diff
changeset
|
31 #include "libmpcodecs/img_format.h" |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
23573
diff
changeset
|
32 #include "libavutil/avstring.h" |
2830 | 33 |
2802 | 34 #include "tv.h" |
2790 | 35 |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
36 #include "frequencies.h" |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
37 |
2790 | 38 /* some default values */ |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
39 int tv_param_audiorate = 44100; |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
40 int tv_param_noaudio = 0; |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
41 int tv_param_immediate = 0; |
2837 | 42 char *tv_param_freq = NULL; |
3284 | 43 char *tv_param_channel = NULL; |
2790 | 44 char *tv_param_norm = "pal"; |
10537 | 45 #ifdef HAVE_TV_V4L2 |
46 int tv_param_normid = -1; | |
47 #endif | |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
48 char *tv_param_chanlist = "europe-east"; |
2790 | 49 char *tv_param_device = NULL; |
50 char *tv_param_driver = "dummy"; | |
51 int tv_param_width = -1; | |
52 int tv_param_height = -1; | |
2802 | 53 int tv_param_input = 0; /* used in v4l and bttv */ |
17862
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
54 int tv_param_outfmt = -1; |
3285 | 55 float tv_param_fps = -1.0; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
56 char **tv_param_channels = NULL; |
10822
6377c7d0459e
audio id setting support for bsdbt848 by Nikolay Nikolaev <nicknickolaev@yahoo.com>
alex
parents:
10771
diff
changeset
|
57 int tv_param_audio_id = 0; |
23422 | 58 int tv_param_automute = 0; |
19189 | 59 #if defined(HAVE_TV_V4L) |
7163
a193df8b275b
v4l audio fixes by Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz>
alex
parents:
7058
diff
changeset
|
60 int tv_param_amode = -1; |
11986 | 61 int tv_param_volume = -1; |
7163
a193df8b275b
v4l audio fixes by Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz>
alex
parents:
7058
diff
changeset
|
62 int tv_param_bass = -1; |
a193df8b275b
v4l audio fixes by Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz>
alex
parents:
7058
diff
changeset
|
63 int tv_param_treble = -1; |
a193df8b275b
v4l audio fixes by Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz>
alex
parents:
7058
diff
changeset
|
64 int tv_param_balance = -1; |
a193df8b275b
v4l audio fixes by Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz>
alex
parents:
7058
diff
changeset
|
65 int tv_param_forcechan = -1; |
7835
d489890c59d3
add an option to force audio recording when a tv card reports no audio sources
henry
parents:
7807
diff
changeset
|
66 int tv_param_force_audio = 0; |
7905
b062996d9794
added an option for specifying the size of capture buffer
henry
parents:
7835
diff
changeset
|
67 int tv_param_buffer_size = -1; |
9620
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
68 int tv_param_mjpeg = 0; |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
69 int tv_param_decimation = 2; |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
70 int tv_param_quality = 90; |
11775 | 71 #if defined(HAVE_ALSA9) || defined(HAVE_ALSA1X) |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
72 int tv_param_alsa = 0; |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
73 #endif |
22381
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
74 #endif |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
75 char* tv_param_adevice = NULL; |
9663 | 76 int tv_param_brightness = 0; |
77 int tv_param_contrast = 0; | |
78 int tv_param_hue = 0; | |
79 int tv_param_saturation = 0; | |
14607
7a80c6ac5058
several sets of headers declare global variables in them, which causes multiple definition errors with gcc 4.x
iive
parents:
14255
diff
changeset
|
80 tv_channels_t *tv_channel_list; |
7a80c6ac5058
several sets of headers declare global variables in them, which causes multiple definition errors with gcc 4.x
iive
parents:
14255
diff
changeset
|
81 tv_channels_t *tv_channel_current, *tv_channel_last; |
7a80c6ac5058
several sets of headers declare global variables in them, which causes multiple definition errors with gcc 4.x
iive
parents:
14255
diff
changeset
|
82 char *tv_channel_last_real; |
2790 | 83 |
22381
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
84 /* enumerating drivers (like in stream.c) */ |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
85 extern tvi_info_t tvi_info_dummy; |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
86 #ifdef HAVE_TV_V4L1 |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
87 extern tvi_info_t tvi_info_v4l; |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
88 #endif |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
89 #ifdef HAVE_TV_V4L2 |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
90 extern tvi_info_t tvi_info_v4l2; |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
91 #endif |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
92 #ifdef HAVE_TV_BSDBT848 |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
93 extern tvi_info_t tvi_info_bsdbt848; |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
94 #endif |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
95 |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
96 static const tvi_info_t* tvi_driver_list[]={ |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
97 &tvi_info_dummy, |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
98 #ifdef HAVE_TV_V4L1 |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
99 &tvi_info_v4l, |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
100 #endif |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
101 #ifdef HAVE_TV_V4L2 |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
102 &tvi_info_v4l2, |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
103 #endif |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
104 #ifdef HAVE_TV_BSDBT848 |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
105 &tvi_info_bsdbt848, |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
106 #endif |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
107 NULL |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
108 }; |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
109 |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
110 |
2790 | 111 /* ================== DEMUX_TV ===================== */ |
112 /* | |
113 Return value: | |
114 0 = EOF(?) or no stream | |
115 1 = successfully read a packet | |
116 */ | |
117 /* fill demux->video and demux->audio */ | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
118 |
16175 | 119 static int demux_tv_fill_buffer(demuxer_t *demux, demux_stream_t *ds) |
2790 | 120 { |
7408 | 121 tvi_handle_t *tvh=(tvi_handle_t*)(demux->priv); |
2813 | 122 demux_packet_t* dp; |
9927 | 123 unsigned int len=0; |
22969
c8ace3e97d73
cosmetics. restore empty line removed in r22985.
voroshil
parents:
22967
diff
changeset
|
124 |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
125 /* ================== ADD AUDIO PACKET =================== */ |
2790 | 126 |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
127 if (ds==demux->audio && tv_param_noaudio == 0 && |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
128 tvh->functions->control(tvh->priv, |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
129 TVI_CONTROL_IS_AUDIO, 0) == TVI_CONTROL_TRUE) |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
130 { |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
131 len = tvh->functions->get_audio_framesize(tvh->priv); |
2802 | 132 |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
133 dp=new_demux_packet(len); |
12034 | 134 dp->flags|=1; /* Keyframe */ |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
135 dp->pts=tvh->functions->grab_audio_frame(tvh->priv, dp->buffer,len); |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
136 ds_add_packet(demux->audio,dp); |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
137 } |
2802 | 138 |
2790 | 139 /* ================== ADD VIDEO PACKET =================== */ |
140 | |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
141 if (ds==demux->video && tvh->functions->control(tvh->priv, |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
142 TVI_CONTROL_IS_VIDEO, 0) == TVI_CONTROL_TRUE) |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
143 { |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
144 len = tvh->functions->get_video_framesize(tvh->priv); |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
145 dp=new_demux_packet(len); |
12034 | 146 dp->flags|=1; /* Keyframe */ |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
147 dp->pts=tvh->functions->grab_video_frame(tvh->priv, dp->buffer, len); |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
148 ds_add_packet(demux->video,dp); |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
149 } |
2790 | 150 |
151 return 1; | |
152 } | |
153 | |
13978 | 154 static int norm_from_string(tvi_handle_t *tvh, char* norm) |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
155 { |
13978 | 156 #ifdef HAVE_TV_V4L2 |
157 if (strcmp(tv_param_driver, "v4l2") != 0) { | |
158 #endif | |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
159 if (!strcasecmp(norm, "pal")) |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
160 return TV_NORM_PAL; |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
161 else if (!strcasecmp(norm, "ntsc")) |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
162 return TV_NORM_NTSC; |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
163 else if (!strcasecmp(norm, "secam")) |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
164 return TV_NORM_SECAM; |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
165 else if (!strcasecmp(norm, "palnc")) |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
166 return TV_NORM_PALNC; |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
167 else if (!strcasecmp(norm, "palm")) |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
168 return TV_NORM_PALM; |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
169 else if (!strcasecmp(norm, "paln")) |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
170 return TV_NORM_PALN; |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
171 else if (!strcasecmp(norm, "ntscjp")) |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
172 return TV_NORM_NTSCJP; |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
173 else { |
22967 | 174 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_BogusNormParameter, norm, "PAL"); |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
175 return TV_NORM_PAL; |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
176 } |
13978 | 177 #ifdef HAVE_TV_V4L2 |
178 } else { | |
179 tvi_functions_t *funcs = tvh->functions; | |
180 char str[8]; | |
181 strncpy(str, norm, sizeof(str)-1); | |
182 str[sizeof(str)-1] = '\0'; | |
183 if (funcs->control(tvh->priv, TVI_CONTROL_SPC_GET_NORMID, str) != TVI_CONTROL_TRUE) | |
22728 | 184 { |
22967 | 185 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_BogusNormParameter, norm,"default"); |
13978 | 186 return 0; |
22728 | 187 } |
13978 | 188 return *(int *)str; |
189 } | |
190 #endif | |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
191 } |
8123
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
7905
diff
changeset
|
192 |
7408 | 193 static int open_tv(tvi_handle_t *tvh) |
2931 | 194 { |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
195 int i; |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
196 tvi_functions_t *funcs = tvh->functions; |
17862
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
197 int tv_fmt_list[] = { |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
198 IMGFMT_YV12, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
199 IMGFMT_I420, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
200 IMGFMT_UYVY, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
201 IMGFMT_YUY2, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
202 IMGFMT_RGB32, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
203 IMGFMT_RGB24, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
204 IMGFMT_RGB16, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
205 IMGFMT_RGB15 |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
206 }; |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
207 |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
208 if (funcs->control(tvh->priv, TVI_CONTROL_IS_VIDEO, 0) != TVI_CONTROL_TRUE) |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
209 { |
22967 | 210 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_NoVideoInputPresent); |
3728 | 211 return 0; |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
212 } |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
213 |
17862
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
214 if (tv_param_outfmt == -1) |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
215 for (i = 0; i < sizeof (tv_fmt_list) / sizeof (*tv_fmt_list); i++) |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
216 { |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
217 tv_param_outfmt = tv_fmt_list[i]; |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
218 if (funcs->control (tvh->priv, TVI_CONTROL_VID_SET_FORMAT, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
219 &tv_param_outfmt) == TVI_CONTROL_TRUE) |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
220 break; |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
221 } |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
222 else |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
223 { |
10598
2b88c28a3cfe
Settled to CONF_TYPE_IMGFMT which simplified lot of things. Now there's no need to add new img formats to the source, instead you can try it out by providing it in hexa format, and if it isn't supported by the card, you get a nice error message. That's all.
alex
parents:
10581
diff
changeset
|
224 switch(tv_param_outfmt) |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
225 { |
10598
2b88c28a3cfe
Settled to CONF_TYPE_IMGFMT which simplified lot of things. Now there's no need to add new img formats to the source, instead you can try it out by providing it in hexa format, and if it isn't supported by the card, you get a nice error message. That's all.
alex
parents:
10581
diff
changeset
|
226 case IMGFMT_YV12: |
2b88c28a3cfe
Settled to CONF_TYPE_IMGFMT which simplified lot of things. Now there's no need to add new img formats to the source, instead you can try it out by providing it in hexa format, and if it isn't supported by the card, you get a nice error message. That's all.
alex
parents:
10581
diff
changeset
|
227 case IMGFMT_I420: |
2b88c28a3cfe
Settled to CONF_TYPE_IMGFMT which simplified lot of things. Now there's no need to add new img formats to the source, instead you can try it out by providing it in hexa format, and if it isn't supported by the card, you get a nice error message. That's all.
alex
parents:
10581
diff
changeset
|
228 case IMGFMT_UYVY: |
2b88c28a3cfe
Settled to CONF_TYPE_IMGFMT which simplified lot of things. Now there's no need to add new img formats to the source, instead you can try it out by providing it in hexa format, and if it isn't supported by the card, you get a nice error message. That's all.
alex
parents:
10581
diff
changeset
|
229 case IMGFMT_YUY2: |
2b88c28a3cfe
Settled to CONF_TYPE_IMGFMT which simplified lot of things. Now there's no need to add new img formats to the source, instead you can try it out by providing it in hexa format, and if it isn't supported by the card, you get a nice error message. That's all.
alex
parents:
10581
diff
changeset
|
230 case IMGFMT_RGB32: |
2b88c28a3cfe
Settled to CONF_TYPE_IMGFMT which simplified lot of things. Now there's no need to add new img formats to the source, instead you can try it out by providing it in hexa format, and if it isn't supported by the card, you get a nice error message. That's all.
alex
parents:
10581
diff
changeset
|
231 case IMGFMT_RGB24: |
15419 | 232 case IMGFMT_BGR32: |
233 case IMGFMT_BGR24: | |
234 case IMGFMT_BGR16: | |
235 case IMGFMT_BGR15: | |
10598
2b88c28a3cfe
Settled to CONF_TYPE_IMGFMT which simplified lot of things. Now there's no need to add new img formats to the source, instead you can try it out by providing it in hexa format, and if it isn't supported by the card, you get a nice error message. That's all.
alex
parents:
10581
diff
changeset
|
236 break; |
2b88c28a3cfe
Settled to CONF_TYPE_IMGFMT which simplified lot of things. Now there's no need to add new img formats to the source, instead you can try it out by providing it in hexa format, and if it isn't supported by the card, you get a nice error message. That's all.
alex
parents:
10581
diff
changeset
|
237 default: |
22967 | 238 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_UnknownImageFormat,tv_param_outfmt); |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
239 } |
10598
2b88c28a3cfe
Settled to CONF_TYPE_IMGFMT which simplified lot of things. Now there's no need to add new img formats to the source, instead you can try it out by providing it in hexa format, and if it isn't supported by the card, you get a nice error message. That's all.
alex
parents:
10581
diff
changeset
|
240 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_FORMAT, &tv_param_outfmt); |
17862
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
241 } |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
242 |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
243 /* set some params got from cmdline */ |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
244 funcs->control(tvh->priv, TVI_CONTROL_SPC_SET_INPUT, &tv_param_input); |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
245 |
10537 | 246 #ifdef HAVE_TV_V4L2 |
13978 | 247 if (!strcmp(tv_param_driver, "v4l2") && tv_param_normid >= 0) { |
22967 | 248 mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_SelectedNormId, tv_param_normid); |
13978 | 249 if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tv_param_normid) != TVI_CONTROL_TRUE) { |
22967 | 250 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_CannotSetNorm); |
13978 | 251 } |
252 } else { | |
10537 | 253 #endif |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
254 /* select video norm */ |
13978 | 255 tvh->norm = norm_from_string(tvh, tv_param_norm); |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
256 |
22967 | 257 mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_SelectedNorm, tv_param_norm); |
8486
c268bbb804d9
handle bogus norm parameter; check for errors when setting norm
henry
parents:
8477
diff
changeset
|
258 if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) { |
22967 | 259 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_CannotSetNorm); |
8486
c268bbb804d9
handle bogus norm parameter; check for errors when setting norm
henry
parents:
8477
diff
changeset
|
260 } |
10537 | 261 #ifdef HAVE_TV_V4L2 |
262 } | |
263 #endif | |
9620
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
264 |
19187 | 265 #ifdef HAVE_TV_V4L1 |
9620
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
266 if ( tv_param_mjpeg ) |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
267 { |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
268 /* set width to expected value */ |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
269 if (tv_param_width == -1) |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
270 { |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
271 tv_param_width = 704/tv_param_decimation; |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
272 } |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
273 if (tv_param_height == -1) |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
274 { |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
275 if ( tvh->norm != TV_NORM_NTSC ) |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
276 tv_param_height = 576/tv_param_decimation; |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
277 else |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
278 tv_param_height = 480/tv_param_decimation; |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
279 } |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
280 mp_msg(MSGT_TV, MSGL_INFO, |
22967 | 281 MSGTR_TV_MJP_WidthHeight, tv_param_width, tv_param_height); |
9620
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
282 } |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
283 #endif |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
284 |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
285 /* limits on w&h are norm-dependent -- JM */ |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
286 /* set width */ |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
287 if (tv_param_width != -1) |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
288 { |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
289 if (funcs->control(tvh->priv, TVI_CONTROL_VID_CHK_WIDTH, &tv_param_width) == TVI_CONTROL_TRUE) |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
290 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_WIDTH, &tv_param_width); |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
291 else |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
292 { |
22967 | 293 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_UnableToSetWidth, tv_param_width); |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
294 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_WIDTH, &tv_param_width); |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
295 } |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
296 } |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
297 |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
298 /* set height */ |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
299 if (tv_param_height != -1) |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
300 { |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
301 if (funcs->control(tvh->priv, TVI_CONTROL_VID_CHK_HEIGHT, &tv_param_height) == TVI_CONTROL_TRUE) |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
302 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_HEIGHT, &tv_param_height); |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
303 else |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
304 { |
22967 | 305 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_UnableToSetHeight, tv_param_height); |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
306 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HEIGHT, &tv_param_height); |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
307 } |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
308 } |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
309 |
3284 | 310 if (funcs->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) != TVI_CONTROL_TRUE) |
311 { | |
22967 | 312 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_NoTuner); |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
313 goto done; |
3284 | 314 } |
315 | |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
316 /* select channel list */ |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
317 for (i = 0; chanlists[i].name != NULL; i++) |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
318 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
319 if (!strcasecmp(chanlists[i].name, tv_param_chanlist)) |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
320 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
321 tvh->chanlist = i; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
322 tvh->chanlist_s = chanlists[i].list; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
323 break; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
324 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
325 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
326 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
327 if (tvh->chanlist == -1) |
22967 | 328 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_UnableFindChanlist, |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
329 tv_param_chanlist); |
3284 | 330 else |
22967 | 331 mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_SelectedChanlist, |
3284 | 332 chanlists[tvh->chanlist].name, chanlists[tvh->chanlist].count); |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
333 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
334 if (tv_param_freq && tv_param_channel) |
3284 | 335 { |
22967 | 336 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_ChannelFreqParamConflict); |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
337 goto done; |
3284 | 338 } |
339 | |
10771 | 340 /* Handle channel names */ |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
341 if (tv_param_channels) { |
9519 | 342 char** channels = tv_param_channels; |
22967 | 343 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_ChannelNamesDetected); |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
344 tv_channel_list = malloc(sizeof(tv_channels_t)); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
345 tv_channel_list->index=1; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
346 tv_channel_list->next=NULL; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
347 tv_channel_list->prev=NULL; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
348 tv_channel_current = tv_channel_list; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
349 |
9519 | 350 while (*channels) { |
351 char* tmp = *(channels++); | |
8955
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
352 char* sep = strchr(tmp,'-'); |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
353 int i; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
354 struct CHANLIST cl; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
355 |
8955
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
356 if (!sep) continue; // Wrong syntax, but mplayer should not crash |
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
357 |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
23573
diff
changeset
|
358 av_strlcpy(tv_channel_current->name, sep + 1, |
18761 | 359 sizeof(tv_channel_current->name)); |
8955
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
360 sep[0] = '\0'; |
8820 | 361 strncpy(tv_channel_current->number, tmp, 5); |
22619
86edaa8501c1
Allow to specify frequencies in channels option.
voroshil
parents:
22381
diff
changeset
|
362 tv_channel_current->number[4]='\0'; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
363 |
8955
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
364 while ((sep=strchr(tv_channel_current->name, '_'))) |
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
365 sep[0] = ' '; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
366 |
22619
86edaa8501c1
Allow to specify frequencies in channels option.
voroshil
parents:
22381
diff
changeset
|
367 // if channel number is a number and larger than 1000 threat it as frequency |
86edaa8501c1
Allow to specify frequencies in channels option.
voroshil
parents:
22381
diff
changeset
|
368 // tmp still contain pointer to null-terminated string with channel number here |
86edaa8501c1
Allow to specify frequencies in channels option.
voroshil
parents:
22381
diff
changeset
|
369 if (atoi(tmp)>1000){ |
86edaa8501c1
Allow to specify frequencies in channels option.
voroshil
parents:
22381
diff
changeset
|
370 tv_channel_current->freq=atoi(tmp); |
86edaa8501c1
Allow to specify frequencies in channels option.
voroshil
parents:
22381
diff
changeset
|
371 }else{ |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
372 tv_channel_current->freq = 0; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
373 for (i = 0; i < chanlists[tvh->chanlist].count; i++) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
374 cl = tvh->chanlist_s[i]; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
375 if (!strcasecmp(cl.name, tv_channel_current->number)) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
376 tv_channel_current->freq=cl.freq; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
377 break; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
378 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
379 } |
22619
86edaa8501c1
Allow to specify frequencies in channels option.
voroshil
parents:
22381
diff
changeset
|
380 } |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
381 if (tv_channel_current->freq == 0) |
22967 | 382 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_NoFreqForChannel, |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
383 tv_channel_current->number, tv_channel_current->name); |
9889
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
384 else { |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
385 sep = strchr(tv_channel_current->name, '-'); |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
386 if ( !sep ) sep = strchr(tv_channel_current->name, '+'); |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
387 |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
388 if ( sep ) { |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
389 i = atoi (sep+1); |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
390 if ( sep[0] == '+' ) tv_channel_current->freq += i * 100; |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
391 if ( sep[0] == '-' ) tv_channel_current->freq -= i * 100; |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
392 sep[0] = '\0'; |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
393 } |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
394 } |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
395 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
396 /*mp_msg(MSGT_TV, MSGL_INFO, "-- Detected channel %s - %s (%5.3f)\n", |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
397 tv_channel_current->number, tv_channel_current->name, |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
398 (float)tv_channel_current->freq/1000);*/ |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
399 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
400 tv_channel_current->next = malloc(sizeof(tv_channels_t)); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
401 tv_channel_current->next->index = tv_channel_current->index + 1; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
402 tv_channel_current->next->prev = tv_channel_current; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
403 tv_channel_current->next->next = NULL; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
404 tv_channel_current = tv_channel_current->next; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
405 } |
8955
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
406 if (tv_channel_current->prev) |
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
407 tv_channel_current->prev->next = NULL; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
408 free(tv_channel_current); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
409 } else |
18366 | 410 tv_channel_last_real = malloc(5); |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
411 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
412 if (tv_channel_list) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
413 int i; |
10011
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
414 int channel = 0; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
415 if (tv_param_channel) |
10011
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
416 { |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
417 if (isdigit(*tv_param_channel)) |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
418 /* if tv_param_channel begins with a digit interpret it as a number */ |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
419 channel = atoi(tv_param_channel); |
10011
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
420 else |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
421 { |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
422 /* if tv_param_channel does not begin with a digit |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
423 set the first channel that contains tv_param_channel in its name */ |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
424 |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
425 tv_channel_current = tv_channel_list; |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
426 while ( tv_channel_current ) { |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
427 if ( strstr(tv_channel_current->name, tv_param_channel) ) |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
428 break; |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
429 tv_channel_current = tv_channel_current->next; |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
430 } |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
431 if ( !tv_channel_current ) tv_channel_current = tv_channel_list; |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
432 } |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
433 } |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
434 else |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
435 channel = 1; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
436 |
10011
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
437 if ( channel ) { |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
438 tv_channel_current = tv_channel_list; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
439 for (i = 1; i < channel; i++) |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
440 if (tv_channel_current->next) |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
441 tv_channel_current = tv_channel_current->next; |
10011
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
442 } |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
443 |
22967 | 444 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel3, tv_channel_current->number, |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
445 tv_channel_current->name, (float)tv_channel_current->freq/1000); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
446 tv_set_freq(tvh, (unsigned long)(((float)tv_channel_current->freq/1000)*16)); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
447 tv_channel_last = tv_channel_current; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
448 } else { |
3284 | 449 /* we need to set frequency */ |
450 if (tv_param_freq) | |
451 { | |
452 unsigned long freq = atof(tv_param_freq)*16; | |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
453 |
3284 | 454 /* set freq in MHz */ |
455 funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_FREQ, &freq); | |
456 | |
457 funcs->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &freq); | |
22967 | 458 mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_SelectedFrequency, |
3284 | 459 freq, (float)freq/16); |
460 } | |
461 | |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
462 if (tv_param_channel) { |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
463 struct CHANLIST cl; |
3284 | 464 |
22967 | 465 mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_RequestedChannel, tv_param_channel); |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
466 for (i = 0; i < chanlists[tvh->chanlist].count; i++) |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
467 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
468 cl = tvh->chanlist_s[i]; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
469 // printf("count%d: name: %s, freq: %d\n", |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
470 // i, cl.name, cl.freq); |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
471 if (!strcasecmp(cl.name, tv_param_channel)) |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
472 { |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
473 strcpy(tv_channel_last_real, cl.name); |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
474 tvh->channel = i; |
22967 | 475 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel2, |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
476 cl.name, (float)cl.freq/1000); |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
477 tv_set_freq(tvh, (unsigned long)(((float)cl.freq/1000)*16)); |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
478 break; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
479 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
480 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
481 } |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
482 } |
7806
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
483 |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
484 /* grep frequency in chanlist */ |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
485 { |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
486 unsigned long i2; |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
487 int freq; |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
488 |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
489 tv_get_freq(tvh, &i2); |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
490 |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
491 freq = (int) (((float)(i2/16))*1000)+250; |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
492 |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
493 for (i = 0; i < chanlists[tvh->chanlist].count; i++) |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
494 { |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
495 if (tvh->chanlist_s[i].freq == freq) |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
496 { |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
497 tvh->channel = i+1; |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
498 break; |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
499 } |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
500 } |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
501 } |
3284 | 502 |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
503 done: |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
504 /* also start device! */ |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
505 return 1; |
2931 | 506 } |
507 | |
23879 | 508 /* ================== STREAM_TV ===================== */ |
509 | |
510 tvi_handle_t *tv_begin(void) | |
511 { | |
512 int i; | |
513 tvi_handle_t* h; | |
514 if(!strcmp(tv_param_driver,"help")){ | |
515 mp_msg(MSGT_TV,MSGL_INFO,MSGTR_TV_AvailableDrivers); | |
516 for(i=0;tvi_driver_list[i];i++){ | |
517 mp_msg(MSGT_TV,MSGL_INFO," %s\t%s",tvi_driver_list[i]->short_name,tvi_driver_list[i]->name); | |
518 if(tvi_driver_list[i]->comment) | |
519 mp_msg(MSGT_TV,MSGL_INFO," (%s)",tvi_driver_list[i]->comment); | |
520 mp_msg(MSGT_TV,MSGL_INFO,"\n"); | |
521 } | |
522 return NULL; | |
523 } | |
524 | |
525 for(i=0;tvi_driver_list[i];i++){ | |
526 if (!strcmp(tvi_driver_list[i]->short_name, tv_param_driver)){ | |
527 h=tvi_driver_list[i]->tvi_init(tv_param_device,tv_param_adevice); | |
528 if(!h) return NULL; | |
529 | |
530 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_DriverInfo, tvi_driver_list[i]->short_name, | |
531 tvi_driver_list[i]->name, | |
532 tvi_driver_list[i]->author, | |
533 tvi_driver_list[i]->comment?tvi_driver_list[i]->comment:""); | |
534 return h; | |
535 } | |
536 } | |
537 | |
538 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_NoSuchDriver, tv_param_driver); | |
539 return(NULL); | |
540 } | |
541 | |
16175 | 542 static demuxer_t* demux_open_tv(demuxer_t *demuxer) |
2790 | 543 { |
7408 | 544 tvi_handle_t *tvh; |
545 sh_video_t *sh_video; | |
2802 | 546 sh_audio_t *sh_audio = NULL; |
7408 | 547 tvi_functions_t *funcs; |
548 | |
21837 | 549 demuxer->priv=NULL; |
16175 | 550 if(!(tvh=tv_begin())) return NULL; |
22381
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
551 if (!tvh->functions->init(tvh->priv)) return NULL; |
7408 | 552 if (!open_tv(tvh)){ |
553 tv_uninit(tvh); | |
16175 | 554 return NULL; |
7408 | 555 } |
556 funcs = tvh->functions; | |
557 demuxer->priv=tvh; | |
2790 | 558 |
2802 | 559 sh_video = new_sh_video(demuxer, 0); |
2790 | 560 |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
561 /* get IMAGE FORMAT */ |
2802 | 562 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_FORMAT, &sh_video->format); |
2810 | 563 // if (IMGFMT_IS_RGB(sh_video->format) || IMGFMT_IS_BGR(sh_video->format)) |
3398 | 564 // sh_video->format = 0x0; |
2802 | 565 |
566 /* set FPS and FRAMETIME */ | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
567 |
2790 | 568 if(!sh_video->fps) |
569 { | |
10019 | 570 float tmp; |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
571 if (funcs->control(tvh->priv, TVI_CONTROL_VID_GET_FPS, &tmp) != TVI_CONTROL_TRUE) |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
572 sh_video->fps = 25.0f; /* on PAL */ |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
573 else sh_video->fps = tmp; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
574 } |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
575 |
3285 | 576 if (tv_param_fps != -1.0f) |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
577 sh_video->fps = tv_param_fps; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
578 |
2790 | 579 sh_video->frametime = 1.0f/sh_video->fps; |
580 | |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
581 /* If playback only mode, go to immediate mode, fail silently */ |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
582 if(tv_param_immediate == 1) |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
583 { |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
584 funcs->control(tvh->priv, TVI_CONTROL_IMMEDIATE, 0); |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
585 tv_param_noaudio = 1; |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
586 } |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
587 |
8799 | 588 /* disable TV audio if -nosound is present */ |
589 if (!demuxer->audio || demuxer->audio->id == -2) { | |
590 tv_param_noaudio = 1; | |
591 } | |
592 | |
2790 | 593 /* set width */ |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
594 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_WIDTH, &sh_video->disp_w); |
2790 | 595 |
596 /* set height */ | |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
597 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HEIGHT, &sh_video->disp_h); |
2802 | 598 |
2790 | 599 demuxer->video->sh = sh_video; |
600 sh_video->ds = demuxer->video; | |
601 demuxer->video->id = 0; | |
9501 | 602 demuxer->seekable = 0; |
2790 | 603 |
604 /* here comes audio init */ | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
605 if (tv_param_noaudio == 0 && funcs->control(tvh->priv, TVI_CONTROL_IS_AUDIO, 0) == TVI_CONTROL_TRUE) |
2802 | 606 { |
607 int audio_format; | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
608 int sh_audio_format; |
14245 | 609 char buf[128]; |
2802 | 610 |
611 /* yeah, audio is present */ | |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
612 |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
613 funcs->control(tvh->priv, TVI_CONTROL_AUD_SET_SAMPLERATE, |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
614 &tv_param_audiorate); |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
615 |
2802 | 616 if (funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_FORMAT, &audio_format) != TVI_CONTROL_TRUE) |
617 goto no_audio; | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
618 |
2802 | 619 switch(audio_format) |
620 { | |
14245 | 621 case AF_FORMAT_U8: |
622 case AF_FORMAT_S8: | |
623 case AF_FORMAT_U16_LE: | |
624 case AF_FORMAT_U16_BE: | |
625 case AF_FORMAT_S16_LE: | |
626 case AF_FORMAT_S16_BE: | |
627 case AF_FORMAT_S32_LE: | |
628 case AF_FORMAT_S32_BE: | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
629 sh_audio_format = 0x1; /* PCM */ |
2802 | 630 break; |
14245 | 631 case AF_FORMAT_IMA_ADPCM: |
632 case AF_FORMAT_MU_LAW: | |
633 case AF_FORMAT_A_LAW: | |
634 case AF_FORMAT_MPEG2: | |
635 case AF_FORMAT_AC3: | |
2802 | 636 default: |
22967 | 637 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_UnsupportedAudioType, |
14255
137896e25c24
100l, buf etc. in af_fmt2str call are already pointers...
reimar
parents:
14245
diff
changeset
|
638 af_fmt2str(audio_format, buf, 128), audio_format); |
2802 | 639 goto no_audio; |
640 } | |
641 | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
642 sh_audio = new_sh_audio(demuxer, 0); |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
643 |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
644 funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_SAMPLERATE, |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
645 &sh_audio->samplerate); |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
646 funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_SAMPLESIZE, |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
647 &sh_audio->samplesize); |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
648 funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_CHANNELS, |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
649 &sh_audio->channels); |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
650 |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
651 sh_audio->format = sh_audio_format; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
652 sh_audio->sample_format = audio_format; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
653 |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
654 sh_audio->i_bps = sh_audio->o_bps = |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
655 sh_audio->samplerate * sh_audio->samplesize * |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
656 sh_audio->channels; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
657 |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
658 // emulate WF for win32 codecs: |
19062
83c3afeab35d
drops casts from void * on malloc/calloc from libmpdemux code
reynaldo
parents:
18922
diff
changeset
|
659 sh_audio->wf = malloc(sizeof(WAVEFORMATEX)); |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
660 sh_audio->wf->wFormatTag = sh_audio->format; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
661 sh_audio->wf->nChannels = sh_audio->channels; |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
662 sh_audio->wf->wBitsPerSample = sh_audio->samplesize * 8; |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
663 sh_audio->wf->nSamplesPerSec = sh_audio->samplerate; |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
664 sh_audio->wf->nBlockAlign = sh_audio->samplesize * sh_audio->channels; |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
665 sh_audio->wf->nAvgBytesPerSec = sh_audio->i_bps; |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
666 |
22967 | 667 mp_msg(MSGT_DECVIDEO, MSGL_V, MSGTR_TV_AudioFormat, |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
668 sh_audio->wf->nChannels, sh_audio->wf->wBitsPerSample, |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
669 sh_audio->wf->nSamplesPerSec); |
2802 | 670 |
671 demuxer->audio->sh = sh_audio; | |
672 sh_audio->ds = demuxer->audio; | |
673 demuxer->audio->id = 0; | |
674 } | |
675 no_audio: | |
676 | |
7329
9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents:
7318
diff
changeset
|
677 if(!(funcs->start(tvh->priv))){ |
9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents:
7318
diff
changeset
|
678 // start failed :( |
9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents:
7318
diff
changeset
|
679 tv_uninit(tvh); |
16175 | 680 return NULL; |
7329
9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents:
7318
diff
changeset
|
681 } |
10581
4ebff25d9a05
From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents:
10537
diff
changeset
|
682 |
4ebff25d9a05
From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents:
10537
diff
changeset
|
683 /* set color eq */ |
4ebff25d9a05
From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents:
10537
diff
changeset
|
684 tv_set_color_options(tvh, TV_COLOR_BRIGHTNESS, tv_param_brightness); |
4ebff25d9a05
From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents:
10537
diff
changeset
|
685 tv_set_color_options(tvh, TV_COLOR_HUE, tv_param_hue); |
4ebff25d9a05
From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents:
10537
diff
changeset
|
686 tv_set_color_options(tvh, TV_COLOR_SATURATION, tv_param_saturation); |
4ebff25d9a05
From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents:
10537
diff
changeset
|
687 tv_set_color_options(tvh, TV_COLOR_CONTRAST, tv_param_contrast); |
4ebff25d9a05
From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents:
10537
diff
changeset
|
688 |
16175 | 689 return demuxer; |
2790 | 690 } |
691 | |
17174
83a8c738be89
make demuxer seek and close functions return void, patch by Dominik Mierzejewski
wanderer
parents:
17012
diff
changeset
|
692 static void demux_close_tv(demuxer_t *demuxer) |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
693 { |
7408 | 694 tvi_handle_t *tvh=(tvi_handle_t*)(demuxer->priv); |
21837 | 695 if (!tvh) return; |
17174
83a8c738be89
make demuxer seek and close functions return void, patch by Dominik Mierzejewski
wanderer
parents:
17012
diff
changeset
|
696 tvh->functions->uninit(tvh->priv); |
21837 | 697 demuxer->priv=NULL; |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
698 } |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
699 |
2837 | 700 int tv_uninit(tvi_handle_t *tvh) |
701 { | |
21837 | 702 int res; |
703 if(!tvh) return 1; | |
704 if (!tvh->priv) return 1; | |
705 res=tvh->functions->uninit(tvh->priv); | |
706 if(res) tvh->priv=NULL; | |
707 return res; | |
2790 | 708 } |
2937 | 709 |
710 /* utilities for mplayer (not mencoder!!) */ | |
711 int tv_set_color_options(tvi_handle_t *tvh, int opt, int value) | |
712 { | |
713 tvi_functions_t *funcs = tvh->functions; | |
714 | |
715 switch(opt) | |
716 { | |
717 case TV_COLOR_BRIGHTNESS: | |
18172
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
718 return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_BRIGHTNESS, &value); |
2937 | 719 case TV_COLOR_HUE: |
18172
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
720 return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_HUE, &value); |
2937 | 721 case TV_COLOR_SATURATION: |
18172
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
722 return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_SATURATION, &value); |
2937 | 723 case TV_COLOR_CONTRAST: |
18172
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
724 return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_CONTRAST, &value); |
2937 | 725 default: |
22967 | 726 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_UnknownColorOption, opt); |
2937 | 727 } |
728 | |
18172
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
729 return(TVI_CONTROL_UNKNOWN); |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
730 } |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
731 |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
732 int tv_get_color_options(tvi_handle_t *tvh, int opt, int* value) |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
733 { |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
734 tvi_functions_t *funcs = tvh->functions; |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
735 |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
736 switch(opt) |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
737 { |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
738 case TV_COLOR_BRIGHTNESS: |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
739 return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_BRIGHTNESS, value); |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
740 case TV_COLOR_HUE: |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
741 return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HUE, value); |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
742 case TV_COLOR_SATURATION: |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
743 return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_SATURATION, value); |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
744 case TV_COLOR_CONTRAST: |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
745 return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_CONTRAST, value); |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
746 default: |
22967 | 747 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_UnknownColorOption, opt); |
18172
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
748 } |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
749 |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
750 return(TVI_CONTROL_UNKNOWN); |
2937 | 751 } |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
752 |
7806
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
753 int tv_get_freq(tvi_handle_t *tvh, unsigned long *freq) |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
754 { |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
755 if (tvh->functions->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) == TVI_CONTROL_TRUE) |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
756 { |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
757 tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, freq); |
22967 | 758 mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_CurrentFrequency, |
7806
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
759 *freq, (float)*freq/16); |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
760 } |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
761 return(1); |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
762 } |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
763 |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
764 int tv_set_freq(tvi_handle_t *tvh, unsigned long freq) |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
765 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
766 if (tvh->functions->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) == TVI_CONTROL_TRUE) |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
767 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
768 // unsigned long freq = atof(tv_param_freq)*16; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
769 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
770 /* set freq in MHz */ |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
771 tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_FREQ, &freq); |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
772 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
773 tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &freq); |
22967 | 774 mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_CurrentFrequency, |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
775 freq, (float)freq/16); |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
776 } |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7408
diff
changeset
|
777 return(1); |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
778 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
779 |
22667 | 780 /***************************************************************** |
781 * \brief tune current frequency by step_interval value | |
782 * \parameter step_interval increment value in 1/16 MHz | |
783 * \note frequency is rounded to 1/16 MHz value | |
784 * \return 1 | |
785 * | |
786 */ | |
787 int tv_step_freq(tvi_handle_t* tvh, float step_interval){ | |
788 unsigned long frequency; | |
789 | |
790 tv_get_freq(tvh,&frequency); | |
791 frequency+=step_interval; | |
792 return tv_set_freq(tvh,frequency); | |
793 } | |
794 | |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
795 int tv_step_channel_real(tvi_handle_t *tvh, int direction) |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
796 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
797 struct CHANLIST cl; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
798 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
799 if (direction == TV_CHANNEL_LOWER) |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
800 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
801 if (tvh->channel-1 >= 0) |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
802 { |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
803 strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name); |
5923 | 804 cl = tvh->chanlist_s[--tvh->channel]; |
22967 | 805 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel2, |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
806 cl.name, (float)cl.freq/1000); |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
807 tv_set_freq(tvh, (unsigned long)(((float)cl.freq/1000)*16)); |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
808 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
809 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
810 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
811 if (direction == TV_CHANNEL_HIGHER) |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
812 { |
4242 | 813 if (tvh->channel+1 < chanlists[tvh->chanlist].count) |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
814 { |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
815 strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name); |
5923 | 816 cl = tvh->chanlist_s[++tvh->channel]; |
22967 | 817 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel2, |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
818 cl.name, (float)cl.freq/1000); |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
819 tv_set_freq(tvh, (unsigned long)(((float)cl.freq/1000)*16)); |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
820 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
821 } |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7408
diff
changeset
|
822 return(1); |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
823 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
824 |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
825 int tv_step_channel(tvi_handle_t *tvh, int direction) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
826 if (tv_channel_list) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
827 if (direction == TV_CHANNEL_HIGHER) { |
16469
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
828 tv_channel_last = tv_channel_current; |
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
829 if (tv_channel_current->next) |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
830 tv_channel_current = tv_channel_current->next; |
16469
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
831 else |
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
832 tv_channel_current = tv_channel_list; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
833 tv_set_freq(tvh, (unsigned long)(((float)tv_channel_current->freq/1000)*16)); |
22967 | 834 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel3, |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
835 tv_channel_current->number, tv_channel_current->name, (float)tv_channel_current->freq/1000); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
836 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
837 if (direction == TV_CHANNEL_LOWER) { |
16469
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
838 tv_channel_last = tv_channel_current; |
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
839 if (tv_channel_current->prev) |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
840 tv_channel_current = tv_channel_current->prev; |
16469
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
841 else |
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
842 while (tv_channel_current->next) |
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
843 tv_channel_current = tv_channel_current->next; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
844 tv_set_freq(tvh, (unsigned long)(((float)tv_channel_current->freq/1000)*16)); |
22967 | 845 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel3, |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
846 tv_channel_current->number, tv_channel_current->name, (float)tv_channel_current->freq/1000); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
847 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
848 } else tv_step_channel_real(tvh, direction); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
849 return(1); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
850 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
851 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
852 int tv_set_channel_real(tvi_handle_t *tvh, char *channel) { |
8494 | 853 int i; |
854 struct CHANLIST cl; | |
855 | |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
856 strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name); |
8494 | 857 for (i = 0; i < chanlists[tvh->chanlist].count; i++) |
858 { | |
859 cl = tvh->chanlist_s[i]; | |
860 // printf("count%d: name: %s, freq: %d\n", | |
861 // i, cl.name, cl.freq); | |
862 if (!strcasecmp(cl.name, channel)) | |
863 { | |
864 tvh->channel = i; | |
22967 | 865 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel2, |
8494 | 866 cl.name, (float)cl.freq/1000); |
867 tv_set_freq(tvh, (unsigned long)(((float)cl.freq/1000)*16)); | |
868 break; | |
869 } | |
870 } | |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
871 return(1); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
872 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
873 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
874 int tv_set_channel(tvi_handle_t *tvh, char *channel) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
875 int i, channel_int; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
876 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
877 if (tv_channel_list) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
878 tv_channel_last = tv_channel_current; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
879 channel_int = atoi(channel); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
880 tv_channel_current = tv_channel_list; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
881 for (i = 1; i < channel_int; i++) |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
882 if (tv_channel_current->next) |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
883 tv_channel_current = tv_channel_current->next; |
22967 | 884 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel3, tv_channel_current->number, |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
885 tv_channel_current->name, (float)tv_channel_current->freq/1000); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
886 tv_set_freq(tvh, (unsigned long)(((float)tv_channel_current->freq/1000)*16)); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
887 } else tv_set_channel_real(tvh, channel); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
888 return(1); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
889 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
890 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
891 int tv_last_channel(tvi_handle_t *tvh) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
892 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
893 if (tv_channel_list) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
894 tv_channels_t *tmp; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
895 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
896 tmp = tv_channel_last; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
897 tv_channel_last = tv_channel_current; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
898 tv_channel_current = tmp; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
899 |
22967 | 900 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel3, tv_channel_current->number, |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
901 tv_channel_current->name, (float)tv_channel_current->freq/1000); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
902 tv_set_freq(tvh, (unsigned long)(((float)tv_channel_current->freq/1000)*16)); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
903 } else { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
904 int i; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
905 struct CHANLIST cl; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
906 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
907 for (i = 0; i < chanlists[tvh->chanlist].count; i++) |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
908 { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
909 cl = tvh->chanlist_s[i]; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
910 if (!strcasecmp(cl.name, tv_channel_last_real)) |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
911 { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
912 strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
913 tvh->channel = i; |
22967 | 914 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel2, |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
915 cl.name, (float)cl.freq/1000); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
916 tv_set_freq(tvh, (unsigned long)(((float)cl.freq/1000)*16)); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
917 break; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
918 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
919 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
920 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
921 return(1); |
8494 | 922 } |
923 | |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
924 int tv_step_norm(tvi_handle_t *tvh) |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
925 { |
16961
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
926 tvh->norm++; |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
927 if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
928 &tvh->norm) != TVI_CONTROL_TRUE) { |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
929 tvh->norm = 0; |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
930 if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
931 &tvh->norm) != TVI_CONTROL_TRUE) { |
22967 | 932 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_CannotSetNorm); |
16961
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
933 return 0; |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
934 } |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
935 } |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7408
diff
changeset
|
936 return(1); |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
937 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
938 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
939 int tv_step_chanlist(tvi_handle_t *tvh) |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
940 { |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7408
diff
changeset
|
941 return(1); |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
942 } |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
943 |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
944 int tv_set_norm(tvi_handle_t *tvh, char* norm) |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
945 { |
13978 | 946 tvh->norm = norm_from_string(tvh, norm); |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
947 |
22967 | 948 mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_SelectedNorm, tv_param_norm); |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
949 if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) { |
22967 | 950 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_CannotSetNorm); |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
951 return 0; |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
952 } |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
953 return(1); |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
954 } |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
955 |
16175 | 956 demuxer_desc_t demuxer_desc_tv = { |
957 "Tv card demuxer", | |
958 "tv", | |
959 "TV", | |
960 "Alex Beregszaszi, Charles R. Henrich", | |
961 "?", | |
962 DEMUXER_TYPE_TV, | |
963 0, // no autodetect | |
964 NULL, | |
965 demux_tv_fill_buffer, | |
966 demux_open_tv, | |
967 demux_close_tv, | |
968 NULL, | |
969 NULL | |
970 }; |