Mercurial > mplayer.hg
annotate stream/stream_pvr.c @ 35429:3a9048421524
Create new header file gui.h.
This is for declarations and definitions used throughout the GUI
which are internal ones and thus shall not appear in interface.h.
author | ib |
---|---|
date | Fri, 30 Nov 2012 11:14:30 +0000 |
parents | 0fa420bbf59a |
children | 389d43c448b3 |
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> | |
33496
a41cd754ef9f
Replace sys/fcntl.h include by fcntl.h include used everywhere else.
reimar
parents:
32511
diff
changeset
|
37 #include <fcntl.h> |
18997 | 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 | |
34807
0fa420bbf59a
stream_pvr: Use sizeof() to get destination buffer size.
reimar
parents:
33496
diff
changeset
|
92 #define BUFSTRCPY(d, s) av_strlcpy(d, s, sizeof(d)) |
0fa420bbf59a
stream_pvr: Use sizeof() to get destination buffer size.
reimar
parents:
33496
diff
changeset
|
93 #define BUFPRINTF(d, ...) snprintf(d, sizeof(d), __VA_ARGS__) |
0fa420bbf59a
stream_pvr: Use sizeof() to get destination buffer size.
reimar
parents:
33496
diff
changeset
|
94 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
95 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
|
96 char name[8]; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
97 int freq; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
98 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
|
99 int enabled; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
100 } station_elem_t; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
101 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
102 typedef struct stationlist_s { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
103 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
|
104 station_elem_t *list; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
105 int total; /* total number */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
106 int used; /* used number */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
107 int enabled; /* enabled number */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
108 } stationlist_t; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
109 |
18997 | 110 struct pvr_t { |
111 int dev_fd; | |
112 char *video_dev; | |
113 | |
114 /* v4l2 params */ | |
115 int mute; | |
116 int input; | |
117 int normid; | |
118 int brightness; | |
119 int contrast; | |
120 int hue; | |
121 int saturation; | |
122 int width; | |
123 int height; | |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
124 int freq; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
125 int chan_idx; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
126 int chan_idx_last; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
127 stationlist_t stationlist; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
128 /* 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
|
129 char *param_channel; |
18997 | 130 |
19976
281ac13bf72d
cosmetic renames because pvr support will soon be less ivtv driver dependant
ben
parents:
19617
diff
changeset
|
131 /* encoder params */ |
18997 | 132 int aspect; |
133 int samplerate; | |
134 int layer; | |
135 int audio_rate; | |
136 int audio_mode; | |
137 int bitrate; | |
138 int bitrate_mode; | |
139 int bitrate_peak; | |
140 int stream_type; | |
141 }; | |
142 | |
143 static struct pvr_t * | |
144 pvr_init (void) | |
145 { | |
146 struct pvr_t *pvr = NULL; | |
147 | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
148 pvr = calloc (1, sizeof (struct pvr_t)); |
18997 | 149 pvr->dev_fd = -1; |
150 pvr->video_dev = strdup (PVR_DEFAULT_DEVICE); | |
151 | |
152 /* v4l2 params */ | |
153 pvr->mute = 0; | |
154 pvr->input = 0; | |
155 pvr->normid = -1; | |
156 pvr->brightness = 0; | |
157 pvr->contrast = 0; | |
158 pvr->hue = 0; | |
159 pvr->saturation = 0; | |
160 pvr->width = -1; | |
161 pvr->height = -1; | |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
162 pvr->freq = -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
163 pvr->chan_idx = -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
164 pvr->chan_idx_last = -1; |
18997 | 165 |
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
|
166 /* 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
|
167 * 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
|
168 * 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
|
169 * 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
|
170 */ |
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->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
|
172 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
|
173 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
|
174 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
|
175 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
|
176 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
|
177 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
|
178 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
|
179 pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
180 |
18997 | 181 return pvr; |
182 } | |
183 | |
184 static void | |
185 pvr_uninit (struct pvr_t *pvr) | |
186 { | |
187 if (!pvr) | |
188 return; | |
189 | |
190 /* close device */ | |
191 if (pvr->dev_fd) | |
192 close (pvr->dev_fd); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
193 |
32511
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
29263
diff
changeset
|
194 free (pvr->video_dev); |
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
29263
diff
changeset
|
195 free (pvr->stationlist.list); |
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
29263
diff
changeset
|
196 free (pvr->param_channel); |
18997 | 197 free (pvr); |
198 } | |
199 | |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
200 /** |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
201 * @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
|
202 * |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
203 * @see parse_setup_stationlist |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
204 */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
205 static int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
206 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
|
207 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
208 int i; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
209 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
210 if (chantab < 0 || !stationlist) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
211 return -1; |
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 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
|
214 |
32511
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
29263
diff
changeset
|
215 free (stationlist->list); |
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
29263
diff
changeset
|
216 stationlist->list = NULL; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
217 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
218 stationlist->total = 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
219 stationlist->enabled = 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
220 stationlist->used = 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
221 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
|
222 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
223 if (!stationlist->list) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
224 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
225 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
|
226 "%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
|
227 LOG_LEVEL_V4L2); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
228 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
229 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
230 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
231 /* 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
|
232 stationlist->total = num; |
34807
0fa420bbf59a
stream_pvr: Use sizeof() to get destination buffer size.
reimar
parents:
33496
diff
changeset
|
233 BUFSTRCPY(stationlist->name, chanlists[chantab].name); |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
234 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
235 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
|
236 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
237 stationlist->list[i].station[0]= '\0'; /* no station name yet */ |
34807
0fa420bbf59a
stream_pvr: Use sizeof() to get destination buffer size.
reimar
parents:
33496
diff
changeset
|
238 BUFSTRCPY(stationlist->list[i].name, chanlists[chantab].list[i].name); |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
239 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
|
240 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
|
241 stationlist->enabled++; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
242 stationlist->used++; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
243 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
244 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
245 return 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
246 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
247 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
248 static int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
249 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
|
250 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
251 int i; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
252 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
253 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
|
254 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
255 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
256 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
|
257 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
258 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
|
259 "%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
|
260 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
|
261 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
|
262 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
|
263 } |
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 return 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
266 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
267 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
268 /** |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
269 * Disables all stations |
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 * @see parse_setup_stationlist |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
272 */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
273 static void |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
274 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
|
275 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
276 int i; |
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 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
|
279 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
|
280 pvr->stationlist.enabled = 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
281 } |
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 /** |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
284 * 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
|
285 * |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
286 * @see parse_setup_stationlist |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
287 */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
288 static int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
289 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
|
290 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
|
291 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
292 int i; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
293 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
294 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
|
295 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
296 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
297 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
|
298 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
299 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
300 /* select channel */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
301 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
|
302 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
303 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
|
304 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
|
305 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
306 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
|
307 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
|
308 } |
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 (i < pvr->stationlist.used) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
311 { |
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 * found an existing entry, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
314 * 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
|
315 * it is also enabled .. |
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 (!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
|
318 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
319 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
|
320 pvr->stationlist.enabled++; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
321 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
322 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
323 if (station) |
34807
0fa420bbf59a
stream_pvr: Use sizeof() to get destination buffer size.
reimar
parents:
33496
diff
changeset
|
324 BUFSTRCPY(pvr->stationlist.list[i].station, station); |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
325 else if (channel) |
34807
0fa420bbf59a
stream_pvr: Use sizeof() to get destination buffer size.
reimar
parents:
33496
diff
changeset
|
326 BUFSTRCPY(pvr->stationlist.list[i].station, channel); |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
327 else |
34807
0fa420bbf59a
stream_pvr: Use sizeof() to get destination buffer size.
reimar
parents:
33496
diff
changeset
|
328 BUFPRINTF(pvr->stationlist.list[i].station, "F %d", freq); |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
329 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
330 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
|
331 "%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
|
332 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
|
333 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
|
334 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
|
335 return 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
336 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
337 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
338 /* 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
|
339 if (freq < 0) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
340 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
341 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
|
342 "%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
|
343 LOG_LEVEL_V4L2); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
344 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
345 } |
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 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
|
348 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
349 /** |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
350 * 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
|
351 * 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
|
352 */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
353 pvr->stationlist.total += 10; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
354 pvr->stationlist.list = |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
355 realloc (pvr->stationlist.list, |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
356 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
|
357 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
358 if (!pvr->stationlist.list) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
359 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
360 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
|
361 "%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
|
362 LOG_LEVEL_V4L2); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
363 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
364 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
365 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
366 /* clear the new space ..*/ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
367 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
|
368 (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
|
369 * sizeof (station_elem_t)); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
370 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
371 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
372 /* 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
|
373 pvr->stationlist.used++; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
374 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
|
375 pvr->stationlist.enabled++; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
376 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
377 if (station) |
34807
0fa420bbf59a
stream_pvr: Use sizeof() to get destination buffer size.
reimar
parents:
33496
diff
changeset
|
378 BUFSTRCPY(pvr->stationlist.list[i].station, station); |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
379 if (channel) |
34807
0fa420bbf59a
stream_pvr: Use sizeof() to get destination buffer size.
reimar
parents:
33496
diff
changeset
|
380 BUFSTRCPY(pvr->stationlist.list[i].name, channel); |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
381 else |
34807
0fa420bbf59a
stream_pvr: Use sizeof() to get destination buffer size.
reimar
parents:
33496
diff
changeset
|
382 BUFPRINTF(pvr->stationlist.list[i].name, "F %d", freq); |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
383 |
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].freq = freq; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
385 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
386 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
|
387 "%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
|
388 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
|
389 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
|
390 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
|
391 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
392 return 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
393 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
394 |
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 * 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
|
397 * - 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
|
398 * - 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
|
399 * - 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
|
400 * - 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
|
401 * - disable all stations |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
402 * - 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
|
403 */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
404 static int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
405 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
|
406 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
407 int i; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
408 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
409 if (!pvr) |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
410 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
411 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
412 /* Create our station/channel list */ |
23888 | 413 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
|
414 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
415 /* select channel list */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
416 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
|
417 { |
23888 | 418 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
|
419 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
420 chantab = i; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
421 break; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
422 } |
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 if (!chanlists[i].name) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
425 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
426 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
|
427 "%s unable to find channel list %s, using default %s\n", |
23888 | 428 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
|
429 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
430 else |
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 mp_msg (MSGT_OPEN, MSGL_INFO, |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
433 "%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
|
434 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
|
435 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
436 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
437 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
438 if (0 > chantab) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
439 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
440 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
|
441 "%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
|
442 return -1; |
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 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
445 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
|
446 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
447 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
|
448 "%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
|
449 LOG_LEVEL_V4L2); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
450 return -1; |
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 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
453 /* Handle user channel mappings */ |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
454 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
|
455 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
456 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
|
457 char station[PVR_STATION_NAME_SIZE]; |
23888 | 458 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
|
459 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
460 disable_all_stations (pvr); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
461 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
462 while (*channels) |
23244
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 char *tmp = *(channels++); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
465 char *sep = strchr (tmp, '-'); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
466 int freq=-1; |
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 if (!sep) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
469 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
|
470 |
34807
0fa420bbf59a
stream_pvr: Use sizeof() to get destination buffer size.
reimar
parents:
33496
diff
changeset
|
471 BUFSTRCPY(station, sep + 1); |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
472 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
473 sep[0] = '\0'; |
34807
0fa420bbf59a
stream_pvr: Use sizeof() to get destination buffer size.
reimar
parents:
33496
diff
changeset
|
474 BUFSTRCPY(channel, tmp); |
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 while ((sep = strchr (station, '_'))) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
477 sep[0] = ' '; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
478 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
479 /* 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
|
480 * 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
|
481 * channel number here |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
482 */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
483 if ((freq = atoi (channel)) <= 1000) |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
484 freq = -1; |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
485 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
486 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
|
487 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
488 mp_msg (MSGT_OPEN, MSGL_ERR, |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
489 "%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
|
490 channel, freq, station); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
491 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
492 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
493 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
494 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
495 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
|
496 } |
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 static int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
499 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
|
500 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
501 int freq; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
502 struct v4l2_frequency vf; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
503 struct v4l2_tuner vt; |
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 if (!pvr) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
506 return -1; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
507 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
508 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
|
509 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
510 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
511 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
|
512 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
|
513 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
514 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
|
515 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
516 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
|
517 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
|
518 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
519 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
520 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
521 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
|
522 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
523 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
|
524 LOG_LEVEL_V4L2, errno); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
525 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
526 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
527 freq = vf.frequency; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
528 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
|
529 freq *= 1000; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
530 freq /= 16; |
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 return freq; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
533 } |
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 static int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
536 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
|
537 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
538 struct v4l2_frequency vf; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
539 struct v4l2_tuner vt; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
540 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
541 if (!pvr) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
542 return -1; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
543 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
544 if (0 >= pvr->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 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
|
547 "%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
|
548 return -1; |
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 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
551 /* 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
|
552 * 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
|
553 */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
554 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
|
555 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
556 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
|
557 "%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
|
558 return 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
559 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
560 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
561 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
|
562 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
563 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
564 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
|
565 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
|
566 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
567 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
|
568 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
569 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
|
570 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
|
571 return -1; |
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 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
574 vf.type = vt.type; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
575 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
|
576 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
577 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
|
578 vf.frequency /= 1000; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
579 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
580 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
|
581 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
582 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
|
583 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
|
584 return -1; |
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 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
587 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
|
588 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
|
589 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
590 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
|
591 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
|
592 return -1; |
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 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
595 /* just a notification */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
596 if (!vt.signal) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
597 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
|
598 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
|
599 else |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
600 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
|
601 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
|
602 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
603 return 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
604 } |
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 static int |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
607 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
|
608 { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
609 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
|
610 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
611 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
612 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
|
613 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
614 int gotcha = 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
615 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
|
616 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
617 while (!gotcha) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
618 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
619 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
|
620 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
621 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
|
622 "%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
|
623 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
|
624 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
|
625 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
626 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
|
627 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
628 mp_msg (MSGT_OPEN, MSGL_DBG2, |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
629 "%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
|
630 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
|
631 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
|
632 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
|
633 chidx += FFSIGN (step); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
634 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
635 else |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
636 gotcha = 1; |
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 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
639 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
|
640 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
|
641 pvr->chan_idx = chidx; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
642 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
643 mp_msg (MSGT_OPEN, MSGL_INFO, |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
644 "%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
|
645 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
|
646 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
|
647 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
|
648 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
649 if (v4lAction) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
650 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
|
651 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
652 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
|
653 } |
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_ERR, |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
656 "%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
|
657 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
|
658 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
659 return -1; |
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 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
662 static int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
663 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
|
664 int freq, int v4lAction) |
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 int i = 0; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
667 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
668 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
|
669 return -1; |
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 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
|
672 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
673 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
|
674 "%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
|
675 LOG_LEVEL_V4L2); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
676 return -1; |
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 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
679 if (channel) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
680 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
681 /* select by channel */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
682 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
|
683 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
684 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
|
685 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
686 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
|
687 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
688 mp_msg (MSGT_OPEN, MSGL_WARN, |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
689 "%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
|
690 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
|
691 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
|
692 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
|
693 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
694 return -1; |
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 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
697 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
|
698 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
|
699 pvr->chan_idx = i; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
700 break; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
701 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
702 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
703 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
704 else if (freq >= 0) |
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 /* select by freq */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
707 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
|
708 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
709 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
|
710 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
711 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
|
712 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
713 mp_msg (MSGT_OPEN, MSGL_WARN, |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
714 "%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
|
715 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
|
716 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
|
717 pvr->stationlist.list[i].station); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
718 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
719 return -1; |
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 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
722 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
|
723 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
|
724 pvr->chan_idx = i; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
725 break; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
726 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
727 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
728 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
729 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
730 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
|
731 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
732 if (channel) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
733 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
|
734 "%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
|
735 else |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
736 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
|
737 "%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
|
738 return -1; |
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 mp_msg (MSGT_OPEN, MSGL_INFO, |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
742 "%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
|
743 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
|
744 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
|
745 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
|
746 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
747 if (v4lAction) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
748 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
|
749 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
750 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
|
751 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
752 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
753 static int |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
754 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
|
755 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
756 int freq; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
757 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
758 if (!pvr) |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
759 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
760 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
761 freq = pvr->freq+step; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
762 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
763 if (freq) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
764 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
765 mp_msg (MSGT_OPEN, MSGL_INFO, |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
766 "%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
|
767 pvr->freq, step, freq); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
768 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
769 pvr->freq = freq; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
770 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
771 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
|
772 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
773 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
774 return -1; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
775 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
776 |
18997 | 777 static void |
19976
281ac13bf72d
cosmetic renames because pvr support will soon be less ivtv driver dependant
ben
parents:
19617
diff
changeset
|
778 parse_encoder_options (struct pvr_t *pvr) |
18997 | 779 { |
780 if (!pvr) | |
781 return; | |
782 | |
783 /* -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
|
784 if (pvr_param_aspect_ratio >= 0 && pvr_param_aspect_ratio <= 3) |
18997 | 785 pvr->aspect = pvr_param_aspect_ratio; |
786 | |
787 /* -pvr arate=x */ | |
788 if (pvr_param_sample_rate != 0) | |
789 { | |
790 switch (pvr_param_sample_rate) | |
791 { | |
792 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
|
793 pvr->samplerate = V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000; |
18997 | 794 break; |
795 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
|
796 pvr->samplerate = V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100; |
18997 | 797 break; |
798 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
|
799 pvr->samplerate = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000; |
18997 | 800 break; |
801 default: | |
802 break; | |
803 } | |
804 } | |
805 | |
806 /* -pvr alayer=x */ | |
807 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
|
808 pvr->layer = V4L2_MPEG_AUDIO_ENCODING_LAYER_1; |
18997 | 809 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
|
810 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
|
811 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
|
812 pvr->layer = V4L2_MPEG_AUDIO_ENCODING_LAYER_3; |
18997 | 813 |
814 /* -pvr abitrate=x */ | |
815 if (pvr_param_audio_bitrate != 0) | |
816 { | |
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
|
817 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
|
818 { |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
819 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
|
820 { |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
821 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
|
822 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
|
823 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
|
824 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
|
825 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
|
826 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
|
827 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
|
828 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
|
829 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
|
830 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
|
831 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
|
832 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
|
833 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
|
834 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
|
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 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
|
837 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
|
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 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
|
840 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
|
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 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
|
843 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
|
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 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
|
846 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
|
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 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
|
849 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
|
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 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
|
852 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
|
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 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
|
855 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
|
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 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
|
858 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
|
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 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
|
861 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
|
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 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
|
864 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
|
865 } |
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 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
867 |
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
|
868 else if (pvr->layer == V4L2_MPEG_AUDIO_ENCODING_LAYER_2) |
18997 | 869 { |
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
|
870 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
|
871 { |
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 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
|
873 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
|
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 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
|
876 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
|
877 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
|
878 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
|
879 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
|
880 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
|
881 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
|
882 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
|
883 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
|
884 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
|
885 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
|
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 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
|
888 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
|
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 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
|
891 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
|
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 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
|
894 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
|
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 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
|
897 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
|
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 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
|
900 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
|
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 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
|
903 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
|
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 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
|
906 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
|
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 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
|
909 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
|
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 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
|
912 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
|
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 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
|
915 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
|
916 } |
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 } |
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 |
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 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
|
920 { |
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 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
|
922 { |
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 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
|
924 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
|
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 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
|
927 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
|
928 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
|
929 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
|
930 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
|
931 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
|
932 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
|
933 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
|
934 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
|
935 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
|
936 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
|
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 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
|
939 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
|
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 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
|
942 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
|
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 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
|
945 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
|
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 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
|
948 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
|
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 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
|
951 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
|
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 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
|
954 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
|
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 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
|
957 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
|
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 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
|
960 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
|
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 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
|
963 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
|
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 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
|
966 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
|
967 } |
18997 | 968 } |
969 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
970 |
18997 | 971 /* -pvr amode=x */ |
972 if (pvr_param_audio_mode) | |
973 { | |
974 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
|
975 pvr->audio_mode = V4L2_MPEG_AUDIO_MODE_STEREO; |
18997 | 976 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
|
977 pvr->audio_mode = V4L2_MPEG_AUDIO_MODE_JOINT_STEREO; |
18997 | 978 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
|
979 pvr->audio_mode = V4L2_MPEG_AUDIO_MODE_DUAL; |
18997 | 980 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
|
981 pvr->audio_mode = V4L2_MPEG_AUDIO_MODE_MONO; |
18997 | 982 } |
983 | |
984 /* -pvr vbitrate=x */ | |
985 if (pvr_param_bitrate) | |
986 pvr->bitrate = pvr_param_bitrate; | |
987 | |
988 /* -pvr vmode=x */ | |
989 if (pvr_param_bitrate_mode) | |
990 { | |
991 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
|
992 pvr->bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_VBR; |
18997 | 993 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
|
994 pvr->bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_CBR; |
18997 | 995 } |
996 | |
997 /* -pvr vpeak=x */ | |
998 if (pvr_param_bitrate_peak) | |
999 pvr->bitrate_peak = pvr_param_bitrate_peak; | |
1000 | |
1001 /* -pvr fmt=x */ | |
1002 if (pvr_param_stream_type) | |
1003 { | |
1004 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
|
1005 pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS; |
18997 | 1006 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
|
1007 pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_TS; |
18997 | 1008 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
|
1009 pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG1_SS; |
18997 | 1010 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
|
1011 pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_DVD; |
18997 | 1012 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
|
1013 pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG1_VCD; |
18997 | 1014 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
|
1015 pvr->stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD; |
18997 | 1016 } |
1017 } | |
1018 | |
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 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
|
1020 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
|
1021 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
|
1022 { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1023 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
|
1024 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
|
1025 } |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1026 |
18997 | 1027 static int |
19976
281ac13bf72d
cosmetic renames because pvr support will soon be less ivtv driver dependant
ben
parents:
19617
diff
changeset
|
1028 set_encoder_settings (struct pvr_t *pvr) |
18997 | 1029 { |
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
|
1030 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
|
1031 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
|
1032 uint32_t count = 0; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1033 |
18997 | 1034 if (!pvr) |
1035 return -1; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1036 |
18997 | 1037 if (pvr->dev_fd < 0) |
1038 return -1; | |
1039 | |
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
|
1040 ext_ctrl = (struct v4l2_ext_control *) |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1041 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
|
1042 |
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 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
|
1044 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
|
1045 |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1046 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
|
1047 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
|
1048 |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1049 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
|
1050 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
|
1051 |
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 switch (pvr->layer) |
18997 | 1053 { |
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 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
|
1055 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
|
1056 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
|
1057 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
|
1058 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
|
1059 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
|
1060 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
|
1061 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
|
1062 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
|
1063 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
|
1064 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
|
1065 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
|
1066 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
|
1067 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
|
1068 } |
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 |
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 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
|
1071 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
|
1072 |
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 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
|
1074 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
|
1075 |
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 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
|
1077 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
|
1078 |
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 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
|
1080 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
|
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_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
|
1083 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
|
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 /* set new encoding settings */ |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1086 ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG; |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1087 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
|
1088 ctrls.controls = ext_ctrl; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1089 |
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
|
1090 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
|
1091 { |
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 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
|
1093 LOG_LEVEL_ENCODER, strerror (errno)); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1094 free (ext_ctrl); |
18997 | 1095 return -1; |
1096 } | |
1097 | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1098 free (ext_ctrl); |
18997 | 1099 |
1100 return 0; | |
1101 } | |
1102 | |
1103 static void | |
1104 parse_v4l2_tv_options (struct pvr_t *pvr) | |
1105 { | |
1106 if (!pvr) | |
1107 return; | |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1108 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1109 /* 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
|
1110 parse_setup_stationlist (pvr); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1111 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1112 if (pvr->param_channel) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1113 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1114 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
|
1115 -1, 0) >= 0) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1116 { |
23888 | 1117 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
|
1118 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1119 mp_msg (MSGT_OPEN, MSGL_HINT, |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1120 "%s tv param freq %s is overwritten by channel setting freq %d\n", LOG_LEVEL_V4L2, |
23888 | 1121 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
|
1122 } |
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 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1125 |
23888 | 1126 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
|
1127 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1128 mp_msg (MSGT_OPEN, MSGL_HINT, "%s tv param freq %s is used directly\n", |
23888 | 1129 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
|
1130 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1131 if (set_station_by_channelname_or_freq (pvr, NULL, |
23888 | 1132 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
|
1133 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1134 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
|
1135 "%s tv param freq %s invalid to set station\n", |
23888 | 1136 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
|
1137 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1138 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1139 |
23888 | 1140 if (stream_tv_defaults.device) |
18997 | 1141 { |
32511
b39155e98ac3
Remove some useless NULL pointer checks before invoking free() on the pointer.
diego
parents:
29263
diff
changeset
|
1142 free (pvr->video_dev); |
23888 | 1143 pvr->video_dev = strdup (stream_tv_defaults.device); |
18997 | 1144 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1145 |
23888 | 1146 if (stream_tv_defaults.noaudio) |
1147 pvr->mute = stream_tv_defaults.noaudio; | |
18997 | 1148 |
23888 | 1149 if (stream_tv_defaults.input) |
1150 pvr->input = stream_tv_defaults.input; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1151 |
23888 | 1152 if (stream_tv_defaults.normid) |
1153 pvr->normid = stream_tv_defaults.normid; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1154 |
23888 | 1155 if (stream_tv_defaults.brightness) |
1156 pvr->brightness = stream_tv_defaults.brightness; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1157 |
23888 | 1158 if (stream_tv_defaults.contrast) |
1159 pvr->contrast = stream_tv_defaults.contrast; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1160 |
23888 | 1161 if (stream_tv_defaults.hue) |
1162 pvr->hue = stream_tv_defaults.hue; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1163 |
23888 | 1164 if (stream_tv_defaults.saturation) |
1165 pvr->saturation = stream_tv_defaults.saturation; | |
18997 | 1166 |
23888 | 1167 if (stream_tv_defaults.width) |
1168 pvr->width = stream_tv_defaults.width; | |
18997 | 1169 |
23888 | 1170 if (stream_tv_defaults.height) |
1171 pvr->height = stream_tv_defaults.height; | |
18997 | 1172 } |
1173 | |
1174 static int | |
1175 set_v4l2_settings (struct pvr_t *pvr) | |
1176 { | |
1177 if (!pvr) | |
1178 return -1; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1179 |
18997 | 1180 if (pvr->dev_fd < 0) |
1181 return -1; | |
1182 | |
1183 /* -tv noaudio */ | |
1184 if (pvr->mute) | |
1185 { | |
1186 struct v4l2_control ctrl; | |
1187 ctrl.id = V4L2_CID_AUDIO_MUTE; | |
1188 ctrl.value = 1; | |
1189 if (ioctl (pvr->dev_fd, VIDIOC_S_CTRL, &ctrl) < 0) | |
1190 { | |
1191 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1192 "%s can't mute (%s).\n", LOG_LEVEL_V4L2, strerror (errno)); | |
1193 return -1; | |
1194 } | |
1195 } | |
1196 | |
1197 /* -tv input=x */ | |
1198 if (pvr->input != 0) | |
1199 { | |
1200 if (ioctl (pvr->dev_fd, VIDIOC_S_INPUT, &pvr->input) < 0) | |
1201 { | |
1202 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1203 "%s can't set input (%s)\n", LOG_LEVEL_V4L2, strerror (errno)); | |
1204 return -1; | |
1205 } | |
1206 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1207 |
18997 | 1208 /* -tv normid=x */ |
1209 if (pvr->normid != -1) | |
1210 { | |
1211 struct v4l2_standard std; | |
1212 std.index = pvr->normid; | |
1213 | |
1214 if (ioctl (pvr->dev_fd, VIDIOC_ENUMSTD, &std) < 0) | |
1215 { | |
1216 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1217 "%s can't set norm (%s)\n", LOG_LEVEL_V4L2, strerror (errno)); | |
1218 return -1; | |
1219 } | |
1220 | |
1221 mp_msg (MSGT_OPEN, MSGL_V, | |
1222 "%s set norm to %s\n", LOG_LEVEL_V4L2, std.name); | |
1223 | |
1224 if (ioctl (pvr->dev_fd, VIDIOC_S_STD, &std.id) < 0) | |
1225 { | |
1226 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1227 "%s can't set norm (%s)\n", LOG_LEVEL_V4L2, strerror (errno)); | |
1228 return -1; | |
1229 } | |
1230 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1231 |
18997 | 1232 /* -tv brightness=x */ |
1233 if (pvr->brightness != 0) | |
1234 { | |
1235 struct v4l2_control ctrl; | |
1236 ctrl.id = V4L2_CID_BRIGHTNESS; | |
1237 ctrl.value = pvr->brightness; | |
1238 | |
1239 if (ctrl.value < 0) | |
1240 ctrl.value = 0; | |
1241 if (ctrl.value > 255) | |
1242 ctrl.value = 255; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1243 |
18997 | 1244 if (ioctl (pvr->dev_fd, VIDIOC_S_CTRL, &ctrl) < 0) |
1245 { | |
1246 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1247 "%s can't set brightness to %d (%s).\n", | |
1248 LOG_LEVEL_V4L2, ctrl.value, strerror (errno)); | |
1249 return -1; | |
1250 } | |
1251 } | |
1252 | |
1253 /* -tv contrast=x */ | |
1254 if (pvr->contrast != 0) | |
1255 { | |
1256 struct v4l2_control ctrl; | |
1257 ctrl.id = V4L2_CID_CONTRAST; | |
1258 ctrl.value = pvr->contrast; | |
1259 | |
1260 if (ctrl.value < 0) | |
1261 ctrl.value = 0; | |
1262 if (ctrl.value > 127) | |
1263 ctrl.value = 127; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1264 |
18997 | 1265 if (ioctl (pvr->dev_fd, VIDIOC_S_CTRL, &ctrl) < 0) |
1266 { | |
1267 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1268 "%s can't set contrast to %d (%s).\n", | |
1269 LOG_LEVEL_V4L2, ctrl.value, strerror (errno)); | |
1270 return -1; | |
1271 } | |
1272 } | |
1273 | |
1274 /* -tv hue=x */ | |
1275 if (pvr->hue != 0) | |
1276 { | |
1277 struct v4l2_control ctrl; | |
1278 ctrl.id = V4L2_CID_HUE; | |
1279 ctrl.value = pvr->hue; | |
1280 | |
1281 if (ctrl.value < -128) | |
1282 ctrl.value = -128; | |
1283 if (ctrl.value > 127) | |
1284 ctrl.value = 127; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1285 |
18997 | 1286 if (ioctl (pvr->dev_fd, VIDIOC_S_CTRL, &ctrl) < 0) |
1287 { | |
1288 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1289 "%s can't set hue to %d (%s).\n", | |
1290 LOG_LEVEL_V4L2, ctrl.value, strerror (errno)); | |
1291 return -1; | |
1292 } | |
1293 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1294 |
18997 | 1295 /* -tv saturation=x */ |
1296 if (pvr->saturation != 0) | |
1297 { | |
1298 struct v4l2_control ctrl; | |
1299 ctrl.id = V4L2_CID_SATURATION; | |
1300 ctrl.value = pvr->saturation; | |
1301 | |
1302 if (ctrl.value < 0) | |
1303 ctrl.value = 0; | |
1304 if (ctrl.value > 127) | |
1305 ctrl.value = 127; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1306 |
18997 | 1307 if (ioctl (pvr->dev_fd, VIDIOC_S_CTRL, &ctrl) < 0) |
1308 { | |
1309 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1310 "%s can't set saturation to %d (%s).\n", | |
1311 LOG_LEVEL_V4L2, ctrl.value, strerror (errno)); | |
1312 return -1; | |
1313 } | |
1314 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1315 |
18997 | 1316 /* -tv width=x:height=y */ |
1317 if (pvr->width && pvr->height) | |
1318 { | |
1319 struct v4l2_format vfmt; | |
1320 vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | |
1321 vfmt.fmt.pix.width = pvr->width; | |
1322 vfmt.fmt.pix.height = pvr->height; | |
1323 | |
1324 if (ioctl (pvr->dev_fd, VIDIOC_S_FMT, &vfmt) < 0) | |
1325 { | |
1326 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1327 "%s can't set resolution to %dx%d (%s).\n", | |
1328 LOG_LEVEL_V4L2, pvr->width, pvr->height, strerror (errno)); | |
1329 return -1; | |
1330 } | |
1331 } | |
1332 | |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1333 if (pvr->freq < 0) |
18997 | 1334 { |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1335 int freq = get_v4l2_freq (pvr); |
18997 | 1336 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
|
1337 "%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
|
1338 LOG_LEVEL_V4L2, freq); |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1339 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1340 if (0 < freq) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1341 return set_station_by_channelname_or_freq (pvr, NULL, freq, 1); |
18997 | 1342 } |
1343 | |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1344 if (0 < pvr->freq) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1345 return set_v4l2_freq (pvr) ; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1346 |
18997 | 1347 return 0; |
1348 } | |
1349 | |
1350 static int | |
1351 v4l2_list_capabilities (struct pvr_t *pvr) | |
1352 { | |
1353 struct v4l2_audio vaudio; | |
1354 struct v4l2_standard vs; | |
1355 struct v4l2_input vin; | |
1356 int err = 0; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1357 |
18997 | 1358 if (!pvr) |
1359 return -1; | |
1360 | |
1361 if (pvr->dev_fd < 0) | |
1362 return -1; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1363 |
18997 | 1364 /* list available video inputs */ |
1365 vin.index = 0; | |
1366 err = 1; | |
1367 mp_msg (MSGT_OPEN, MSGL_INFO, | |
1368 "%s Available video inputs: ", LOG_LEVEL_V4L2); | |
1369 while (ioctl (pvr->dev_fd, VIDIOC_ENUMINPUT, &vin) >= 0) | |
1370 { | |
1371 err = 0; | |
1372 mp_msg (MSGT_OPEN, MSGL_INFO, "'#%d, %s' ", vin.index, vin.name); | |
1373 vin.index++; | |
1374 } | |
1375 if (err) | |
1376 { | |
1377 mp_msg (MSGT_OPEN, MSGL_INFO, "none\n"); | |
1378 return -1; | |
1379 } | |
1380 else | |
1381 mp_msg (MSGT_OPEN, MSGL_INFO, "\n"); | |
1382 | |
1383 /* list available audio inputs */ | |
1384 vaudio.index = 0; | |
1385 err = 1; | |
1386 mp_msg (MSGT_OPEN, MSGL_INFO, | |
1387 "%s Available audio inputs: ", LOG_LEVEL_V4L2); | |
1388 while (ioctl (pvr->dev_fd, VIDIOC_ENUMAUDIO, &vaudio) >= 0) | |
1389 { | |
1390 err = 0; | |
1391 mp_msg (MSGT_OPEN, MSGL_INFO, "'#%d, %s' ", vaudio.index, vaudio.name); | |
1392 vaudio.index++; | |
1393 } | |
1394 if (err) | |
1395 { | |
1396 mp_msg (MSGT_OPEN, MSGL_INFO, "none\n"); | |
1397 return -1; | |
1398 } | |
1399 else | |
1400 mp_msg (MSGT_OPEN, MSGL_INFO, "\n"); | |
1401 | |
1402 /* list available norms */ | |
1403 vs.index = 0; | |
1404 mp_msg (MSGT_OPEN, MSGL_INFO, "%s Available norms: ", LOG_LEVEL_V4L2); | |
1405 while (ioctl (pvr->dev_fd, VIDIOC_ENUMSTD, &vs) >= 0) | |
1406 { | |
1407 err = 0; | |
1408 mp_msg (MSGT_OPEN, MSGL_INFO, "'#%d, %s' ", vs.index, vs.name); | |
1409 vs.index++; | |
1410 } | |
1411 if (err) | |
1412 { | |
1413 mp_msg (MSGT_OPEN, MSGL_INFO, "none\n"); | |
1414 return -1; | |
1415 } | |
1416 else | |
1417 mp_msg (MSGT_OPEN, MSGL_INFO, "\n"); | |
1418 | |
1419 return 0; | |
1420 } | |
1421 | |
1422 static int | |
1423 v4l2_display_settings (struct pvr_t *pvr) | |
1424 { | |
1425 struct v4l2_audio vaudio; | |
1426 struct v4l2_standard vs; | |
1427 struct v4l2_input vin; | |
1428 v4l2_std_id std; | |
1429 int input; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1430 |
18997 | 1431 if (!pvr) |
1432 return -1; | |
1433 | |
1434 if (pvr->dev_fd < 0) | |
1435 return -1; | |
1436 | |
1437 /* get current video input */ | |
1438 if (ioctl (pvr->dev_fd, VIDIOC_G_INPUT, &input) == 0) | |
1439 { | |
1440 vin.index = input; | |
1441 if (ioctl (pvr->dev_fd, VIDIOC_ENUMINPUT, &vin) < 0) | |
1442 { | |
1443 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1444 "%s can't get input (%s).\n", LOG_LEVEL_V4L2, strerror (errno)); | |
1445 return -1; | |
1446 } | |
1447 else | |
1448 mp_msg (MSGT_OPEN, MSGL_INFO, | |
1449 "%s Video input: %s\n", LOG_LEVEL_V4L2, vin.name); | |
1450 } | |
1451 else | |
1452 { | |
1453 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1454 "%s can't get input (%s).\n", LOG_LEVEL_V4L2, strerror (errno)); | |
1455 return -1; | |
1456 } | |
1457 | |
1458 /* get current audio input */ | |
1459 if (ioctl (pvr->dev_fd, VIDIOC_G_AUDIO, &vaudio) == 0) | |
1460 { | |
19294 | 1461 mp_msg (MSGT_OPEN, MSGL_INFO, |
1462 "%s Audio input: %s\n", LOG_LEVEL_V4L2, vaudio.name); | |
18997 | 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 video format */ | |
1472 if (ioctl (pvr->dev_fd, VIDIOC_G_STD, &std) == 0) | |
1473 { | |
1474 vs.index = 0; | |
1475 | |
1476 while (ioctl (pvr->dev_fd, VIDIOC_ENUMSTD, &vs) >= 0) | |
1477 { | |
1478 if (vs.id == std) | |
1479 { | |
1480 mp_msg (MSGT_OPEN, MSGL_INFO, | |
1481 "%s Norm: %s.\n", LOG_LEVEL_V4L2, vs.name); | |
1482 break; | |
1483 } | |
1484 vs.index++; | |
1485 } | |
1486 } | |
1487 else | |
1488 { | |
1489 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1490 "%s can't get norm (%s)\n", LOG_LEVEL_V4L2, strerror (errno)); | |
1491 return -1; | |
1492 } | |
1493 | |
1494 return 0; | |
1495 } | |
1496 | |
1497 /* stream layer */ | |
1498 | |
1499 static void | |
1500 pvr_stream_close (stream_t *stream) | |
1501 { | |
1502 struct pvr_t *pvr; | |
1503 | |
1504 if (!stream) | |
1505 return; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1506 |
18997 | 1507 pvr = (struct pvr_t *) stream->priv; |
1508 pvr_uninit (pvr); | |
1509 } | |
1510 | |
1511 static int | |
1512 pvr_stream_read (stream_t *stream, char *buffer, int size) | |
1513 { | |
1514 struct pollfd pfds[1]; | |
1515 struct pvr_t *pvr; | |
1516 int rk, fd, pos; | |
1517 | |
1518 if (!stream || !buffer) | |
1519 return 0; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1520 |
18997 | 1521 pvr = (struct pvr_t *) stream->priv; |
1522 fd = pvr->dev_fd; | |
1523 pos = 0; | |
1524 | |
1525 if (fd < 0) | |
1526 return 0; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1527 |
18997 | 1528 while (pos < size) |
1529 { | |
1530 pfds[0].fd = fd; | |
1531 pfds[0].events = POLLIN | POLLPRI; | |
1532 | |
1533 rk = size - pos; | |
1534 | |
1535 if (poll (pfds, 1, 500) <= 0) | |
1536 { | |
1537 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1538 "%s failed with errno %d when reading %d bytes\n", | |
1539 LOG_LEVEL_PVR, errno, size-pos); | |
1540 break; | |
1541 } | |
1542 | |
1543 rk = read (fd, &buffer[pos], rk); | |
1544 if (rk > 0) | |
1545 { | |
1546 pos += rk; | |
1547 mp_msg (MSGT_OPEN, MSGL_DBG3, | |
1548 "%s read (%d) bytes\n", LOG_LEVEL_PVR, pos); | |
1549 } | |
1550 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1551 |
18997 | 1552 if (!pos) |
1553 mp_msg (MSGT_OPEN, MSGL_ERR, "%s read %d bytes\n", LOG_LEVEL_PVR, pos); | |
1554 | |
1555 return pos; | |
1556 } | |
1557 | |
1558 static int | |
1559 pvr_stream_open (stream_t *stream, int mode, void *opts, int *file_format) | |
1560 { | |
1561 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
|
1562 struct v4l2_ext_controls ctrls; |
18997 | 1563 struct pvr_t *pvr = NULL; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1564 |
18997 | 1565 if (mode != STREAM_READ) |
24257 | 1566 return STREAM_UNSUPPORTED; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1567 |
18997 | 1568 pvr = pvr_init (); |
1569 | |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1570 /** |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1571 * 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
|
1572 * 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
|
1573 */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1574 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
|
1575 pvr->param_channel = strdup (stream->url + 6); |
23888 | 1576 else if (stream_tv_defaults.channel && strlen (stream_tv_defaults.channel)) |
1577 pvr->param_channel = strdup (stream_tv_defaults.channel); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1578 |
18997 | 1579 parse_v4l2_tv_options (pvr); |
19976
281ac13bf72d
cosmetic renames because pvr support will soon be less ivtv driver dependant
ben
parents:
19617
diff
changeset
|
1580 parse_encoder_options (pvr); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1581 |
18997 | 1582 /* open device */ |
1583 pvr->dev_fd = open (pvr->video_dev, O_RDWR); | |
1584 mp_msg (MSGT_OPEN, MSGL_INFO, | |
1585 "%s Using device %s\n", LOG_LEVEL_PVR, pvr->video_dev); | |
1586 if (pvr->dev_fd == -1) | |
1587 { | |
1588 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1589 "%s error opening device %s\n", LOG_LEVEL_PVR, pvr->video_dev); | |
1590 pvr_uninit (pvr); | |
1591 return STREAM_ERROR; | |
1592 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1593 |
18997 | 1594 /* query capabilities (i.e test V4L2 support) */ |
1595 if (ioctl (pvr->dev_fd, VIDIOC_QUERYCAP, &vcap) < 0) | |
1596 { | |
1597 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1598 "%s device is not V4L2 compliant (%s).\n", | |
1599 LOG_LEVEL_PVR, strerror (errno)); | |
1600 pvr_uninit (pvr); | |
1601 return STREAM_ERROR; | |
1602 } | |
1603 else | |
1604 mp_msg (MSGT_OPEN, MSGL_INFO, | |
1605 "%s Detected %s\n", LOG_LEVEL_PVR, vcap.card); | |
1606 | |
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
|
1607 /* 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
|
1608 if (!(vcap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) |
18997 | 1609 { |
1610 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
|
1611 "%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
|
1612 LOG_LEVEL_PVR); |
18997 | 1613 pvr_uninit (pvr); |
1614 return STREAM_ERROR; | |
1615 } | |
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
|
1616 |
be7b8a83649c
removed ivtv driver dependancy in favor of native V4L2 MPEG API (requires Linux 2.6.18 and above)
ben
parents:
19976
diff
changeset
|
1617 /* check for device hardware MPEG encoding capability */ |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1618 ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG; |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1619 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
|
1620 ctrls.controls = NULL; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1621 |
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
|
1622 if (ioctl (pvr->dev_fd, VIDIOC_G_EXT_CTRLS, &ctrls) < 0) |
18997 | 1623 { |
1624 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
|
1625 "%s device do not support MPEG input.\n", LOG_LEVEL_ENCODER); |
18997 | 1626 return STREAM_ERROR; |
1627 } | |
1628 | |
1629 /* list V4L2 capabilities */ | |
1630 if (v4l2_list_capabilities (pvr) == -1) | |
1631 { | |
1632 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1633 "%s can't get v4l2 capabilities\n", LOG_LEVEL_PVR); | |
1634 pvr_uninit (pvr); | |
1635 return STREAM_ERROR; | |
1636 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1637 |
18997 | 1638 /* apply V4L2 settings */ |
1639 if (set_v4l2_settings (pvr) == -1) | |
1640 { | |
1641 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1642 "%s can't set v4l2 settings\n", LOG_LEVEL_PVR); | |
1643 pvr_uninit (pvr); | |
1644 return STREAM_ERROR; | |
1645 } | |
1646 | |
19976
281ac13bf72d
cosmetic renames because pvr support will soon be less ivtv driver dependant
ben
parents:
19617
diff
changeset
|
1647 /* apply encoder settings */ |
281ac13bf72d
cosmetic renames because pvr support will soon be less ivtv driver dependant
ben
parents:
19617
diff
changeset
|
1648 if (set_encoder_settings (pvr) == -1) |
18997 | 1649 { |
1650 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
|
1651 "%s can't set encoder settings\n", LOG_LEVEL_PVR); |
18997 | 1652 pvr_uninit (pvr); |
1653 return STREAM_ERROR; | |
1654 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1655 |
18997 | 1656 /* display current V4L2 settings */ |
1657 if (v4l2_display_settings (pvr) == -1) | |
1658 { | |
1659 mp_msg (MSGT_OPEN, MSGL_ERR, | |
1660 "%s can't get v4l2 settings\n", LOG_LEVEL_PVR); | |
1661 pvr_uninit (pvr); | |
1662 return STREAM_ERROR; | |
1663 } | |
1664 | |
1665 stream->priv = pvr; | |
1666 stream->type = STREAMTYPE_PVR; | |
1667 stream->fill_buffer = pvr_stream_read; | |
1668 stream->close = pvr_stream_close; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1669 |
18997 | 1670 return STREAM_OK; |
1671 } | |
1672 | |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1673 /* PVR Public API access */ |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1674 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1675 const char * |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1676 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
|
1677 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1678 struct pvr_t *pvr; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1679 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1680 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
|
1681 return NULL; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1682 |
23244
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1683 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
|
1684 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1685 if (pvr->stationlist.list && |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1686 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
|
1687 pvr->chan_idx >= 0) |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1688 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
|
1689 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1690 return NULL; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1691 } |
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 const char * |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1694 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
|
1695 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1696 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
|
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].name; |
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 int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1707 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
|
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 return pvr->freq; |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1712 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1713 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1714 int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1715 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
|
1716 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1717 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
|
1718 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1719 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
|
1720 } |
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 int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1723 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
|
1724 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1725 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
|
1726 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1727 if (pvr->stationlist.list && |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1728 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
|
1729 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
|
1730 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
|
1731 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1732 return -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_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
|
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 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
|
1741 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1742 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1743 int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1744 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
|
1745 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1746 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
|
1747 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1748 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
|
1749 } |
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 int |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1752 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
|
1753 { |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1754 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
|
1755 |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1756 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
|
1757 } |
e5e8ac0bd7fc
support for PVR channel navigation (patch by Sven Gothel <sgothel at jausoft dot com>)
ben
parents:
23166
diff
changeset
|
1758 |
25211 | 1759 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
|
1760 "V4L2 MPEG Input (a.k.a PVR)", |
18997 | 1761 "pvr", |
1762 "Benjamin Zores", | |
1763 "", | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27431
diff
changeset
|
1764 pvr_stream_open, |
18997 | 1765 { "pvr", NULL }, |
1766 NULL, | |
1767 1 | |
1768 }; |