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