Mercurial > mplayer.hg
annotate stream/tv.c @ 36564:d22374047528
Improve the dialog for subtitle encodings with iconv.
Disable the check buttons for options 'sub_utf8' and 'sub_unicode'
in case option 'sub_cp' is active.
author | ib |
---|---|
date | Mon, 20 Jan 2014 17:09:47 +0000 |
parents | 389d43c448b3 |
children |
rev | line source |
---|---|
2790 | 1 /* |
30426
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
2 * TV Interface for MPlayer |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
3 * |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
4 * API idea based on libvo2 |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
5 * |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
6 * Copyright (C) 2001 Alex Beregszaszi |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
7 * |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
8 * Feb 19, 2002: Significant rewrites by Charles R. Henrich (henrich@msu.edu) |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
9 * to add support for audio, and bktr *BSD support. |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
10 * |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
11 * This file is part of MPlayer. |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
12 * |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
13 * MPlayer is free software; you can redistribute it and/or modify |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
14 * it under the terms of the GNU General Public License as published by |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
15 * the Free Software Foundation; either version 2 of the License, or |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
16 * (at your option) any later version. |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
17 * |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
18 * MPlayer is distributed in the hope that it will be useful, |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
21 * GNU General Public License for more details. |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
22 * |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
23 * You should have received a copy of the GNU General Public License along |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
24 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
30241
diff
changeset
|
26 */ |
2790 | 27 |
28 #include <stdio.h> | |
29 #include <stdlib.h> | |
30 #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
|
31 #include <string.h> |
35903 | 32 #include <strings.h> |
10242 | 33 #include <ctype.h> |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
34 #include <sys/time.h> |
2790 | 35 |
36 #include "config.h" | |
37 | |
2819
2e58962dc9fe
cleaned up some warnings, and tv_param_on moved out from #ifdef USE_TV
alex
parents:
2818
diff
changeset
|
38 |
2790 | 39 #include "mp_msg.h" |
40 #include "help_mp.h" | |
41 | |
42 #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
|
43 #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
|
44 #include "libmpdemux/stheader.h" |
2830 | 45 |
17012 | 46 #include "libaf/af_format.h" |
19431
ac69ba536915
Explicitly include libmpcodecs/img_format.h and libvo/fastmemcpy.h.
diego
parents:
19312
diff
changeset
|
47 #include "libmpcodecs/img_format.h" |
29759
d287e2785570
Move teletext specific code from stream into libmpcodecs.
cehoyos
parents:
29717
diff
changeset
|
48 #include "libmpcodecs/dec_teletext.h" |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
23573
diff
changeset
|
49 #include "libavutil/avstring.h" |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
50 #include "osdep/timer.h" |
2830 | 51 |
2802 | 52 #include "tv.h" |
2790 | 53 |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
54 #include "frequencies.h" |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
55 |
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
|
56 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
|
57 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
|
58 char *tv_channel_last_real; |
2790 | 59 |
22381
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
60 /* enumerating drivers (like in stream.c) */ |
25689 | 61 extern const tvi_info_t tvi_info_dummy; |
62 extern const tvi_info_t tvi_info_dshow; | |
63 extern const tvi_info_t tvi_info_v4l; | |
64 extern const tvi_info_t tvi_info_v4l2; | |
65 extern const tvi_info_t tvi_info_bsdbt848; | |
22381
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
66 |
24403 | 67 /** List of drivers in autodetection order */ |
22381
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
68 static const tvi_info_t* tvi_driver_list[]={ |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27067
diff
changeset
|
69 #ifdef CONFIG_TV_V4L2 |
24403 | 70 &tvi_info_v4l2, |
71 #endif | |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27067
diff
changeset
|
72 #ifdef CONFIG_TV_V4L1 |
22381
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
73 &tvi_info_v4l, |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
74 #endif |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27067
diff
changeset
|
75 #ifdef CONFIG_TV_BSDBT848 |
22381
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
76 &tvi_info_bsdbt848, |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
77 #endif |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27067
diff
changeset
|
78 #ifdef CONFIG_TV_DSHOW |
24744 | 79 &tvi_info_dshow, |
80 #endif | |
24403 | 81 &tvi_info_dummy, |
22381
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
82 NULL |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
83 }; |
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
84 |
32141
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
85 tvi_handle_t *tv_new_handle(int size, const tvi_functions_t *functions) |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
86 { |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
87 tvi_handle_t *h = malloc(sizeof(*h)); |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
88 |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
89 if (!h) |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
90 return NULL; |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
91 |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
92 h->priv = calloc(1, size); |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
93 |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
94 if (!h->priv) { |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
95 free(h); |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
96 return NULL; |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
97 } |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
98 |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
99 h->functions = functions; |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
100 h->seq = 0; |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
101 h->chanlist = -1; |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
102 h->chanlist_s = NULL; |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
103 h->norm = -1; |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
104 h->channel = -1; |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
105 h->scan = NULL; |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
106 |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
107 return h; |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
108 } |
2802b8095bf7
Move TV input new_handle static function to tv.c and make it non-static.
diego
parents:
32105
diff
changeset
|
109 |
32090
535ebcd085e4
Move TV input free_handle static function to tv.c and make it non-static.
diego
parents:
31611
diff
changeset
|
110 void tv_free_handle(tvi_handle_t *h) |
535ebcd085e4
Move TV input free_handle static function to tv.c and make it non-static.
diego
parents:
31611
diff
changeset
|
111 { |
32511
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
32141
diff
changeset
|
112 if (!h) |
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
32141
diff
changeset
|
113 return; |
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
32141
diff
changeset
|
114 free(h->priv); |
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
32141
diff
changeset
|
115 free(h->scan); |
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
32141
diff
changeset
|
116 free(h); |
32090
535ebcd085e4
Move TV input free_handle static function to tv.c and make it non-static.
diego
parents:
31611
diff
changeset
|
117 } |
535ebcd085e4
Move TV input free_handle static function to tv.c and make it non-static.
diego
parents:
31611
diff
changeset
|
118 |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
119 void tv_start_scan(tvi_handle_t *tvh, int start) |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
120 { |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
121 mp_msg(MSGT_TV,MSGL_INFO,"start scan\n"); |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
122 tvh->tv_param->scan=start?1:0; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
123 } |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
124 |
35269 | 125 static int tv_set_freq_float(tvi_handle_t *tvh, float freq) |
126 { | |
127 return tv_set_freq(tvh, freq/1000.0*16); | |
128 } | |
129 | |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
130 static void tv_scan(tvi_handle_t *tvh) |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
131 { |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
132 unsigned int now; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
133 struct CHANLIST cl; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
134 tv_channels_t *tv_channel_tmp=NULL; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
135 tv_channels_t *tv_channel_add=NULL; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
136 tv_scan_t* scan; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
137 int found=0, index=1; |
24748 | 138 |
24762
1ed81edfac75
Disable channel scanner when no tuner is present.
voroshil
parents:
24754
diff
changeset
|
139 //Channel scanner without tuner is useless and causes crash due to uninitialized chanlist_s |
1ed81edfac75
Disable channel scanner when no tuner is present.
voroshil
parents:
24754
diff
changeset
|
140 if (tvh->functions->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) != TVI_CONTROL_TRUE) |
1ed81edfac75
Disable channel scanner when no tuner is present.
voroshil
parents:
24754
diff
changeset
|
141 { |
1ed81edfac75
Disable channel scanner when no tuner is present.
voroshil
parents:
24754
diff
changeset
|
142 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_ScannerNotAvailableWithoutTuner); |
1ed81edfac75
Disable channel scanner when no tuner is present.
voroshil
parents:
24754
diff
changeset
|
143 tvh->tv_param->scan=0; |
1ed81edfac75
Disable channel scanner when no tuner is present.
voroshil
parents:
24754
diff
changeset
|
144 return; |
1ed81edfac75
Disable channel scanner when no tuner is present.
voroshil
parents:
24754
diff
changeset
|
145 } |
1ed81edfac75
Disable channel scanner when no tuner is present.
voroshil
parents:
24754
diff
changeset
|
146 |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
147 scan = tvh->scan; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
148 now=GetTimer(); |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
149 if (!scan) { |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
150 scan=calloc(1,sizeof(tv_scan_t)); |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
151 tvh->scan=scan; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
152 cl = tvh->chanlist_s[scan->channel_num]; |
35269 | 153 tv_set_freq_float(tvh, cl.freq); |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
154 scan->scan_timer=now+1e6*tvh->tv_param->scan_period; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
155 } |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
156 if(scan->scan_timer>now) |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
157 return; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
158 |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
159 if (tv_get_signal(tvh)>tvh->tv_param->scan_threshold) { |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
160 cl = tvh->chanlist_s[scan->channel_num]; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
161 tv_channel_tmp=tv_channel_list; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
162 while (tv_channel_tmp) { |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
163 index++; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
164 if (cl.freq==tv_channel_tmp->freq){ |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
165 found=1; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
166 break; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
167 } |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
168 tv_channel_add=tv_channel_tmp; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
169 tv_channel_tmp=tv_channel_tmp->next; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
170 } |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
171 if (!found) { |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
172 mp_msg(MSGT_TV, MSGL_INFO, "Found new channel: %s (#%d). \n",cl.name,index); |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
173 scan->new_channels++; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
174 tv_channel_tmp = malloc(sizeof(tv_channels_t)); |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
175 tv_channel_tmp->index=index; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
176 tv_channel_tmp->next=NULL; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
177 tv_channel_tmp->prev=tv_channel_add; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
178 tv_channel_tmp->freq=cl.freq; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
179 snprintf(tv_channel_tmp->name,sizeof(tv_channel_tmp->name),"ch%d",index); |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
180 strncpy(tv_channel_tmp->number, cl.name, 5); |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
181 tv_channel_tmp->number[4]='\0'; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
182 if (!tv_channel_list) |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
183 tv_channel_list=tv_channel_tmp; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
184 else { |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
185 tv_channel_add->next=tv_channel_tmp; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
186 tv_channel_list->prev=tv_channel_tmp; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
187 } |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
188 }else |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
189 mp_msg(MSGT_TV, MSGL_INFO, "Found existing channel: %s-%s.\n", |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
190 tv_channel_tmp->number,tv_channel_tmp->name); |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
191 } |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
192 scan->channel_num++; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
193 scan->scan_timer=now+1e6*tvh->tv_param->scan_period; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
194 if (scan->channel_num>=chanlists[tvh->chanlist].count) { |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
195 tvh->tv_param->scan=0; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
196 mp_msg(MSGT_TV, MSGL_INFO, "TV scan end. Found %d new channels.\n", scan->new_channels); |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
197 tv_channel_tmp=tv_channel_list; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
198 if(tv_channel_tmp){ |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
199 mp_msg(MSGT_TV,MSGL_INFO,"channels="); |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
200 while(tv_channel_tmp){ |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
201 mp_msg(MSGT_TV,MSGL_INFO,"%s-%s",tv_channel_tmp->number,tv_channel_tmp->name); |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
202 if(tv_channel_tmp->next) |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
203 mp_msg(MSGT_TV,MSGL_INFO,","); |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
204 tv_channel_tmp=tv_channel_tmp->next; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
205 } |
25138 | 206 mp_msg(MSGT_TV, MSGL_INFO, "\n"); |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
207 } |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
208 if (!tv_channel_current) tv_channel_current=tv_channel_list; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
209 if (tv_channel_current) |
35269 | 210 tv_set_freq_float(tvh, tv_channel_current->freq); |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
211 free(tvh->scan); |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
212 tvh->scan=NULL; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
213 }else{ |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
214 cl = tvh->chanlist_s[scan->channel_num]; |
35269 | 215 tv_set_freq_float(tvh, cl.freq); |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
216 mp_msg(MSGT_TV, MSGL_INFO, "Trying: %s (%.2f). \n",cl.name,1e-3*cl.freq); |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
217 } |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
218 } |
22381
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
219 |
2790 | 220 /* ================== DEMUX_TV ===================== */ |
221 /* | |
222 Return value: | |
223 0 = EOF(?) or no stream | |
224 1 = successfully read a packet | |
225 */ | |
226 /* fill demux->video and demux->audio */ | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
227 |
16175 | 228 static int demux_tv_fill_buffer(demuxer_t *demux, demux_stream_t *ds) |
2790 | 229 { |
7408 | 230 tvi_handle_t *tvh=(tvi_handle_t*)(demux->priv); |
2813 | 231 demux_packet_t* dp; |
9927 | 232 unsigned int len=0; |
22969
c8ace3e97d73
cosmetics. restore empty line removed in r22985.
voroshil
parents:
22967
diff
changeset
|
233 |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
234 /* ================== ADD AUDIO PACKET =================== */ |
2790 | 235 |
24748 | 236 if (ds==demux->audio && tvh->tv_param->noaudio == 0 && |
237 tvh->functions->control(tvh->priv, | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
238 TVI_CONTROL_IS_AUDIO, 0) == TVI_CONTROL_TRUE) |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
239 { |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
240 len = tvh->functions->get_audio_framesize(tvh->priv); |
2802 | 241 |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
242 dp=new_demux_packet(len); |
12034 | 243 dp->flags|=1; /* Keyframe */ |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
244 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
|
245 ds_add_packet(demux->audio,dp); |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
246 } |
2802 | 247 |
2790 | 248 /* ================== ADD VIDEO PACKET =================== */ |
249 | |
24748 | 250 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
|
251 TVI_CONTROL_IS_VIDEO, 0) == TVI_CONTROL_TRUE) |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
252 { |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
253 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
|
254 dp=new_demux_packet(len); |
12034 | 255 dp->flags|=1; /* Keyframe */ |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
256 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
|
257 ds_add_packet(demux->video,dp); |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
258 } |
2790 | 259 |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
260 if (tvh->tv_param->scan) tv_scan(tvh); |
2790 | 261 return 1; |
262 } | |
263 | |
13978 | 264 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
|
265 { |
25688
cd4af70b12ef
Make some tvi_functions_t pointers const that I forgot to change before
reimar
parents:
25687
diff
changeset
|
266 const tvi_functions_t *funcs = tvh->functions; |
24753
0dca70b5337b
8 bytes buffer is not enough for at least SECAM-DK.
voroshil
parents:
24752
diff
changeset
|
267 char str[20]; |
24750
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
268 int ret; |
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
269 |
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
270 strncpy(str, norm, sizeof(str)-1); |
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
271 str[sizeof(str)-1] = '\0'; |
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
272 ret=funcs->control(tvh->priv, TVI_CONTROL_SPC_GET_NORMID, str); |
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
273 |
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
274 if(ret==TVI_CONTROL_TRUE) |
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
275 return *(int *)str; |
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
276 |
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
277 if(ret!=TVI_CONTROL_UNKNOWN) |
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
278 { |
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
279 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_BogusNormParameter, norm,"default"); |
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
280 return 0; |
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
281 } |
24749
00ad4fc92af3
Remove driver-dependent #ifdef from norm_from_string routine.
voroshil
parents:
24748
diff
changeset
|
282 |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
283 if (!strcasecmp(norm, "pal")) |
24750
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
284 return TV_NORM_PAL; |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
285 else if (!strcasecmp(norm, "ntsc")) |
24750
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
286 return TV_NORM_NTSC; |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
287 else if (!strcasecmp(norm, "secam")) |
24750
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
288 return TV_NORM_SECAM; |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
289 else if (!strcasecmp(norm, "palnc")) |
24750
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
290 return TV_NORM_PALNC; |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
291 else if (!strcasecmp(norm, "palm")) |
24750
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
292 return TV_NORM_PALM; |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
293 else if (!strcasecmp(norm, "paln")) |
24750
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
294 return TV_NORM_PALN; |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
295 else if (!strcasecmp(norm, "ntscjp")) |
24750
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
296 return TV_NORM_NTSCJP; |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
297 else { |
24750
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
298 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_BogusNormParameter, norm, "PAL"); |
af0540caadd1
(cosmetics) indentation fix of my previous commit and small readability
voroshil
parents:
24749
diff
changeset
|
299 return TV_NORM_PAL; |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
300 } |
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
301 } |
8123
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
7905
diff
changeset
|
302 |
24246
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
303 static void parse_channels(tvi_handle_t *tvh) |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
304 { |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
305 char** channels = tvh->tv_param->channels; |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
306 |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
307 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_ChannelNamesDetected); |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
308 tv_channel_list = malloc(sizeof(tv_channels_t)); |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
309 tv_channel_list->index=1; |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
310 tv_channel_list->next=NULL; |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
311 tv_channel_list->prev=NULL; |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
312 tv_channel_current = tv_channel_list; |
27025
e598c9756181
Ability for specifying TV standard individually for each TV channel.
voroshil
parents:
26756
diff
changeset
|
313 tv_channel_current->norm = tvh->norm; |
24246
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
314 |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
315 while (*channels) { |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
316 char* tmp = *(channels++); |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
317 char* sep = strchr(tmp,'-'); |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
318 int i; |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
319 struct CHANLIST cl; |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
320 |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
321 if (!sep) continue; // Wrong syntax, but mplayer should not crash |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
322 |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
323 av_strlcpy(tv_channel_current->name, sep + 1, |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
324 sizeof(tv_channel_current->name)); |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
325 sep[0] = '\0'; |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
326 strncpy(tv_channel_current->number, tmp, 5); |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
327 tv_channel_current->number[4]='\0'; |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
328 |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
329 while ((sep=strchr(tv_channel_current->name, '_'))) |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
330 sep[0] = ' '; |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
331 |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
332 // if channel number is a number and larger than 1000 threat it as frequency |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
333 // tmp still contain pointer to null-terminated string with channel number here |
24748 | 334 if (atoi(tmp)>1000){ |
24246
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
335 tv_channel_current->freq=atoi(tmp); |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
336 }else{ |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
337 tv_channel_current->freq = 0; |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
338 for (i = 0; i < chanlists[tvh->chanlist].count; i++) { |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
339 cl = tvh->chanlist_s[i]; |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
340 if (!strcasecmp(cl.name, tv_channel_current->number)) { |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
341 tv_channel_current->freq=cl.freq; |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
342 break; |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
343 } |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
344 } |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
345 } |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
346 if (tv_channel_current->freq == 0) |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
347 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_NoFreqForChannel, |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
348 tv_channel_current->number, tv_channel_current->name); |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
349 else { |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
350 sep = strchr(tv_channel_current->name, '-'); |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
351 if ( !sep ) sep = strchr(tv_channel_current->name, '+'); |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
352 |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
353 if ( sep ) { |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
354 i = atoi (sep+1); |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
355 if ( sep[0] == '+' ) tv_channel_current->freq += i * 100; |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
356 if ( sep[0] == '-' ) tv_channel_current->freq -= i * 100; |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
357 sep[0] = '\0'; |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
358 } |
27025
e598c9756181
Ability for specifying TV standard individually for each TV channel.
voroshil
parents:
26756
diff
changeset
|
359 |
e598c9756181
Ability for specifying TV standard individually for each TV channel.
voroshil
parents:
26756
diff
changeset
|
360 sep = strchr(tv_channel_current->name, '='); |
e598c9756181
Ability for specifying TV standard individually for each TV channel.
voroshil
parents:
26756
diff
changeset
|
361 if ( sep ) { |
e598c9756181
Ability for specifying TV standard individually for each TV channel.
voroshil
parents:
26756
diff
changeset
|
362 tv_channel_current->norm = norm_from_string(tvh, sep+1); |
e598c9756181
Ability for specifying TV standard individually for each TV channel.
voroshil
parents:
26756
diff
changeset
|
363 sep[0] = '\0'; |
e598c9756181
Ability for specifying TV standard individually for each TV channel.
voroshil
parents:
26756
diff
changeset
|
364 } |
24246
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
365 } |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
366 |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
367 /*mp_msg(MSGT_TV, MSGL_INFO, "-- Detected channel %s - %s (%5.3f)\n", |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
368 tv_channel_current->number, tv_channel_current->name, |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
369 (float)tv_channel_current->freq/1000);*/ |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
370 |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
371 tv_channel_current->next = malloc(sizeof(tv_channels_t)); |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
372 tv_channel_current->next->index = tv_channel_current->index + 1; |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
373 tv_channel_current->next->prev = tv_channel_current; |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
374 tv_channel_current->next->next = NULL; |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
375 tv_channel_current = tv_channel_current->next; |
27025
e598c9756181
Ability for specifying TV standard individually for each TV channel.
voroshil
parents:
26756
diff
changeset
|
376 tv_channel_current->norm = tvh->norm; |
24246
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
377 } |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
378 if (tv_channel_current->prev) |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
379 tv_channel_current->prev->next = NULL; |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
380 free(tv_channel_current); |
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
381 } |
27067
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
382 |
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
383 int tv_set_norm(tvi_handle_t *tvh, char* norm) |
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
384 { |
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
385 tvh->norm = norm_from_string(tvh, norm); |
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
386 |
33827
277ec491a8a7
Do not translate console messages of verbosity level MSGL_V and above.
diego
parents:
32511
diff
changeset
|
387 mp_msg(MSGT_TV, MSGL_V, "Selected norm : %s\n", norm); |
27067
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
388 if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) { |
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
389 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_CannotSetNorm); |
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
390 return 0; |
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
391 } |
29806 | 392 teletext_control(tvh->demuxer->teletext,TV_VBI_CONTROL_RESET, |
393 &tvh->tv_param->teletext); | |
27067
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
394 return 1; |
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
395 } |
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
396 |
30557
74a6c2a3dcce
stream: Mark functions not used outside of their files as static.
diego
parents:
30426
diff
changeset
|
397 static int tv_set_norm_i(tvi_handle_t *tvh, int norm) |
27067
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
398 { |
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
399 tvh->norm = norm; |
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
400 |
33827
277ec491a8a7
Do not translate console messages of verbosity level MSGL_V and above.
diego
parents:
32511
diff
changeset
|
401 mp_msg(MSGT_TV, MSGL_V, "Selected norm id: %d\n", norm); |
27067
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
402 if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) { |
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
403 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_CannotSetNorm); |
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
404 return 0; |
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
405 } |
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
406 |
29806 | 407 teletext_control(tvh->demuxer->teletext,TV_VBI_CONTROL_RESET, |
408 &tvh->tv_param->teletext); | |
29717
afc8b80eb027
cosmetics: Remove some pointless parentheses from return calls.
diego
parents:
29263
diff
changeset
|
409 return 1; |
27067
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
410 } |
833ec0c12cb9
Reorder some functions to avoid implicit declaration warnings.
diego
parents:
27025
diff
changeset
|
411 |
34901 | 412 static void set_norm_and_freq(tvi_handle_t *tvh, tv_channels_t *chan) |
413 { | |
414 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel3, chan->number, | |
35269 | 415 chan->name, chan->freq/1000.0); |
34901 | 416 tv_set_norm_i(tvh, chan->norm); |
35269 | 417 tv_set_freq_float(tvh, chan->freq); |
34901 | 418 } |
419 | |
7408 | 420 static int open_tv(tvi_handle_t *tvh) |
2931 | 421 { |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
422 int i; |
25688
cd4af70b12ef
Make some tvi_functions_t pointers const that I forgot to change before
reimar
parents:
25687
diff
changeset
|
423 const tvi_functions_t *funcs = tvh->functions; |
35271 | 424 static const int tv_fmt_list[] = { |
17862
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
425 IMGFMT_YV12, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
426 IMGFMT_I420, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
427 IMGFMT_UYVY, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
428 IMGFMT_YUY2, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
429 IMGFMT_RGB32, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
430 IMGFMT_RGB24, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
431 IMGFMT_RGB16, |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
432 IMGFMT_RGB15 |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
433 }; |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
434 |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
435 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
|
436 { |
22967 | 437 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_NoVideoInputPresent); |
3728 | 438 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
|
439 } |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
440 |
23887 | 441 if (tvh->tv_param->outfmt == -1) |
17862
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
442 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
|
443 { |
23887 | 444 tvh->tv_param->outfmt = tv_fmt_list[i]; |
17862
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
445 if (funcs->control (tvh->priv, TVI_CONTROL_VID_SET_FORMAT, |
23887 | 446 &tvh->tv_param->outfmt) == TVI_CONTROL_TRUE) |
17862
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
447 break; |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
448 } |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
449 else |
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
450 { |
23887 | 451 switch(tvh->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
|
452 { |
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
|
453 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
|
454 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
|
455 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
|
456 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
|
457 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
|
458 case IMGFMT_RGB24: |
15419 | 459 case IMGFMT_BGR32: |
460 case IMGFMT_BGR24: | |
461 case IMGFMT_BGR16: | |
462 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
|
463 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
|
464 default: |
23887 | 465 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_UnknownImageFormat,tvh->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
|
466 } |
23887 | 467 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_FORMAT, &tvh->tv_param->outfmt); |
17862
ecb2023ee4b6
Try several formats instead of only YV12 if no format was explicitly
albeu
parents:
17174
diff
changeset
|
468 } |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
469 |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
470 /* set some params got from cmdline */ |
23887 | 471 funcs->control(tvh->priv, TVI_CONTROL_SPC_SET_INPUT, &tvh->tv_param->input); |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
472 |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27067
diff
changeset
|
473 #if defined(CONFIG_TV_V4L2) || defined(CONFIG_TV_DSHOW) |
24748 | 474 if (0 |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27067
diff
changeset
|
475 #ifdef CONFIG_TV_V4L2 |
24744 | 476 || (!strcmp(tvh->tv_param->driver, "v4l2") && tvh->tv_param->normid >= 0) |
477 #endif | |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27067
diff
changeset
|
478 #ifdef CONFIG_TV_DSHOW |
24744 | 479 || (!strcmp(tvh->tv_param->driver, "dshow") && tvh->tv_param->normid >= 0) |
480 #endif | |
27025
e598c9756181
Ability for specifying TV standard individually for each TV channel.
voroshil
parents:
26756
diff
changeset
|
481 ) |
e598c9756181
Ability for specifying TV standard individually for each TV channel.
voroshil
parents:
26756
diff
changeset
|
482 tv_set_norm_i(tvh, tvh->tv_param->normid); |
e598c9756181
Ability for specifying TV standard individually for each TV channel.
voroshil
parents:
26756
diff
changeset
|
483 else |
10537 | 484 #endif |
24752 | 485 tv_set_norm(tvh,tvh->tv_param->norm); |
9620
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«¡n Sz«¡nt«Ñ <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
486 |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27067
diff
changeset
|
487 #ifdef CONFIG_TV_V4L1 |
23887 | 488 if ( tvh->tv_param->mjpeg ) |
9620
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«¡n Sz«¡nt«Ñ <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
489 { |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«¡n Sz«¡nt«Ñ <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
490 /* set width to expected value */ |
23887 | 491 if (tvh->tv_param->width == -1) |
9620
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«¡n Sz«¡nt«Ñ <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
492 { |
23887 | 493 tvh->tv_param->width = 704/tvh->tv_param->decimation; |
9620
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«¡n Sz«¡nt«Ñ <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
494 } |
23887 | 495 if (tvh->tv_param->height == -1) |
9620
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«¡n Sz«¡nt«Ñ <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
496 { |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«¡n Sz«¡nt«Ñ <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
497 if ( tvh->norm != TV_NORM_NTSC ) |
24748 | 498 tvh->tv_param->height = 576/tvh->tv_param->decimation; |
9620
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«¡n Sz«¡nt«Ñ <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
499 else |
24748 | 500 tvh->tv_param->height = 480/tvh->tv_param->decimation; |
9620
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«¡n Sz«¡nt«Ñ <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
501 } |
24748 | 502 mp_msg(MSGT_TV, MSGL_INFO, |
23887 | 503 MSGTR_TV_MJP_WidthHeight, tvh->tv_param->width, tvh->tv_param->height); |
9620
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«¡n Sz«¡nt«Ñ <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
504 } |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«¡n Sz«¡nt«Ñ <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
505 #endif |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«¡n Sz«¡nt«Ñ <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
506 |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
507 /* limits on w&h are norm-dependent -- JM */ |
28940
7406e7f30d4e
Add TVI_CONTROL_VID_SET_WIDTH_HEIGHT to set width and height together for v4l2,
reimar
parents:
27370
diff
changeset
|
508 if (tvh->tv_param->width != -1 && tvh->tv_param->height != -1) { |
7406e7f30d4e
Add TVI_CONTROL_VID_SET_WIDTH_HEIGHT to set width and height together for v4l2,
reimar
parents:
27370
diff
changeset
|
509 // first tell the driver both width and height, some drivers do not support setting them independently. |
7406e7f30d4e
Add TVI_CONTROL_VID_SET_WIDTH_HEIGHT to set width and height together for v4l2,
reimar
parents:
27370
diff
changeset
|
510 int dim[2]; |
7406e7f30d4e
Add TVI_CONTROL_VID_SET_WIDTH_HEIGHT to set width and height together for v4l2,
reimar
parents:
27370
diff
changeset
|
511 dim[0] = tvh->tv_param->width; dim[1] = tvh->tv_param->height; |
7406e7f30d4e
Add TVI_CONTROL_VID_SET_WIDTH_HEIGHT to set width and height together for v4l2,
reimar
parents:
27370
diff
changeset
|
512 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_WIDTH_HEIGHT, dim); |
7406e7f30d4e
Add TVI_CONTROL_VID_SET_WIDTH_HEIGHT to set width and height together for v4l2,
reimar
parents:
27370
diff
changeset
|
513 } |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
514 /* set width */ |
23887 | 515 if (tvh->tv_param->width != -1) |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
516 { |
23887 | 517 if (funcs->control(tvh->priv, TVI_CONTROL_VID_CHK_WIDTH, &tvh->tv_param->width) == TVI_CONTROL_TRUE) |
518 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_WIDTH, &tvh->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
|
519 else |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
520 { |
23887 | 521 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_UnableToSetWidth, tvh->tv_param->width); |
522 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_WIDTH, &tvh->tv_param->width); | |
24748 | 523 } |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
524 } |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
525 |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
526 /* set height */ |
23887 | 527 if (tvh->tv_param->height != -1) |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
528 { |
23887 | 529 if (funcs->control(tvh->priv, TVI_CONTROL_VID_CHK_HEIGHT, &tvh->tv_param->height) == TVI_CONTROL_TRUE) |
530 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_HEIGHT, &tvh->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
|
531 else |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
532 { |
23887 | 533 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_UnableToSetHeight, tvh->tv_param->height); |
534 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HEIGHT, &tvh->tv_param->height); | |
24748 | 535 } |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
536 } |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
537 |
3284 | 538 if (funcs->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) != TVI_CONTROL_TRUE) |
539 { | |
24748 | 540 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_NoTuner); |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
541 goto done; |
3284 | 542 } |
543 | |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
544 /* select channel list */ |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
545 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
|
546 { |
23887 | 547 if (!strcasecmp(chanlists[i].name, tvh->tv_param->chanlist)) |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
548 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
549 tvh->chanlist = i; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
550 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
|
551 break; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
552 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
553 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
554 |
35270
5816c9e25d29
Error out if an invalid channel list name was specified
reimar
parents:
35269
diff
changeset
|
555 if (tvh->chanlist == -1) { |
22967 | 556 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_UnableFindChanlist, |
23887 | 557 tvh->tv_param->chanlist); |
35270
5816c9e25d29
Error out if an invalid channel list name was specified
reimar
parents:
35269
diff
changeset
|
558 return 0; |
5816c9e25d29
Error out if an invalid channel list name was specified
reimar
parents:
35269
diff
changeset
|
559 } else |
33827
277ec491a8a7
Do not translate console messages of verbosity level MSGL_V and above.
diego
parents:
32511
diff
changeset
|
560 mp_msg(MSGT_TV, MSGL_V, "Selected channel list: %s (including %d channels)\n", |
3284 | 561 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
|
562 |
23887 | 563 if (tvh->tv_param->freq && tvh->tv_param->channel) |
3284 | 564 { |
22967 | 565 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_ChannelFreqParamConflict); |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
566 goto done; |
3284 | 567 } |
568 | |
10771 | 569 /* Handle channel names */ |
23887 | 570 if (tvh->tv_param->channels) { |
24246
0a82a3b7ac46
Move channels option parsing code into separate routine.
voroshil
parents:
24105
diff
changeset
|
571 parse_channels(tvh); |
24748 | 572 } else |
18366 | 573 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
|
574 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
575 if (tv_channel_list) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
576 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
|
577 int channel = 0; |
23887 | 578 if (tvh->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
|
579 { |
23887 | 580 if (isdigit(*tvh->tv_param->channel)) |
581 /* if tvh->tv_param->channel begins with a digit interpret it as a number */ | |
582 channel = atoi(tvh->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
|
583 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
|
584 { |
24748 | 585 /* if tvh->tv_param->channel does not begin with a digit |
23887 | 586 set the first channel that contains tvh->tv_param->channel in its name */ |
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
|
587 |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
588 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
|
589 while ( tv_channel_current ) { |
23887 | 590 if ( strstr(tv_channel_current->name, tvh->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
|
591 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
|
592 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
|
593 } |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
594 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
|
595 } |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
596 } |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
597 else |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
598 channel = 1; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
599 |
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
|
600 if ( channel ) { |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
601 tv_channel_current = tv_channel_list; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
602 for (i = 1; i < channel; i++) |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
603 if (tv_channel_current->next) |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
604 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
|
605 } |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
606 |
34901 | 607 set_norm_and_freq(tvh, tv_channel_current); |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
608 tv_channel_last = tv_channel_current; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
609 } else { |
3284 | 610 /* we need to set frequency */ |
23887 | 611 if (tvh->tv_param->freq) |
3284 | 612 { |
23887 | 613 unsigned long freq = atof(tvh->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
|
614 |
3284 | 615 /* set freq in MHz */ |
616 funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_FREQ, &freq); | |
617 | |
618 funcs->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &freq); | |
33827
277ec491a8a7
Do not translate console messages of verbosity level MSGL_V and above.
diego
parents:
32511
diff
changeset
|
619 mp_msg(MSGT_TV, MSGL_V, "Selected frequency: %lu (%.3f)\n", |
35269 | 620 freq, freq/16.0); |
3284 | 621 } |
622 | |
23887 | 623 if (tvh->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
|
624 struct CHANLIST cl; |
3284 | 625 |
33827
277ec491a8a7
Do not translate console messages of verbosity level MSGL_V and above.
diego
parents:
32511
diff
changeset
|
626 mp_msg(MSGT_TV, MSGL_V, "Requested channel: %s\n", tvh->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
|
627 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
|
628 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
629 cl = tvh->chanlist_s[i]; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
630 // 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
|
631 // i, cl.name, cl.freq); |
23887 | 632 if (!strcasecmp(cl.name, tvh->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
|
633 { |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
634 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
|
635 tvh->channel = i; |
22967 | 636 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel2, |
35269 | 637 cl.name, cl.freq/1000.0); |
638 tv_set_freq_float(tvh, cl.freq); | |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
639 break; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
640 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
641 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
642 } |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
643 } |
24748 | 644 |
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
|
645 /* 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
|
646 { |
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
|
647 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
|
648 int freq; |
24748 | 649 |
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
|
650 tv_get_freq(tvh, &i2); |
24748 | 651 |
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
|
652 freq = (int) (((float)(i2/16))*1000)+250; |
24748 | 653 |
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
|
654 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
|
655 { |
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
|
656 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
|
657 { |
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
|
658 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
|
659 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
|
660 } |
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
|
661 } |
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
|
662 } |
3284 | 663 |
24748 | 664 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
|
665 /* also start device! */ |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
666 return 1; |
2931 | 667 } |
668 | |
23883 | 669 static tvi_handle_t *tv_begin(tv_param_t* tv_param) |
23879 | 670 { |
671 int i; | |
672 tvi_handle_t* h; | |
24403 | 673 if(tv_param->driver && !strcmp(tv_param->driver,"help")){ |
23879 | 674 mp_msg(MSGT_TV,MSGL_INFO,MSGTR_TV_AvailableDrivers); |
675 for(i=0;tvi_driver_list[i];i++){ | |
676 mp_msg(MSGT_TV,MSGL_INFO," %s\t%s",tvi_driver_list[i]->short_name,tvi_driver_list[i]->name); | |
677 if(tvi_driver_list[i]->comment) | |
678 mp_msg(MSGT_TV,MSGL_INFO," (%s)",tvi_driver_list[i]->comment); | |
679 mp_msg(MSGT_TV,MSGL_INFO,"\n"); | |
680 } | |
681 return NULL; | |
682 } | |
683 | |
684 for(i=0;tvi_driver_list[i];i++){ | |
24403 | 685 if (!tv_param->driver || !strcmp(tvi_driver_list[i]->short_name, tv_param->driver)){ |
23883 | 686 h=tvi_driver_list[i]->tvi_init(tv_param); |
24403 | 687 //Requested driver initialization failed |
688 if (!h && tv_param->driver) | |
689 return NULL; | |
690 //Driver initialization failed during autodetection process. | |
691 if (!h) | |
692 continue; | |
23879 | 693 |
23883 | 694 h->tv_param=tv_param; |
23879 | 695 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_DriverInfo, tvi_driver_list[i]->short_name, |
696 tvi_driver_list[i]->name, | |
697 tvi_driver_list[i]->author, | |
698 tvi_driver_list[i]->comment?tvi_driver_list[i]->comment:""); | |
24403 | 699 tv_param->driver=strdup(tvi_driver_list[i]->short_name); |
23879 | 700 return h; |
701 } | |
702 } | |
24748 | 703 |
24403 | 704 if(tv_param->driver) |
24748 | 705 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_NoSuchDriver, tv_param->driver); |
24403 | 706 else |
707 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_DriverAutoDetectionFailed); | |
26756
c43ce7268677
cosmetics: Remove useless parentheses from return statements.
diego
parents:
25689
diff
changeset
|
708 return NULL; |
23879 | 709 } |
710 | |
23881
5a5c7866921f
Removing forward declarations of routines used only in tv.c
voroshil
parents:
23880
diff
changeset
|
711 static int tv_uninit(tvi_handle_t *tvh) |
23880 | 712 { |
713 int res; | |
714 if(!tvh) return 1; | |
715 if (!tvh->priv) return 1; | |
716 res=tvh->functions->uninit(tvh->priv); | |
24943
1777d38d020d
Fix segmentation fault after audio initialization failure in tv driver.
voroshil
parents:
24762
diff
changeset
|
717 if(res) { |
1777d38d020d
Fix segmentation fault after audio initialization failure in tv driver.
voroshil
parents:
24762
diff
changeset
|
718 free(tvh->priv); |
1777d38d020d
Fix segmentation fault after audio initialization failure in tv driver.
voroshil
parents:
24762
diff
changeset
|
719 tvh->priv=NULL; |
1777d38d020d
Fix segmentation fault after audio initialization failure in tv driver.
voroshil
parents:
24762
diff
changeset
|
720 } |
23880 | 721 return res; |
722 } | |
723 | |
16175 | 724 static demuxer_t* demux_open_tv(demuxer_t *demuxer) |
2790 | 725 { |
7408 | 726 tvi_handle_t *tvh; |
727 sh_video_t *sh_video; | |
2802 | 728 sh_audio_t *sh_audio = NULL; |
25688
cd4af70b12ef
Make some tvi_functions_t pointers const that I forgot to change before
reimar
parents:
25687
diff
changeset
|
729 const tvi_functions_t *funcs; |
24748 | 730 |
21837 | 731 demuxer->priv=NULL; |
23883 | 732 if(!(tvh=tv_begin(demuxer->stream->priv))) return NULL; |
22381
6cabac4d35b5
tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents:
21837
diff
changeset
|
733 if (!tvh->functions->init(tvh->priv)) return NULL; |
23900 | 734 |
29806 | 735 tvh->demuxer = demuxer; |
736 tvh->functions->control(tvh->priv,TVI_CONTROL_VBI_INIT, | |
737 &(tvh->tv_param->teletext.device)); | |
738 tvh->functions->control(tvh->priv,TVI_CONTROL_GET_VBI_PTR, | |
739 &demuxer->teletext); | |
23900 | 740 |
7408 | 741 if (!open_tv(tvh)){ |
742 tv_uninit(tvh); | |
16175 | 743 return NULL; |
7408 | 744 } |
745 funcs = tvh->functions; | |
746 demuxer->priv=tvh; | |
24748 | 747 |
2802 | 748 sh_video = new_sh_video(demuxer, 0); |
2790 | 749 |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
750 /* get IMAGE FORMAT */ |
2802 | 751 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_FORMAT, &sh_video->format); |
2810 | 752 // if (IMGFMT_IS_RGB(sh_video->format) || IMGFMT_IS_BGR(sh_video->format)) |
3398 | 753 // sh_video->format = 0x0; |
2802 | 754 |
755 /* set FPS and FRAMETIME */ | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
756 |
2790 | 757 if(!sh_video->fps) |
758 { | |
10019 | 759 float tmp; |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
760 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
|
761 sh_video->fps = 25.0f; /* on PAL */ |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
762 else sh_video->fps = tmp; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
763 } |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
764 |
23887 | 765 if (tvh->tv_param->fps != -1.0f) |
766 sh_video->fps = tvh->tv_param->fps; | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
767 |
2790 | 768 sh_video->frametime = 1.0f/sh_video->fps; |
769 | |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
770 /* If playback only mode, go to immediate mode, fail silently */ |
23887 | 771 if(tvh->tv_param->immediate == 1) |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
772 { |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
773 funcs->control(tvh->priv, TVI_CONTROL_IMMEDIATE, 0); |
24748 | 774 tvh->tv_param->noaudio = 1; |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
775 } |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
776 |
8799 | 777 /* disable TV audio if -nosound is present */ |
778 if (!demuxer->audio || demuxer->audio->id == -2) { | |
24748 | 779 tvh->tv_param->noaudio = 1; |
8799 | 780 } |
781 | |
2790 | 782 /* 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
|
783 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_WIDTH, &sh_video->disp_w); |
2790 | 784 |
785 /* 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
|
786 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HEIGHT, &sh_video->disp_h); |
2802 | 787 |
2790 | 788 demuxer->video->sh = sh_video; |
789 sh_video->ds = demuxer->video; | |
790 demuxer->video->id = 0; | |
9501 | 791 demuxer->seekable = 0; |
2790 | 792 |
793 /* here comes audio init */ | |
23887 | 794 if (tvh->tv_param->noaudio == 0 && funcs->control(tvh->priv, TVI_CONTROL_IS_AUDIO, 0) == TVI_CONTROL_TRUE) |
2802 | 795 { |
796 int audio_format; | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
797 int sh_audio_format; |
14245 | 798 char buf[128]; |
2802 | 799 |
800 /* yeah, audio is present */ | |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
801 |
24748 | 802 funcs->control(tvh->priv, TVI_CONTROL_AUD_SET_SAMPLERATE, |
23887 | 803 &tvh->tv_param->audiorate); |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
804 |
2802 | 805 if (funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_FORMAT, &audio_format) != TVI_CONTROL_TRUE) |
806 goto no_audio; | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
807 |
2802 | 808 switch(audio_format) |
809 { | |
14245 | 810 case AF_FORMAT_U8: |
811 case AF_FORMAT_S8: | |
812 case AF_FORMAT_U16_LE: | |
813 case AF_FORMAT_U16_BE: | |
814 case AF_FORMAT_S16_LE: | |
815 case AF_FORMAT_S16_BE: | |
816 case AF_FORMAT_S32_LE: | |
817 case AF_FORMAT_S32_BE: | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
818 sh_audio_format = 0x1; /* PCM */ |
2802 | 819 break; |
14245 | 820 case AF_FORMAT_IMA_ADPCM: |
821 case AF_FORMAT_MU_LAW: | |
822 case AF_FORMAT_A_LAW: | |
823 case AF_FORMAT_MPEG2: | |
2802 | 824 default: |
22967 | 825 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_UnsupportedAudioType, |
14255
137896e25c24
100l, buf etc. in af_fmt2str call are already pointers...
reimar
parents:
14245
diff
changeset
|
826 af_fmt2str(audio_format, buf, 128), audio_format); |
2802 | 827 goto no_audio; |
828 } | |
24748 | 829 |
31611 | 830 sh_audio = new_sh_audio(demuxer, 0, NULL); |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
831 |
24748 | 832 funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_SAMPLERATE, |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
833 &sh_audio->samplerate); |
24748 | 834 funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_SAMPLESIZE, |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
835 &sh_audio->samplesize); |
24748 | 836 funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_CHANNELS, |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
837 &sh_audio->channels); |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
838 |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
839 sh_audio->format = sh_audio_format; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
840 sh_audio->sample_format = audio_format; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
841 |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
842 sh_audio->i_bps = sh_audio->o_bps = |
24748 | 843 sh_audio->samplerate * sh_audio->samplesize * |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
844 sh_audio->channels; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
845 |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
846 // emulate WF for win32 codecs: |
32105 | 847 sh_audio->wf = malloc(sizeof(*sh_audio->wf)); |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
848 sh_audio->wf->wFormatTag = sh_audio->format; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
849 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
|
850 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
|
851 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
|
852 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
|
853 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
|
854 |
33827
277ec491a8a7
Do not translate console messages of verbosity level MSGL_V and above.
diego
parents:
32511
diff
changeset
|
855 mp_msg(MSGT_DECVIDEO, MSGL_V, " TV audio: %d channels, %d bits, %d Hz\n", |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
856 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
|
857 sh_audio->wf->nSamplesPerSec); |
2802 | 858 |
859 demuxer->audio->sh = sh_audio; | |
860 sh_audio->ds = demuxer->audio; | |
861 demuxer->audio->id = 0; | |
862 } | |
863 no_audio: | |
864 | |
7329
9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents:
7318
diff
changeset
|
865 if(!(funcs->start(tvh->priv))){ |
9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents:
7318
diff
changeset
|
866 // start failed :( |
9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents:
7318
diff
changeset
|
867 tv_uninit(tvh); |
16175 | 868 return NULL; |
7329
9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents:
7318
diff
changeset
|
869 } |
10581
4ebff25d9a05
From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents:
10537
diff
changeset
|
870 |
4ebff25d9a05
From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents:
10537
diff
changeset
|
871 /* set color eq */ |
23887 | 872 tv_set_color_options(tvh, TV_COLOR_BRIGHTNESS, tvh->tv_param->brightness); |
873 tv_set_color_options(tvh, TV_COLOR_HUE, tvh->tv_param->hue); | |
874 tv_set_color_options(tvh, TV_COLOR_SATURATION, tvh->tv_param->saturation); | |
875 tv_set_color_options(tvh, TV_COLOR_CONTRAST, tvh->tv_param->contrast); | |
10581
4ebff25d9a05
From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents:
10537
diff
changeset
|
876 |
24553
d6bba2781d01
Implement setting gain control for video devices (usually webcams)
voroshil
parents:
24430
diff
changeset
|
877 if(tvh->tv_param->gain!=-1) |
d6bba2781d01
Implement setting gain control for video devices (usually webcams)
voroshil
parents:
24430
diff
changeset
|
878 if(funcs->control(tvh->priv,TVI_CONTROL_VID_SET_GAIN,&tvh->tv_param->gain)!=TVI_CONTROL_TRUE) |
d6bba2781d01
Implement setting gain control for video devices (usually webcams)
voroshil
parents:
24430
diff
changeset
|
879 mp_msg(MSGT_TV,MSGL_WARN,"Unable to set gain control!\n"); |
d6bba2781d01
Implement setting gain control for video devices (usually webcams)
voroshil
parents:
24430
diff
changeset
|
880 |
29806 | 881 teletext_control(demuxer->teletext,TV_VBI_CONTROL_RESET, |
882 &tvh->tv_param->teletext); | |
24430
85156c51f912
Fix missing reset/initialization (with tv parameters) of
voroshil
parents:
24403
diff
changeset
|
883 |
16175 | 884 return demuxer; |
2790 | 885 } |
886 | |
17174
83a8c738be89
make demuxer seek and close functions return void, patch by Dominik Mierzejewski
wanderer
parents:
17012
diff
changeset
|
887 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
|
888 { |
7408 | 889 tvi_handle_t *tvh=(tvi_handle_t*)(demuxer->priv); |
21837 | 890 if (!tvh) return; |
24943
1777d38d020d
Fix segmentation fault after audio initialization failure in tv driver.
voroshil
parents:
24762
diff
changeset
|
891 tv_uninit(tvh); |
24944 | 892 free(tvh); |
21837 | 893 demuxer->priv=NULL; |
29831
8f20788b3610
Set demuxer->teletext to NULL when closing the TV interface,
reimar
parents:
29806
diff
changeset
|
894 demuxer->teletext=NULL; |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
895 } |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
896 |
2937 | 897 /* utilities for mplayer (not mencoder!!) */ |
898 int tv_set_color_options(tvi_handle_t *tvh, int opt, int value) | |
899 { | |
25688
cd4af70b12ef
Make some tvi_functions_t pointers const that I forgot to change before
reimar
parents:
25687
diff
changeset
|
900 const tvi_functions_t *funcs = tvh->functions; |
2937 | 901 |
902 switch(opt) | |
903 { | |
904 case TV_COLOR_BRIGHTNESS: | |
18172
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
905 return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_BRIGHTNESS, &value); |
2937 | 906 case TV_COLOR_HUE: |
18172
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
907 return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_HUE, &value); |
2937 | 908 case TV_COLOR_SATURATION: |
18172
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
909 return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_SATURATION, &value); |
2937 | 910 case TV_COLOR_CONTRAST: |
18172
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
911 return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_CONTRAST, &value); |
2937 | 912 default: |
22967 | 913 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_UnknownColorOption, opt); |
2937 | 914 } |
24748 | 915 |
26756
c43ce7268677
cosmetics: Remove useless parentheses from return statements.
diego
parents:
25689
diff
changeset
|
916 return TVI_CONTROL_UNKNOWN; |
18172
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
917 } |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
918 |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
919 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
|
920 { |
25688
cd4af70b12ef
Make some tvi_functions_t pointers const that I forgot to change before
reimar
parents:
25687
diff
changeset
|
921 const tvi_functions_t *funcs = tvh->functions; |
18172
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
922 |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
923 switch(opt) |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
924 { |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
925 case TV_COLOR_BRIGHTNESS: |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
926 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
|
927 case TV_COLOR_HUE: |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
928 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
|
929 case TV_COLOR_SATURATION: |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
930 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
|
931 case TV_COLOR_CONTRAST: |
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
932 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
|
933 default: |
22967 | 934 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_UnknownColorOption, opt); |
18172
90b62d7c0fca
Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents:
18073
diff
changeset
|
935 } |
24748 | 936 |
26756
c43ce7268677
cosmetics: Remove useless parentheses from return statements.
diego
parents:
25689
diff
changeset
|
937 return TVI_CONTROL_UNKNOWN; |
2937 | 938 } |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
939 |
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
|
940 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
|
941 { |
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
|
942 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
|
943 { |
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
|
944 tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, freq); |
33827
277ec491a8a7
Do not translate console messages of verbosity level MSGL_V and above.
diego
parents:
32511
diff
changeset
|
945 mp_msg(MSGT_TV, MSGL_V, "Current frequency: %lu (%.3f)\n", |
35269 | 946 *freq, *freq/16.0); |
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
|
947 } |
26756
c43ce7268677
cosmetics: Remove useless parentheses from return statements.
diego
parents:
25689
diff
changeset
|
948 return 1; |
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
|
949 } |
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
|
950 |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
951 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
|
952 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
953 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
|
954 { |
23887 | 955 // unsigned long freq = atof(tvh->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
|
956 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
957 /* 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
|
958 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
|
959 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
960 tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &freq); |
33827
277ec491a8a7
Do not translate console messages of verbosity level MSGL_V and above.
diego
parents:
32511
diff
changeset
|
961 mp_msg(MSGT_TV, MSGL_V, "Current frequency: %lu (%.3f)\n", |
35269 | 962 freq, freq/16.0); |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
963 } |
29806 | 964 teletext_control(tvh->demuxer->teletext,TV_VBI_CONTROL_RESET, |
965 &tvh->tv_param->teletext); | |
26756
c43ce7268677
cosmetics: Remove useless parentheses from return statements.
diego
parents:
25689
diff
changeset
|
966 return 1; |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
967 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
968 |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
969 int tv_get_signal(tvi_handle_t *tvh) |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
970 { |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
971 int signal=0; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
972 if (tvh->functions->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) != TVI_CONTROL_TRUE || |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
973 tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_GET_SIGNAL, &signal)!=TVI_CONTROL_TRUE) |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
974 return 0; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
975 |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
976 return signal; |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
977 } |
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
978 |
22667 | 979 /***************************************************************** |
980 * \brief tune current frequency by step_interval value | |
981 * \parameter step_interval increment value in 1/16 MHz | |
982 * \note frequency is rounded to 1/16 MHz value | |
983 * \return 1 | |
984 * | |
985 */ | |
986 int tv_step_freq(tvi_handle_t* tvh, float step_interval){ | |
987 unsigned long frequency; | |
988 | |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
989 tvh->tv_param->scan=0; |
22667 | 990 tv_get_freq(tvh,&frequency); |
991 frequency+=step_interval; | |
992 return tv_set_freq(tvh,frequency); | |
993 } | |
994 | |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
995 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
|
996 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
997 struct CHANLIST cl; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
998 |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
999 tvh->tv_param->scan=0; |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
1000 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
|
1001 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
1002 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
|
1003 { |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1004 strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name); |
5923 | 1005 cl = tvh->chanlist_s[--tvh->channel]; |
22967 | 1006 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel2, |
35269 | 1007 cl.name, cl.freq/1000.0); |
1008 tv_set_freq_float(tvh, cl.freq); | |
24748 | 1009 } |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
1010 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
1011 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
1012 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
|
1013 { |
4242 | 1014 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
|
1015 { |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1016 strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name); |
5923 | 1017 cl = tvh->chanlist_s[++tvh->channel]; |
22967 | 1018 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel2, |
35269 | 1019 cl.name, cl.freq/1000.0); |
1020 tv_set_freq_float(tvh, cl.freq); | |
24748 | 1021 } |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
1022 } |
26756
c43ce7268677
cosmetics: Remove useless parentheses from return statements.
diego
parents:
25689
diff
changeset
|
1023 return 1; |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
1024 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
1025 |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1026 int tv_step_channel(tvi_handle_t *tvh, int direction) { |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
1027 tvh->tv_param->scan=0; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1028 if (tv_channel_list) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1029 if (direction == TV_CHANNEL_HIGHER) { |
16469
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
1030 tv_channel_last = tv_channel_current; |
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
1031 if (tv_channel_current->next) |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1032 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
|
1033 else |
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
1034 tv_channel_current = tv_channel_list; |
34901 | 1035 set_norm_and_freq(tvh, tv_channel_current); |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1036 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1037 if (direction == TV_CHANNEL_LOWER) { |
16469
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
1038 tv_channel_last = tv_channel_current; |
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
1039 if (tv_channel_current->prev) |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1040 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
|
1041 else |
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
1042 while (tv_channel_current->next) |
8c1c8d10c163
cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents:
16175
diff
changeset
|
1043 tv_channel_current = tv_channel_current->next; |
34901 | 1044 set_norm_and_freq(tvh, tv_channel_current); |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1045 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1046 } else tv_step_channel_real(tvh, direction); |
26756
c43ce7268677
cosmetics: Remove useless parentheses from return statements.
diego
parents:
25689
diff
changeset
|
1047 return 1; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1048 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1049 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1050 int tv_set_channel_real(tvi_handle_t *tvh, char *channel) { |
8494 | 1051 int i; |
1052 struct CHANLIST cl; | |
1053 | |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
1054 tvh->tv_param->scan=0; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1055 strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name); |
8494 | 1056 for (i = 0; i < chanlists[tvh->chanlist].count; i++) |
1057 { | |
1058 cl = tvh->chanlist_s[i]; | |
1059 // printf("count%d: name: %s, freq: %d\n", | |
1060 // i, cl.name, cl.freq); | |
1061 if (!strcasecmp(cl.name, channel)) | |
1062 { | |
1063 tvh->channel = i; | |
22967 | 1064 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel2, |
35269 | 1065 cl.name, cl.freq/1000.0); |
1066 tv_set_freq_float(tvh, cl.freq); | |
8494 | 1067 break; |
1068 } | |
1069 } | |
26756
c43ce7268677
cosmetics: Remove useless parentheses from return statements.
diego
parents:
25689
diff
changeset
|
1070 return 1; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1071 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1072 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1073 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
|
1074 int i, channel_int; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1075 |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
1076 tvh->tv_param->scan=0; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1077 if (tv_channel_list) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1078 tv_channel_last = tv_channel_current; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1079 channel_int = atoi(channel); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1080 tv_channel_current = tv_channel_list; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1081 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
|
1082 if (tv_channel_current->next) |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1083 tv_channel_current = tv_channel_current->next; |
34901 | 1084 set_norm_and_freq(tvh, tv_channel_current); |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1085 } else tv_set_channel_real(tvh, channel); |
26756
c43ce7268677
cosmetics: Remove useless parentheses from return statements.
diego
parents:
25689
diff
changeset
|
1086 return 1; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1087 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1088 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1089 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
|
1090 |
24105
9e71e0345c35
Automatic TV channels scanning ability for MPlayer.
voroshil
parents:
23900
diff
changeset
|
1091 tvh->tv_param->scan=0; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1092 if (tv_channel_list) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1093 tv_channels_t *tmp; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1094 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1095 tmp = tv_channel_last; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1096 tv_channel_last = tv_channel_current; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1097 tv_channel_current = tmp; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1098 |
34901 | 1099 set_norm_and_freq(tvh, tv_channel_current); |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1100 } else { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1101 int i; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1102 struct CHANLIST cl; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1103 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1104 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
|
1105 { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1106 cl = tvh->chanlist_s[i]; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1107 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
|
1108 { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1109 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
|
1110 tvh->channel = i; |
22967 | 1111 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel2, |
35269 | 1112 cl.name, cl.freq/1000.0); |
1113 tv_set_freq_float(tvh, cl.freq); | |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1114 break; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1115 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1116 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
1117 } |
26756
c43ce7268677
cosmetics: Remove useless parentheses from return statements.
diego
parents:
25689
diff
changeset
|
1118 return 1; |
8494 | 1119 } |
1120 | |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
1121 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
|
1122 { |
16961
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
1123 tvh->norm++; |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
1124 if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
1125 &tvh->norm) != TVI_CONTROL_TRUE) { |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
1126 tvh->norm = 0; |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
1127 if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
1128 &tvh->norm) != TVI_CONTROL_TRUE) { |
22967 | 1129 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_CannotSetNorm); |
16961
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
1130 return 0; |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
1131 } |
8b5a4d2dcc2b
implement norm switching, which was already documented??
reimar
parents:
16469
diff
changeset
|
1132 } |
29806 | 1133 teletext_control(tvh->demuxer->teletext,TV_VBI_CONTROL_RESET, |
1134 &tvh->tv_param->teletext); | |
26756
c43ce7268677
cosmetics: Remove useless parentheses from return statements.
diego
parents:
25689
diff
changeset
|
1135 return 1; |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
1136 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
1137 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
1138 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
|
1139 { |
26756
c43ce7268677
cosmetics: Remove useless parentheses from return statements.
diego
parents:
25689
diff
changeset
|
1140 return 1; |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
1141 } |
10521
141141fdd250
I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents:
10368
diff
changeset
|
1142 |
16175 | 1143 demuxer_desc_t demuxer_desc_tv = { |
1144 "Tv card demuxer", | |
1145 "tv", | |
1146 "TV", | |
1147 "Alex Beregszaszi, Charles R. Henrich", | |
1148 "?", | |
1149 DEMUXER_TYPE_TV, | |
1150 0, // no autodetect | |
1151 NULL, | |
1152 demux_tv_fill_buffer, | |
1153 demux_open_tv, | |
1154 demux_close_tv, | |
1155 NULL, | |
1156 NULL | |
1157 }; |