Mercurial > mplayer.hg
annotate libmpdemux/tv.c @ 10295:cd92ccde7d2d
ff lossless jpeg
author | michael |
---|---|
date | Sun, 15 Jun 2003 00:20:25 +0000 |
parents | 4e34d468f549 |
children | 6fb8a6a4a071 |
rev | line source |
---|---|
2790 | 1 /* |
3284 | 2 TV Interface for MPlayer |
2790 | 3 |
3284 | 4 (C) Alex Beregszaszi <alex@naxine.org> |
5 | |
6 API idea based on libvo2 | |
2790 | 7 |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
8 Feb 19, 2002: Significant rewrites by Charles R. Henrich (henrich@msu.edu) |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
9 to add support for audio, and bktr *BSD support. |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
10 |
2790 | 11 */ |
12 | |
13 #include <stdio.h> | |
14 #include <stdlib.h> | |
15 #include <unistd.h> | |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
16 #include <string.h> |
10242 | 17 #include <ctype.h> |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
18 #include <sys/time.h> |
2790 | 19 |
20 #include "config.h" | |
21 | |
2819
2e58962dc9fe
cleaned up some warnings, and tv_param_on moved out from #ifdef USE_TV
alex
parents:
2818
diff
changeset
|
22 int tv_param_on = 0; |
2e58962dc9fe
cleaned up some warnings, and tv_param_on moved out from #ifdef USE_TV
alex
parents:
2818
diff
changeset
|
23 |
2790 | 24 #ifdef USE_TV |
25 #include "mp_msg.h" | |
26 #include "help_mp.h" | |
27 | |
28 #include "stream.h" | |
29 #include "demuxer.h" | |
30 #include "stheader.h" | |
2830 | 31 |
32 #include "../libao2/afmt.h" | |
8254
772d6d27fd66
warning patch by (Dominik Mierzejewski <dominik at rangers dot eu dot org>)
michael
parents:
8123
diff
changeset
|
33 #include "../libao2/audio_out.h" |
2830 | 34 #include "../libvo/img_format.h" |
35 #include "../libvo/fastmemcpy.h" | |
36 | |
2802 | 37 #include "tv.h" |
2790 | 38 |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
39 #include "frequencies.h" |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
40 |
2790 | 41 /* some default values */ |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
42 int tv_param_audiorate = 44100; |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
43 int tv_param_noaudio = 0; |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
44 int tv_param_immediate = 0; |
2837 | 45 char *tv_param_freq = NULL; |
3284 | 46 char *tv_param_channel = NULL; |
2790 | 47 char *tv_param_norm = "pal"; |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
48 char *tv_param_chanlist = "europe-east"; |
2790 | 49 char *tv_param_device = NULL; |
50 char *tv_param_driver = "dummy"; | |
51 int tv_param_width = -1; | |
52 int tv_param_height = -1; | |
2802 | 53 int tv_param_input = 0; /* used in v4l and bttv */ |
2817 | 54 char *tv_param_outfmt = "yv12"; |
3285 | 55 float tv_param_fps = -1.0; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
56 char **tv_param_channels = NULL; |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
57 #ifdef HAVE_TV_V4L |
7163
a193df8b275b
v4l audio fixes by Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz>
alex
parents:
7058
diff
changeset
|
58 int tv_param_amode = -1; |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
59 int tv_param_audio_id = 0; |
7163
a193df8b275b
v4l audio fixes by Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz>
alex
parents:
7058
diff
changeset
|
60 int tv_param_volume = 60000; |
a193df8b275b
v4l audio fixes by Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz>
alex
parents:
7058
diff
changeset
|
61 int tv_param_bass = -1; |
a193df8b275b
v4l audio fixes by Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz>
alex
parents:
7058
diff
changeset
|
62 int tv_param_treble = -1; |
a193df8b275b
v4l audio fixes by Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz>
alex
parents:
7058
diff
changeset
|
63 int tv_param_balance = -1; |
a193df8b275b
v4l audio fixes by Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz>
alex
parents:
7058
diff
changeset
|
64 int tv_param_forcechan = -1; |
7835
d489890c59d3
add an option to force audio recording when a tv card reports no audio sources
henry
parents:
7807
diff
changeset
|
65 int tv_param_force_audio = 0; |
7905
b062996d9794
added an option for specifying the size of capture buffer
henry
parents:
7835
diff
changeset
|
66 int tv_param_buffer_size = -1; |
9620
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
67 int tv_param_mjpeg = 0; |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
68 int tv_param_decimation = 2; |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
69 int tv_param_quality = 90; |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
70 #ifdef HAVE_ALSA9 |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
71 int tv_param_alsa = 0; |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
72 #endif |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
73 char* tv_param_adevice = NULL; |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
74 #endif |
9663 | 75 int tv_param_brightness = 0; |
76 int tv_param_contrast = 0; | |
77 int tv_param_hue = 0; | |
78 int tv_param_saturation = 0; | |
2790 | 79 |
80 /* ================== DEMUX_TV ===================== */ | |
81 /* | |
82 Return value: | |
83 0 = EOF(?) or no stream | |
84 1 = successfully read a packet | |
85 */ | |
86 /* fill demux->video and demux->audio */ | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
87 |
7329
9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents:
7318
diff
changeset
|
88 int demux_tv_fill_buffer(demuxer_t *demux, demux_stream_t *ds) |
2790 | 89 { |
7408 | 90 tvi_handle_t *tvh=(tvi_handle_t*)(demux->priv); |
2813 | 91 demux_packet_t* dp; |
9927 | 92 unsigned int len=0; |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
93 |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
94 /* ================== ADD AUDIO PACKET =================== */ |
2790 | 95 |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
96 if (ds==demux->audio && tv_param_noaudio == 0 && |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
97 tvh->functions->control(tvh->priv, |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
98 TVI_CONTROL_IS_AUDIO, 0) == TVI_CONTROL_TRUE) |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
99 { |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
100 len = tvh->functions->get_audio_framesize(tvh->priv); |
2802 | 101 |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
102 dp=new_demux_packet(len); |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
103 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
|
104 ds_add_packet(demux->audio,dp); |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
105 } |
2802 | 106 |
2790 | 107 /* ================== ADD VIDEO PACKET =================== */ |
108 | |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
109 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
|
110 TVI_CONTROL_IS_VIDEO, 0) == TVI_CONTROL_TRUE) |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
111 { |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
112 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
|
113 dp=new_demux_packet(len); |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
114 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
|
115 ds_add_packet(demux->video,dp); |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
116 } |
2790 | 117 |
118 return 1; | |
119 } | |
120 | |
8123
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
7905
diff
changeset
|
121 /* forward declarations */ |
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
7905
diff
changeset
|
122 int tv_set_freq(tvi_handle_t *tvh, unsigned long freq); |
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
7905
diff
changeset
|
123 int tv_get_freq(tvi_handle_t *tvh, unsigned long *freq); |
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
7905
diff
changeset
|
124 |
7408 | 125 static int open_tv(tvi_handle_t *tvh) |
2931 | 126 { |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
127 int i; |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
128 tvi_functions_t *funcs = tvh->functions; |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
129 int picture_format = 0; |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
130 |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
131 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
|
132 { |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
133 mp_msg(MSGT_TV, MSGL_ERR, "Error: no video input present!\n"); |
3728 | 134 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
|
135 } |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
136 |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
137 if (!strcasecmp(tv_param_outfmt, "yv12")) |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
138 picture_format = IMGFMT_YV12; |
3703 | 139 else if (!strcasecmp(tv_param_outfmt, "i420")) |
140 picture_format = IMGFMT_I420; | |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
141 else if (!strcasecmp(tv_param_outfmt, "uyvy")) |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
142 picture_format = IMGFMT_UYVY; |
4350 | 143 else if (!strcasecmp(tv_param_outfmt, "yuy2")) |
144 picture_format = IMGFMT_YUY2; | |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
145 else if (!strcasecmp(tv_param_outfmt, "rgb32")) |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
146 picture_format = IMGFMT_RGB32; |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
147 else if (!strcasecmp(tv_param_outfmt, "rgb24")) |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
148 picture_format = IMGFMT_RGB24; |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
149 else if (!strcasecmp(tv_param_outfmt, "rgb16")) |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
150 picture_format = IMGFMT_RGB16; |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
151 else if (!strcasecmp(tv_param_outfmt, "rgb15")) |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
152 picture_format = IMGFMT_RGB15; |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
153 else |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
154 { |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
155 mp_msg(MSGT_TV, MSGL_ERR, "Unknown format given: %s\n", tv_param_outfmt); |
7318
85897ab199a4
changed message leveles (too many non-sense info messages)
alex
parents:
7163
diff
changeset
|
156 mp_msg(MSGT_TV, MSGL_V, "Using default: Planar YV12\n"); |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
157 picture_format = IMGFMT_YV12; |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
158 } |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
159 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_FORMAT, &picture_format); |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
160 |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
161 /* set some params got from cmdline */ |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
162 funcs->control(tvh->priv, TVI_CONTROL_SPC_SET_INPUT, &tv_param_input); |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
163 |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
164 /* select video norm */ |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
165 if (!strcasecmp(tv_param_norm, "pal")) |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
166 tvh->norm = TV_NORM_PAL; |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
167 else if (!strcasecmp(tv_param_norm, "ntsc")) |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
168 tvh->norm = TV_NORM_NTSC; |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
169 else if (!strcasecmp(tv_param_norm, "secam")) |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
170 tvh->norm = TV_NORM_SECAM; |
8487 | 171 else if (!strcasecmp(tv_param_norm, "palnc")) |
172 tvh->norm = TV_NORM_PALNC; | |
173 else if (!strcasecmp(tv_param_norm, "palm")) | |
174 tvh->norm = TV_NORM_PALM; | |
175 else if (!strcasecmp(tv_param_norm, "paln")) | |
176 tvh->norm = TV_NORM_PALN; | |
177 else if (!strcasecmp(tv_param_norm, "ntscjp")) | |
178 tvh->norm = TV_NORM_NTSCJP; | |
8477 | 179 else { |
180 mp_msg(MSGT_TV, MSGL_V, "Bogus norm parameter, setting PAL.\n"); | |
181 tvh->norm = TV_NORM_PAL; | |
182 } | |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
183 |
7318
85897ab199a4
changed message leveles (too many non-sense info messages)
alex
parents:
7163
diff
changeset
|
184 mp_msg(MSGT_TV, MSGL_V, "Selected norm: %s\n", tv_param_norm); |
8486
c268bbb804d9
handle bogus norm parameter; check for errors when setting norm
henry
parents:
8477
diff
changeset
|
185 if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) { |
c268bbb804d9
handle bogus norm parameter; check for errors when setting norm
henry
parents:
8477
diff
changeset
|
186 mp_msg(MSGT_TV, MSGL_ERR, "Error: cannot set norm!\n"); |
c268bbb804d9
handle bogus norm parameter; check for errors when setting norm
henry
parents:
8477
diff
changeset
|
187 return 0; |
c268bbb804d9
handle bogus norm parameter; check for errors when setting norm
henry
parents:
8477
diff
changeset
|
188 } |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
189 |
9620
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
190 |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
191 #ifdef HAVE_TV_V4L |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
192 if ( tv_param_mjpeg ) |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
193 { |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
194 /* set width to expected value */ |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
195 if (tv_param_width == -1) |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
196 { |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
197 tv_param_width = 704/tv_param_decimation; |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
198 } |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
199 if (tv_param_height == -1) |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
200 { |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
201 if ( tvh->norm != TV_NORM_NTSC ) |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
202 tv_param_height = 576/tv_param_decimation; |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
203 else |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
204 tv_param_height = 480/tv_param_decimation; |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
205 } |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
206 mp_msg(MSGT_TV, MSGL_INFO, |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
207 " MJP: width %d height %d\n", tv_param_width, tv_param_height); |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
208 } |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
209 #endif |
ce4cd85498f3
hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents:
9519
diff
changeset
|
210 |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
211 /* limits on w&h are norm-dependent -- JM */ |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
212 /* set width */ |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
213 if (tv_param_width != -1) |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
214 { |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
215 if (funcs->control(tvh->priv, TVI_CONTROL_VID_CHK_WIDTH, &tv_param_width) == TVI_CONTROL_TRUE) |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
216 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_WIDTH, &tv_param_width); |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
217 else |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
218 { |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
219 mp_msg(MSGT_TV, MSGL_ERR, "Unable set requested width: %d\n", tv_param_width); |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
220 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_WIDTH, &tv_param_width); |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
221 } |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
222 } |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
223 |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
224 /* set height */ |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
225 if (tv_param_height != -1) |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
226 { |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
227 if (funcs->control(tvh->priv, TVI_CONTROL_VID_CHK_HEIGHT, &tv_param_height) == TVI_CONTROL_TRUE) |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
228 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_HEIGHT, &tv_param_height); |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
229 else |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
230 { |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
231 mp_msg(MSGT_TV, MSGL_ERR, "Unable set requested height: %d\n", tv_param_height); |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
232 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HEIGHT, &tv_param_height); |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
233 } |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
234 } |
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
235 |
3284 | 236 if (funcs->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) != TVI_CONTROL_TRUE) |
237 { | |
238 mp_msg(MSGT_TV, MSGL_WARN, "Selected input hasn't got a tuner!\n"); | |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
239 goto done; |
3284 | 240 } |
241 | |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
242 /* select channel list */ |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
243 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
|
244 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
245 if (!strcasecmp(chanlists[i].name, tv_param_chanlist)) |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
246 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
247 tvh->chanlist = i; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
248 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
|
249 break; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
250 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
251 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
252 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
253 if (tvh->chanlist == -1) |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
254 mp_msg(MSGT_TV, MSGL_WARN, "Unable to find selected channel list! (%s)\n", |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
255 tv_param_chanlist); |
3284 | 256 else |
7318
85897ab199a4
changed message leveles (too many non-sense info messages)
alex
parents:
7163
diff
changeset
|
257 mp_msg(MSGT_TV, MSGL_V, "Selected channel list: %s (including %d channels)\n", |
3284 | 258 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
|
259 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
260 if (tv_param_freq && tv_param_channel) |
3284 | 261 { |
262 mp_msg(MSGT_TV, MSGL_WARN, "You can't set frequency and channel simultanly!\n"); | |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
263 goto done; |
3284 | 264 } |
265 | |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
266 /* Handle channels names */ |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
267 if (tv_param_channels) { |
9519 | 268 char** channels = tv_param_channels; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
269 mp_msg(MSGT_TV, MSGL_INFO, "TV Channels names detected.\n"); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
270 tv_channel_list = malloc(sizeof(tv_channels_t)); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
271 tv_channel_list->index=1; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
272 tv_channel_list->next=NULL; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
273 tv_channel_list->prev=NULL; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
274 tv_channel_current = tv_channel_list; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
275 |
9519 | 276 while (*channels) { |
277 char* tmp = *(channels++); | |
8955
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
278 char* sep = strchr(tmp,'-'); |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
279 int i; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
280 struct CHANLIST cl; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
281 |
8955
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
282 if (!sep) continue; // Wrong syntax, but mplayer should not crash |
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
283 |
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
284 strcpy(tv_channel_current->name, sep + 1); |
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
285 sep[0] = '\0'; |
8820 | 286 strncpy(tv_channel_current->number, tmp, 5); |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
287 |
8955
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
288 while ((sep=strchr(tv_channel_current->name, '_'))) |
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
289 sep[0] = ' '; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
290 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
291 tv_channel_current->freq = 0; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
292 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
|
293 cl = tvh->chanlist_s[i]; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
294 if (!strcasecmp(cl.name, tv_channel_current->number)) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
295 tv_channel_current->freq=cl.freq; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
296 break; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
297 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
298 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
299 if (tv_channel_current->freq == 0) |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
300 mp_msg(MSGT_TV, MSGL_ERR, "Couldn't find frequency for channel %s (%s)\n", |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
301 tv_channel_current->number, tv_channel_current->name); |
9889
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
302 else { |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
303 sep = strchr(tv_channel_current->name, '-'); |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
304 if ( !sep ) sep = strchr(tv_channel_current->name, '+'); |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
305 |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
306 if ( sep ) { |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
307 i = atoi (sep+1); |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
308 if ( sep[0] == '+' ) tv_channel_current->freq += i * 100; |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
309 if ( sep[0] == '-' ) tv_channel_current->freq -= i * 100; |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
310 sep[0] = '\0'; |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
311 } |
9dc39697e3b3
channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9663
diff
changeset
|
312 } |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
313 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
314 /*mp_msg(MSGT_TV, MSGL_INFO, "-- Detected channel %s - %s (%5.3f)\n", |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
315 tv_channel_current->number, tv_channel_current->name, |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
316 (float)tv_channel_current->freq/1000);*/ |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
317 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
318 tv_channel_current->next = malloc(sizeof(tv_channels_t)); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
319 tv_channel_current->next->index = tv_channel_current->index + 1; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
320 tv_channel_current->next->prev = tv_channel_current; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
321 tv_channel_current->next->next = NULL; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
322 tv_channel_current = tv_channel_current->next; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
323 } |
8955
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
324 if (tv_channel_current->prev) |
2454bcd4c3f3
sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents:
8820
diff
changeset
|
325 tv_channel_current->prev->next = NULL; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
326 free(tv_channel_current); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
327 } else |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
328 tv_channel_last_real = malloc(sizeof(char)*5); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
329 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
330 if (tv_channel_list) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
331 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
|
332 int channel = 0; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
333 if (tv_param_channel) |
10011
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
334 { |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
335 if (isdigit(*tv_param_channel)) |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
336 /* if tv_param_channel begins with a digit interpret it as a number */ |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
337 channel = atoi(tv_param_channel); |
10011
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
338 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
|
339 { |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
340 /* if tv_param_channel does not begin with a digit |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
341 set the first channel that contains tv_param_channel in its name */ |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
342 |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
343 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
|
344 while ( tv_channel_current ) { |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
345 if ( strstr(tv_channel_current->name, tv_param_channel) ) |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
346 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
|
347 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
|
348 } |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
349 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
|
350 } |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
351 } |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
352 else |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
353 channel = 1; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
354 |
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
|
355 if ( channel ) { |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
356 tv_channel_current = tv_channel_list; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
357 for (i = 1; i < channel; i++) |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
358 if (tv_channel_current->next) |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
359 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
|
360 } |
736ca83d609f
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents:
9927
diff
changeset
|
361 |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
362 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n", tv_channel_current->number, |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
363 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
|
364 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
|
365 tv_channel_last = tv_channel_current; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
366 } else { |
3284 | 367 /* we need to set frequency */ |
368 if (tv_param_freq) | |
369 { | |
370 unsigned long freq = atof(tv_param_freq)*16; | |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
371 |
3284 | 372 /* set freq in MHz */ |
373 funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_FREQ, &freq); | |
374 | |
375 funcs->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &freq); | |
7318
85897ab199a4
changed message leveles (too many non-sense info messages)
alex
parents:
7163
diff
changeset
|
376 mp_msg(MSGT_TV, MSGL_V, "Selected frequency: %lu (%.3f)\n", |
3284 | 377 freq, (float)freq/16); |
378 } | |
379 | |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
380 if (tv_param_channel) { |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
381 struct CHANLIST cl; |
3284 | 382 |
383 mp_msg(MSGT_TV, MSGL_V, "Requested channel: %s\n", tv_param_channel); | |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
384 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
|
385 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
386 cl = tvh->chanlist_s[i]; |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
387 // 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
|
388 // i, cl.name, cl.freq); |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
389 if (!strcasecmp(cl.name, tv_param_channel)) |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
390 { |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
391 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
|
392 tvh->channel = i; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
393 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n", |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
394 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
|
395 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
|
396 break; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
397 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
398 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
399 } |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
400 } |
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
|
401 |
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
|
402 /* 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
|
403 { |
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
|
404 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
|
405 int freq; |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
406 |
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
|
407 tv_get_freq(tvh, &i2); |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
408 |
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
|
409 freq = (int) (((float)(i2/16))*1000)+250; |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
410 |
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
|
411 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
|
412 { |
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
|
413 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
|
414 { |
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
|
415 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
|
416 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
|
417 } |
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
|
418 } |
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
|
419 } |
3284 | 420 |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
421 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
|
422 /* also start device! */ |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
423 return 1; |
2931 | 424 } |
425 | |
7329
9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents:
7318
diff
changeset
|
426 int demux_open_tv(demuxer_t *demuxer) |
2790 | 427 { |
7408 | 428 tvi_handle_t *tvh; |
429 sh_video_t *sh_video; | |
2802 | 430 sh_audio_t *sh_audio = NULL; |
7408 | 431 tvi_functions_t *funcs; |
432 | |
433 if(!(tvh=tv_begin())) return 0; | |
434 if (!tv_init(tvh)) return 0; | |
435 if (!open_tv(tvh)){ | |
436 tv_uninit(tvh); | |
437 return 0; | |
438 } | |
439 funcs = tvh->functions; | |
440 demuxer->priv=tvh; | |
2790 | 441 |
2802 | 442 sh_video = new_sh_video(demuxer, 0); |
2790 | 443 |
2932
fa3224774679
splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents:
2931
diff
changeset
|
444 /* get IMAGE FORMAT */ |
2802 | 445 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_FORMAT, &sh_video->format); |
2810 | 446 // if (IMGFMT_IS_RGB(sh_video->format) || IMGFMT_IS_BGR(sh_video->format)) |
3398 | 447 // sh_video->format = 0x0; |
2802 | 448 |
449 /* set FPS and FRAMETIME */ | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
450 |
2790 | 451 if(!sh_video->fps) |
452 { | |
10019 | 453 float tmp; |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
454 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
|
455 sh_video->fps = 25.0f; /* on PAL */ |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
456 else sh_video->fps = tmp; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
457 } |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
458 |
3285 | 459 if (tv_param_fps != -1.0f) |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
460 sh_video->fps = tv_param_fps; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
461 |
2790 | 462 sh_video->frametime = 1.0f/sh_video->fps; |
463 | |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
464 /* If playback only mode, go to immediate mode, fail silently */ |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
465 if(tv_param_immediate == 1) |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
466 { |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
467 funcs->control(tvh->priv, TVI_CONTROL_IMMEDIATE, 0); |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
468 tv_param_noaudio = 1; |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
469 } |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
470 |
8799 | 471 /* disable TV audio if -nosound is present */ |
472 if (!demuxer->audio || demuxer->audio->id == -2) { | |
473 tv_param_noaudio = 1; | |
474 } | |
475 | |
2790 | 476 /* 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
|
477 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_WIDTH, &sh_video->disp_w); |
2790 | 478 |
479 /* 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
|
480 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HEIGHT, &sh_video->disp_h); |
2802 | 481 |
9663 | 482 /* set color eq */ |
483 tv_set_color_options(tvh, TV_COLOR_BRIGHTNESS, tv_param_brightness); | |
484 tv_set_color_options(tvh, TV_COLOR_HUE, tv_param_hue); | |
485 tv_set_color_options(tvh, TV_COLOR_SATURATION, tv_param_saturation); | |
486 tv_set_color_options(tvh, TV_COLOR_CONTRAST, tv_param_contrast); | |
487 | |
2790 | 488 demuxer->video->sh = sh_video; |
489 sh_video->ds = demuxer->video; | |
490 demuxer->video->id = 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
|
491 |
9501 | 492 demuxer->seekable = 0; |
2790 | 493 |
494 /* here comes audio init */ | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
495 |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
496 if (tv_param_noaudio == 0 && funcs->control(tvh->priv, TVI_CONTROL_IS_AUDIO, 0) == TVI_CONTROL_TRUE) |
2802 | 497 { |
498 int audio_format; | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
499 int sh_audio_format; |
2802 | 500 |
501 /* yeah, audio is present */ | |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
502 |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
503 funcs->control(tvh->priv, TVI_CONTROL_AUD_SET_SAMPLERATE, |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
504 &tv_param_audiorate); |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
505 |
2802 | 506 if (funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_FORMAT, &audio_format) != TVI_CONTROL_TRUE) |
507 goto no_audio; | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
508 |
2802 | 509 switch(audio_format) |
510 { | |
511 case AFMT_U8: | |
512 case AFMT_S8: | |
513 case AFMT_U16_LE: | |
514 case AFMT_U16_BE: | |
515 case AFMT_S16_LE: | |
516 case AFMT_S16_BE: | |
517 case AFMT_S32_LE: | |
518 case AFMT_S32_BE: | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
519 sh_audio_format = 0x1; /* PCM */ |
2802 | 520 break; |
521 case AFMT_IMA_ADPCM: | |
522 case AFMT_MU_LAW: | |
523 case AFMT_A_LAW: | |
524 case AFMT_MPEG: | |
525 case AFMT_AC3: | |
526 default: | |
6161
c50ea0721e78
applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents:
5923
diff
changeset
|
527 mp_msg(MSGT_TV, MSGL_ERR, "Audio type '%s (%x)' unsupported!\n", |
c50ea0721e78
applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents:
5923
diff
changeset
|
528 audio_out_format_name(audio_format), audio_format); |
2802 | 529 goto no_audio; |
530 } | |
531 | |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
532 sh_audio = new_sh_audio(demuxer, 0); |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
533 |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
534 funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_SAMPLERATE, |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
535 &sh_audio->samplerate); |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
536 funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_SAMPLESIZE, |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
537 &sh_audio->samplesize); |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
538 funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_CHANNELS, |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
539 &sh_audio->channels); |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
540 |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
541 sh_audio->format = sh_audio_format; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
542 sh_audio->sample_format = audio_format; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
543 |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
544 sh_audio->i_bps = sh_audio->o_bps = |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
545 sh_audio->samplerate * sh_audio->samplesize * |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
546 sh_audio->channels; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
547 |
5572
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
548 // emulate WF for win32 codecs: |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
549 sh_audio->wf = (WAVEFORMATEX *)malloc(sizeof(WAVEFORMATEX)); |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
550 sh_audio->wf->wFormatTag = sh_audio->format; |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
551 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
|
552 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
|
553 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
|
554 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
|
555 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
|
556 |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
557 mp_msg(MSGT_DECVIDEO, MSGL_V, " TV audio: %d channels, %d bits, %d Hz\n", |
8cd761968f35
BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents:
5087
diff
changeset
|
558 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
|
559 sh_audio->wf->nSamplesPerSec); |
2802 | 560 |
561 demuxer->audio->sh = sh_audio; | |
562 sh_audio->ds = demuxer->audio; | |
563 demuxer->audio->id = 0; | |
564 } | |
565 no_audio: | |
566 | |
7329
9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents:
7318
diff
changeset
|
567 if(!(funcs->start(tvh->priv))){ |
9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents:
7318
diff
changeset
|
568 // start failed :( |
9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents:
7318
diff
changeset
|
569 tv_uninit(tvh); |
9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents:
7318
diff
changeset
|
570 return 0; |
9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents:
7318
diff
changeset
|
571 } |
9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents:
7318
diff
changeset
|
572 return 1; |
2790 | 573 } |
574 | |
7329
9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents:
7318
diff
changeset
|
575 int 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
|
576 { |
7408 | 577 tvi_handle_t *tvh=(tvi_handle_t*)(demuxer->priv); |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
578 return(tvh->functions->uninit(tvh->priv)); |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
579 } |
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
580 |
2790 | 581 /* ================== STREAM_TV ===================== */ |
6161
c50ea0721e78
applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents:
5923
diff
changeset
|
582 tvi_handle_t *tvi_init_dummy(char *device); |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
583 tvi_handle_t *tvi_init_v4l(char *device, char *adevice); |
6161
c50ea0721e78
applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents:
5923
diff
changeset
|
584 tvi_handle_t *tvi_init_bsdbt848(char *device); |
c50ea0721e78
applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents:
5923
diff
changeset
|
585 |
2802 | 586 tvi_handle_t *tv_begin(void) |
2790 | 587 { |
588 if (!strcmp(tv_param_driver, "dummy")) | |
6161
c50ea0721e78
applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents:
5923
diff
changeset
|
589 return tvi_init_dummy(tv_param_device); |
3249 | 590 #ifdef HAVE_TV_V4L |
2790 | 591 if (!strcmp(tv_param_driver, "v4l")) |
7058
2e5c07262861
new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents:
6161
diff
changeset
|
592 return tvi_init_v4l(tv_param_device, tv_param_adevice); |
3249 | 593 #endif |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
594 #ifdef HAVE_TV_BSDBT848 |
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
595 if (!strcmp(tv_param_driver, "bsdbt848")) |
6161
c50ea0721e78
applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents:
5923
diff
changeset
|
596 return tvi_init_bsdbt848(tv_param_device); |
5087
1d54c3a27093
audio support and pts based packet handling by Charles Henrich
alex
parents:
4350
diff
changeset
|
597 #endif |
2790 | 598 |
599 mp_msg(MSGT_TV, MSGL_ERR, "No such driver: %s\n", tv_param_driver); | |
600 return(NULL); | |
601 } | |
602 | |
2802 | 603 int tv_init(tvi_handle_t *tvh) |
2790 | 604 { |
2818 | 605 mp_msg(MSGT_TV, MSGL_INFO, "Selected driver: %s\n", tvh->info->short_name); |
606 mp_msg(MSGT_TV, MSGL_INFO, " name: %s\n", tvh->info->name); | |
607 mp_msg(MSGT_TV, MSGL_INFO, " author: %s\n", tvh->info->author); | |
2802 | 608 if (tvh->info->comment) |
2818 | 609 mp_msg(MSGT_TV, MSGL_INFO, " comment: %s\n", tvh->info->comment); |
2790 | 610 |
3815 | 611 return(tvh->functions->init(tvh->priv)); |
2837 | 612 } |
613 | |
614 int tv_uninit(tvi_handle_t *tvh) | |
615 { | |
616 return(tvh->functions->uninit(tvh->priv)); | |
2790 | 617 } |
2937 | 618 |
619 /* utilities for mplayer (not mencoder!!) */ | |
620 int tv_set_color_options(tvi_handle_t *tvh, int opt, int value) | |
621 { | |
622 tvi_functions_t *funcs = tvh->functions; | |
623 | |
624 switch(opt) | |
625 { | |
626 case TV_COLOR_BRIGHTNESS: | |
627 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_BRIGHTNESS, &value); | |
628 break; | |
629 case TV_COLOR_HUE: | |
630 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_HUE, &value); | |
631 break; | |
632 case TV_COLOR_SATURATION: | |
633 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_SATURATION, &value); | |
634 break; | |
635 case TV_COLOR_CONTRAST: | |
636 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_CONTRAST, &value); | |
637 break; | |
638 default: | |
639 mp_msg(MSGT_TV, MSGL_WARN, "Unknown color option (%d) specified!\n", opt); | |
640 } | |
641 | |
642 return(1); | |
643 } | |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
644 |
7806
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
645 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
|
646 { |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
647 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
|
648 { |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
649 tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, freq); |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
650 mp_msg(MSGT_TV, MSGL_V, "Current frequency: %lu (%.3f)\n", |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
651 *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
|
652 } |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
653 return(1); |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
654 } |
6a6f6b8b2ac7
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents:
7472
diff
changeset
|
655 |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
656 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
|
657 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
658 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
|
659 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
660 // unsigned long freq = atof(tv_param_freq)*16; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
661 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
662 /* 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
|
663 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
|
664 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
665 tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &freq); |
7318
85897ab199a4
changed message leveles (too many non-sense info messages)
alex
parents:
7163
diff
changeset
|
666 mp_msg(MSGT_TV, MSGL_V, "Current frequency: %lu (%.3f)\n", |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
667 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
|
668 } |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7408
diff
changeset
|
669 return(1); |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
670 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
671 |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
672 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
|
673 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
674 struct CHANLIST cl; |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
675 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
676 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
|
677 { |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
678 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
|
679 { |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
680 strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name); |
5923 | 681 cl = tvh->chanlist_s[--tvh->channel]; |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
682 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n", |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
683 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
|
684 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
|
685 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
686 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
687 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
688 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
|
689 { |
4242 | 690 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
|
691 { |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
692 strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name); |
5923 | 693 cl = tvh->chanlist_s[++tvh->channel]; |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
694 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n", |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
695 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
|
696 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
|
697 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
698 } |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7408
diff
changeset
|
699 return(1); |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
700 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
701 |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
702 int tv_step_channel(tvi_handle_t *tvh, int direction) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
703 if (tv_channel_list) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
704 if (direction == TV_CHANNEL_HIGHER) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
705 if (tv_channel_current->next) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
706 tv_channel_last = tv_channel_current; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
707 tv_channel_current = tv_channel_current->next; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
708 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
|
709 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n", |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
710 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
|
711 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
712 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
713 if (direction == TV_CHANNEL_LOWER) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
714 if (tv_channel_current->prev) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
715 tv_channel_last = tv_channel_current; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
716 tv_channel_current = tv_channel_current->prev; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
717 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
|
718 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n", |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
719 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
|
720 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
721 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
722 } else tv_step_channel_real(tvh, direction); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
723 return(1); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
724 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
725 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
726 int tv_set_channel_real(tvi_handle_t *tvh, char *channel) { |
8494 | 727 int i; |
728 struct CHANLIST cl; | |
729 | |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
730 strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name); |
8494 | 731 for (i = 0; i < chanlists[tvh->chanlist].count; i++) |
732 { | |
733 cl = tvh->chanlist_s[i]; | |
734 // printf("count%d: name: %s, freq: %d\n", | |
735 // i, cl.name, cl.freq); | |
736 if (!strcasecmp(cl.name, channel)) | |
737 { | |
738 tvh->channel = i; | |
739 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n", | |
740 cl.name, (float)cl.freq/1000); | |
741 tv_set_freq(tvh, (unsigned long)(((float)cl.freq/1000)*16)); | |
742 break; | |
743 } | |
744 } | |
8627
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
745 return(1); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
746 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
747 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
748 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
|
749 int i, channel_int; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
750 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
751 if (tv_channel_list) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
752 tv_channel_last = tv_channel_current; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
753 channel_int = atoi(channel); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
754 tv_channel_current = tv_channel_list; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
755 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
|
756 if (tv_channel_current->next) |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
757 tv_channel_current = tv_channel_current->next; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
758 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n", tv_channel_current->number, |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
759 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
|
760 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
|
761 } else tv_set_channel_real(tvh, channel); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
762 return(1); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
763 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
764 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
765 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
|
766 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
767 if (tv_channel_list) { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
768 tv_channels_t *tmp; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
769 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
770 tmp = tv_channel_last; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
771 tv_channel_last = tv_channel_current; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
772 tv_channel_current = tmp; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
773 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
774 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n", tv_channel_current->number, |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
775 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
|
776 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
|
777 } else { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
778 int i; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
779 struct CHANLIST cl; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
780 |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
781 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
|
782 { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
783 cl = tvh->chanlist_s[i]; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
784 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
|
785 { |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
786 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
|
787 tvh->channel = i; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
788 mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n", |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
789 cl.name, (float)cl.freq/1000); |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
790 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
|
791 break; |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
792 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
793 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
794 } |
14ab71b47a58
user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents:
8494
diff
changeset
|
795 return(1); |
8494 | 796 } |
797 | |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
798 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
|
799 { |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7408
diff
changeset
|
800 return(1); |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
801 } |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
802 |
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
803 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
|
804 { |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7408
diff
changeset
|
805 return(1); |
2941
60c1b7c0ea21
added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents:
2937
diff
changeset
|
806 } |
2790 | 807 #endif /* USE_TV */ |