Mercurial > mplayer.hg
annotate stream/tv.c @ 21827:b0bc0d81f91b
Subtitle handling cleanup: factor out code for parsing embedded subtitles
and adding and removing of lines in subtitle struct into subreader.c.
author | reimar |
---|---|
date | Sat, 06 Jan 2007 19:07:58 +0000 |
parents | ac69ba536915 |
children | 922c0072a2bf |
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 int tv_param_on = 0; |
2e58962dc9fe
cleaned up some warnings, and tv_param_on moved out from #ifdef USE_TV
alex
parents:
2818
diff
changeset
|
23 |
2790 | 24 #include "mp_msg.h" |
25 #include "help_mp.h" | |
26 | |
27 #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
|
28 #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
|
29 #include "libmpdemux/stheader.h" |
2830 | 30 |
17012 | 31 #include "libaf/af_format.h" |
19431
ac69ba536915
Explicitly include libmpcodecs/img_format.h and libvo/fastmemcpy.h.
diego
parents:
19312
diff
changeset
|
32 #include "libmpcodecs/img_format.h" |
17012 | 33 #include "libvo/fastmemcpy.h" |
2830 | 34 |
2802 | 35 #include "tv.h" |
2790 | 36 |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
37 #include "frequencies.h" |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
38 |
2790 | 39 /* some default values */ |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
40 int tv_param_audiorate = 44100; |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
41 int tv_param_noaudio = 0; |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
42 int tv_param_immediate = 0; |
2837 | 43 char *tv_param_freq = NULL; |
3284 | 44 char *tv_param_channel = NULL; |
2790 | 45 char *tv_param_norm = "pal"; |
10537 | 46 #ifdef HAVE_TV_V4L2 |
47 int tv_param_normid = -1; | |
48 #endif | |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
49 char *tv_param_chanlist = "europe-east"; |
2790 | 50 char *tv_param_device = NULL; |
51 char *tv_param_driver = "dummy"; | |
52 int tv_param_width = -1; | |
53 int tv_param_height = -1; | |
2802 | 54 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
|
55 int tv_param_outfmt = -1; |
3285 | 56 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
|
57 char **tv_param_channels = NULL; |
10822
6377c7d0459e
audio id setting support for bsdbt848 by Nikolay Nikolaev <nicknickolaev@yahoo.com>
alex
parents:
10771
diff
changeset
|
58 int tv_param_audio_id = 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 |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
74 char* tv_param_adevice = NULL; |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
75 #endif |
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 |
84 /* ================== DEMUX_TV ===================== */ | |
85 /* | |
86 Return value: | |
87 0 = EOF(?) or no stream | |
88 1 = successfully read a packet | |
89 */ | |
90 /* fill demux->video and demux->audio */ | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
91 |
16175 | 92 static int demux_tv_fill_buffer(demuxer_t *demux, demux_stream_t *ds) |
2790 | 93 { |
7408 | 94 tvi_handle_t *tvh=(tvi_handle_t*)(demux->priv); |
2813 | 95 demux_packet_t* dp; |
9927 | 96 unsigned int len=0; |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
97 |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
98 /* ================== ADD AUDIO PACKET =================== */ |
2790 | 99 |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
100 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
|
101 tvh->functions->control(tvh->priv, |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
102 TVI_CONTROL_IS_AUDIO, 0) == TVI_CONTROL_TRUE) |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
103 { |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
104 len = tvh->functions->get_audio_framesize(tvh->priv); |
2802 | 105 |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
106 dp=new_demux_packet(len); |
12034 | 107 dp->flags|=1; /* Keyframe */ |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
108 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
|
109 ds_add_packet(demux->audio,dp); |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
110 } |
2802 | 111 |
2790 | 112 /* ================== ADD VIDEO PACKET =================== */ |
113 | |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
114 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
|
115 TVI_CONTROL_IS_VIDEO, 0) == TVI_CONTROL_TRUE) |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
116 { |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
117 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
|
118 dp=new_demux_packet(len); |
12034 | 119 dp->flags|=1; /* Keyframe */ |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
120 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
|
121 ds_add_packet(demux->video,dp); |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
122 } |
2790 | 123 |
124 return 1; | |
125 } | |
126 | |
13978 | 127 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
|
128 { |
13978 | 129 #ifdef HAVE_TV_V4L2 |
130 if (strcmp(tv_param_driver, "v4l2") != 0) { | |
131 #endif | |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
132 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
|
133 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
|
134 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
|
135 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
|
136 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
|
137 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
|
138 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
|
139 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
|
140 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
|
141 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
|
142 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
|
143 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
|
144 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
|
145 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
|
146 else { |
10771 | 147 mp_msg(MSGT_TV, MSGL_V, "tv.c: norm_from_string(%s): Bogus norm parameter, setting PAL.\n", norm); |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
148 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
|
149 } |
13978 | 150 #ifdef HAVE_TV_V4L2 |
151 } else { | |
152 tvi_functions_t *funcs = tvh->functions; | |
153 char str[8]; | |
154 strncpy(str, norm, sizeof(str)-1); | |
155 str[sizeof(str)-1] = '\0'; | |
156 if (funcs->control(tvh->priv, TVI_CONTROL_SPC_GET_NORMID, str) != TVI_CONTROL_TRUE) | |
157 return 0; | |
158 return *(int *)str; | |
159 } | |
160 #endif | |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
161 } |
8123
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
7905
diff
changeset
|
162 |
7408 | 163 static int open_tv(tvi_handle_t *tvh) |
2931 | 164 { |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
165 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
|
166 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
|
167 int tv_fmt_list[] = { |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
168 IMGFMT_YV12, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
169 IMGFMT_I420, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
170 IMGFMT_UYVY, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
171 IMGFMT_YUY2, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
172 IMGFMT_RGB32, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
173 IMGFMT_RGB24, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
174 IMGFMT_RGB16, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
175 IMGFMT_RGB15 |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
176 }; |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
177 |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
178 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
|
179 { |
10771 | 180 mp_msg(MSGT_TV, MSGL_ERR, "Error: No video input present!\n"); |
3728 | 181 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
|
182 } |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
183 |
17862
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
184 if (tv_param_outfmt == -1) |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
185 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
|
186 { |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
187 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
|
188 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
|
189 &tv_param_outfmt) == TVI_CONTROL_TRUE) |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
190 break; |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
191 } |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
192 else |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
193 { |
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
|
194 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
|
195 { |
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
|
196 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
|
197 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
|
198 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
|
199 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
|
200 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
|
201 case IMGFMT_RGB24: |
15419 | 202 case IMGFMT_BGR32: |
203 case IMGFMT_BGR24: | |
204 case IMGFMT_BGR16: | |
205 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
|
206 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
|
207 default: |
10771 | 208 mp_msg(MSGT_TV, MSGL_ERR, "==================================================================\n"); |
209 mp_msg(MSGT_TV, MSGL_ERR, " WARNING: UNTESTED OR UNKNOWN OUTPUT IMAGE FORMAT REQUESTED (0x%x)\n", tv_param_outfmt); | |
210 mp_msg(MSGT_TV, MSGL_ERR, " This may cause buggy playback or program crash! Bug reports will\n"); | |
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
|
211 mp_msg(MSGT_TV, MSGL_ERR, " be ignored! You should try again with YV12 (which is the default\n"); |
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
|
212 mp_msg(MSGT_TV, MSGL_ERR, " colorspace) and read the documentation!\n"); |
10771 | 213 mp_msg(MSGT_TV, MSGL_ERR, "==================================================================\n"); |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
214 } |
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
|
215 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
|
216 } |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
217 |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
218 /* set some params got from cmdline */ |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
219 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
|
220 |
10537 | 221 #ifdef HAVE_TV_V4L2 |
13978 | 222 if (!strcmp(tv_param_driver, "v4l2") && tv_param_normid >= 0) { |
223 mp_msg(MSGT_TV, MSGL_V, "Selected norm id: %d\n", tv_param_normid); | |
224 if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tv_param_normid) != TVI_CONTROL_TRUE) { | |
225 mp_msg(MSGT_TV, MSGL_ERR, "Error: Cannot set norm!\n"); | |
226 } | |
227 } else { | |
10537 | 228 #endif |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
229 /* select video norm */ |
13978 | 230 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
|
231 |
7318
85897ab199a4
changed message leveles (too many non-sense info messages)
alex
parents:
7163
diff
changeset
|
232 mp_msg(MSGT_TV, MSGL_V, "Selected norm: %s\n", tv_param_norm); |
8486
c268bbb804d9
handle bogus norm parameter; check for errors when setting norm
henry
parents:
8477
diff
changeset
|
233 if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) { |
10771 | 234 mp_msg(MSGT_TV, MSGL_ERR, "Error: Cannot set norm!\n"); |
8486
c268bbb804d9
handle bogus norm parameter; check for errors when setting norm
henry
parents:
8477
diff
changeset
|
235 } |
10537 | 236 #ifdef HAVE_TV_V4L2 |
237 } | |
238 #endif | |
9620
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
239 |
19187 | 240 #ifdef HAVE_TV_V4L1 |
9620
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
241 if ( tv_param_mjpeg ) |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
242 { |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
243 /* set width to expected value */ |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
244 if (tv_param_width == -1) |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
245 { |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
246 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
|
247 } |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
248 if (tv_param_height == -1) |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
249 { |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
250 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
|
251 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
|
252 else |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
253 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
|
254 } |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
255 mp_msg(MSGT_TV, MSGL_INFO, |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
256 " MJP: width %d height %d\n", tv_param_width, tv_param_height); |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
257 } |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
258 #endif |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
259 |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
260 /* 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
|
261 /* 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
|
262 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
|
263 { |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
264 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
|
265 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
|
266 else |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
267 { |
10771 | 268 mp_msg(MSGT_TV, MSGL_ERR, "Unable to set requested width: %d\n", 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
|
269 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
|
270 } |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
271 } |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
272 |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
273 /* 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
|
274 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
|
275 { |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
276 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
|
277 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
|
278 else |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
279 { |
10771 | 280 mp_msg(MSGT_TV, MSGL_ERR, "Unable to set requested height: %d\n", 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
|
281 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
|
282 } |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
283 } |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
284 |
3284 | 285 if (funcs->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) != TVI_CONTROL_TRUE) |
286 { | |
287 mp_msg(MSGT_TV, MSGL_WARN, "Selected input hasn't got a tuner!\n"); | |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
288 goto done; |
3284 | 289 } |
290 | |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
291 /* select channel list */ |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
292 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
|
293 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
294 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
|
295 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
296 tvh->chanlist = i; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
297 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
|
298 break; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
299 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
300 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
301 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
302 if (tvh->chanlist == -1) |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
303 mp_msg(MSGT_TV, MSGL_WARN, "Unable to find selected channel list! (%s)\n", |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
304 tv_param_chanlist); |
3284 | 305 else |
7318
85897ab199a4
changed message leveles (too many non-sense info messages)
alex
parents:
7163
diff
changeset
|
306 mp_msg(MSGT_TV, MSGL_V, "Selected channel list: %s (including %d channels)\n", |
3284 | 307 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
|
308 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
309 if (tv_param_freq && tv_param_channel) |
3284 | 310 { |
10771 | 311 mp_msg(MSGT_TV, MSGL_WARN, "You can't set frequency and channel simultaneously!\n"); |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
312 goto done; |
3284 | 313 } |
314 | |
10771 | 315 /* Handle channel names */ |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
316 if (tv_param_channels) { |
9519 | 317 char** channels = tv_param_channels; |
10771 | 318 mp_msg(MSGT_TV, MSGL_INFO, "TV channel names detected.\n"); |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
319 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
|
320 tv_channel_list->index=1; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
321 tv_channel_list->next=NULL; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
322 tv_channel_list->prev=NULL; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
323 tv_channel_current = tv_channel_list; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
324 |
9519 | 325 while (*channels) { |
326 char* tmp = *(channels++); | |
8955
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
327 char* sep = strchr(tmp,'-'); |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
328 int i; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
329 struct CHANLIST cl; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
330 |
8955
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
331 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
|
332 |
18761 | 333 strlcpy(tv_channel_current->name, sep + 1, |
334 sizeof(tv_channel_current->name)); | |
8955
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
335 sep[0] = '\0'; |
8820 | 336 strncpy(tv_channel_current->number, tmp, 5); |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
337 |
8955
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
338 while ((sep=strchr(tv_channel_current->name, '_'))) |
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
339 sep[0] = ' '; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
340 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
341 tv_channel_current->freq = 0; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
342 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
|
343 cl = tvh->chanlist_s[i]; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
344 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
|
345 tv_channel_current->freq=cl.freq; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
346 break; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
347 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
348 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
349 if (tv_channel_current->freq == 0) |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
350 mp_msg(MSGT_TV, MSGL_ERR, "Couldn't find frequency for channel %s (%s)\n", |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
351 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
|
352 else { |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
353 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
|
354 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
|
355 |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
356 if ( sep ) { |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
357 i = atoi (sep+1); |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
358 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
|
359 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
|
360 sep[0] = '\0'; |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
361 } |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
362 } |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
363 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
364 /*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
|
365 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
|
366 (float)tv_channel_current->freq/1000);*/ |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
367 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
368 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
|
369 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
|
370 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
|
371 tv_channel_current->next->next = NULL; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
372 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
|
373 } |
8955
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
374 if (tv_channel_current->prev) |
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
375 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
|
376 free(tv_channel_current); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
377 } else |
18366 | 378 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
|
379 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
380 if (tv_channel_list) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
381 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
|
382 int channel = 0; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
383 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
|
384 { |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
385 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
|
386 /* 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
|
387 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
|
388 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
|
389 { |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
390 /* 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
|
391 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
|
392 |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
393 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
|
394 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
|
395 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
|
396 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
|
397 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
|
398 } |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
399 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
|
400 } |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
401 } |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
402 else |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
403 channel = 1; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
404 |
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
|
405 if ( channel ) { |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
406 tv_channel_current = tv_channel_list; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
407 for (i = 1; i < channel; i++) |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
408 if (tv_channel_current->next) |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
409 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
|
410 } |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
411 |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
412 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n", tv_channel_current->number, |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
413 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
|
414 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
|
415 tv_channel_last = tv_channel_current; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
416 } else { |
3284 | 417 /* we need to set frequency */ |
418 if (tv_param_freq) | |
419 { | |
420 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
|
421 |
3284 | 422 /* set freq in MHz */ |
423 funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_FREQ, &freq); | |
424 | |
425 funcs->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &freq); | |
7318
85897ab199a4
changed message leveles (too many non-sense info messages)
alex
parents:
7163
diff
changeset
|
426 mp_msg(MSGT_TV, MSGL_V, "Selected frequency: %lu (%.3f)\n", |
3284 | 427 freq, (float)freq/16); |
428 } | |
429 | |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
430 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
|
431 struct CHANLIST cl; |
3284 | 432 |
433 mp_msg(MSGT_TV, MSGL_V, "Requested channel: %s\n", 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
|
434 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
|
435 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
436 cl = tvh->chanlist_s[i]; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
437 // 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
|
438 // 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
|
439 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
|
440 { |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
441 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
|
442 tvh->channel = i; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
443 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n", |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
444 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
|
445 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
|
446 break; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
447 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
448 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
449 } |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
450 } |
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
|
451 |
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
|
452 /* 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
|
453 { |
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
|
454 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
|
455 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
|
456 |
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
|
457 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
|
458 |
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
|
459 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
|
460 |
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
|
461 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
|
462 { |
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
|
463 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
|
464 { |
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
|
465 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
|
466 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
|
467 } |
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
|
468 } |
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
|
469 } |
3284 | 470 |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
471 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
|
472 /* also start device! */ |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
473 return 1; |
2931 | 474 } |
475 | |
16175 | 476 static demuxer_t* demux_open_tv(demuxer_t *demuxer) |
2790 | 477 { |
7408 | 478 tvi_handle_t *tvh; |
479 sh_video_t *sh_video; | |
2802 | 480 sh_audio_t *sh_audio = NULL; |
7408 | 481 tvi_functions_t *funcs; |
482 | |
16175 | 483 if(!(tvh=tv_begin())) return NULL; |
484 if (!tv_init(tvh)) return NULL; | |
7408 | 485 if (!open_tv(tvh)){ |
486 tv_uninit(tvh); | |
16175 | 487 return NULL; |
7408 | 488 } |
489 funcs = tvh->functions; | |
490 demuxer->priv=tvh; | |
2790 | 491 |
2802 | 492 sh_video = new_sh_video(demuxer, 0); |
2790 | 493 |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
494 /* get IMAGE FORMAT */ |
2802 | 495 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_FORMAT, &sh_video->format); |
2810 | 496 // if (IMGFMT_IS_RGB(sh_video->format) || IMGFMT_IS_BGR(sh_video->format)) |
3398 | 497 // sh_video->format = 0x0; |
2802 | 498 |
499 /* set FPS and FRAMETIME */ | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
500 |
2790 | 501 if(!sh_video->fps) |
502 { | |
10019 | 503 float tmp; |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
504 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
|
505 sh_video->fps = 25.0f; /* on PAL */ |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
506 else sh_video->fps = tmp; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
507 } |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
508 |
3285 | 509 if (tv_param_fps != -1.0f) |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
510 sh_video->fps = tv_param_fps; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
511 |
2790 | 512 sh_video->frametime = 1.0f/sh_video->fps; |
513 | |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
514 /* 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
|
515 if(tv_param_immediate == 1) |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
516 { |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
517 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
|
518 tv_param_noaudio = 1; |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
519 } |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
520 |
8799 | 521 /* disable TV audio if -nosound is present */ |
522 if (!demuxer->audio || demuxer->audio->id == -2) { | |
523 tv_param_noaudio = 1; | |
524 } | |
525 | |
2790 | 526 /* 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
|
527 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_WIDTH, &sh_video->disp_w); |
2790 | 528 |
529 /* 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
|
530 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HEIGHT, &sh_video->disp_h); |
2802 | 531 |
2790 | 532 demuxer->video->sh = sh_video; |
533 sh_video->ds = demuxer->video; | |
534 demuxer->video->id = 0; | |
9501 | 535 demuxer->seekable = 0; |
2790 | 536 |
537 /* here comes audio init */ | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
538 if (tv_param_noaudio == 0 && funcs->control(tvh->priv, TVI_CONTROL_IS_AUDIO, 0) == TVI_CONTROL_TRUE) |
2802 | 539 { |
540 int audio_format; | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
541 int sh_audio_format; |
14245 | 542 char buf[128]; |
2802 | 543 |
544 /* yeah, audio is present */ | |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
545 |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
546 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
|
547 &tv_param_audiorate); |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
548 |
2802 | 549 if (funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_FORMAT, &audio_format) != TVI_CONTROL_TRUE) |
550 goto no_audio; | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
551 |
2802 | 552 switch(audio_format) |
553 { | |
14245 | 554 case AF_FORMAT_U8: |
555 case AF_FORMAT_S8: | |
556 case AF_FORMAT_U16_LE: | |
557 case AF_FORMAT_U16_BE: | |
558 case AF_FORMAT_S16_LE: | |
559 case AF_FORMAT_S16_BE: | |
560 case AF_FORMAT_S32_LE: | |
561 case AF_FORMAT_S32_BE: | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
562 sh_audio_format = 0x1; /* PCM */ |
2802 | 563 break; |
14245 | 564 case AF_FORMAT_IMA_ADPCM: |
565 case AF_FORMAT_MU_LAW: | |
566 case AF_FORMAT_A_LAW: | |
567 case AF_FORMAT_MPEG2: | |
568 case AF_FORMAT_AC3: | |
2802 | 569 default: |
6161
c50ea0721e78
applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents:
5923
diff
changeset
|
570 mp_msg(MSGT_TV, MSGL_ERR, "Audio type '%s (%x)' unsupported!\n", |
14255
137896e25c24
100l, buf etc. in af_fmt2str call are already pointers...
reimar
parents:
14245
diff
changeset
|
571 af_fmt2str(audio_format, buf, 128), audio_format); |
2802 | 572 goto no_audio; |
573 } | |
574 | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
575 sh_audio = new_sh_audio(demuxer, 0); |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
576 |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
577 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
|
578 &sh_audio->samplerate); |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
579 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
|
580 &sh_audio->samplesize); |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
581 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
|
582 &sh_audio->channels); |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
583 |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
584 sh_audio->format = sh_audio_format; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
585 sh_audio->sample_format = audio_format; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
586 |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
587 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
|
588 sh_audio->samplerate * sh_audio->samplesize * |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
589 sh_audio->channels; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
590 |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
591 // emulate WF for win32 codecs: |
19062
83c3afeab35d
drops casts from void * on malloc/calloc from libmpdemux code
reynaldo
parents:
18922
diff
changeset
|
592 sh_audio->wf = malloc(sizeof(WAVEFORMATEX)); |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
593 sh_audio->wf->wFormatTag = sh_audio->format; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
594 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
|
595 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
|
596 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
|
597 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
|
598 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
|
599 |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
600 mp_msg(MSGT_DECVIDEO, MSGL_V, " TV audio: %d channels, %d bits, %d Hz\n", |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
601 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
|
602 sh_audio->wf->nSamplesPerSec); |
2802 | 603 |
604 demuxer->audio->sh = sh_audio; | |
605 sh_audio->ds = demuxer->audio; | |
606 demuxer->audio->id = 0; | |
607 } | |
608 no_audio: | |
609 | |
7329
9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents:
7318
diff
changeset
|
610 if(!(funcs->start(tvh->priv))){ |
9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents:
7318
diff
changeset
|
611 // start failed :( |
9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents:
7318
diff
changeset
|
612 tv_uninit(tvh); |
16175 | 613 return NULL; |
7329
9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents:
7318
diff
changeset
|
614 } |
10581
4ebff25d9a05
From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents:
10537
diff
changeset
|
615 |
4ebff25d9a05
From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents:
10537
diff
changeset
|
616 /* set color eq */ |
4ebff25d9a05
From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents:
10537
diff
changeset
|
617 tv_set_color_options(tvh, TV_COLOR_BRIGHTNESS, tv_param_brightness); |
4ebff25d9a05
From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents:
10537
diff
changeset
|
618 tv_set_color_options(tvh, TV_COLOR_HUE, tv_param_hue); |
4ebff25d9a05
From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents:
10537
diff
changeset
|
619 tv_set_color_options(tvh, TV_COLOR_SATURATION, tv_param_saturation); |
4ebff25d9a05
From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents:
10537
diff
changeset
|
620 tv_set_color_options(tvh, TV_COLOR_CONTRAST, tv_param_contrast); |
4ebff25d9a05
From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents:
10537
diff
changeset
|
621 |
16175 | 622 return demuxer; |
2790 | 623 } |
624 | |
17174
83a8c738be89
make demuxer seek and close functions return void, patch by Dominik Mierzejewski
wanderer
parents:
17012
diff
changeset
|
625 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
|
626 { |
7408 | 627 tvi_handle_t *tvh=(tvi_handle_t*)(demuxer->priv); |
17174
83a8c738be89
make demuxer seek and close functions return void, patch by Dominik Mierzejewski
wanderer
parents:
17012
diff
changeset
|
628 tvh->functions->uninit(tvh->priv); |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
629 } |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
630 |
2790 | 631 /* ================== STREAM_TV ===================== */ |
6161
c50ea0721e78
applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents:
5923
diff
changeset
|
632 tvi_handle_t *tvi_init_dummy(char *device); |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
633 tvi_handle_t *tvi_init_v4l(char *device, char *adevice); |
10537 | 634 tvi_handle_t *tvi_init_v4l2(char *device, char *adevice); |
6161
c50ea0721e78
applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents:
5923
diff
changeset
|
635 tvi_handle_t *tvi_init_bsdbt848(char *device); |
c50ea0721e78
applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents:
5923
diff
changeset
|
636 |
2802 | 637 tvi_handle_t *tv_begin(void) |
2790 | 638 { |
639 if (!strcmp(tv_param_driver, "dummy")) | |
6161
c50ea0721e78
applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents:
5923
diff
changeset
|
640 return tvi_init_dummy(tv_param_device); |
19187 | 641 #ifdef HAVE_TV_V4L1 |
2790 | 642 if (!strcmp(tv_param_driver, "v4l")) |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
643 return tvi_init_v4l(tv_param_device, tv_param_adevice); |
3249 | 644 #endif |
10537 | 645 #ifdef HAVE_TV_V4L2 |
646 if (!strcmp(tv_param_driver, "v4l2")) | |
647 return tvi_init_v4l2(tv_param_device, tv_param_adevice); | |
648 #endif | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
649 #ifdef HAVE_TV_BSDBT848 |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
650 if (!strcmp(tv_param_driver, "bsdbt848")) |
6161
c50ea0721e78
applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents:
5923
diff
changeset
|
651 return tvi_init_bsdbt848(tv_param_device); |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
652 #endif |
2790 | 653 |
654 mp_msg(MSGT_TV, MSGL_ERR, "No such driver: %s\n", tv_param_driver); | |
655 return(NULL); | |
656 } | |
657 | |
2802 | 658 int tv_init(tvi_handle_t *tvh) |
2790 | 659 { |
2818 | 660 mp_msg(MSGT_TV, MSGL_INFO, "Selected driver: %s\n", tvh->info->short_name); |
661 mp_msg(MSGT_TV, MSGL_INFO, " name: %s\n", tvh->info->name); | |
662 mp_msg(MSGT_TV, MSGL_INFO, " author: %s\n", tvh->info->author); | |
2802 | 663 if (tvh->info->comment) |
2818 | 664 mp_msg(MSGT_TV, MSGL_INFO, " comment: %s\n", tvh->info->comment); |
2790 | 665 |
3815 | 666 return(tvh->functions->init(tvh->priv)); |
2837 | 667 } |
668 | |
669 int tv_uninit(tvi_handle_t *tvh) | |
670 { | |
671 return(tvh->functions->uninit(tvh->priv)); | |
2790 | 672 } |
2937 | 673 |
674 /* utilities for mplayer (not mencoder!!) */ | |
675 int tv_set_color_options(tvi_handle_t *tvh, int opt, int value) | |
676 { | |
677 tvi_functions_t *funcs = tvh->functions; | |
678 | |
679 switch(opt) | |
680 { | |
681 case TV_COLOR_BRIGHTNESS: | |
18172
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
682 return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_BRIGHTNESS, &value); |
2937 | 683 case TV_COLOR_HUE: |
18172
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
684 return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_HUE, &value); |
2937 | 685 case TV_COLOR_SATURATION: |
18172
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
686 return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_SATURATION, &value); |
2937 | 687 case TV_COLOR_CONTRAST: |
18172
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
688 return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_CONTRAST, &value); |
2937 | 689 default: |
690 mp_msg(MSGT_TV, MSGL_WARN, "Unknown color option (%d) specified!\n", opt); | |
691 } | |
692 | |
18172
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
693 return(TVI_CONTROL_UNKNOWN); |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
694 } |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
695 |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
696 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
|
697 { |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
698 tvi_functions_t *funcs = tvh->functions; |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
699 |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
700 switch(opt) |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
701 { |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
702 case TV_COLOR_BRIGHTNESS: |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
703 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
|
704 case TV_COLOR_HUE: |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
705 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
|
706 case TV_COLOR_SATURATION: |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
707 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
|
708 case TV_COLOR_CONTRAST: |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
709 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
|
710 default: |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
711 mp_msg(MSGT_TV, MSGL_WARN, "Unknown color option (%d) specified!\n", opt); |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
712 } |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
713 |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
714 return(TVI_CONTROL_UNKNOWN); |
2937 | 715 } |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
716 |
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
|
717 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
|
718 { |
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
|
719 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
|
720 { |
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
|
721 tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_GET_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
|
722 mp_msg(MSGT_TV, MSGL_V, "Current frequency: %lu (%.3f)\n", |
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
|
723 *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
|
724 } |
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
|
725 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
|
726 } |
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
|
727 |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
728 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
|
729 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
730 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
|
731 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
732 // 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
|
733 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
734 /* 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
|
735 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
|
736 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
737 tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &freq); |
7318
85897ab199a4
changed message leveles (too many non-sense info messages)
alex
parents:
7163
diff
changeset
|
738 mp_msg(MSGT_TV, MSGL_V, "Current frequency: %lu (%.3f)\n", |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
739 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
|
740 } |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7408
diff
changeset
|
741 return(1); |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
742 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
743 |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
744 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
|
745 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
746 struct CHANLIST cl; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
747 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
748 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
|
749 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
750 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
|
751 { |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
752 strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name); |
5923 | 753 cl = tvh->chanlist_s[--tvh->channel]; |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
754 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n", |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
755 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
|
756 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
|
757 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
758 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
759 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
760 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
|
761 { |
4242 | 762 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
|
763 { |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
764 strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name); |
5923 | 765 cl = tvh->chanlist_s[++tvh->channel]; |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
766 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n", |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
767 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
|
768 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
|
769 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
770 } |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7408
diff
changeset
|
771 return(1); |
2941
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 |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
774 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
|
775 if (tv_channel_list) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
776 if (direction == TV_CHANNEL_HIGHER) { |
16469
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
777 tv_channel_last = tv_channel_current; |
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
778 if (tv_channel_current->next) |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
779 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
|
780 else |
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
781 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
|
782 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
|
783 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n", |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
784 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
|
785 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
786 if (direction == TV_CHANNEL_LOWER) { |
16469
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
787 tv_channel_last = tv_channel_current; |
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
788 if (tv_channel_current->prev) |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
789 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
|
790 else |
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
791 while (tv_channel_current->next) |
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
792 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
|
793 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
|
794 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n", |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
795 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
|
796 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
797 } 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
|
798 return(1); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
799 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
800 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
801 int tv_set_channel_real(tvi_handle_t *tvh, char *channel) { |
8494 | 802 int i; |
803 struct CHANLIST cl; | |
804 | |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
805 strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name); |
8494 | 806 for (i = 0; i < chanlists[tvh->chanlist].count; i++) |
807 { | |
808 cl = tvh->chanlist_s[i]; | |
809 // printf("count%d: name: %s, freq: %d\n", | |
810 // i, cl.name, cl.freq); | |
811 if (!strcasecmp(cl.name, channel)) | |
812 { | |
813 tvh->channel = i; | |
814 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n", | |
815 cl.name, (float)cl.freq/1000); | |
816 tv_set_freq(tvh, (unsigned long)(((float)cl.freq/1000)*16)); | |
817 break; | |
818 } | |
819 } | |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
820 return(1); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
821 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
822 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
823 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
|
824 int i, channel_int; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
825 |
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 tv_channel_last = tv_channel_current; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
828 channel_int = atoi(channel); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
829 tv_channel_current = tv_channel_list; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
830 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
|
831 if (tv_channel_current->next) |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
832 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
|
833 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n", tv_channel_current->number, |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
834 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
|
835 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
|
836 } 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
|
837 return(1); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
838 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
839 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
840 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
|
841 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
842 if (tv_channel_list) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
843 tv_channels_t *tmp; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
844 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
845 tmp = tv_channel_last; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
846 tv_channel_last = tv_channel_current; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
847 tv_channel_current = tmp; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
848 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
849 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n", tv_channel_current->number, |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
850 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
|
851 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
|
852 } else { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
853 int i; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
854 struct CHANLIST cl; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
855 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
856 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
|
857 { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
858 cl = tvh->chanlist_s[i]; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
859 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
|
860 { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
861 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
|
862 tvh->channel = i; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
863 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n", |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
864 cl.name, (float)cl.freq/1000); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
865 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
|
866 break; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
867 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
868 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
869 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
870 return(1); |
8494 | 871 } |
872 | |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
873 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
|
874 { |
16961
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
875 tvh->norm++; |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
876 if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
877 &tvh->norm) != TVI_CONTROL_TRUE) { |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
878 tvh->norm = 0; |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
879 if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
880 &tvh->norm) != TVI_CONTROL_TRUE) { |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
881 mp_msg(MSGT_TV, MSGL_ERR, "Error: Cannot set norm!\n"); |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
882 return 0; |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
883 } |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
884 } |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7408
diff
changeset
|
885 return(1); |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
886 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
887 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
888 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
|
889 { |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7408
diff
changeset
|
890 return(1); |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
891 } |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
892 |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
893 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
|
894 { |
13978 | 895 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
|
896 |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
897 mp_msg(MSGT_TV, MSGL_V, "Selected norm: %s\n", tv_param_norm); |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
898 if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) { |
10771 | 899 mp_msg(MSGT_TV, MSGL_ERR, "Error: Cannot set norm!\n"); |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
900 return 0; |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
901 } |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
902 return(1); |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
903 } |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
904 |
16175 | 905 demuxer_desc_t demuxer_desc_tv = { |
906 "Tv card demuxer", | |
907 "tv", | |
908 "TV", | |
909 "Alex Beregszaszi, Charles R. Henrich", | |
910 "?", | |
911 DEMUXER_TYPE_TV, | |
912 0, // no autodetect | |
913 NULL, | |
914 demux_tv_fill_buffer, | |
915 demux_open_tv, | |
916 demux_close_tv, | |
917 NULL, | |
918 NULL | |
919 }; |