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