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