annotate libvo/vo_ivtv.c @ 29514:23a59bb3baf4

First attempts at supporting -fs with -wid, -vo gl on X11 only so far
author reimar
date Thu, 27 Aug 2009 12:03:02 +0000
parents 0f1b5b68af32
children 1772a5171ac7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
1 /*
26739
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
2 * video output for WinTV PVR-150/250/350 (a.k.a IVTV) cards
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
3 * TV-Out through hardware MPEG decoder
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
4 * Based on some old code from ivtv driver authors.
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
5 * See http://ivtvdriver.org/index.php/Main_Page for more details on the
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
6 * cards supported by the ivtv driver.
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
7 *
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
8 * Copyright (C) 2006 Benjamin Zores
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
9 *
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
10 * This file is part of MPlayer.
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
11 *
26739
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
12 * MPlayer is free software; you can redistribute it and/or modify
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
13 * it under the terms of the GNU General Public License as published by
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
15 * (at your option) any later version.
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
16 *
26739
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
17 * MPlayer is distributed in the hope that it will be useful,
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
20 * GNU General Public License for more details.
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
21 *
26739
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
22 * You should have received a copy of the GNU General Public License along
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
23 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
25 */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
26
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
27 #include "config.h"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
28
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
29 #include <stdio.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
30 #include <stdlib.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
31 #include <string.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
32 #include <errno.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
33 #include <sys/types.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
34 #include <sys/stat.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
35 #include <sys/ioctl.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
36 #include <fcntl.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
37 #include <unistd.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
38 #include <stdlib.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
39 #include <inttypes.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
40 #include <linux/types.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
41 #include <linux/videodev2.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
42 #include <linux/ivtv.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
43 #include <linux/ioctl.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
44
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
45 #include "mp_msg.h"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
46 #include "subopt-helper.h"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
47 #include "video_out.h"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
48 #include "video_out_internal.h"
19142
4c22e1d84ac9 updated mpeg_packetizer include to new localization
ben
parents: 19137
diff changeset
49 #include "libmpdemux/mpeg_packetizer.h"
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
50
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
51 #define DEFAULT_MPEG_DECODER "/dev/video16"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
52 #define IVTV_VO_HDR "VO: [ivtv]"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
53
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
54 /* ivtv private */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
55 int ivtv_fd = -1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
56 static vo_mpegpes_t *pes;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
57
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
58 /* suboptions */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
59 static int output = -1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
60 static char *device = NULL;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
61
28828
56eee6ffba9b Make data related to suboption parsing const in libvo
reimar
parents: 26739
diff changeset
62 static const opt_t subopts[] = {
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
63 {"output", OPT_ARG_INT, &output, (opt_test_f)int_non_neg},
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
64 {"device", OPT_ARG_MSTRZ, &device, NULL},
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
65 {NULL}
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
66 };
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
67
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
68 static const vo_info_t info =
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
69 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
70 "IVTV MPEG Video Decoder TV-Out",
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
71 "ivtv",
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
72 "Benjamin Zores",
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
73 ""
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
74 };
25220
c9e9ac2008c2 Mark the vo_functions_t definitions as const where possible.
reimar
parents: 25216
diff changeset
75 const LIBVO_EXTERN (ivtv)
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
76
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
77 /* ivtv internals */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
78
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
79 static uint32_t
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
80 ivtv_reset (int blank_screen)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
81 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
82 struct ivtv_cfg_stop_decode sd;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
83 struct ivtv_cfg_start_decode sd1;
22335
2f43fee89f0e support for new ivtv api
ben
parents: 19978
diff changeset
84 int flags = 0;
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
85
22335
2f43fee89f0e support for new ivtv api
ben
parents: 19978
diff changeset
86 if (blank_screen)
2f43fee89f0e support for new ivtv api
ben
parents: 19978
diff changeset
87 flags |= IVTV_STOP_FL_HIDE_FRAME;
2f43fee89f0e support for new ivtv api
ben
parents: 19978
diff changeset
88 sd.flags = flags;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
89
19978
f04afca36cf4 use a more generic ioctl as the one used was deprecated with Linux 2.6.18 kernel
ben
parents: 19148
diff changeset
90 if (ioctl (ivtv_fd, IVTV_IOC_STOP_DECODE, &sd) < 0)
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
91 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
92 mp_msg (MSGT_VO, MSGL_ERR,
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
93 "IVTV_IOC_STOP_DECODE: %s\n", strerror (errno));
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
94 return 1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
95 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
96
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
97 sd1.gop_offset = 0;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
98 sd1.muted_audio_frames = 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
99
19978
f04afca36cf4 use a more generic ioctl as the one used was deprecated with Linux 2.6.18 kernel
ben
parents: 19148
diff changeset
100 if (ioctl (ivtv_fd, IVTV_IOC_START_DECODE, &sd1) < 0)
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
101 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
102 mp_msg (MSGT_VO, MSGL_ERR,
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
103 "IVTV_IOC_START_DECODE: %s\n", strerror (errno));
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
104 return 1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
105 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
106
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
107 return 0;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
108 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
109
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
110 int
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
111 ivtv_write (unsigned char *data, int len)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
112 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
113 if (ivtv_fd < 0)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
114 return 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
115
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
116 return write (ivtv_fd, data, len);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
117 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
118
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
119 /* video out functions */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
120
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
121 static int
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
122 config (uint32_t width, uint32_t height,
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
123 uint32_t d_width, uint32_t d_height,
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
124 uint32_t fullscreen, char *title, uint32_t format)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
125 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
126 return 0;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
127 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
128
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
129 static int
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
130 preinit (const char *arg)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
131 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
132 struct v4l2_output vout;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
133 int err;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
134
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
135 if (subopt_parse (arg, subopts) != 0)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
136 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
137 mp_msg (MSGT_VO, MSGL_FATAL,
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
138 "\n-vo ivtv command line help:\n"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
139 "Example: mplayer -vo ivtv:device=/dev/video16:output=2\n"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
140 "\nOptions:\n"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
141 " device=/dev/videoX\n"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
142 " Name of the MPEG decoder device file.\n"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
143 " output=<0-...>\n"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
144 " V4L2 id of the TV output.\n"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
145 "\n" );
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
146 return -1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
147 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
148
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
149 if (!device)
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
150 device = strdup (DEFAULT_MPEG_DECODER);
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
151
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
152 ivtv_fd = open (device, O_RDWR);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
153 if (ivtv_fd < 0)
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
154 {
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
155 free (device);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
156 mp_msg (MSGT_VO, MSGL_FATAL, "%s %s\n", IVTV_VO_HDR, strerror (errno));
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
157 return -1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
158 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
159
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
160 /* list available outputs */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
161 vout.index = 0;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
162 err = 1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
163 mp_msg (MSGT_VO, MSGL_INFO, "%s Available video outputs: ", IVTV_VO_HDR);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
164 while (ioctl (ivtv_fd, VIDIOC_ENUMOUTPUT, &vout) >= 0)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
165 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
166 err = 0;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
167 mp_msg (MSGT_VO, MSGL_INFO, "'#%d, %s' ", vout.index, vout.name);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
168 vout.index++;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
169 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
170 if (err)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
171 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
172 mp_msg (MSGT_VO, MSGL_INFO, "none\n");
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
173 free (device);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
174 return -1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
175 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
176 else
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
177 mp_msg (MSGT_VO, MSGL_INFO, "\n");
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
178
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
179 /* set user specified output */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
180 if (output != -1)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
181 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
182 if (ioctl (ivtv_fd, VIDIOC_S_OUTPUT, &output) < 0)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
183 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
184 mp_msg (MSGT_VO, MSGL_ERR,
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
185 "%s can't set output (%s)\n", IVTV_VO_HDR, strerror (errno));
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
186 free (device);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
187 return -1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
188 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
189 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
190
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
191 /* display device name */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
192 mp_msg (MSGT_VO, MSGL_INFO, "%s using %s\n", IVTV_VO_HDR, device);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
193 free (device);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
194
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
195 /* display current video output */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
196 if (ioctl (ivtv_fd, VIDIOC_G_OUTPUT, &output) == 0)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
197 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
198 vout.index = output;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
199 if (ioctl (ivtv_fd, VIDIOC_ENUMOUTPUT, &vout) < 0)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
200 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
201 mp_msg (MSGT_VO, MSGL_ERR,
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
202 "%s can't get output (%s).\n", IVTV_VO_HDR, strerror (errno));
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
203 return -1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
204 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
205 else
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
206 mp_msg (MSGT_VO, MSGL_INFO,
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
207 "%s video output: %s\n", IVTV_VO_HDR, vout.name);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
208 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
209 else
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
210 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
211 mp_msg (MSGT_VO, MSGL_ERR,
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
212 "%s can't get output (%s).\n", IVTV_VO_HDR, strerror (errno));
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
213 return -1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
214 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
215
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
216 /* clear output */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
217 ivtv_reset (1);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
218
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
219 return 0;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
220 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
221
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
222 static void
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
223 draw_osd (void)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
224 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
225 /* do nothing */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
226 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
227
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
228 static int
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
229 draw_frame (uint8_t * src[])
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
230 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
231 pes = (vo_mpegpes_t *) src[0];
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
232 return 0;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
233 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
234
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
235 static void
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
236 flip_page (void)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
237 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
238 if (ivtv_fd < 0)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
239 return;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
240
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
241 if (!pes)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
242 return;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
243
19148
3b839a8d297a simplified mpeg packetizer used by hw mpeg decoders/vo - first round
nicodvb
parents: 19142
diff changeset
244 send_mpeg_pes_packet (pes->data, pes->size, pes->id,
3b839a8d297a simplified mpeg packetizer used by hw mpeg decoders/vo - first round
nicodvb
parents: 19142
diff changeset
245 pes->timestamp ? pes->timestamp : vo_pts, 2,
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
246 ivtv_write);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
247
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
248 /* ensure flip_page() won't be called twice */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
249 pes = NULL;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
250 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
251
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
252 static int
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
253 draw_slice (uint8_t *image[], int stride[], int w, int h, int x, int y)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
254 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
255 return 0;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
256 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
257
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
258 static void
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
259 uninit (void)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
260 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
261 if (ivtv_fd < 0)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
262 return;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
263
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
264 /* clear output */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
265 ivtv_reset (1);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
266
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
267 /* close device */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
268 close (ivtv_fd);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
269 ivtv_fd = -1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
270 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
271
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
272 static void
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
273 check_events (void)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
274 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
275 /* do nothing */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
276 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
277
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
278 static int
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
279 query_format (uint32_t format)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
280 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
281 if (format != IMGFMT_MPEGPES)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
282 return 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
283
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
284 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_TIMER;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
285 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
286
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
287 static int
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
288 control (uint32_t request, void *data, ...)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
289 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
290 switch (request)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
291 {
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
292 case VOCTRL_PAUSE:
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
293 case VOCTRL_RESUME:
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
294 return ivtv_reset (0);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
295
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
296 case VOCTRL_RESET:
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
297 return ivtv_reset (1);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
298
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
299 case VOCTRL_QUERY_FORMAT:
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
300 return query_format (*((uint32_t*) data));
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
301 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
302
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
303 return VO_NOTIMPL;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
304 }