Mercurial > mplayer.hg
annotate stream/stream_pvr.c @ 31163:07faae7acdfa
Add support for decoding VP8 through libvpx wrapper in FFmpeg.
patch by James Zern, jzern google com
author | diego |
---|---|
date | Tue, 25 May 2010 23:41:30 +0000 |
parents | 0f1b5b68af32 |
children | b39155e98ac3 |
rev | line source |
---|---|
18997 | 1 /* |
26737
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25211
diff
changeset
|
2 * stream layer for hardware MPEG 1/2/4 encoders a.k.a PVR |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25211
diff
changeset
|
3 * (such as WinTV PVR-150/250/350/500 (a.k.a IVTV), pvrusb2 and cx88) |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25211
diff
changeset
|
4 * See http://ivtvdriver.org/index.php/Main_Page for more details on the |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25211
diff
changeset
|
5 * cards supported by the ivtv driver. |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25211
diff
changeset
|
6 * |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25211
diff
changeset
|
7 * Copyright (C) 2006 Benjamin Zores |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25211
diff
changeset
|
8 * Copyright (C) 2007 Sven Gothel (channel navigation) |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25211
diff
changeset
|
9 * |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25211
diff
changeset
|
10 * This file is part of MPlayer. |
18997 | 11 * |
26737
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25211
diff
changeset
|
12 * MPlayer is free software; you can redistribute it and/or modify |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25211
diff
changeset
|
13 * it under the terms of the GNU General Public License as published by |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25211
diff
changeset
|
14 * the Free Software Foundation; either version 2 of the License, or |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25211
diff
changeset
|
15 * (at your option) any later version. |
18997 | 16 * |
26737
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25211
diff
changeset
|
17 * MPlayer is distributed in the hope that it will be useful, |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25211
diff
changeset
|
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25211
diff
changeset
|
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25211
diff
changeset
|
20 * GNU General Public License for more details. |
18997 | 21 * |
26737
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25211
diff
changeset
|
22 * You should have received a copy of the GNU General Public License along |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25211
diff
changeset
|
23 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
a26e50cae389
Use standard license headers with standard formatting.
diego
parents:
25211
diff
changeset
|
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
18997 | 25 */ |
26 | |
27 #include "config.h" | |
28 | |
29 #include <stdio.h> | |
30 #include <stdlib.h> | |
31 #include <unistd.h> | |
32 #include <string.h> | |
33 #include <ctype.h> | |
34 #include <sys/time.h> | |
35 #include <errno.h> | |
36 #include <sys/ioctl.h> | |
37 #include <sys/fcntl.h> | |
38 #include <inttypes.h> | |
27431
bb738b9ea7c4
Use '#include <poll.h>' instead of '#include <sys/poll.h>'.
diego
parents:
26737
diff
changeset
|
39 #include <poll.h> |
19617
75063178d39f
fix build on some old 2.6 kernels, patch by Gernot Hillier
ben
parents:
19294
diff
changeset
|
40 #include <linux/types.h> |
18997 | 41 #include <linux/videodev2.h> |
42 | |
43 #include "mp_msg.h" | |
44 #include "help_mp.h" | |
45 | |
46 #include "stream.h" | |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
47 #include "pvr.h" |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
48 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
49 #include "frequencies.h" |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
50 #include "libavutil/common.h" |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
23245
diff
changeset
|
51 #include "libavutil/avstring.h" |
18997 | 52 |
53 #define PVR_DEFAULT_DEVICE "/dev/video0" | |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
54 #define PVR_MAX_CONTROLS 10 |
18997 | 55 |
56 /* logging mechanisms */ | |
57 #define LOG_LEVEL_PVR "[pvr]" | |
58 #define LOG_LEVEL_V4L2 "[v4l2]" | |
19976
281ac13bf72d
cosmetic renames because pvr support will soon be less ivtv driver dependant
ben
parents:
19617
diff
changeset
|
59 #define LOG_LEVEL_ENCODER "[encoder]" |
18997 | 60 |
61 /* audio codec mode */ | |
62 #define PVR_AUDIO_MODE_ARG_STEREO "stereo" | |
63 #define PVR_AUDIO_MODE_ARG_JOINT_STEREO "joint_stereo" | |
64 #define PVR_AUDIO_MODE_ARG_DUAL "dual" | |
65 #define PVR_AUDIO_MODE_ARG_MONO "mono" | |
66 | |
67 /* video codec bitrate mode */ | |
68 #define PVR_VIDEO_BITRATE_MODE_ARG_VBR "vbr" | |
69 #define PVR_VIDEO_BITRATE_MODE_ARG_CBR "cbr" | |
70 | |
71 /* video codec stream type */ | |
72 #define PVR_VIDEO_STREAM_TYPE_PS "ps" | |
73 #define PVR_VIDEO_STREAM_TYPE_TS "ts" | |
74 #define PVR_VIDEO_STREAM_TYPE_MPEG1 "mpeg1" | |
75 #define PVR_VIDEO_STREAM_TYPE_DVD "dvd" | |
76 #define PVR_VIDEO_STREAM_TYPE_VCD "vcd" | |
77 #define PVR_VIDEO_STREAM_TYPE_SVCD "svcd" | |
78 | |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
79 #define PVR_STATION_NAME_SIZE 256 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
80 |
18997 | 81 /* command line arguments */ |
82 int pvr_param_aspect_ratio = 0; | |
83 int pvr_param_sample_rate = 0; | |
84 int pvr_param_audio_layer = 0; | |
85 int pvr_param_audio_bitrate = 0; | |
86 char *pvr_param_audio_mode = NULL; | |
87 int pvr_param_bitrate = 0; | |
88 char *pvr_param_bitrate_mode = NULL; | |
89 int pvr_param_bitrate_peak = 0; | |
90 char *pvr_param_stream_type = NULL; | |
91 | |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
92 typedef struct station_elem_s { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
93 char name[8]; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
94 int freq; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
95 char station[PVR_STATION_NAME_SIZE]; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
96 int enabled; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
97 } station_elem_t; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
98 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
99 typedef struct stationlist_s { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
100 char name[PVR_STATION_NAME_SIZE]; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
101 station_elem_t *list; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
102 int total; /* total number */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
103 int used; /* used number */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
104 int enabled; /* enabled number */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
105 } stationlist_t; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
106 |
18997 | 107 struct pvr_t { |
108 int dev_fd; | |
109 char *video_dev; | |
110 | |
111 /* v4l2 params */ | |
112 int mute; | |
113 int input; | |
114 int normid; | |
115 int brightness; | |
116 int contrast; | |
117 int hue; | |
118 int saturation; | |
119 int width; | |
120 int height; | |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
121 int freq; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
122 int chan_idx; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
123 int chan_idx_last; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
124 stationlist_t stationlist; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
125 /* dups the tv_param_channel, or the url's channel param */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
126 char *param_channel; |
18997 | 127 |
19976
281ac13bf72d
cosmetic renames because pvr support will soon be less ivtv driver dependant
ben
parents:
19617
diff
changeset
|
128 /* encoder params */ |
18997 | 129 int aspect; |
130 int samplerate; | |
131 int layer; | |
132 int audio_rate; | |
133 int audio_mode; | |
134 int bitrate; | |
135 int bitrate_mode; | |
136 int bitrate_peak; | |
137 int stream_type; | |
138 }; | |
139 | |
140 static struct pvr_t * | |
141 pvr_init (void) | |
142 { | |
143 struct pvr_t *pvr = NULL; | |
144 | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
145 pvr = calloc (1, sizeof (struct pvr_t)); |
18997 | 146 pvr->dev_fd = -1; |
147 pvr->video_dev = strdup (PVR_DEFAULT_DEVICE); | |
148 | |
149 /* v4l2 params */ | |
150 pvr->mute = 0; | |
151 pvr->input = 0; | |
152 pvr->normid = -1; | |
153 pvr->brightness = 0; | |
154 pvr->contrast = 0; | |
155 pvr->hue = 0; | |
156 pvr->saturation = 0; | |
157 pvr->width = -1; | |
158 pvr->height = -1; | |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
159 pvr->freq = -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
160 pvr->chan_idx = -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
161 pvr->chan_idx_last = -1; |
18997 | 162 |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
163 /* set default encoding settings |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
164 * may be overlapped by user parameters |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
165 * Use VBR MPEG_PS encoding at 6 Mbps (peak at 9.6 Mbps) |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
166 * with 48 KHz L2 384 kbps audio. |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
167 */ |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
168 pvr->aspect = V4L2_MPEG_VIDEO_ASPECT_4x3; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
169 pvr->samplerate = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
170 pvr->layer = V4L2_MPEG_AUDIO_ENCODING_LAYER_2; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
171 pvr->audio_rate = V4L2_MPEG_AUDIO_L2_BITRATE_384K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
172 pvr->audio_mode = V4L2_MPEG_AUDIO_MODE_STEREO; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
173 pvr->bitrate = 6000000; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
174 pvr->bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_VBR; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
175 pvr->bitrate_peak = 9600000; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
176 pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
177 |
18997 | 178 return pvr; |
179 } | |
180 | |
181 static void | |
182 pvr_uninit (struct pvr_t *pvr) | |
183 { | |
184 if (!pvr) | |
185 return; | |
186 | |
187 /* close device */ | |
188 if (pvr->dev_fd) | |
189 close (pvr->dev_fd); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
190 |
18997 | 191 if (pvr->video_dev) |
192 free (pvr->video_dev); | |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
193 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
194 if (pvr->stationlist.list) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
195 free (pvr->stationlist.list); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
196 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
197 if (pvr->param_channel) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
198 free (pvr->param_channel); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
199 |
18997 | 200 free (pvr); |
201 } | |
202 | |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
203 /** |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
204 * @brief Copy Constructor for stationlist |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
205 * |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
206 * @see parse_setup_stationlist |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
207 */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
208 static int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
209 copycreate_stationlist (stationlist_t *stationlist, int num) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
210 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
211 int i; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
212 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
213 if (chantab < 0 || !stationlist) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
214 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
215 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
216 num = FFMAX (num, chanlists[chantab].count); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
217 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
218 if (stationlist->list) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
219 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
220 free (stationlist->list); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
221 stationlist->list = NULL; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
222 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
223 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
224 stationlist->total = 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
225 stationlist->enabled = 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
226 stationlist->used = 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
227 stationlist->list = calloc (num, sizeof (station_elem_t)); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
228 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
229 if (!stationlist->list) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
230 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
231 mp_msg (MSGT_OPEN, MSGL_ERR, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
232 "%s No memory allocated for station list, giving up\n", |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
233 LOG_LEVEL_V4L2); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
234 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
235 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
236 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
237 /* transport the channel list data to our extented struct */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
238 stationlist->total = num; |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
23245
diff
changeset
|
239 av_strlcpy (stationlist->name, chanlists[chantab].name, PVR_STATION_NAME_SIZE); |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
240 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
241 for (i = 0; i < chanlists[chantab].count; i++) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
242 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
243 stationlist->list[i].station[0]= '\0'; /* no station name yet */ |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
23245
diff
changeset
|
244 av_strlcpy (stationlist->list[i].name, |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
245 chanlists[chantab].list[i].name, PVR_STATION_NAME_SIZE); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
246 stationlist->list[i].freq = chanlists[chantab].list[i].freq; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
247 stationlist->list[i].enabled = 1; /* default enabled */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
248 stationlist->enabled++; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
249 stationlist->used++; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
250 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
251 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
252 return 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
253 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
254 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
255 static int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
256 print_all_stations (struct pvr_t *pvr) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
257 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
258 int i; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
259 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
260 if (!pvr || !pvr->stationlist.list) |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
261 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
262 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
263 for (i = 0; i < pvr->stationlist.total; i++) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
264 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
265 mp_msg (MSGT_OPEN, MSGL_V, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
266 "%s %3d: [%c] channel: %8s - freq: %8d - station: %s\n", |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
267 LOG_LEVEL_V4L2, i, (pvr->stationlist.list[i].enabled) ? 'X' : ' ', |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
268 pvr->stationlist.list[i].name, pvr->stationlist.list[i].freq, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
269 pvr->stationlist.list[i].station); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
270 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
271 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
272 return 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
273 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
274 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
275 /** |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
276 * Disables all stations |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
277 * |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
278 * @see parse_setup_stationlist |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
279 */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
280 static void |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
281 disable_all_stations (struct pvr_t *pvr) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
282 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
283 int i; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
284 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
285 for (i = 0; i < pvr->stationlist.total; i++) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
286 pvr->stationlist.list[i].enabled = 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
287 pvr->stationlist.enabled = 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
288 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
289 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
290 /** |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
291 * Update or add a station |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
292 * |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
293 * @see parse_setup_stationlist |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
294 */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
295 static int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
296 set_station (struct pvr_t *pvr, const char *station, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
297 const char *channel, int freq) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
298 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
299 int i; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
300 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
301 if (!pvr || !pvr->stationlist.list) |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
302 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
303 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
304 if (0 >= pvr->stationlist.total || (!channel && !freq)) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
305 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
306 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
307 /* select channel */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
308 for (i = 0; i < pvr->stationlist.used; i++) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
309 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
310 if (channel && !strcasecmp (pvr->stationlist.list[i].name, channel)) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
311 break; /* found existing channel entry */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
312 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
313 if (freq > 0 && pvr->stationlist.list[i].freq == freq) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
314 break; /* found existing frequency entry */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
315 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
316 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
317 if (i < pvr->stationlist.used) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
318 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
319 /** |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
320 * found an existing entry, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
321 * which is about to change with the user data. |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
322 * it is also enabled .. |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
323 */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
324 if (!pvr->stationlist.list[i].enabled) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
325 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
326 pvr->stationlist.list[i].enabled = 1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
327 pvr->stationlist.enabled++; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
328 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
329 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
330 if (station) |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
23245
diff
changeset
|
331 av_strlcpy (pvr->stationlist.list[i].station, |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
332 station, PVR_STATION_NAME_SIZE); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
333 else if (channel) |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
23245
diff
changeset
|
334 av_strlcpy (pvr->stationlist.list[i].station, |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
335 channel, PVR_STATION_NAME_SIZE); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
336 else |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
337 snprintf (pvr->stationlist.list[i].station, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
338 PVR_STATION_NAME_SIZE, "F %d", freq); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
339 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
340 mp_msg (MSGT_OPEN, MSGL_DBG2, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
341 "%s Set user station channel: %8s - freq: %8d - station: %s\n", |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
342 LOG_LEVEL_V4L2, pvr->stationlist.list[i].name, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
343 pvr->stationlist.list[i].freq, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
344 pvr->stationlist.list[i].station); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
345 return 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
346 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
347 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
348 /* from here on, we have to create a new entry, frequency is mandatory */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
349 if (freq < 0) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
350 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
351 mp_msg (MSGT_OPEN, MSGL_ERR, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
352 "%s Cannot add new station/channel without frequency\n", |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
353 LOG_LEVEL_V4L2); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
354 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
355 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
356 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
357 if (pvr->stationlist.total < i) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
358 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
359 /** |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
360 * we have to extend the stationlist about |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
361 * an arbitrary size, even though this path is not performance critical |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
362 */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
363 pvr->stationlist.total += 10; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
364 pvr->stationlist.list = |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
365 realloc (pvr->stationlist.list, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
366 pvr->stationlist.total * sizeof (station_elem_t)); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
367 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
368 if (!pvr->stationlist.list) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
369 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
370 mp_msg (MSGT_OPEN, MSGL_ERR, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
371 "%s No memory allocated for station list, giving up\n", |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
372 LOG_LEVEL_V4L2); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
373 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
374 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
375 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
376 /* clear the new space ..*/ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
377 memset (&(pvr->stationlist.list[pvr->stationlist.used]), 0, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
378 (pvr->stationlist.total - pvr->stationlist.used) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
379 * sizeof (station_elem_t)); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
380 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
381 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
382 /* here we go, our actual new entry */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
383 pvr->stationlist.used++; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
384 pvr->stationlist.list[i].enabled = 1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
385 pvr->stationlist.enabled++; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
386 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
387 if (station) |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
23245
diff
changeset
|
388 av_strlcpy (pvr->stationlist.list[i].station, |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
389 station, PVR_STATION_NAME_SIZE); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
390 if (channel) |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
23245
diff
changeset
|
391 av_strlcpy (pvr->stationlist.list[i].name, channel, PVR_STATION_NAME_SIZE); |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
392 else |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
393 snprintf (pvr->stationlist.list[i].name, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
394 PVR_STATION_NAME_SIZE, "F %d", freq); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
395 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
396 pvr->stationlist.list[i].freq = freq; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
397 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
398 mp_msg (MSGT_OPEN, MSGL_DBG2, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
399 "%s Add user station channel: %8s - freq: %8d - station: %s\n", |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
400 LOG_LEVEL_V4L2, pvr->stationlist.list[i].name, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
401 pvr->stationlist.list[i].freq, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
402 pvr->stationlist.list[i].station); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
403 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
404 return 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
405 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
406 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
407 /** |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
408 * Here we set our stationlist, as follow |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
409 * - choose the frequency channel table, e.g. ntsc-cable |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
410 * - create our stationlist, same element size as the channellist |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
411 * - copy the channellist content to our stationlist |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
412 * - IF the user provides his channel-mapping, THEN: |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
413 * - disable all stations |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
414 * - update and/or create entries in the stationlist and enable them |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
415 */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
416 static int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
417 parse_setup_stationlist (struct pvr_t *pvr) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
418 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
419 int i; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
420 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
421 if (!pvr) |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
422 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
423 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
424 /* Create our station/channel list */ |
23888 | 425 if (stream_tv_defaults.chanlist) |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
426 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
427 /* select channel list */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
428 for (i = 0; chanlists[i].name != NULL; i++) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
429 { |
23888 | 430 if (!strcasecmp (chanlists[i].name, stream_tv_defaults.chanlist)) |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
431 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
432 chantab = i; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
433 break; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
434 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
435 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
436 if (!chanlists[i].name) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
437 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
438 mp_msg (MSGT_OPEN, MSGL_ERR, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
439 "%s unable to find channel list %s, using default %s\n", |
23888 | 440 LOG_LEVEL_V4L2, stream_tv_defaults.chanlist, chanlists[chantab].name); |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
441 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
442 else |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
443 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
444 mp_msg (MSGT_OPEN, MSGL_INFO, |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
445 "%s select channel list %s, entries %d\n", LOG_LEVEL_V4L2, |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
446 chanlists[chantab].name, chanlists[chantab].count); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
447 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
448 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
449 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
450 if (0 > chantab) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
451 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
452 mp_msg (MSGT_OPEN, MSGL_FATAL, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
453 "%s No channel list selected, giving up\n", LOG_LEVEL_V4L2); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
454 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
455 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
456 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
457 if (copycreate_stationlist (&(pvr->stationlist), -1) < 0) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
458 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
459 mp_msg (MSGT_OPEN, MSGL_FATAL, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
460 "%s No memory allocated for station list, giving up\n", |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
461 LOG_LEVEL_V4L2); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
462 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
463 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
464 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
465 /* Handle user channel mappings */ |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
466 if (stream_tv_defaults.channels) |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
467 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
468 char channel[PVR_STATION_NAME_SIZE]; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
469 char station[PVR_STATION_NAME_SIZE]; |
23888 | 470 char **channels = stream_tv_defaults.channels; |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
471 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
472 disable_all_stations (pvr); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
473 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
474 while (*channels) |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
475 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
476 char *tmp = *(channels++); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
477 char *sep = strchr (tmp, '-'); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
478 int freq=-1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
479 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
480 if (!sep) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
481 continue; /* Wrong syntax, but mplayer should not crash */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
482 |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
23245
diff
changeset
|
483 av_strlcpy (station, sep + 1, PVR_STATION_NAME_SIZE); |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
484 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
485 sep[0] = '\0'; |
23703
9fb716ab06a3
Avoid code duplication and ugly config.h hack by using av_strlcat/av_strlcpy
reimar
parents:
23245
diff
changeset
|
486 av_strlcpy (channel, tmp, PVR_STATION_NAME_SIZE); |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
487 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
488 while ((sep = strchr (station, '_'))) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
489 sep[0] = ' '; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
490 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
491 /* if channel number is a number and larger than 1000 treat it as |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
492 * frequency tmp still contain pointer to null-terminated string with |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
493 * channel number here |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
494 */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
495 if ((freq = atoi (channel)) <= 1000) |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
496 freq = -1; |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
497 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
498 if (set_station (pvr, station, (freq <= 0) ? channel : NULL, freq) < 0) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
499 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
500 mp_msg (MSGT_OPEN, MSGL_ERR, |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
501 "%s Unable to set user station channel: %8s - freq: %8d - station: %s\n", LOG_LEVEL_V4L2, |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
502 channel, freq, station); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
503 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
504 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
505 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
506 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
507 return print_all_stations (pvr); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
508 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
509 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
510 static int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
511 get_v4l2_freq (struct pvr_t *pvr) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
512 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
513 int freq; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
514 struct v4l2_frequency vf; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
515 struct v4l2_tuner vt; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
516 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
517 if (!pvr) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
518 return -1; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
519 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
520 if (pvr->dev_fd < 0) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
521 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
522 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
523 memset (&vt, 0, sizeof (vt)); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
524 memset (&vf, 0, sizeof (vf)); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
525 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
526 if (ioctl (pvr->dev_fd, VIDIOC_G_TUNER, &vt) < 0) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
527 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
528 mp_msg (MSGT_OPEN, MSGL_ERR, "%s can't set tuner (%s).\n", |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
529 LOG_LEVEL_V4L2, strerror (errno)); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
530 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
531 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
532 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
533 if (ioctl (pvr->dev_fd, VIDIOC_G_FREQUENCY, &vf) < 0) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
534 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
535 mp_msg (MSGT_OPEN, MSGL_ERR, "%s can't get frequency %d.\n", |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
536 LOG_LEVEL_V4L2, errno); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
537 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
538 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
539 freq = vf.frequency; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
540 if (!(vt.capability & V4L2_TUNER_CAP_LOW)) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
541 freq *= 1000; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
542 freq /= 16; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
543 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
544 return freq; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
545 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
546 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
547 static int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
548 set_v4l2_freq (struct pvr_t *pvr) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
549 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
550 struct v4l2_frequency vf; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
551 struct v4l2_tuner vt; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
552 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
553 if (!pvr) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
554 return -1; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
555 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
556 if (0 >= pvr->freq) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
557 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
558 mp_msg (MSGT_OPEN, MSGL_ERR, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
559 "%s Frequency invalid %d !!!\n", LOG_LEVEL_V4L2, pvr->freq); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
560 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
561 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
562 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
563 /* don't set the frequency, if it's already set. |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
564 * setting it here would interrupt the stream. |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
565 */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
566 if (get_v4l2_freq (pvr) == pvr->freq) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
567 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
568 mp_msg (MSGT_OPEN, MSGL_STATUS, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
569 "%s Frequency %d already set.\n", LOG_LEVEL_V4L2, pvr->freq); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
570 return 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
571 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
572 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
573 if (pvr->dev_fd < 0) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
574 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
575 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
576 memset (&vf, 0, sizeof (vf)); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
577 memset (&vt, 0, sizeof (vt)); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
578 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
579 if (ioctl (pvr->dev_fd, VIDIOC_G_TUNER, &vt) < 0) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
580 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
581 mp_msg (MSGT_OPEN, MSGL_ERR, "%s can't get tuner (%s).\n", |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
582 LOG_LEVEL_V4L2, strerror (errno)); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
583 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
584 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
585 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
586 vf.type = vt.type; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
587 vf.frequency = pvr->freq * 16; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
588 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
589 if (!(vt.capability & V4L2_TUNER_CAP_LOW)) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
590 vf.frequency /= 1000; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
591 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
592 if (ioctl (pvr->dev_fd, VIDIOC_S_FREQUENCY, &vf) < 0) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
593 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
594 mp_msg (MSGT_OPEN, MSGL_ERR, "%s can't set frequency (%s).\n", |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
595 LOG_LEVEL_V4L2, strerror (errno)); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
596 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
597 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
598 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
599 memset (&vt, 0, sizeof(vt)); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
600 if (ioctl (pvr->dev_fd, VIDIOC_G_TUNER, &vt) < 0) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
601 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
602 mp_msg (MSGT_OPEN, MSGL_ERR, "%s can't set tuner (%s).\n", |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
603 LOG_LEVEL_V4L2, strerror (errno)); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
604 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
605 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
606 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
607 /* just a notification */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
608 if (!vt.signal) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
609 mp_msg (MSGT_OPEN, MSGL_ERR, "%s NO SIGNAL at frequency %d (%d)\n", |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
610 LOG_LEVEL_V4L2, pvr->freq, vf.frequency); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
611 else |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
612 mp_msg (MSGT_OPEN, MSGL_STATUS, "%s Got signal at frequency %d (%d)\n", |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
613 LOG_LEVEL_V4L2, pvr->freq, vf.frequency); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
614 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
615 return 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
616 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
617 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
618 static int |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
619 set_station_by_step (struct pvr_t *pvr, int step, int v4lAction) |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
620 { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
621 if (!pvr || !pvr->stationlist.list) |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
622 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
623 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
624 if (pvr->stationlist.enabled >= abs (step)) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
625 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
626 int gotcha = 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
627 int chidx = pvr->chan_idx + step; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
628 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
629 while (!gotcha) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
630 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
631 chidx = (chidx + pvr->stationlist.used) % pvr->stationlist.used; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
632 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
633 mp_msg (MSGT_OPEN, MSGL_DBG2, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
634 "%s Offset switch: current %d, enabled %d, step %d -> %d\n", |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
635 LOG_LEVEL_V4L2, pvr->chan_idx, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
636 pvr->stationlist.enabled, step, chidx); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
637 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
638 if (!pvr->stationlist.list[chidx].enabled) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
639 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
640 mp_msg (MSGT_OPEN, MSGL_DBG2, |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
641 "%s Switch disabled to user station channel: %8s - freq: %8d - station: %s\n", LOG_LEVEL_V4L2, |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
642 pvr->stationlist.list[chidx].name, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
643 pvr->stationlist.list[chidx].freq, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
644 pvr->stationlist.list[chidx].station); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
645 chidx += FFSIGN (step); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
646 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
647 else |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
648 gotcha = 1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
649 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
650 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
651 pvr->freq = pvr->stationlist.list[chidx].freq; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
652 pvr->chan_idx_last = pvr->chan_idx; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
653 pvr->chan_idx = chidx; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
654 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
655 mp_msg (MSGT_OPEN, MSGL_INFO, |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
656 "%s Switch to user station channel: %8s - freq: %8d - station: %s\n", LOG_LEVEL_V4L2, |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
657 pvr->stationlist.list[chidx].name, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
658 pvr->stationlist.list[chidx].freq, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
659 pvr->stationlist.list[chidx].station); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
660 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
661 if (v4lAction) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
662 return set_v4l2_freq (pvr); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
663 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
664 return (pvr->freq > 0) ? 0 : -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
665 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
666 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
667 mp_msg (MSGT_OPEN, MSGL_ERR, |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
668 "%s Ooops couldn't set freq by channel entry step %d to current %d, enabled %d\n", LOG_LEVEL_V4L2, |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
669 step, pvr->chan_idx, pvr->stationlist.enabled); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
670 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
671 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
672 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
673 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
674 static int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
675 set_station_by_channelname_or_freq (struct pvr_t *pvr, const char *channel, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
676 int freq, int v4lAction) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
677 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
678 int i = 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
679 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
680 if (!pvr || !pvr->stationlist.list) |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
681 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
682 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
683 if (0 >= pvr->stationlist.enabled) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
684 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
685 mp_msg (MSGT_OPEN, MSGL_WARN, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
686 "%s No enabled station, cannot switch channel/frequency\n", |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
687 LOG_LEVEL_V4L2); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
688 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
689 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
690 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
691 if (channel) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
692 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
693 /* select by channel */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
694 for (i = 0; i < pvr->stationlist.used ; i++) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
695 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
696 if (!strcasecmp (pvr->stationlist.list[i].name, channel)) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
697 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
698 if (!pvr->stationlist.list[i].enabled) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
699 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
700 mp_msg (MSGT_OPEN, MSGL_WARN, |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
701 "%s Switch disabled to user station channel: %8s - freq: %8d - station: %s\n", LOG_LEVEL_V4L2, |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
702 pvr->stationlist.list[i].name, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
703 pvr->stationlist.list[i].freq, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
704 pvr->stationlist.list[i].station); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
705 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
706 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
707 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
708 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
709 pvr->freq = pvr->stationlist.list[i].freq; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
710 pvr->chan_idx_last = pvr->chan_idx; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
711 pvr->chan_idx = i; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
712 break; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
713 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
714 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
715 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
716 else if (freq >= 0) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
717 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
718 /* select by freq */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
719 for (i = 0; i < pvr->stationlist.used; i++) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
720 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
721 if (pvr->stationlist.list[i].freq == freq) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
722 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
723 if (!pvr->stationlist.list[i].enabled) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
724 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
725 mp_msg (MSGT_OPEN, MSGL_WARN, |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
726 "%s Switch disabled to user station channel: %8s - freq: %8d - station: %s\n", LOG_LEVEL_V4L2, |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
727 pvr->stationlist.list[i].name, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
728 pvr->stationlist.list[i].freq, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
729 pvr->stationlist.list[i].station); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
730 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
731 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
732 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
733 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
734 pvr->freq = pvr->stationlist.list[i].freq; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
735 pvr->chan_idx_last = pvr->chan_idx; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
736 pvr->chan_idx = i; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
737 break; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
738 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
739 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
740 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
741 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
742 if (i >= pvr->stationlist.used) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
743 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
744 if (channel) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
745 mp_msg (MSGT_OPEN, MSGL_WARN, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
746 "%s unable to find channel %s\n", LOG_LEVEL_V4L2, channel); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
747 else |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
748 mp_msg (MSGT_OPEN, MSGL_WARN, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
749 "%s unable to find frequency %d\n", LOG_LEVEL_V4L2, freq); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
750 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
751 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
752 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
753 mp_msg (MSGT_OPEN, MSGL_INFO, |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
754 "%s Switch to user station channel: %8s - freq: %8d - station: %s\n", LOG_LEVEL_V4L2, |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
755 pvr->stationlist.list[i].name, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
756 pvr->stationlist.list[i].freq, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
757 pvr->stationlist.list[i].station); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
758 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
759 if (v4lAction) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
760 return set_v4l2_freq (pvr); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
761 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
762 return (pvr->freq > 0) ? 0 : -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
763 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
764 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
765 static int |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
766 force_freq_step (struct pvr_t *pvr, int step) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
767 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
768 int freq; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
769 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
770 if (!pvr) |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
771 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
772 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
773 freq = pvr->freq+step; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
774 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
775 if (freq) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
776 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
777 mp_msg (MSGT_OPEN, MSGL_INFO, |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
778 "%s Force Frequency %d + %d = %d \n", LOG_LEVEL_V4L2, |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
779 pvr->freq, step, freq); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
780 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
781 pvr->freq = freq; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
782 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
783 return set_v4l2_freq (pvr); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
784 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
785 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
786 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
787 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
788 |
18997 | 789 static void |
19976
281ac13bf72d
cosmetic renames because pvr support will soon be less ivtv driver dependant
ben
parents:
19617
diff
changeset
|
790 parse_encoder_options (struct pvr_t *pvr) |
18997 | 791 { |
792 if (!pvr) | |
793 return; | |
794 | |
795 /* -pvr aspect=digit */ | |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
796 if (pvr_param_aspect_ratio >= 0 && pvr_param_aspect_ratio <= 3) |
18997 | 797 pvr->aspect = pvr_param_aspect_ratio; |
798 | |
799 /* -pvr arate=x */ | |
800 if (pvr_param_sample_rate != 0) | |
801 { | |
802 switch (pvr_param_sample_rate) | |
803 { | |
804 case 32000: | |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
805 pvr->samplerate = V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000; |
18997 | 806 break; |
807 case 44100: | |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
808 pvr->samplerate = V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100; |
18997 | 809 break; |
810 case 48000: | |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
811 pvr->samplerate = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000; |
18997 | 812 break; |
813 default: | |
814 break; | |
815 } | |
816 } | |
817 | |
818 /* -pvr alayer=x */ | |
819 if (pvr_param_audio_layer == 1) | |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
820 pvr->layer = V4L2_MPEG_AUDIO_ENCODING_LAYER_1; |
18997 | 821 else if (pvr_param_audio_layer == 2) |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
822 pvr->layer = V4L2_MPEG_AUDIO_ENCODING_LAYER_2; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
823 else if (pvr_param_audio_layer == 3) |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
824 pvr->layer = V4L2_MPEG_AUDIO_ENCODING_LAYER_3; |
18997 | 825 |
826 /* -pvr abitrate=x */ | |
827 if (pvr_param_audio_bitrate != 0) | |
828 { | |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
829 if (pvr->layer == V4L2_MPEG_AUDIO_ENCODING_LAYER_1) |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
830 { |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
831 switch (pvr_param_audio_bitrate) |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
832 { |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
833 case 32: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
834 pvr->audio_rate = V4L2_MPEG_AUDIO_L1_BITRATE_32K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
835 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
836 case 64: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
837 pvr->audio_rate = V4L2_MPEG_AUDIO_L1_BITRATE_64K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
838 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
839 case 96: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
840 pvr->audio_rate = V4L2_MPEG_AUDIO_L1_BITRATE_96K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
841 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
842 case 128: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
843 pvr->audio_rate = V4L2_MPEG_AUDIO_L1_BITRATE_128K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
844 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
845 case 160: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
846 pvr->audio_rate = V4L2_MPEG_AUDIO_L1_BITRATE_160K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
847 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
848 case 192: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
849 pvr->audio_rate = V4L2_MPEG_AUDIO_L1_BITRATE_192K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
850 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
851 case 224: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
852 pvr->audio_rate = V4L2_MPEG_AUDIO_L1_BITRATE_224K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
853 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
854 case 256: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
855 pvr->audio_rate = V4L2_MPEG_AUDIO_L1_BITRATE_256K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
856 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
857 case 288: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
858 pvr->audio_rate = V4L2_MPEG_AUDIO_L1_BITRATE_288K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
859 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
860 case 320: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
861 pvr->audio_rate = V4L2_MPEG_AUDIO_L1_BITRATE_320K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
862 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
863 case 352: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
864 pvr->audio_rate = V4L2_MPEG_AUDIO_L1_BITRATE_352K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
865 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
866 case 384: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
867 pvr->audio_rate = V4L2_MPEG_AUDIO_L1_BITRATE_384K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
868 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
869 case 416: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
870 pvr->audio_rate = V4L2_MPEG_AUDIO_L1_BITRATE_416K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
871 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
872 case 448: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
873 pvr->audio_rate = V4L2_MPEG_AUDIO_L1_BITRATE_448K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
874 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
875 default: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
876 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
877 } |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
878 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
879 |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
880 else if (pvr->layer == V4L2_MPEG_AUDIO_ENCODING_LAYER_2) |
18997 | 881 { |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
882 switch (pvr_param_audio_bitrate) |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
883 { |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
884 case 32: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
885 pvr->audio_rate = V4L2_MPEG_AUDIO_L2_BITRATE_32K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
886 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
887 case 48: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
888 pvr->audio_rate = V4L2_MPEG_AUDIO_L2_BITRATE_48K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
889 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
890 case 56: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
891 pvr->audio_rate = V4L2_MPEG_AUDIO_L2_BITRATE_56K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
892 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
893 case 64: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
894 pvr->audio_rate = V4L2_MPEG_AUDIO_L2_BITRATE_64K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
895 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
896 case 80: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
897 pvr->audio_rate = V4L2_MPEG_AUDIO_L2_BITRATE_80K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
898 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
899 case 96: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
900 pvr->audio_rate = V4L2_MPEG_AUDIO_L2_BITRATE_96K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
901 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
902 case 112: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
903 pvr->audio_rate = V4L2_MPEG_AUDIO_L2_BITRATE_112K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
904 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
905 case 128: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
906 pvr->audio_rate = V4L2_MPEG_AUDIO_L2_BITRATE_128K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
907 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
908 case 160: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
909 pvr->audio_rate = V4L2_MPEG_AUDIO_L2_BITRATE_160K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
910 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
911 case 192: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
912 pvr->audio_rate = V4L2_MPEG_AUDIO_L2_BITRATE_192K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
913 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
914 case 224: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
915 pvr->audio_rate = V4L2_MPEG_AUDIO_L2_BITRATE_224K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
916 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
917 case 256: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
918 pvr->audio_rate = V4L2_MPEG_AUDIO_L2_BITRATE_256K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
919 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
920 case 320: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
921 pvr->audio_rate = V4L2_MPEG_AUDIO_L2_BITRATE_320K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
922 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
923 case 384: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
924 pvr->audio_rate = V4L2_MPEG_AUDIO_L2_BITRATE_384K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
925 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
926 default: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
927 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
928 } |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
929 } |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
930 |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
931 else if (pvr->layer == V4L2_MPEG_AUDIO_ENCODING_LAYER_3) |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
932 { |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
933 switch (pvr_param_audio_bitrate) |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
934 { |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
935 case 32: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
936 pvr->audio_rate = V4L2_MPEG_AUDIO_L3_BITRATE_32K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
937 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
938 case 40: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
939 pvr->audio_rate = V4L2_MPEG_AUDIO_L3_BITRATE_40K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
940 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
941 case 48: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
942 pvr->audio_rate = V4L2_MPEG_AUDIO_L3_BITRATE_48K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
943 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
944 case 56: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
945 pvr->audio_rate = V4L2_MPEG_AUDIO_L3_BITRATE_56K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
946 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
947 case 64: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
948 pvr->audio_rate = V4L2_MPEG_AUDIO_L3_BITRATE_64K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
949 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
950 case 80: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
951 pvr->audio_rate = V4L2_MPEG_AUDIO_L3_BITRATE_80K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
952 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
953 case 96: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
954 pvr->audio_rate = V4L2_MPEG_AUDIO_L3_BITRATE_96K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
955 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
956 case 112: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
957 pvr->audio_rate = V4L2_MPEG_AUDIO_L3_BITRATE_112K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
958 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
959 case 128: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
960 pvr->audio_rate = V4L2_MPEG_AUDIO_L3_BITRATE_128K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
961 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
962 case 160: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
963 pvr->audio_rate = V4L2_MPEG_AUDIO_L3_BITRATE_160K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
964 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
965 case 192: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
966 pvr->audio_rate = V4L2_MPEG_AUDIO_L3_BITRATE_192K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
967 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
968 case 224: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
969 pvr->audio_rate = V4L2_MPEG_AUDIO_L3_BITRATE_224K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
970 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
971 case 256: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
972 pvr->audio_rate = V4L2_MPEG_AUDIO_L3_BITRATE_256K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
973 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
974 case 320: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
975 pvr->audio_rate = V4L2_MPEG_AUDIO_L3_BITRATE_320K; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
976 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
977 default: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
978 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
979 } |
18997 | 980 } |
981 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
982 |
18997 | 983 /* -pvr amode=x */ |
984 if (pvr_param_audio_mode) | |
985 { | |
986 if (!strcmp (pvr_param_audio_mode, PVR_AUDIO_MODE_ARG_STEREO)) | |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
987 pvr->audio_mode = V4L2_MPEG_AUDIO_MODE_STEREO; |
18997 | 988 else if (!strcmp (pvr_param_audio_mode, PVR_AUDIO_MODE_ARG_JOINT_STEREO)) |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
989 pvr->audio_mode = V4L2_MPEG_AUDIO_MODE_JOINT_STEREO; |
18997 | 990 else if (!strcmp (pvr_param_audio_mode, PVR_AUDIO_MODE_ARG_DUAL)) |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
991 pvr->audio_mode = V4L2_MPEG_AUDIO_MODE_DUAL; |
18997 | 992 else if (!strcmp (pvr_param_audio_mode, PVR_AUDIO_MODE_ARG_MONO)) |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
993 pvr->audio_mode = V4L2_MPEG_AUDIO_MODE_MONO; |
18997 | 994 } |
995 | |
996 /* -pvr vbitrate=x */ | |
997 if (pvr_param_bitrate) | |
998 pvr->bitrate = pvr_param_bitrate; | |
999 | |
1000 /* -pvr vmode=x */ | |
1001 if (pvr_param_bitrate_mode) | |
1002 { | |
1003 if (!strcmp (pvr_param_bitrate_mode, PVR_VIDEO_BITRATE_MODE_ARG_VBR)) | |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1004 pvr->bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_VBR; |
18997 | 1005 else if (!strcmp (pvr_param_bitrate_mode, PVR_VIDEO_BITRATE_MODE_ARG_CBR)) |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1006 pvr->bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_CBR; |
18997 | 1007 } |
1008 | |
1009 /* -pvr vpeak=x */ | |
1010 if (pvr_param_bitrate_peak) | |
1011 pvr->bitrate_peak = pvr_param_bitrate_peak; | |
1012 | |
1013 /* -pvr fmt=x */ | |
1014 if (pvr_param_stream_type) | |
1015 { | |
1016 if (!strcmp (pvr_param_stream_type, PVR_VIDEO_STREAM_TYPE_PS)) | |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1017 pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS; |
18997 | 1018 else if (!strcmp (pvr_param_stream_type, PVR_VIDEO_STREAM_TYPE_TS)) |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1019 pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_TS; |
18997 | 1020 else if (!strcmp (pvr_param_stream_type, PVR_VIDEO_STREAM_TYPE_MPEG1)) |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1021 pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG1_SS; |
18997 | 1022 else if (!strcmp (pvr_param_stream_type, PVR_VIDEO_STREAM_TYPE_DVD)) |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1023 pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_DVD; |
18997 | 1024 else if (!strcmp (pvr_param_stream_type, PVR_VIDEO_STREAM_TYPE_VCD)) |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1025 pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG1_VCD; |
18997 | 1026 else if (!strcmp (pvr_param_stream_type, PVR_VIDEO_STREAM_TYPE_SVCD)) |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1027 pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD; |
18997 | 1028 } |
1029 } | |
1030 | |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1031 static void |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1032 add_v4l2_ext_control (struct v4l2_ext_control *ctrl, |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1033 uint32_t id, int32_t value) |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1034 { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1035 ctrl->id = id; |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1036 ctrl->value = value; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1037 } |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1038 |
18997 | 1039 static int |
19976
281ac13bf72d
cosmetic renames because pvr support will soon be less ivtv driver dependant
ben
parents:
19617
diff
changeset
|
1040 set_encoder_settings (struct pvr_t *pvr) |
18997 | 1041 { |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1042 struct v4l2_ext_control *ext_ctrl = NULL; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1043 struct v4l2_ext_controls ctrls; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1044 uint32_t count = 0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1045 |
18997 | 1046 if (!pvr) |
1047 return -1; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1048 |
18997 | 1049 if (pvr->dev_fd < 0) |
1050 return -1; | |
1051 | |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1052 ext_ctrl = (struct v4l2_ext_control *) |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1053 malloc (PVR_MAX_CONTROLS * sizeof (struct v4l2_ext_control)); |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1054 |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1055 add_v4l2_ext_control (&ext_ctrl[count++], V4L2_CID_MPEG_VIDEO_ASPECT, |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1056 pvr->aspect); |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1057 |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1058 add_v4l2_ext_control (&ext_ctrl[count++], V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ, |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1059 pvr->samplerate); |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1060 |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1061 add_v4l2_ext_control (&ext_ctrl[count++], V4L2_CID_MPEG_AUDIO_ENCODING, |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1062 pvr->layer); |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1063 |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1064 switch (pvr->layer) |
18997 | 1065 { |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1066 case V4L2_MPEG_AUDIO_ENCODING_LAYER_1: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1067 add_v4l2_ext_control (&ext_ctrl[count++], V4L2_CID_MPEG_AUDIO_L1_BITRATE, |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1068 pvr->audio_rate); |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1069 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1070 case V4L2_MPEG_AUDIO_ENCODING_LAYER_2: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1071 add_v4l2_ext_control (&ext_ctrl[count++], V4L2_CID_MPEG_AUDIO_L2_BITRATE, |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1072 pvr->audio_rate); |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1073 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1074 case V4L2_MPEG_AUDIO_ENCODING_LAYER_3: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1075 add_v4l2_ext_control (&ext_ctrl[count++], V4L2_CID_MPEG_AUDIO_L3_BITRATE, |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1076 pvr->audio_rate); |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1077 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1078 default: |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1079 break; |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1080 } |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1081 |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1082 add_v4l2_ext_control (&ext_ctrl[count++], V4L2_CID_MPEG_AUDIO_MODE, |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1083 pvr->audio_mode); |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1084 |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1085 add_v4l2_ext_control (&ext_ctrl[count++], V4L2_CID_MPEG_VIDEO_BITRATE, |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1086 pvr->bitrate); |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1087 |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1088 add_v4l2_ext_control (&ext_ctrl[count++], V4L2_CID_MPEG_VIDEO_BITRATE_PEAK, |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1089 pvr->bitrate_peak); |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1090 |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1091 add_v4l2_ext_control (&ext_ctrl[count++], V4L2_CID_MPEG_VIDEO_BITRATE_MODE, |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1092 pvr->bitrate_mode); |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1093 |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1094 add_v4l2_ext_control (&ext_ctrl[count++], V4L2_CID_MPEG_STREAM_TYPE, |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1095 pvr->stream_type); |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1096 |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1097 /* set new encoding settings */ |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1098 ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG; |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1099 ctrls.count = count; |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1100 ctrls.controls = ext_ctrl; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1101 |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1102 if (ioctl (pvr->dev_fd, VIDIOC_S_EXT_CTRLS, &ctrls) < 0) |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1103 { |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1104 mp_msg (MSGT_OPEN, MSGL_ERR, "%s Error setting MPEG controls (%s).\n", |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1105 LOG_LEVEL_ENCODER, strerror (errno)); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1106 free (ext_ctrl); |
18997 | 1107 return -1; |
1108 } | |
1109 | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1110 free (ext_ctrl); |
18997 | 1111 |
1112 return 0; | |
1113 } | |
1114 | |
1115 static void | |
1116 parse_v4l2_tv_options (struct pvr_t *pvr) | |
1117 { | |
1118 if (!pvr) | |
1119 return; | |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1120 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1121 /* Create our station/channel list */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1122 parse_setup_stationlist (pvr); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1123 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1124 if (pvr->param_channel) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1125 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1126 if (set_station_by_channelname_or_freq (pvr, pvr->param_channel, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1127 -1, 0) >= 0) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1128 { |
23888 | 1129 if (stream_tv_defaults.freq) |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1130 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1131 mp_msg (MSGT_OPEN, MSGL_HINT, |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1132 "%s tv param freq %s is overwritten by channel setting freq %d\n", LOG_LEVEL_V4L2, |
23888 | 1133 stream_tv_defaults.freq, pvr->freq); |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1134 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1135 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1136 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1137 |
23888 | 1138 if (pvr->freq < 0 && stream_tv_defaults.freq) |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1139 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1140 mp_msg (MSGT_OPEN, MSGL_HINT, "%s tv param freq %s is used directly\n", |
23888 | 1141 LOG_LEVEL_V4L2, stream_tv_defaults.freq); |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1142 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1143 if (set_station_by_channelname_or_freq (pvr, NULL, |
23888 | 1144 atoi (stream_tv_defaults.freq), 0)<0) |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1145 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1146 mp_msg (MSGT_OPEN, MSGL_WARN, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1147 "%s tv param freq %s invalid to set station\n", |
23888 | 1148 LOG_LEVEL_V4L2, stream_tv_defaults.freq); |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1149 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1150 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1151 |
23888 | 1152 if (stream_tv_defaults.device) |
18997 | 1153 { |
1154 if (pvr->video_dev) | |
1155 free (pvr->video_dev); | |
23888 | 1156 pvr->video_dev = strdup (stream_tv_defaults.device); |
18997 | 1157 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1158 |
23888 | 1159 if (stream_tv_defaults.noaudio) |
1160 pvr->mute = stream_tv_defaults.noaudio; | |
18997 | 1161 |
23888 | 1162 if (stream_tv_defaults.input) |
1163 pvr->input = stream_tv_defaults.input; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1164 |
23888 | 1165 if (stream_tv_defaults.normid) |
1166 pvr->normid = stream_tv_defaults.normid; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1167 |
23888 | 1168 if (stream_tv_defaults.brightness) |
1169 pvr->brightness = stream_tv_defaults.brightness; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1170 |
23888 | 1171 if (stream_tv_defaults.contrast) |
1172 pvr->contrast = stream_tv_defaults.contrast; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1173 |
23888 | 1174 if (stream_tv_defaults.hue) |
1175 pvr->hue = stream_tv_defaults.hue; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1176 |
23888 | 1177 if (stream_tv_defaults.saturation) |
1178 pvr->saturation = stream_tv_defaults.saturation; | |
18997 | 1179 |
23888 | 1180 if (stream_tv_defaults.width) |
1181 pvr->width = stream_tv_defaults.width; | |
18997 | 1182 |
23888 | 1183 if (stream_tv_defaults.height) |
1184 pvr->height = stream_tv_defaults.height; | |
18997 | 1185 } |
1186 | |
1187 static int | |
1188 set_v4l2_settings (struct pvr_t *pvr) | |
1189 { | |
1190 if (!pvr) | |
1191 return -1; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1192 |
18997 | 1193 if (pvr->dev_fd < 0) |
1194 return -1; | |
1195 | |
1196 /* -tv noaudio */ | |
1197 if (pvr->mute) | |
1198 { | |
1199 struct v4l2_control ctrl; | |
1200 ctrl.id = V4L2_CID_AUDIO_MUTE; | |
1201 ctrl.value = 1; | |
1202 if (ioctl (pvr->dev_fd, VIDIOC_S_CTRL, &ctrl) < 0) | |
1203 { | |
1204 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1205 "%s can't mute (%s).\n", LOG_LEVEL_V4L2, strerror (errno)); | |
1206 return -1; | |
1207 } | |
1208 } | |
1209 | |
1210 /* -tv input=x */ | |
1211 if (pvr->input != 0) | |
1212 { | |
1213 if (ioctl (pvr->dev_fd, VIDIOC_S_INPUT, &pvr->input) < 0) | |
1214 { | |
1215 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1216 "%s can't set input (%s)\n", LOG_LEVEL_V4L2, strerror (errno)); | |
1217 return -1; | |
1218 } | |
1219 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1220 |
18997 | 1221 /* -tv normid=x */ |
1222 if (pvr->normid != -1) | |
1223 { | |
1224 struct v4l2_standard std; | |
1225 std.index = pvr->normid; | |
1226 | |
1227 if (ioctl (pvr->dev_fd, VIDIOC_ENUMSTD, &std) < 0) | |
1228 { | |
1229 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1230 "%s can't set norm (%s)\n", LOG_LEVEL_V4L2, strerror (errno)); | |
1231 return -1; | |
1232 } | |
1233 | |
1234 mp_msg (MSGT_OPEN, MSGL_V, | |
1235 "%s set norm to %s\n", LOG_LEVEL_V4L2, std.name); | |
1236 | |
1237 if (ioctl (pvr->dev_fd, VIDIOC_S_STD, &std.id) < 0) | |
1238 { | |
1239 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1240 "%s can't set norm (%s)\n", LOG_LEVEL_V4L2, strerror (errno)); | |
1241 return -1; | |
1242 } | |
1243 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1244 |
18997 | 1245 /* -tv brightness=x */ |
1246 if (pvr->brightness != 0) | |
1247 { | |
1248 struct v4l2_control ctrl; | |
1249 ctrl.id = V4L2_CID_BRIGHTNESS; | |
1250 ctrl.value = pvr->brightness; | |
1251 | |
1252 if (ctrl.value < 0) | |
1253 ctrl.value = 0; | |
1254 if (ctrl.value > 255) | |
1255 ctrl.value = 255; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1256 |
18997 | 1257 if (ioctl (pvr->dev_fd, VIDIOC_S_CTRL, &ctrl) < 0) |
1258 { | |
1259 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1260 "%s can't set brightness to %d (%s).\n", | |
1261 LOG_LEVEL_V4L2, ctrl.value, strerror (errno)); | |
1262 return -1; | |
1263 } | |
1264 } | |
1265 | |
1266 /* -tv contrast=x */ | |
1267 if (pvr->contrast != 0) | |
1268 { | |
1269 struct v4l2_control ctrl; | |
1270 ctrl.id = V4L2_CID_CONTRAST; | |
1271 ctrl.value = pvr->contrast; | |
1272 | |
1273 if (ctrl.value < 0) | |
1274 ctrl.value = 0; | |
1275 if (ctrl.value > 127) | |
1276 ctrl.value = 127; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1277 |
18997 | 1278 if (ioctl (pvr->dev_fd, VIDIOC_S_CTRL, &ctrl) < 0) |
1279 { | |
1280 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1281 "%s can't set contrast to %d (%s).\n", | |
1282 LOG_LEVEL_V4L2, ctrl.value, strerror (errno)); | |
1283 return -1; | |
1284 } | |
1285 } | |
1286 | |
1287 /* -tv hue=x */ | |
1288 if (pvr->hue != 0) | |
1289 { | |
1290 struct v4l2_control ctrl; | |
1291 ctrl.id = V4L2_CID_HUE; | |
1292 ctrl.value = pvr->hue; | |
1293 | |
1294 if (ctrl.value < -128) | |
1295 ctrl.value = -128; | |
1296 if (ctrl.value > 127) | |
1297 ctrl.value = 127; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1298 |
18997 | 1299 if (ioctl (pvr->dev_fd, VIDIOC_S_CTRL, &ctrl) < 0) |
1300 { | |
1301 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1302 "%s can't set hue to %d (%s).\n", | |
1303 LOG_LEVEL_V4L2, ctrl.value, strerror (errno)); | |
1304 return -1; | |
1305 } | |
1306 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1307 |
18997 | 1308 /* -tv saturation=x */ |
1309 if (pvr->saturation != 0) | |
1310 { | |
1311 struct v4l2_control ctrl; | |
1312 ctrl.id = V4L2_CID_SATURATION; | |
1313 ctrl.value = pvr->saturation; | |
1314 | |
1315 if (ctrl.value < 0) | |
1316 ctrl.value = 0; | |
1317 if (ctrl.value > 127) | |
1318 ctrl.value = 127; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1319 |
18997 | 1320 if (ioctl (pvr->dev_fd, VIDIOC_S_CTRL, &ctrl) < 0) |
1321 { | |
1322 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1323 "%s can't set saturation to %d (%s).\n", | |
1324 LOG_LEVEL_V4L2, ctrl.value, strerror (errno)); | |
1325 return -1; | |
1326 } | |
1327 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1328 |
18997 | 1329 /* -tv width=x:height=y */ |
1330 if (pvr->width && pvr->height) | |
1331 { | |
1332 struct v4l2_format vfmt; | |
1333 vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | |
1334 vfmt.fmt.pix.width = pvr->width; | |
1335 vfmt.fmt.pix.height = pvr->height; | |
1336 | |
1337 if (ioctl (pvr->dev_fd, VIDIOC_S_FMT, &vfmt) < 0) | |
1338 { | |
1339 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1340 "%s can't set resolution to %dx%d (%s).\n", | |
1341 LOG_LEVEL_V4L2, pvr->width, pvr->height, strerror (errno)); | |
1342 return -1; | |
1343 } | |
1344 } | |
1345 | |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1346 if (pvr->freq < 0) |
18997 | 1347 { |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1348 int freq = get_v4l2_freq (pvr); |
18997 | 1349 mp_msg (MSGT_OPEN, MSGL_INFO, |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1350 "%s Using current set frequency %d, to set channel\n", |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1351 LOG_LEVEL_V4L2, freq); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1352 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1353 if (0 < freq) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1354 return set_station_by_channelname_or_freq (pvr, NULL, freq, 1); |
18997 | 1355 } |
1356 | |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1357 if (0 < pvr->freq) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1358 return set_v4l2_freq (pvr) ; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1359 |
18997 | 1360 return 0; |
1361 } | |
1362 | |
1363 static int | |
1364 v4l2_list_capabilities (struct pvr_t *pvr) | |
1365 { | |
1366 struct v4l2_audio vaudio; | |
1367 struct v4l2_standard vs; | |
1368 struct v4l2_input vin; | |
1369 int err = 0; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1370 |
18997 | 1371 if (!pvr) |
1372 return -1; | |
1373 | |
1374 if (pvr->dev_fd < 0) | |
1375 return -1; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1376 |
18997 | 1377 /* list available video inputs */ |
1378 vin.index = 0; | |
1379 err = 1; | |
1380 mp_msg (MSGT_OPEN, MSGL_INFO, | |
1381 "%s Available video inputs: ", LOG_LEVEL_V4L2); | |
1382 while (ioctl (pvr->dev_fd, VIDIOC_ENUMINPUT, &vin) >= 0) | |
1383 { | |
1384 err = 0; | |
1385 mp_msg (MSGT_OPEN, MSGL_INFO, "'#%d, %s' ", vin.index, vin.name); | |
1386 vin.index++; | |
1387 } | |
1388 if (err) | |
1389 { | |
1390 mp_msg (MSGT_OPEN, MSGL_INFO, "none\n"); | |
1391 return -1; | |
1392 } | |
1393 else | |
1394 mp_msg (MSGT_OPEN, MSGL_INFO, "\n"); | |
1395 | |
1396 /* list available audio inputs */ | |
1397 vaudio.index = 0; | |
1398 err = 1; | |
1399 mp_msg (MSGT_OPEN, MSGL_INFO, | |
1400 "%s Available audio inputs: ", LOG_LEVEL_V4L2); | |
1401 while (ioctl (pvr->dev_fd, VIDIOC_ENUMAUDIO, &vaudio) >= 0) | |
1402 { | |
1403 err = 0; | |
1404 mp_msg (MSGT_OPEN, MSGL_INFO, "'#%d, %s' ", vaudio.index, vaudio.name); | |
1405 vaudio.index++; | |
1406 } | |
1407 if (err) | |
1408 { | |
1409 mp_msg (MSGT_OPEN, MSGL_INFO, "none\n"); | |
1410 return -1; | |
1411 } | |
1412 else | |
1413 mp_msg (MSGT_OPEN, MSGL_INFO, "\n"); | |
1414 | |
1415 /* list available norms */ | |
1416 vs.index = 0; | |
1417 mp_msg (MSGT_OPEN, MSGL_INFO, "%s Available norms: ", LOG_LEVEL_V4L2); | |
1418 while (ioctl (pvr->dev_fd, VIDIOC_ENUMSTD, &vs) >= 0) | |
1419 { | |
1420 err = 0; | |
1421 mp_msg (MSGT_OPEN, MSGL_INFO, "'#%d, %s' ", vs.index, vs.name); | |
1422 vs.index++; | |
1423 } | |
1424 if (err) | |
1425 { | |
1426 mp_msg (MSGT_OPEN, MSGL_INFO, "none\n"); | |
1427 return -1; | |
1428 } | |
1429 else | |
1430 mp_msg (MSGT_OPEN, MSGL_INFO, "\n"); | |
1431 | |
1432 return 0; | |
1433 } | |
1434 | |
1435 static int | |
1436 v4l2_display_settings (struct pvr_t *pvr) | |
1437 { | |
1438 struct v4l2_audio vaudio; | |
1439 struct v4l2_standard vs; | |
1440 struct v4l2_input vin; | |
1441 v4l2_std_id std; | |
1442 int input; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1443 |
18997 | 1444 if (!pvr) |
1445 return -1; | |
1446 | |
1447 if (pvr->dev_fd < 0) | |
1448 return -1; | |
1449 | |
1450 /* get current video input */ | |
1451 if (ioctl (pvr->dev_fd, VIDIOC_G_INPUT, &input) == 0) | |
1452 { | |
1453 vin.index = input; | |
1454 if (ioctl (pvr->dev_fd, VIDIOC_ENUMINPUT, &vin) < 0) | |
1455 { | |
1456 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1457 "%s can't get input (%s).\n", LOG_LEVEL_V4L2, strerror (errno)); | |
1458 return -1; | |
1459 } | |
1460 else | |
1461 mp_msg (MSGT_OPEN, MSGL_INFO, | |
1462 "%s Video input: %s\n", LOG_LEVEL_V4L2, vin.name); | |
1463 } | |
1464 else | |
1465 { | |
1466 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1467 "%s can't get input (%s).\n", LOG_LEVEL_V4L2, strerror (errno)); | |
1468 return -1; | |
1469 } | |
1470 | |
1471 /* get current audio input */ | |
1472 if (ioctl (pvr->dev_fd, VIDIOC_G_AUDIO, &vaudio) == 0) | |
1473 { | |
19294 | 1474 mp_msg (MSGT_OPEN, MSGL_INFO, |
1475 "%s Audio input: %s\n", LOG_LEVEL_V4L2, vaudio.name); | |
18997 | 1476 } |
1477 else | |
1478 { | |
1479 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1480 "%s can't get input (%s).\n", LOG_LEVEL_V4L2, strerror (errno)); | |
1481 return -1; | |
1482 } | |
1483 | |
1484 /* get current video format */ | |
1485 if (ioctl (pvr->dev_fd, VIDIOC_G_STD, &std) == 0) | |
1486 { | |
1487 vs.index = 0; | |
1488 | |
1489 while (ioctl (pvr->dev_fd, VIDIOC_ENUMSTD, &vs) >= 0) | |
1490 { | |
1491 if (vs.id == std) | |
1492 { | |
1493 mp_msg (MSGT_OPEN, MSGL_INFO, | |
1494 "%s Norm: %s.\n", LOG_LEVEL_V4L2, vs.name); | |
1495 break; | |
1496 } | |
1497 vs.index++; | |
1498 } | |
1499 } | |
1500 else | |
1501 { | |
1502 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1503 "%s can't get norm (%s)\n", LOG_LEVEL_V4L2, strerror (errno)); | |
1504 return -1; | |
1505 } | |
1506 | |
1507 return 0; | |
1508 } | |
1509 | |
1510 /* stream layer */ | |
1511 | |
1512 static void | |
1513 pvr_stream_close (stream_t *stream) | |
1514 { | |
1515 struct pvr_t *pvr; | |
1516 | |
1517 if (!stream) | |
1518 return; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1519 |
18997 | 1520 pvr = (struct pvr_t *) stream->priv; |
1521 pvr_uninit (pvr); | |
1522 } | |
1523 | |
1524 static int | |
1525 pvr_stream_read (stream_t *stream, char *buffer, int size) | |
1526 { | |
1527 struct pollfd pfds[1]; | |
1528 struct pvr_t *pvr; | |
1529 int rk, fd, pos; | |
1530 | |
1531 if (!stream || !buffer) | |
1532 return 0; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1533 |
18997 | 1534 pvr = (struct pvr_t *) stream->priv; |
1535 fd = pvr->dev_fd; | |
1536 pos = 0; | |
1537 | |
1538 if (fd < 0) | |
1539 return 0; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1540 |
18997 | 1541 while (pos < size) |
1542 { | |
1543 pfds[0].fd = fd; | |
1544 pfds[0].events = POLLIN | POLLPRI; | |
1545 | |
1546 rk = size - pos; | |
1547 | |
1548 if (poll (pfds, 1, 500) <= 0) | |
1549 { | |
1550 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1551 "%s failed with errno %d when reading %d bytes\n", | |
1552 LOG_LEVEL_PVR, errno, size-pos); | |
1553 break; | |
1554 } | |
1555 | |
1556 rk = read (fd, &buffer[pos], rk); | |
1557 if (rk > 0) | |
1558 { | |
1559 pos += rk; | |
1560 mp_msg (MSGT_OPEN, MSGL_DBG3, | |
1561 "%s read (%d) bytes\n", LOG_LEVEL_PVR, pos); | |
1562 } | |
1563 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1564 |
18997 | 1565 if (!pos) |
1566 mp_msg (MSGT_OPEN, MSGL_ERR, "%s read %d bytes\n", LOG_LEVEL_PVR, pos); | |
1567 | |
1568 return pos; | |
1569 } | |
1570 | |
1571 static int | |
1572 pvr_stream_open (stream_t *stream, int mode, void *opts, int *file_format) | |
1573 { | |
1574 struct v4l2_capability vcap; | |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1575 struct v4l2_ext_controls ctrls; |
18997 | 1576 struct pvr_t *pvr = NULL; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1577 |
18997 | 1578 if (mode != STREAM_READ) |
24257 | 1579 return STREAM_UNSUPPORTED; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1580 |
18997 | 1581 pvr = pvr_init (); |
1582 | |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1583 /** |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1584 * if the url, i.e. 'pvr://8', contains the channel, use it, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1585 * else use the tv parameter. |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1586 */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1587 if (stream->url && strlen (stream->url) > 6 && stream->url[6] != '\0') |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1588 pvr->param_channel = strdup (stream->url + 6); |
23888 | 1589 else if (stream_tv_defaults.channel && strlen (stream_tv_defaults.channel)) |
1590 pvr->param_channel = strdup (stream_tv_defaults.channel); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1591 |
18997 | 1592 parse_v4l2_tv_options (pvr); |
19976
281ac13bf72d
cosmetic renames because pvr support will soon be less ivtv driver dependant
ben
parents:
19617
diff
changeset
|
1593 parse_encoder_options (pvr); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1594 |
18997 | 1595 /* open device */ |
1596 pvr->dev_fd = open (pvr->video_dev, O_RDWR); | |
1597 mp_msg (MSGT_OPEN, MSGL_INFO, | |
1598 "%s Using device %s\n", LOG_LEVEL_PVR, pvr->video_dev); | |
1599 if (pvr->dev_fd == -1) | |
1600 { | |
1601 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1602 "%s error opening device %s\n", LOG_LEVEL_PVR, pvr->video_dev); | |
1603 pvr_uninit (pvr); | |
1604 return STREAM_ERROR; | |
1605 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1606 |
18997 | 1607 /* query capabilities (i.e test V4L2 support) */ |
1608 if (ioctl (pvr->dev_fd, VIDIOC_QUERYCAP, &vcap) < 0) | |
1609 { | |
1610 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1611 "%s device is not V4L2 compliant (%s).\n", | |
1612 LOG_LEVEL_PVR, strerror (errno)); | |
1613 pvr_uninit (pvr); | |
1614 return STREAM_ERROR; | |
1615 } | |
1616 else | |
1617 mp_msg (MSGT_OPEN, MSGL_INFO, | |
1618 "%s Detected %s\n", LOG_LEVEL_PVR, vcap.card); | |
1619 | |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1620 /* check for a valid V4L2 capture device */ |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1621 if (!(vcap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) |
18997 | 1622 { |
1623 mp_msg (MSGT_OPEN, MSGL_ERR, | |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1624 "%s device is not a valid V4L2 capture device.\n", |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1625 LOG_LEVEL_PVR); |
18997 | 1626 pvr_uninit (pvr); |
1627 return STREAM_ERROR; | |
1628 } | |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1629 |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1630 /* check for device hardware MPEG encoding capability */ |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1631 ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG; |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1632 ctrls.count = 0; |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1633 ctrls.controls = NULL; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1634 |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1635 if (ioctl (pvr->dev_fd, VIDIOC_G_EXT_CTRLS, &ctrls) < 0) |
18997 | 1636 { |
1637 mp_msg (MSGT_OPEN, MSGL_ERR, | |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1638 "%s device do not support MPEG input.\n", LOG_LEVEL_ENCODER); |
18997 | 1639 return STREAM_ERROR; |
1640 } | |
1641 | |
1642 /* list V4L2 capabilities */ | |
1643 if (v4l2_list_capabilities (pvr) == -1) | |
1644 { | |
1645 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1646 "%s can't get v4l2 capabilities\n", LOG_LEVEL_PVR); | |
1647 pvr_uninit (pvr); | |
1648 return STREAM_ERROR; | |
1649 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1650 |
18997 | 1651 /* apply V4L2 settings */ |
1652 if (set_v4l2_settings (pvr) == -1) | |
1653 { | |
1654 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1655 "%s can't set v4l2 settings\n", LOG_LEVEL_PVR); | |
1656 pvr_uninit (pvr); | |
1657 return STREAM_ERROR; | |
1658 } | |
1659 | |
19976
281ac13bf72d
cosmetic renames because pvr support will soon be less ivtv driver dependant
ben
parents:
19617
diff
changeset
|
1660 /* apply encoder settings */ |
281ac13bf72d
cosmetic renames because pvr support will soon be less ivtv driver dependant
ben
parents:
19617
diff
changeset
|
1661 if (set_encoder_settings (pvr) == -1) |
18997 | 1662 { |
1663 mp_msg (MSGT_OPEN, MSGL_ERR, | |
19976
281ac13bf72d
cosmetic renames because pvr support will soon be less ivtv driver dependant
ben
parents:
19617
diff
changeset
|
1664 "%s can't set encoder settings\n", LOG_LEVEL_PVR); |
18997 | 1665 pvr_uninit (pvr); |
1666 return STREAM_ERROR; | |
1667 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1668 |
18997 | 1669 /* display current V4L2 settings */ |
1670 if (v4l2_display_settings (pvr) == -1) | |
1671 { | |
1672 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1673 "%s can't get v4l2 settings\n", LOG_LEVEL_PVR); | |
1674 pvr_uninit (pvr); | |
1675 return STREAM_ERROR; | |
1676 } | |
1677 | |
1678 stream->priv = pvr; | |
1679 stream->type = STREAMTYPE_PVR; | |
1680 stream->fill_buffer = pvr_stream_read; | |
1681 stream->close = pvr_stream_close; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1682 |
18997 | 1683 return STREAM_OK; |
1684 } | |
1685 | |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1686 /* PVR Public API access */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1687 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1688 const char * |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1689 pvr_get_current_stationname (stream_t *stream) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1690 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1691 struct pvr_t *pvr; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1692 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1693 if (!stream || stream->type != STREAMTYPE_PVR) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1694 return NULL; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1695 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1696 pvr = (struct pvr_t *) stream->priv; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1697 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1698 if (pvr->stationlist.list && |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1699 pvr->stationlist.used > pvr->chan_idx && |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1700 pvr->chan_idx >= 0) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1701 return pvr->stationlist.list[pvr->chan_idx].station; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1702 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1703 return NULL; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1704 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1705 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1706 const char * |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1707 pvr_get_current_channelname (stream_t *stream) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1708 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1709 struct pvr_t *pvr = (struct pvr_t *) stream->priv; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1710 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1711 if (pvr->stationlist.list && |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1712 pvr->stationlist.used > pvr->chan_idx && |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1713 pvr->chan_idx >= 0) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1714 return pvr->stationlist.list[pvr->chan_idx].name; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1715 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1716 return NULL; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1717 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1718 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1719 int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1720 pvr_get_current_frequency (stream_t *stream) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1721 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1722 struct pvr_t *pvr = (struct pvr_t *) stream->priv; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1723 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1724 return pvr->freq; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1725 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1726 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1727 int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1728 pvr_set_channel (stream_t *stream, const char * channel) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1729 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1730 struct pvr_t *pvr = (struct pvr_t *) stream->priv; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1731 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1732 return set_station_by_channelname_or_freq (pvr, channel, -1, 1); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1733 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1734 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1735 int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1736 pvr_set_lastchannel (stream_t *stream) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1737 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1738 struct pvr_t *pvr = (struct pvr_t *) stream->priv; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1739 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1740 if (pvr->stationlist.list && |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1741 pvr->stationlist.used > pvr->chan_idx_last && |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1742 pvr->chan_idx_last >= 0) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1743 return set_station_by_channelname_or_freq (pvr, pvr->stationlist.list[pvr->chan_idx_last].name, -1, 1); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1744 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1745 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1746 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1747 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1748 int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1749 pvr_set_freq (stream_t *stream, int freq) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1750 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1751 struct pvr_t *pvr = (struct pvr_t *) stream->priv; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1752 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1753 return set_station_by_channelname_or_freq (pvr, NULL, freq, 1); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1754 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1755 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1756 int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1757 pvr_set_channel_step (stream_t *stream, int step) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1758 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1759 struct pvr_t *pvr = (struct pvr_t *) stream->priv; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1760 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1761 return set_station_by_step (pvr, step, 1); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1762 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1763 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1764 int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1765 pvr_force_freq_step (stream_t *stream, int step) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1766 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1767 struct pvr_t *pvr = (struct pvr_t *) stream->priv; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1768 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1769 return force_freq_step (pvr, step); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1770 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1771 |
25211 | 1772 const stream_info_t stream_info_pvr = { |
19992
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1773 "V4L2 MPEG Input (a.k.a PVR)", |
18997 | 1774 "pvr", |
1775 "Benjamin Zores", | |
1776 "", | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1777 pvr_stream_open, |
18997 | 1778 { "pvr", NULL }, |
1779 NULL, | |
1780 1 | |
1781 }; |