annotate stream/tv.c @ 23542:2e13eea875a3

Copile fix: missing libswscale part of ffmpeg r9322 TARGET_ARCH -> ARCH change.
author reimar
date Sat, 16 Jun 2007 15:17:00 +0000
parents a6c619ee9d30
children 21c28c2645fe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
1 /*
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
2 TV Interface for MPlayer
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
3
10368
6fb8a6a4a071 removing my (nonworking) email address
alex
parents: 10242
diff changeset
4 (C) Alex Beregszaszi
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
5
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
6 API idea based on libvo2
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
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
98769cea155c added tv subsystem
alex
parents:
diff changeset
11 */
98769cea155c added tv subsystem
alex
parents:
diff changeset
12
98769cea155c added tv subsystem
alex
parents:
diff changeset
13 #include <stdio.h>
98769cea155c added tv subsystem
alex
parents:
diff changeset
14 #include <stdlib.h>
98769cea155c added tv subsystem
alex
parents:
diff changeset
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
4e34d468f549 warning fixes by Dominik
alex
parents: 10019
diff changeset
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
98769cea155c added tv subsystem
alex
parents:
diff changeset
19
98769cea155c added tv subsystem
alex
parents:
diff changeset
20 #include "config.h"
98769cea155c added tv subsystem
alex
parents:
diff changeset
21
2819
2e58962dc9fe cleaned up some warnings, and tv_param_on moved out from #ifdef USE_TV
alex
parents: 2818
diff changeset
22
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
23 #include "mp_msg.h"
98769cea155c added tv subsystem
alex
parents:
diff changeset
24 #include "help_mp.h"
98769cea155c added tv subsystem
alex
parents:
diff changeset
25
98769cea155c added tv subsystem
alex
parents:
diff changeset
26 #include "stream.h"
19312
ab8d6b6deb63 proper inclusion of demuxer.h (including libmpdemux in Makefile only was to make previous split easier)
ben
parents: 19271
diff changeset
27 #include "libmpdemux/demuxer.h"
ab8d6b6deb63 proper inclusion of demuxer.h (including libmpdemux in Makefile only was to make previous split easier)
ben
parents: 19271
diff changeset
28 #include "libmpdemux/stheader.h"
2830
596a6ba3520f never include files from public headers...
arpi
parents: 2819
diff changeset
29
17012
6ff3379a0862 Unify include path handling, -I.. is in CFLAGS.
diego
parents: 16961
diff changeset
30 #include "libaf/af_format.h"
19431
ac69ba536915 Explicitly include libmpcodecs/img_format.h and libvo/fastmemcpy.h.
diego
parents: 19312
diff changeset
31 #include "libmpcodecs/img_format.h"
2830
596a6ba3520f never include files from public headers...
arpi
parents: 2819
diff changeset
32
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
33 #include "tv.h"
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
34
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
35 #include "frequencies.h"
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
36
23510
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
37 #ifdef HAVE_TV_TELETEXT
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
38 #include "tvi_vbi.h"
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
39 #endif
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
40
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
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
c63562f5f56f tuning worx (can set frequency)
alex
parents: 2830
diff changeset
45 char *tv_param_freq = NULL;
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
46 char *tv_param_channel = NULL;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
47 char *tv_param_norm = "pal";
10537
31f12f99118b v4l2 support
henry
parents: 10521
diff changeset
48 #ifdef HAVE_TV_V4L2
31f12f99118b v4l2 support
henry
parents: 10521
diff changeset
49 int tv_param_normid = -1;
31f12f99118b v4l2 support
henry
parents: 10521
diff changeset
50 #endif
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
51 char *tv_param_chanlist = "europe-east";
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
52 char *tv_param_device = NULL;
98769cea155c added tv subsystem
alex
parents:
diff changeset
53 char *tv_param_driver = "dummy";
98769cea155c added tv subsystem
alex
parents:
diff changeset
54 int tv_param_width = -1;
98769cea155c added tv subsystem
alex
parents:
diff changeset
55 int tv_param_height = -1;
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
56 int tv_param_input = 0; /* used in v4l and bttv */
17862
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
57 int tv_param_outfmt = -1;
3285
bd7bff4cb453 add tv fps support
alex
parents: 3284
diff changeset
58 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
59 char **tv_param_channels = NULL;
10822
6377c7d0459e audio id setting support for bsdbt848 by Nikolay Nikolaev <nicknickolaev@yahoo.com>
alex
parents: 10771
diff changeset
60 int tv_param_audio_id = 0;
23422
e7b4c913dc31 New "automute" tv:// option.
voroshil
parents: 23377
diff changeset
61 int tv_param_automute = 0;
19189
0506fc913c27 Introduce general V4L variable/define.
diego
parents: 19187
diff changeset
62 #if defined(HAVE_TV_V4L)
7163
a193df8b275b v4l audio fixes by Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz>
alex
parents: 7058
diff changeset
63 int tv_param_amode = -1;
11986
80f8c8cffa31 dont mess up v4l volumes
attila
parents: 11775
diff changeset
64 int tv_param_volume = -1;
7163
a193df8b275b v4l audio fixes by Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz>
alex
parents: 7058
diff changeset
65 int tv_param_bass = -1;
a193df8b275b v4l audio fixes by Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz>
alex
parents: 7058
diff changeset
66 int tv_param_treble = -1;
a193df8b275b v4l audio fixes by Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz>
alex
parents: 7058
diff changeset
67 int tv_param_balance = -1;
a193df8b275b v4l audio fixes by Jindrich Makovicka <makovick@KMLinux.fjfi.cvut.cz>
alex
parents: 7058
diff changeset
68 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
69 int tv_param_force_audio = 0;
7905
b062996d9794 added an option for specifying the size of capture buffer
henry
parents: 7835
diff changeset
70 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
71 int tv_param_mjpeg = 0;
ce4cd85498f3 hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents: 9519
diff changeset
72 int tv_param_decimation = 2;
ce4cd85498f3 hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents: 9519
diff changeset
73 int tv_param_quality = 90;
11775
66e491c35dc8 ALSA 1.x audio out driver
henry
parents: 10822
diff changeset
74 #if defined(HAVE_ALSA9) || defined(HAVE_ALSA1X)
7058
2e5c07262861 new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents: 6161
diff changeset
75 int tv_param_alsa = 0;
2e5c07262861 new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents: 6161
diff changeset
76 #endif
22381
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
77 #endif
7058
2e5c07262861 new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents: 6161
diff changeset
78 char* tv_param_adevice = NULL;
9663
596ad944a65e color equalizer for tv input
henry
parents: 9620
diff changeset
79 int tv_param_brightness = 0;
596ad944a65e color equalizer for tv input
henry
parents: 9620
diff changeset
80 int tv_param_contrast = 0;
596ad944a65e color equalizer for tv input
henry
parents: 9620
diff changeset
81 int tv_param_hue = 0;
596ad944a65e color equalizer for tv input
henry
parents: 9620
diff changeset
82 int tv_param_saturation = 0;
14607
7a80c6ac5058 several sets of headers declare global variables in them, which causes multiple definition errors with gcc 4.x
iive
parents: 14255
diff changeset
83 tv_channels_t *tv_channel_list;
7a80c6ac5058 several sets of headers declare global variables in them, which causes multiple definition errors with gcc 4.x
iive
parents: 14255
diff changeset
84 tv_channels_t *tv_channel_current, *tv_channel_last;
7a80c6ac5058 several sets of headers declare global variables in them, which causes multiple definition errors with gcc 4.x
iive
parents: 14255
diff changeset
85 char *tv_channel_last_real;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
86
22381
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
87 /* enumerating drivers (like in stream.c) */
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
88 extern tvi_info_t tvi_info_dummy;
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
89 #ifdef HAVE_TV_V4L1
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
90 extern tvi_info_t tvi_info_v4l;
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
91 #endif
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
92 #ifdef HAVE_TV_V4L2
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
93 extern tvi_info_t tvi_info_v4l2;
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
94 #endif
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
95 #ifdef HAVE_TV_BSDBT848
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
96 extern tvi_info_t tvi_info_bsdbt848;
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
97 #endif
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
98
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
99 static const tvi_info_t* tvi_driver_list[]={
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
100 &tvi_info_dummy,
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
101 #ifdef HAVE_TV_V4L1
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
102 &tvi_info_v4l,
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
103 #endif
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
104 #ifdef HAVE_TV_V4L2
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
105 &tvi_info_v4l2,
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
106 #endif
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
107 #ifdef HAVE_TV_BSDBT848
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
108 &tvi_info_bsdbt848,
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
109 #endif
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
110 NULL
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
111 };
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
112
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
113
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
114 /* ================== DEMUX_TV ===================== */
98769cea155c added tv subsystem
alex
parents:
diff changeset
115 /*
98769cea155c added tv subsystem
alex
parents:
diff changeset
116 Return value:
98769cea155c added tv subsystem
alex
parents:
diff changeset
117 0 = EOF(?) or no stream
98769cea155c added tv subsystem
alex
parents:
diff changeset
118 1 = successfully read a packet
98769cea155c added tv subsystem
alex
parents:
diff changeset
119 */
98769cea155c added tv subsystem
alex
parents:
diff changeset
120 /* fill demux->video and demux->audio */
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
121
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15419
diff changeset
122 static int demux_tv_fill_buffer(demuxer_t *demux, demux_stream_t *ds)
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
123 {
7408
0c6948b8100f stream layer cleanup part 2
arpi
parents: 7329
diff changeset
124 tvi_handle_t *tvh=(tvi_handle_t*)(demux->priv);
2813
d6d88771f5ef demuxer fixed
arpi
parents: 2810
diff changeset
125 demux_packet_t* dp;
9927
ea1274e658b4 mingw fix
faust3
parents: 9889
diff changeset
126 unsigned int len=0;
22969
c8ace3e97d73 cosmetics. restore empty line removed in r22985.
voroshil
parents: 22967
diff changeset
127
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
128 /* ================== ADD AUDIO PACKET =================== */
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
129
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
130 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
131 tvh->functions->control(tvh->priv,
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
132 TVI_CONTROL_IS_AUDIO, 0) == TVI_CONTROL_TRUE)
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
133 {
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
134 len = tvh->functions->get_audio_framesize(tvh->priv);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
135
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
136 dp=new_demux_packet(len);
12034
90315c910b26 Raw audio and video are always keyframes
ranma
parents: 11986
diff changeset
137 dp->flags|=1; /* Keyframe */
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
138 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
139 ds_add_packet(demux->audio,dp);
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
140 }
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
141
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
142 /* ================== ADD VIDEO PACKET =================== */
98769cea155c added tv subsystem
alex
parents:
diff changeset
143
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
144 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
145 TVI_CONTROL_IS_VIDEO, 0) == TVI_CONTROL_TRUE)
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
146 {
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
147 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
148 dp=new_demux_packet(len);
12034
90315c910b26 Raw audio and video are always keyframes
ranma
parents: 11986
diff changeset
149 dp->flags|=1; /* Keyframe */
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
150 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
151 ds_add_packet(demux->video,dp);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
152 }
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
153
98769cea155c added tv subsystem
alex
parents:
diff changeset
154 return 1;
98769cea155c added tv subsystem
alex
parents:
diff changeset
155 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
156
13978
2a9afbfc79d7 setting the norm using text ID instead of numeric
henry
parents: 12034
diff changeset
157 static int norm_from_string(tvi_handle_t *tvh, char* norm)
10521
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
158 {
13978
2a9afbfc79d7 setting the norm using text ID instead of numeric
henry
parents: 12034
diff changeset
159 #ifdef HAVE_TV_V4L2
2a9afbfc79d7 setting the norm using text ID instead of numeric
henry
parents: 12034
diff changeset
160 if (strcmp(tv_param_driver, "v4l2") != 0) {
2a9afbfc79d7 setting the norm using text ID instead of numeric
henry
parents: 12034
diff changeset
161 #endif
10521
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
162 if (!strcasecmp(norm, "pal"))
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
163 return TV_NORM_PAL;
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
164 else if (!strcasecmp(norm, "ntsc"))
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
165 return TV_NORM_NTSC;
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
166 else if (!strcasecmp(norm, "secam"))
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
167 return TV_NORM_SECAM;
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
168 else if (!strcasecmp(norm, "palnc"))
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
169 return TV_NORM_PALNC;
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
170 else if (!strcasecmp(norm, "palm"))
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
171 return TV_NORM_PALM;
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
172 else if (!strcasecmp(norm, "paln"))
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
173 return TV_NORM_PALN;
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
174 else if (!strcasecmp(norm, "ntscjp"))
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
175 return TV_NORM_NTSCJP;
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
176 else {
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
177 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_BogusNormParameter, norm, "PAL");
10521
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
178 return TV_NORM_PAL;
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
179 }
13978
2a9afbfc79d7 setting the norm using text ID instead of numeric
henry
parents: 12034
diff changeset
180 #ifdef HAVE_TV_V4L2
2a9afbfc79d7 setting the norm using text ID instead of numeric
henry
parents: 12034
diff changeset
181 } else {
2a9afbfc79d7 setting the norm using text ID instead of numeric
henry
parents: 12034
diff changeset
182 tvi_functions_t *funcs = tvh->functions;
2a9afbfc79d7 setting the norm using text ID instead of numeric
henry
parents: 12034
diff changeset
183 char str[8];
2a9afbfc79d7 setting the norm using text ID instead of numeric
henry
parents: 12034
diff changeset
184 strncpy(str, norm, sizeof(str)-1);
2a9afbfc79d7 setting the norm using text ID instead of numeric
henry
parents: 12034
diff changeset
185 str[sizeof(str)-1] = '\0';
2a9afbfc79d7 setting the norm using text ID instead of numeric
henry
parents: 12034
diff changeset
186 if (funcs->control(tvh->priv, TVI_CONTROL_SPC_GET_NORMID, str) != TVI_CONTROL_TRUE)
22728
5e4a2438a0e2 Add missing bogus norm warning for v4l2
voroshil
parents: 22727
diff changeset
187 {
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
188 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_BogusNormParameter, norm,"default");
13978
2a9afbfc79d7 setting the norm using text ID instead of numeric
henry
parents: 12034
diff changeset
189 return 0;
22728
5e4a2438a0e2 Add missing bogus norm warning for v4l2
voroshil
parents: 22727
diff changeset
190 }
13978
2a9afbfc79d7 setting the norm using text ID instead of numeric
henry
parents: 12034
diff changeset
191 return *(int *)str;
2a9afbfc79d7 setting the norm using text ID instead of numeric
henry
parents: 12034
diff changeset
192 }
2a9afbfc79d7 setting the norm using text ID instead of numeric
henry
parents: 12034
diff changeset
193 #endif
10521
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
194 }
8123
9fc45fe0d444 *HUGE* set of compiler warning fixes, unused variables removal
arpi
parents: 7905
diff changeset
195
7408
0c6948b8100f stream layer cleanup part 2
arpi
parents: 7329
diff changeset
196 static int open_tv(tvi_handle_t *tvh)
2931
bce9c945b29c tv interface update
alex
parents: 2842
diff changeset
197 {
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
198 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
199 tvi_functions_t *funcs = tvh->functions;
17862
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
200 int tv_fmt_list[] = {
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
201 IMGFMT_YV12,
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
202 IMGFMT_I420,
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
203 IMGFMT_UYVY,
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
204 IMGFMT_YUY2,
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
205 IMGFMT_RGB32,
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
206 IMGFMT_RGB24,
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
207 IMGFMT_RGB16,
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
208 IMGFMT_RGB15
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
209 };
2932
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
210
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
211 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
212 {
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
213 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_NoVideoInputPresent);
3728
499ce786c30d As nobody fixed this yet:
pl
parents: 3703
diff changeset
214 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
215 }
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
216
17862
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
217 if (tv_param_outfmt == -1)
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
218 for (i = 0; i < sizeof (tv_fmt_list) / sizeof (*tv_fmt_list); i++)
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
219 {
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
220 tv_param_outfmt = tv_fmt_list[i];
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
221 if (funcs->control (tvh->priv, TVI_CONTROL_VID_SET_FORMAT,
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
222 &tv_param_outfmt) == TVI_CONTROL_TRUE)
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
223 break;
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
224 }
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
225 else
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
226 {
10598
2b88c28a3cfe Settled to CONF_TYPE_IMGFMT which simplified lot of things. Now there's no need to add new img formats to the source, instead you can try it out by providing it in hexa format, and if it isn't supported by the card, you get a nice error message. That's all.
alex
parents: 10581
diff changeset
227 switch(tv_param_outfmt)
2932
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
228 {
10598
2b88c28a3cfe Settled to CONF_TYPE_IMGFMT which simplified lot of things. Now there's no need to add new img formats to the source, instead you can try it out by providing it in hexa format, and if it isn't supported by the card, you get a nice error message. That's all.
alex
parents: 10581
diff changeset
229 case IMGFMT_YV12:
2b88c28a3cfe Settled to CONF_TYPE_IMGFMT which simplified lot of things. Now there's no need to add new img formats to the source, instead you can try it out by providing it in hexa format, and if it isn't supported by the card, you get a nice error message. That's all.
alex
parents: 10581
diff changeset
230 case IMGFMT_I420:
2b88c28a3cfe Settled to CONF_TYPE_IMGFMT which simplified lot of things. Now there's no need to add new img formats to the source, instead you can try it out by providing it in hexa format, and if it isn't supported by the card, you get a nice error message. That's all.
alex
parents: 10581
diff changeset
231 case IMGFMT_UYVY:
2b88c28a3cfe Settled to CONF_TYPE_IMGFMT which simplified lot of things. Now there's no need to add new img formats to the source, instead you can try it out by providing it in hexa format, and if it isn't supported by the card, you get a nice error message. That's all.
alex
parents: 10581
diff changeset
232 case IMGFMT_YUY2:
2b88c28a3cfe Settled to CONF_TYPE_IMGFMT which simplified lot of things. Now there's no need to add new img formats to the source, instead you can try it out by providing it in hexa format, and if it isn't supported by the card, you get a nice error message. That's all.
alex
parents: 10581
diff changeset
233 case IMGFMT_RGB32:
2b88c28a3cfe Settled to CONF_TYPE_IMGFMT which simplified lot of things. Now there's no need to add new img formats to the source, instead you can try it out by providing it in hexa format, and if it isn't supported by the card, you get a nice error message. That's all.
alex
parents: 10581
diff changeset
234 case IMGFMT_RGB24:
15419
da39fe11c872 BGR formats are ok, too
henry
parents: 14607
diff changeset
235 case IMGFMT_BGR32:
da39fe11c872 BGR formats are ok, too
henry
parents: 14607
diff changeset
236 case IMGFMT_BGR24:
da39fe11c872 BGR formats are ok, too
henry
parents: 14607
diff changeset
237 case IMGFMT_BGR16:
da39fe11c872 BGR formats are ok, too
henry
parents: 14607
diff changeset
238 case IMGFMT_BGR15:
10598
2b88c28a3cfe Settled to CONF_TYPE_IMGFMT which simplified lot of things. Now there's no need to add new img formats to the source, instead you can try it out by providing it in hexa format, and if it isn't supported by the card, you get a nice error message. That's all.
alex
parents: 10581
diff changeset
239 break;
2b88c28a3cfe Settled to CONF_TYPE_IMGFMT which simplified lot of things. Now there's no need to add new img formats to the source, instead you can try it out by providing it in hexa format, and if it isn't supported by the card, you get a nice error message. That's all.
alex
parents: 10581
diff changeset
240 default:
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
241 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_UnknownImageFormat,tv_param_outfmt);
2932
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
242 }
10598
2b88c28a3cfe Settled to CONF_TYPE_IMGFMT which simplified lot of things. Now there's no need to add new img formats to the source, instead you can try it out by providing it in hexa format, and if it isn't supported by the card, you get a nice error message. That's all.
alex
parents: 10581
diff changeset
243 funcs->control(tvh->priv, TVI_CONTROL_VID_SET_FORMAT, &tv_param_outfmt);
17862
ecb2023ee4b6 Try several formats instead of only YV12 if no format was explicitly
albeu
parents: 17174
diff changeset
244 }
2932
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
245
7058
2e5c07262861 new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents: 6161
diff changeset
246 /* set some params got from cmdline */
2e5c07262861 new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents: 6161
diff changeset
247 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
248
10537
31f12f99118b v4l2 support
henry
parents: 10521
diff changeset
249 #ifdef HAVE_TV_V4L2
13978
2a9afbfc79d7 setting the norm using text ID instead of numeric
henry
parents: 12034
diff changeset
250 if (!strcmp(tv_param_driver, "v4l2") && tv_param_normid >= 0) {
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
251 mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_SelectedNormId, tv_param_normid);
13978
2a9afbfc79d7 setting the norm using text ID instead of numeric
henry
parents: 12034
diff changeset
252 if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tv_param_normid) != TVI_CONTROL_TRUE) {
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
253 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_CannotSetNorm);
13978
2a9afbfc79d7 setting the norm using text ID instead of numeric
henry
parents: 12034
diff changeset
254 }
2a9afbfc79d7 setting the norm using text ID instead of numeric
henry
parents: 12034
diff changeset
255 } else {
10537
31f12f99118b v4l2 support
henry
parents: 10521
diff changeset
256 #endif
7058
2e5c07262861 new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents: 6161
diff changeset
257 /* select video norm */
13978
2a9afbfc79d7 setting the norm using text ID instead of numeric
henry
parents: 12034
diff changeset
258 tvh->norm = norm_from_string(tvh, tv_param_norm);
7058
2e5c07262861 new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents: 6161
diff changeset
259
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
260 mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_SelectedNorm, tv_param_norm);
8486
c268bbb804d9 handle bogus norm parameter; check for errors when setting norm
henry
parents: 8477
diff changeset
261 if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) {
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
262 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_CannotSetNorm);
8486
c268bbb804d9 handle bogus norm parameter; check for errors when setting norm
henry
parents: 8477
diff changeset
263 }
10537
31f12f99118b v4l2 support
henry
parents: 10521
diff changeset
264 #ifdef HAVE_TV_V4L2
31f12f99118b v4l2 support
henry
parents: 10521
diff changeset
265 }
31f12f99118b v4l2 support
henry
parents: 10521
diff changeset
266 #endif
9620
ce4cd85498f3 hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents: 9519
diff changeset
267
19187
97ea9a6616df Rename *v4l variable to *v4l1.
diego
parents: 19062
diff changeset
268 #ifdef HAVE_TV_V4L1
9620
ce4cd85498f3 hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents: 9519
diff changeset
269 if ( tv_param_mjpeg )
ce4cd85498f3 hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents: 9519
diff changeset
270 {
ce4cd85498f3 hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents: 9519
diff changeset
271 /* set width to expected value */
ce4cd85498f3 hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents: 9519
diff changeset
272 if (tv_param_width == -1)
ce4cd85498f3 hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents: 9519
diff changeset
273 {
ce4cd85498f3 hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents: 9519
diff changeset
274 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
275 }
ce4cd85498f3 hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents: 9519
diff changeset
276 if (tv_param_height == -1)
ce4cd85498f3 hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents: 9519
diff changeset
277 {
ce4cd85498f3 hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents: 9519
diff changeset
278 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
279 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
280 else
ce4cd85498f3 hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents: 9519
diff changeset
281 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
282 }
ce4cd85498f3 hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents: 9519
diff changeset
283 mp_msg(MSGT_TV, MSGL_INFO,
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
284 MSGTR_TV_MJP_WidthHeight, tv_param_width, tv_param_height);
9620
ce4cd85498f3 hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents: 9519
diff changeset
285 }
ce4cd85498f3 hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents: 9519
diff changeset
286 #endif
ce4cd85498f3 hardware mjpeg encoding using v4l by Iv«”n Sz«”nt«Ń <szivan@freemail.hu>
henry
parents: 9519
diff changeset
287
7058
2e5c07262861 new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents: 6161
diff changeset
288 /* 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
289 /* 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
290 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
291 {
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
292 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
293 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
294 else
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
295 {
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
296 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_UnableToSetWidth, tv_param_width);
2932
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
297 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
298 }
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
299 }
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
300
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
301 /* 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
302 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
303 {
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
304 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
305 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
306 else
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
307 {
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
308 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_UnableToSetHeight, tv_param_height);
2932
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
309 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
310 }
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
311 }
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
312
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
313 if (funcs->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) != TVI_CONTROL_TRUE)
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
314 {
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
315 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_NoTuner);
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
316 goto done;
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
317 }
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
318
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
319 /* select channel list */
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
320 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
321 {
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
322 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
323 {
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
324 tvh->chanlist = i;
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
325 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
326 break;
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
327 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
328 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
329
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
330 if (tvh->chanlist == -1)
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
331 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_UnableFindChanlist,
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
332 tv_param_chanlist);
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
333 else
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
334 mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_SelectedChanlist,
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
335 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
336
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
337 if (tv_param_freq && tv_param_channel)
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
338 {
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
339 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_ChannelFreqParamConflict);
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
340 goto done;
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
341 }
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
342
10771
2f213f786e41 spelling fixes
diego
parents: 10598
diff changeset
343 /* Handle channel names */
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
344 if (tv_param_channels) {
9519
34b636d19268 10L never blowup an option pointer !!!!
albeu
parents: 9501
diff changeset
345 char** channels = tv_param_channels;
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
346 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_ChannelNamesDetected);
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
347 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
348 tv_channel_list->index=1;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
349 tv_channel_list->next=NULL;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
350 tv_channel_list->prev=NULL;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
351 tv_channel_current = tv_channel_list;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
352
9519
34b636d19268 10L never blowup an option pointer !!!!
albeu
parents: 9501
diff changeset
353 while (*channels) {
34b636d19268 10L never blowup an option pointer !!!!
albeu
parents: 9501
diff changeset
354 char* tmp = *(channels++);
8955
2454bcd4c3f3 sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents: 8820
diff changeset
355 char* sep = strchr(tmp,'-');
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
356 int i;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
357 struct CHANLIST cl;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
358
8955
2454bcd4c3f3 sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents: 8820
diff changeset
359 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
360
18761
4168044c1be4 fix a buffer overflow causing a segfault
aurel
parents: 18366
diff changeset
361 strlcpy(tv_channel_current->name, sep + 1,
4168044c1be4 fix a buffer overflow causing a segfault
aurel
parents: 18366
diff changeset
362 sizeof(tv_channel_current->name));
8955
2454bcd4c3f3 sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents: 8820
diff changeset
363 sep[0] = '\0';
8820
56fc9c8a8692 10l? :)
arpi
parents: 8799
diff changeset
364 strncpy(tv_channel_current->number, tmp, 5);
22619
86edaa8501c1 Allow to specify frequencies in channels option.
voroshil
parents: 22381
diff changeset
365 tv_channel_current->number[4]='\0';
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
366
8955
2454bcd4c3f3 sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents: 8820
diff changeset
367 while ((sep=strchr(tv_channel_current->name, '_')))
2454bcd4c3f3 sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents: 8820
diff changeset
368 sep[0] = ' ';
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
369
22619
86edaa8501c1 Allow to specify frequencies in channels option.
voroshil
parents: 22381
diff changeset
370 // if channel number is a number and larger than 1000 threat it as frequency
86edaa8501c1 Allow to specify frequencies in channels option.
voroshil
parents: 22381
diff changeset
371 // tmp still contain pointer to null-terminated string with channel number here
86edaa8501c1 Allow to specify frequencies in channels option.
voroshil
parents: 22381
diff changeset
372 if (atoi(tmp)>1000){
86edaa8501c1 Allow to specify frequencies in channels option.
voroshil
parents: 22381
diff changeset
373 tv_channel_current->freq=atoi(tmp);
86edaa8501c1 Allow to specify frequencies in channels option.
voroshil
parents: 22381
diff changeset
374 }else{
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
375 tv_channel_current->freq = 0;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
376 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
377 cl = tvh->chanlist_s[i];
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
378 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
379 tv_channel_current->freq=cl.freq;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
380 break;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
381 }
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
382 }
22619
86edaa8501c1 Allow to specify frequencies in channels option.
voroshil
parents: 22381
diff changeset
383 }
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
384 if (tv_channel_current->freq == 0)
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
385 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_NoFreqForChannel,
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
386 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
387 else {
9dc39697e3b3 channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents: 9663
diff changeset
388 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
389 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
390
9dc39697e3b3 channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents: 9663
diff changeset
391 if ( sep ) {
9dc39697e3b3 channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents: 9663
diff changeset
392 i = atoi (sep+1);
9dc39697e3b3 channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents: 9663
diff changeset
393 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
394 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
395 sep[0] = '\0';
9dc39697e3b3 channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents: 9663
diff changeset
396 }
9dc39697e3b3 channel finetuning cmdline support, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents: 9663
diff changeset
397 }
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
398
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
399 /*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
400 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
401 (float)tv_channel_current->freq/1000);*/
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
402
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
403 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
404 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
405 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
406 tv_channel_current->next->next = NULL;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
407 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
408 }
8955
2454bcd4c3f3 sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents: 8820
diff changeset
409 if (tv_channel_current->prev)
2454bcd4c3f3 sanity checks - patch by Fabian Franz <FabianFranz@gmx.de>
arpi
parents: 8820
diff changeset
410 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
411 free(tv_channel_current);
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
412 } else
18366
d18fc000093d 100000l to the fools who don't know C
rfelker
parents: 18172
diff changeset
413 tv_channel_last_real = malloc(5);
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
414
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
415 if (tv_channel_list) {
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
416 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
417 int channel = 0;
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
418 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
419 {
736ca83d609f abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents: 9927
diff changeset
420 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
421 /* 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
422 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
423 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
424 {
736ca83d609f abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents: 9927
diff changeset
425 /* 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
426 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
427
736ca83d609f abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents: 9927
diff changeset
428 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
429 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
430 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
431 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
432 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
433 }
736ca83d609f abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents: 9927
diff changeset
434 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
435 }
736ca83d609f abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents: 9927
diff changeset
436 }
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
437 else
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
438 channel = 1;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
439
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
440 if ( channel ) {
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
441 tv_channel_current = tv_channel_list;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
442 for (i = 1; i < channel; i++)
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
443 if (tv_channel_current->next)
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
444 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
445 }
736ca83d609f abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
alex
parents: 9927
diff changeset
446
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
447 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel3, tv_channel_current->number,
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
448 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
449 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
450 tv_channel_last = tv_channel_current;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
451 } else {
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
452 /* we need to set frequency */
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
453 if (tv_param_freq)
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
454 {
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
455 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
456
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
457 /* set freq in MHz */
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
458 funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_FREQ, &freq);
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
459
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
460 funcs->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &freq);
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
461 mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_SelectedFrequency,
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
462 freq, (float)freq/16);
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
463 }
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
464
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
465 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
466 struct CHANLIST cl;
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
467
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
468 mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_RequestedChannel, 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
469 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
470 {
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
471 cl = tvh->chanlist_s[i];
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
472 // 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
473 // 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
474 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
475 {
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
476 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
477 tvh->channel = i;
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
478 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel2,
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
479 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
480 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
481 break;
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
482 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
483 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
484 }
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
485 }
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
486
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
487 /* 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
488 {
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
489 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
490 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
491
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
492 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
493
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
494 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
495
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
496 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
497 {
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
498 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
499 {
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
500 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
501 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
502 }
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
503 }
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
504 }
3284
702e399a4b3e update (audio support is coming:)
alex
parents: 3249
diff changeset
505
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
506 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
507 /* also start device! */
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
508 return 1;
2931
bce9c945b29c tv interface update
alex
parents: 2842
diff changeset
509 }
bce9c945b29c tv interface update
alex
parents: 2842
diff changeset
510
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15419
diff changeset
511 static demuxer_t* demux_open_tv(demuxer_t *demuxer)
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
512 {
7408
0c6948b8100f stream layer cleanup part 2
arpi
parents: 7329
diff changeset
513 tvi_handle_t *tvh;
0c6948b8100f stream layer cleanup part 2
arpi
parents: 7329
diff changeset
514 sh_video_t *sh_video;
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
515 sh_audio_t *sh_audio = NULL;
7408
0c6948b8100f stream layer cleanup part 2
arpi
parents: 7329
diff changeset
516 tvi_functions_t *funcs;
0c6948b8100f stream layer cleanup part 2
arpi
parents: 7329
diff changeset
517
21837
922c0072a2bf Two crash issues fixed:
voroshil
parents: 19431
diff changeset
518 demuxer->priv=NULL;
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15419
diff changeset
519 if(!(tvh=tv_begin())) return NULL;
22381
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
520 if (!tvh->functions->init(tvh->priv)) return NULL;
7408
0c6948b8100f stream layer cleanup part 2
arpi
parents: 7329
diff changeset
521 if (!open_tv(tvh)){
0c6948b8100f stream layer cleanup part 2
arpi
parents: 7329
diff changeset
522 tv_uninit(tvh);
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15419
diff changeset
523 return NULL;
7408
0c6948b8100f stream layer cleanup part 2
arpi
parents: 7329
diff changeset
524 }
23510
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
525 #ifdef HAVE_TV_TELETEXT
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
526 if(tvh->priv_vbi) teletext_control(tvh->priv_vbi,TVI_CONTROL_VBI_START,1); //arg must be not null
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
527 #endif
7408
0c6948b8100f stream layer cleanup part 2
arpi
parents: 7329
diff changeset
528 funcs = tvh->functions;
0c6948b8100f stream layer cleanup part 2
arpi
parents: 7329
diff changeset
529 demuxer->priv=tvh;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
530
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
531 sh_video = new_sh_video(demuxer, 0);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
532
2932
fa3224774679 splitted demux_open_tv into two parts: stream_open_tv and demux_open_tv to support caching
alex
parents: 2931
diff changeset
533 /* get IMAGE FORMAT */
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
534 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_FORMAT, &sh_video->format);
2810
1f0bcdb49910 tv update
alex
parents: 2802
diff changeset
535 // if (IMGFMT_IS_RGB(sh_video->format) || IMGFMT_IS_BGR(sh_video->format))
3398
a73b02e35e70 give the IMGFMT_ for sh_video->format not 0x0
alex
parents: 3285
diff changeset
536 // sh_video->format = 0x0;
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
537
09d5c9834580 tv update
alex
parents: 2790
diff changeset
538 /* set FPS and FRAMETIME */
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
539
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
540 if(!sh_video->fps)
98769cea155c added tv subsystem
alex
parents:
diff changeset
541 {
10019
0ea7b9c6c27f 1000000000l
rfelker
parents: 10011
diff changeset
542 float tmp;
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
543 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
544 sh_video->fps = 25.0f; /* on PAL */
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
545 else sh_video->fps = tmp;
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
546 }
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
547
3285
bd7bff4cb453 add tv fps support
alex
parents: 3284
diff changeset
548 if (tv_param_fps != -1.0f)
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
549 sh_video->fps = tv_param_fps;
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
550
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
551 sh_video->frametime = 1.0f/sh_video->fps;
98769cea155c added tv subsystem
alex
parents:
diff changeset
552
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
553 /* 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
554 if(tv_param_immediate == 1)
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
555 {
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
556 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
557 tv_param_noaudio = 1;
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
558 }
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
559
8799
f08d507eb683 -nosound fix
henry
parents: 8627
diff changeset
560 /* disable TV audio if -nosound is present */
f08d507eb683 -nosound fix
henry
parents: 8627
diff changeset
561 if (!demuxer->audio || demuxer->audio->id == -2) {
f08d507eb683 -nosound fix
henry
parents: 8627
diff changeset
562 tv_param_noaudio = 1;
f08d507eb683 -nosound fix
henry
parents: 8627
diff changeset
563 }
f08d507eb683 -nosound fix
henry
parents: 8627
diff changeset
564
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
565 /* 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
566 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_WIDTH, &sh_video->disp_w);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
567
98769cea155c added tv subsystem
alex
parents:
diff changeset
568 /* 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
569 funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HEIGHT, &sh_video->disp_h);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
570
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
571 demuxer->video->sh = sh_video;
98769cea155c added tv subsystem
alex
parents:
diff changeset
572 sh_video->ds = demuxer->video;
98769cea155c added tv subsystem
alex
parents:
diff changeset
573 demuxer->video->id = 0;
9501
d64c56172220 make tv non-seekable
henry
parents: 8955
diff changeset
574 demuxer->seekable = 0;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
575
98769cea155c added tv subsystem
alex
parents:
diff changeset
576 /* here comes audio init */
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
577 if (tv_param_noaudio == 0 && funcs->control(tvh->priv, TVI_CONTROL_IS_AUDIO, 0) == TVI_CONTROL_TRUE)
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
578 {
09d5c9834580 tv update
alex
parents: 2790
diff changeset
579 int audio_format;
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
580 int sh_audio_format;
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13978
diff changeset
581 char buf[128];
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
582
09d5c9834580 tv update
alex
parents: 2790
diff changeset
583 /* yeah, audio is present */
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
584
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
585 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
586 &tv_param_audiorate);
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
587
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
588 if (funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_FORMAT, &audio_format) != TVI_CONTROL_TRUE)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
589 goto no_audio;
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
590
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
591 switch(audio_format)
09d5c9834580 tv update
alex
parents: 2790
diff changeset
592 {
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13978
diff changeset
593 case AF_FORMAT_U8:
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13978
diff changeset
594 case AF_FORMAT_S8:
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13978
diff changeset
595 case AF_FORMAT_U16_LE:
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13978
diff changeset
596 case AF_FORMAT_U16_BE:
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13978
diff changeset
597 case AF_FORMAT_S16_LE:
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13978
diff changeset
598 case AF_FORMAT_S16_BE:
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13978
diff changeset
599 case AF_FORMAT_S32_LE:
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13978
diff changeset
600 case AF_FORMAT_S32_BE:
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
601 sh_audio_format = 0x1; /* PCM */
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
602 break;
14245
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13978
diff changeset
603 case AF_FORMAT_IMA_ADPCM:
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13978
diff changeset
604 case AF_FORMAT_MU_LAW:
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13978
diff changeset
605 case AF_FORMAT_A_LAW:
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13978
diff changeset
606 case AF_FORMAT_MPEG2:
815f03b7cee5 removing AFMT_ dependancy
alex
parents: 13978
diff changeset
607 case AF_FORMAT_AC3:
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
608 default:
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
609 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_UnsupportedAudioType,
14255
137896e25c24 100l, buf etc. in af_fmt2str call are already pointers...
reimar
parents: 14245
diff changeset
610 af_fmt2str(audio_format, buf, 128), audio_format);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
611 goto no_audio;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
612 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
613
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
614 sh_audio = new_sh_audio(demuxer, 0);
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
615
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
616 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
617 &sh_audio->samplerate);
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
618 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
619 &sh_audio->samplesize);
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
620 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
621 &sh_audio->channels);
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
622
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
623 sh_audio->format = sh_audio_format;
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
624 sh_audio->sample_format = audio_format;
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
625
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
626 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
627 sh_audio->samplerate * sh_audio->samplesize *
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
628 sh_audio->channels;
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
629
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
630 // emulate WF for win32 codecs:
19062
83c3afeab35d drops casts from void * on malloc/calloc from libmpdemux code
reynaldo
parents: 18922
diff changeset
631 sh_audio->wf = malloc(sizeof(WAVEFORMATEX));
5087
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
632 sh_audio->wf->wFormatTag = sh_audio->format;
1d54c3a27093 audio support and pts based packet handling by Charles Henrich
alex
parents: 4350
diff changeset
633 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
634 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
635 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
636 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
637 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
638
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
639 mp_msg(MSGT_DECVIDEO, MSGL_V, MSGTR_TV_AudioFormat,
5572
8cd761968f35 BSD-BT848 TV update patch by Charles Henrich <henrich@sigbus.com>
arpi
parents: 5087
diff changeset
640 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
641 sh_audio->wf->nSamplesPerSec);
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
642
09d5c9834580 tv update
alex
parents: 2790
diff changeset
643 demuxer->audio->sh = sh_audio;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
644 sh_audio->ds = demuxer->audio;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
645 demuxer->audio->id = 0;
09d5c9834580 tv update
alex
parents: 2790
diff changeset
646 }
09d5c9834580 tv update
alex
parents: 2790
diff changeset
647 no_audio:
09d5c9834580 tv update
alex
parents: 2790
diff changeset
648
7329
9129781e5939 removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents: 7318
diff changeset
649 if(!(funcs->start(tvh->priv))){
9129781e5939 removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents: 7318
diff changeset
650 // start failed :(
9129781e5939 removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents: 7318
diff changeset
651 tv_uninit(tvh);
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15419
diff changeset
652 return NULL;
7329
9129781e5939 removed messy global 'tv_handle', use stream->priv for that purpose
arpi
parents: 7318
diff changeset
653 }
10581
4ebff25d9a05 From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents: 10537
diff changeset
654
4ebff25d9a05 From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents: 10537
diff changeset
655 /* set color eq */
4ebff25d9a05 From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents: 10537
diff changeset
656 tv_set_color_options(tvh, TV_COLOR_BRIGHTNESS, tv_param_brightness);
4ebff25d9a05 From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents: 10537
diff changeset
657 tv_set_color_options(tvh, TV_COLOR_HUE, tv_param_hue);
4ebff25d9a05 From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents: 10537
diff changeset
658 tv_set_color_options(tvh, TV_COLOR_SATURATION, tv_param_saturation);
4ebff25d9a05 From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents: 10537
diff changeset
659 tv_set_color_options(tvh, TV_COLOR_CONTRAST, tv_param_contrast);
4ebff25d9a05 From: Kir Kostuchenko <kir@users.sourceforge.net>
gabucino
parents: 10537
diff changeset
660
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15419
diff changeset
661 return demuxer;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
662 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
663
17174
83a8c738be89 make demuxer seek and close functions return void, patch by Dominik Mierzejewski
wanderer
parents: 17012
diff changeset
664 static void demux_close_tv(demuxer_t *demuxer)
7058
2e5c07262861 new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents: 6161
diff changeset
665 {
7408
0c6948b8100f stream layer cleanup part 2
arpi
parents: 7329
diff changeset
666 tvi_handle_t *tvh=(tvi_handle_t*)(demuxer->priv);
23510
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
667 #ifdef HAVE_TV_TELETEXT
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
668 if(tvh->priv_vbi) {
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
669 teletext_uninit(tvh->priv_vbi);
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
670 tvh->priv_vbi=NULL;
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
671 }
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
672 #endif
21837
922c0072a2bf Two crash issues fixed:
voroshil
parents: 19431
diff changeset
673 if (!tvh) return;
17174
83a8c738be89 make demuxer seek and close functions return void, patch by Dominik Mierzejewski
wanderer
parents: 17012
diff changeset
674 tvh->functions->uninit(tvh->priv);
21837
922c0072a2bf Two crash issues fixed:
voroshil
parents: 19431
diff changeset
675 demuxer->priv=NULL;
7058
2e5c07262861 new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents: 6161
diff changeset
676 }
2e5c07262861 new v4l capture patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>:
arpi
parents: 6161
diff changeset
677
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
678 /* ================== STREAM_TV ===================== */
6161
c50ea0721e78 applied 64bit patch from Ulrich Hecht <uli at suse dot de>
alex
parents: 5923
diff changeset
679
2802
09d5c9834580 tv update
alex
parents: 2790
diff changeset
680 tvi_handle_t *tv_begin(void)
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
681 {
22381
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
682 int i;
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
683 tvi_handle_t* h;
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
684 if(!strcmp(tv_param_driver,"help")){
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
685 mp_msg(MSGT_TV,MSGL_INFO,MSGTR_TV_AvailableDrivers);
22381
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
686 for(i=0;tvi_driver_list[i];i++){
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
687 mp_msg(MSGT_TV,MSGL_INFO," %s\t%s",tvi_driver_list[i]->short_name,tvi_driver_list[i]->name);
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
688 if(tvi_driver_list[i]->comment)
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
689 mp_msg(MSGT_TV,MSGL_INFO," (%s)",tvi_driver_list[i]->comment);
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
690 mp_msg(MSGT_TV,MSGL_INFO,"\n");
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
691 }
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
692 return NULL;
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
693 }
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
694
22381
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
695 for(i=0;tvi_driver_list[i];i++){
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
696 if (!strcmp(tvi_driver_list[i]->short_name, tv_param_driver)){
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
697 h=tvi_driver_list[i]->tvi_init(tv_param_device,tv_param_adevice);
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
698 if(!h) return NULL;
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
699
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
700 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_DriverInfo, tvi_driver_list[i]->short_name,
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
701 tvi_driver_list[i]->name,
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
702 tvi_driver_list[i]->author,
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
703 tvi_driver_list[i]->comment?tvi_driver_list[i]->comment:"");
23510
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
704 #ifdef HAVE_TV_TELETEXT
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
705 h->priv_vbi=teletext_init();
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
706 #endif
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
707
22381
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
708 return h;
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
709 }
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
710 }
6cabac4d35b5 tv driver loading rework. As a side effect "-tv driver=help" option is
voroshil
parents: 21837
diff changeset
711
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
712 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_NoSuchDriver, tv_param_driver);
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
713 return(NULL);
98769cea155c added tv subsystem
alex
parents:
diff changeset
714 }
98769cea155c added tv subsystem
alex
parents:
diff changeset
715
2837
c63562f5f56f tuning worx (can set frequency)
alex
parents: 2830
diff changeset
716 int tv_uninit(tvi_handle_t *tvh)
c63562f5f56f tuning worx (can set frequency)
alex
parents: 2830
diff changeset
717 {
21837
922c0072a2bf Two crash issues fixed:
voroshil
parents: 19431
diff changeset
718 int res;
922c0072a2bf Two crash issues fixed:
voroshil
parents: 19431
diff changeset
719 if(!tvh) return 1;
922c0072a2bf Two crash issues fixed:
voroshil
parents: 19431
diff changeset
720 if (!tvh->priv) return 1;
922c0072a2bf Two crash issues fixed:
voroshil
parents: 19431
diff changeset
721 res=tvh->functions->uninit(tvh->priv);
922c0072a2bf Two crash issues fixed:
voroshil
parents: 19431
diff changeset
722 if(res) tvh->priv=NULL;
922c0072a2bf Two crash issues fixed:
voroshil
parents: 19431
diff changeset
723 return res;
2790
98769cea155c added tv subsystem
alex
parents:
diff changeset
724 }
2937
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
725
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
726 /* utilities for mplayer (not mencoder!!) */
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
727 int tv_set_color_options(tvi_handle_t *tvh, int opt, int value)
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
728 {
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
729 tvi_functions_t *funcs = tvh->functions;
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
730
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
731 switch(opt)
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
732 {
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
733 case TV_COLOR_BRIGHTNESS:
18172
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
734 return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_BRIGHTNESS, &value);
2937
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
735 case TV_COLOR_HUE:
18172
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
736 return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_HUE, &value);
2937
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
737 case TV_COLOR_SATURATION:
18172
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
738 return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_SATURATION, &value);
2937
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
739 case TV_COLOR_CONTRAST:
18172
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
740 return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_CONTRAST, &value);
2937
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
741 default:
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
742 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_UnknownColorOption, opt);
2937
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
743 }
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
744
18172
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
745 return(TVI_CONTROL_UNKNOWN);
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
746 }
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
747
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
748 int tv_get_color_options(tvi_handle_t *tvh, int opt, int* value)
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
749 {
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
750 tvi_functions_t *funcs = tvh->functions;
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
751
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
752 switch(opt)
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
753 {
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
754 case TV_COLOR_BRIGHTNESS:
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
755 return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_BRIGHTNESS, value);
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
756 case TV_COLOR_HUE:
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
757 return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HUE, value);
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
758 case TV_COLOR_SATURATION:
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
759 return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_SATURATION, value);
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
760 case TV_COLOR_CONTRAST:
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
761 return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_CONTRAST, value);
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
762 default:
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
763 mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_UnknownColorOption, opt);
18172
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
764 }
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
765
90b62d7c0fca Implement tv_get_color_options() and make tv_set_color_options() return
albeu
parents: 18073
diff changeset
766 return(TVI_CONTROL_UNKNOWN);
2937
4307478ad922 added support for setting color values
alex
parents: 2932
diff changeset
767 }
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
768
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
769 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
770 {
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
771 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
772 {
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
773 tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, freq);
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
774 mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_CurrentFrequency,
7806
6a6f6b8b2ac7 set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
alex
parents: 7472
diff changeset
775 *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
776 }
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
777 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
778 }
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
779
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
780 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
781 {
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
782 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
783 {
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
784 // 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
785
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
786 /* 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
787 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
788
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
789 tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &freq);
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
790 mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_CurrentFrequency,
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
791 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
792 }
23510
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
793 #ifdef HAVE_TV_TELETEXT
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
794 if (tvh->priv_vbi) teletext_control(tvh->priv_vbi,TVI_CONTROL_VBI_RESET,1); //arg must be not null
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
795 #endif
7472
c4434bdf6e51 tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents: 7408
diff changeset
796 return(1);
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
797 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
798
22667
e1859558b37d New slave command: tv_step_freq <offset in MHz>
voroshil
parents: 22619
diff changeset
799 /*****************************************************************
e1859558b37d New slave command: tv_step_freq <offset in MHz>
voroshil
parents: 22619
diff changeset
800 * \brief tune current frequency by step_interval value
e1859558b37d New slave command: tv_step_freq <offset in MHz>
voroshil
parents: 22619
diff changeset
801 * \parameter step_interval increment value in 1/16 MHz
e1859558b37d New slave command: tv_step_freq <offset in MHz>
voroshil
parents: 22619
diff changeset
802 * \note frequency is rounded to 1/16 MHz value
e1859558b37d New slave command: tv_step_freq <offset in MHz>
voroshil
parents: 22619
diff changeset
803 * \return 1
e1859558b37d New slave command: tv_step_freq <offset in MHz>
voroshil
parents: 22619
diff changeset
804 *
e1859558b37d New slave command: tv_step_freq <offset in MHz>
voroshil
parents: 22619
diff changeset
805 */
e1859558b37d New slave command: tv_step_freq <offset in MHz>
voroshil
parents: 22619
diff changeset
806 int tv_step_freq(tvi_handle_t* tvh, float step_interval){
e1859558b37d New slave command: tv_step_freq <offset in MHz>
voroshil
parents: 22619
diff changeset
807 unsigned long frequency;
e1859558b37d New slave command: tv_step_freq <offset in MHz>
voroshil
parents: 22619
diff changeset
808
e1859558b37d New slave command: tv_step_freq <offset in MHz>
voroshil
parents: 22619
diff changeset
809 tv_get_freq(tvh,&frequency);
e1859558b37d New slave command: tv_step_freq <offset in MHz>
voroshil
parents: 22619
diff changeset
810 frequency+=step_interval;
e1859558b37d New slave command: tv_step_freq <offset in MHz>
voroshil
parents: 22619
diff changeset
811 return tv_set_freq(tvh,frequency);
e1859558b37d New slave command: tv_step_freq <offset in MHz>
voroshil
parents: 22619
diff changeset
812 }
e1859558b37d New slave command: tv_step_freq <offset in MHz>
voroshil
parents: 22619
diff changeset
813
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
814 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
815 {
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
816 struct CHANLIST cl;
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
817
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
818 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
819 {
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
820 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
821 {
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
822 strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name);
5923
4241047fb315 patch by J«ärgen Appel <jappel@linux01.gwdg.de>:
pl
parents: 5572
diff changeset
823 cl = tvh->chanlist_s[--tvh->channel];
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
824 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel2,
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
825 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
826 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
827 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
828 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
829
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
830 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
831 {
4242
bbfbe9bbb956 fixed channel changing with frequencies.c
alex
parents: 3815
diff changeset
832 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
833 {
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
834 strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name);
5923
4241047fb315 patch by J«ärgen Appel <jappel@linux01.gwdg.de>:
pl
parents: 5572
diff changeset
835 cl = tvh->chanlist_s[++tvh->channel];
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
836 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel2,
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
837 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
838 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
839 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
840 }
7472
c4434bdf6e51 tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents: 7408
diff changeset
841 return(1);
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
842 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
843
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
844 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
845 if (tv_channel_list) {
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
846 if (direction == TV_CHANNEL_HIGHER) {
16469
8c1c8d10c163 cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents: 16175
diff changeset
847 tv_channel_last = tv_channel_current;
8c1c8d10c163 cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents: 16175
diff changeset
848 if (tv_channel_current->next)
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
849 tv_channel_current = tv_channel_current->next;
16469
8c1c8d10c163 cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents: 16175
diff changeset
850 else
8c1c8d10c163 cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents: 16175
diff changeset
851 tv_channel_current = tv_channel_list;
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
852 tv_set_freq(tvh, (unsigned long)(((float)tv_channel_current->freq/1000)*16));
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
853 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel3,
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
854 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
855 }
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
856 if (direction == TV_CHANNEL_LOWER) {
16469
8c1c8d10c163 cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents: 16175
diff changeset
857 tv_channel_last = tv_channel_current;
8c1c8d10c163 cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents: 16175
diff changeset
858 if (tv_channel_current->prev)
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
859 tv_channel_current = tv_channel_current->prev;
16469
8c1c8d10c163 cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents: 16175
diff changeset
860 else
8c1c8d10c163 cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents: 16175
diff changeset
861 while (tv_channel_current->next)
8c1c8d10c163 cycle through tv channels (patch by Andrew Calkin < calkina at geexbox.org >)
aurel
parents: 16175
diff changeset
862 tv_channel_current = tv_channel_current->next;
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
863 tv_set_freq(tvh, (unsigned long)(((float)tv_channel_current->freq/1000)*16));
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
864 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel3,
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
865 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
866 }
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
867 } 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
868 return(1);
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
869 }
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
870
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
871 int tv_set_channel_real(tvi_handle_t *tvh, char *channel) {
8494
47cf94058137 add a TV_SET_CNANNEL command
henry
parents: 8487
diff changeset
872 int i;
47cf94058137 add a TV_SET_CNANNEL command
henry
parents: 8487
diff changeset
873 struct CHANLIST cl;
47cf94058137 add a TV_SET_CNANNEL command
henry
parents: 8487
diff changeset
874
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
875 strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name);
8494
47cf94058137 add a TV_SET_CNANNEL command
henry
parents: 8487
diff changeset
876 for (i = 0; i < chanlists[tvh->chanlist].count; i++)
47cf94058137 add a TV_SET_CNANNEL command
henry
parents: 8487
diff changeset
877 {
47cf94058137 add a TV_SET_CNANNEL command
henry
parents: 8487
diff changeset
878 cl = tvh->chanlist_s[i];
47cf94058137 add a TV_SET_CNANNEL command
henry
parents: 8487
diff changeset
879 // printf("count%d: name: %s, freq: %d\n",
47cf94058137 add a TV_SET_CNANNEL command
henry
parents: 8487
diff changeset
880 // i, cl.name, cl.freq);
47cf94058137 add a TV_SET_CNANNEL command
henry
parents: 8487
diff changeset
881 if (!strcasecmp(cl.name, channel))
47cf94058137 add a TV_SET_CNANNEL command
henry
parents: 8487
diff changeset
882 {
47cf94058137 add a TV_SET_CNANNEL command
henry
parents: 8487
diff changeset
883 tvh->channel = i;
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
884 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel2,
8494
47cf94058137 add a TV_SET_CNANNEL command
henry
parents: 8487
diff changeset
885 cl.name, (float)cl.freq/1000);
47cf94058137 add a TV_SET_CNANNEL command
henry
parents: 8487
diff changeset
886 tv_set_freq(tvh, (unsigned long)(((float)cl.freq/1000)*16));
47cf94058137 add a TV_SET_CNANNEL command
henry
parents: 8487
diff changeset
887 break;
47cf94058137 add a TV_SET_CNANNEL command
henry
parents: 8487
diff changeset
888 }
47cf94058137 add a TV_SET_CNANNEL command
henry
parents: 8487
diff changeset
889 }
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
890 return(1);
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
891 }
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
892
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
893 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
894 int i, channel_int;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
895
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
896 if (tv_channel_list) {
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
897 tv_channel_last = tv_channel_current;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
898 channel_int = atoi(channel);
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
899 tv_channel_current = tv_channel_list;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
900 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
901 if (tv_channel_current->next)
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
902 tv_channel_current = tv_channel_current->next;
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
903 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel3, tv_channel_current->number,
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
904 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
905 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
906 } 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
907 return(1);
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
908 }
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
909
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
910 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
911
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
912 if (tv_channel_list) {
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
913 tv_channels_t *tmp;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
914
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
915 tmp = tv_channel_last;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
916 tv_channel_last = tv_channel_current;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
917 tv_channel_current = tmp;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
918
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
919 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel3, tv_channel_current->number,
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
920 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
921 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
922 } else {
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
923 int i;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
924 struct CHANLIST cl;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
925
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
926 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
927 {
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
928 cl = tvh->chanlist_s[i];
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
929 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
930 {
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
931 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
932 tvh->channel = i;
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
933 mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel2,
8627
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
934 cl.name, (float)cl.freq/1000);
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
935 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
936 break;
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
937 }
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
938 }
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
939 }
14ab71b47a58 user friendly channel tuning + 10L fix in tvi_v4l (by Stephane Jourdois)
henry
parents: 8494
diff changeset
940 return(1);
8494
47cf94058137 add a TV_SET_CNANNEL command
henry
parents: 8487
diff changeset
941 }
47cf94058137 add a TV_SET_CNANNEL command
henry
parents: 8487
diff changeset
942
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
943 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
944 {
16961
8b5a4d2dcc2b implement norm switching, which was already documented??
reimar
parents: 16469
diff changeset
945 tvh->norm++;
8b5a4d2dcc2b implement norm switching, which was already documented??
reimar
parents: 16469
diff changeset
946 if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM,
8b5a4d2dcc2b implement norm switching, which was already documented??
reimar
parents: 16469
diff changeset
947 &tvh->norm) != TVI_CONTROL_TRUE) {
8b5a4d2dcc2b implement norm switching, which was already documented??
reimar
parents: 16469
diff changeset
948 tvh->norm = 0;
8b5a4d2dcc2b implement norm switching, which was already documented??
reimar
parents: 16469
diff changeset
949 if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM,
8b5a4d2dcc2b implement norm switching, which was already documented??
reimar
parents: 16469
diff changeset
950 &tvh->norm) != TVI_CONTROL_TRUE) {
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
951 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_CannotSetNorm);
16961
8b5a4d2dcc2b implement norm switching, which was already documented??
reimar
parents: 16469
diff changeset
952 return 0;
8b5a4d2dcc2b implement norm switching, which was already documented??
reimar
parents: 16469
diff changeset
953 }
8b5a4d2dcc2b implement norm switching, which was already documented??
reimar
parents: 16469
diff changeset
954 }
23510
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
955 #ifdef HAVE_TV_TELETEXT
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
956 if (tvh->priv_vbi) teletext_control(tvh->priv_vbi,TVI_CONTROL_VBI_RESET,1); //arg must be not null
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
957 #endif
7472
c4434bdf6e51 tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents: 7408
diff changeset
958 return(1);
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
959 }
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
960
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
961 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
962 {
7472
c4434bdf6e51 tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents: 7408
diff changeset
963 return(1);
2941
60c1b7c0ea21 added support for norm=,chanlist=,channel= and also on-the-fly channel chaning with keys
alex
parents: 2937
diff changeset
964 }
10521
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
965
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
966 int tv_set_norm(tvi_handle_t *tvh, char* norm)
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
967 {
13978
2a9afbfc79d7 setting the norm using text ID instead of numeric
henry
parents: 12034
diff changeset
968 tvh->norm = norm_from_string(tvh, norm);
10521
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
969
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
970 mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_SelectedNorm, tv_param_norm);
10521
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
971 if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) {
22967
25704c80d194 Move translatable strings from tv.c to help_mp*
voroshil
parents: 22728
diff changeset
972 mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_CannotSetNorm);
10521
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
973 return 0;
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
974 }
23510
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
975 #ifdef HAVE_TV_TELETEXT
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
976 if (tvh->priv_vbi) teletext_control(tvh->priv_vbi,TVI_CONTROL_VBI_RESET,1); //arg must be not null
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
977 #endif
10521
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
978 return(1);
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
979 }
141141fdd250 I'd like to change tv tuner frequency in the slave mode. So this patch
gabucino
parents: 10368
diff changeset
980
23510
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
981 #ifdef HAVE_TV_TELETEXT
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
982 int tv_teletext_control(tvi_handle_t* tvh, int control, void* arg)
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
983 {
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
984 if (!tvh || !tvh->priv_vbi)
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
985 return TVI_CONTROL_FALSE;
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
986
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
987 return teletext_control(tvh->priv_vbi,control,arg);
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
988 }
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
989
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
990 int tv_teletext_add_dec(tvi_handle_t *tvh, char *dec)
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
991 {
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
992 if(!dec) return 0;
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
993 if (teletext_control(tvh->priv_vbi, TVI_CONTROL_VBI_ADD_DEC, &dec)!= TVI_CONTROL_TRUE)
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
994 return 0;
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
995 return 1;
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
996 }
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
997
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
998 int tv_teletext_go_link(tvi_handle_t *tvh, int linkno)
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
999 {
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1000 if (teletext_control(tvh->priv_vbi, TVI_CONTROL_VBI_GO_LINK, &linkno)!= TVI_CONTROL_TRUE)
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1001 return 0;
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1002 return 1;
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1003 }
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1004
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1005 void* tv_get_teletext_vbipage(tvi_handle_t *tvh)
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1006 {
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1007 void* page = NULL;
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1008 if (teletext_control(tvh->priv_vbi, TVI_CONTROL_VBI_GET_VBIPAGE, &page)!= TVI_CONTROL_TRUE)
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1009 return NULL;
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1010 return page;
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1011 }
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1012
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1013 char* tv_get_teletext_txtpage(tvi_handle_t *tvh)
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1014 {
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1015 char* page = NULL;
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1016 if (teletext_control(tvh->priv_vbi, TVI_CONTROL_VBI_GET_TXTPAGE, &page)!= TVI_CONTROL_TRUE)
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1017 return NULL;
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1018 return page;
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1019 }
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1020
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1021 tv_teletext_img_t* tv_get_teletext_imgpage(tvi_handle_t *tvh)
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1022 {
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1023 tv_teletext_img_t* tv_teletext_img = NULL;
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1024 if (teletext_control(tvh->priv_vbi, TVI_CONTROL_VBI_GET_IMGPAGE, &tv_teletext_img)!= TVI_CONTROL_TRUE)
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1025 return NULL;
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1026 return tv_teletext_img;
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1027 }
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1028 #endif
a6c619ee9d30 Teletext support for tv:// (v4l and v4l2 only)
voroshil
parents: 23485
diff changeset
1029
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 15419
diff changeset
1030 demuxer_desc_t demuxer_desc_tv = {
6b86089c2edd Demuxer modularization
rtognimp
parents: 15419
diff changeset
1031 "Tv card demuxer",
6b86089c2edd Demuxer modularization
rtognimp
parents: 15419
diff changeset
1032 "tv",
6b86089c2edd Demuxer modularization
rtognimp
parents: 15419
diff changeset
1033 "TV",
6b86089c2edd Demuxer modularization
rtognimp
parents: 15419
diff changeset
1034 "Alex Beregszaszi, Charles R. Henrich",
6b86089c2edd Demuxer modularization
rtognimp
parents: 15419
diff changeset
1035 "?",
6b86089c2edd Demuxer modularization
rtognimp
parents: 15419
diff changeset
1036 DEMUXER_TYPE_TV,
6b86089c2edd Demuxer modularization
rtognimp
parents: 15419
diff changeset
1037 0, // no autodetect
6b86089c2edd Demuxer modularization
rtognimp
parents: 15419
diff changeset
1038 NULL,
6b86089c2edd Demuxer modularization
rtognimp
parents: 15419
diff changeset
1039 demux_tv_fill_buffer,
6b86089c2edd Demuxer modularization
rtognimp
parents: 15419
diff changeset
1040 demux_open_tv,
6b86089c2edd Demuxer modularization
rtognimp
parents: 15419
diff changeset
1041 demux_close_tv,
6b86089c2edd Demuxer modularization
rtognimp
parents: 15419
diff changeset
1042 NULL,
6b86089c2edd Demuxer modularization
rtognimp
parents: 15419
diff changeset
1043 NULL
6b86089c2edd Demuxer modularization
rtognimp
parents: 15419
diff changeset
1044 };