annotate stream/stream_pvr.c @ 24778:9e723abe8646

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