annotate libvo/vo_ivtv.c @ 35756:3919b6360e54

Cosmetic: Adjust indent.
author ib
date Thu, 24 Jan 2013 15:59:24 +0000
parents ddb45e9443ec
children 5d3f93051de9
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"
31353
a465b54b0897 Add header for ivtv_write() instead of forward declaring it.
diego
parents: 31352
diff changeset
49 #include "vo_ivtv.h"
19142
4c22e1d84ac9 updated mpeg_packetizer include to new localization
ben
parents: 19137
diff changeset
50 #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
51
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
52 #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
53 #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
54
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
55 /* ivtv private */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
56 int ivtv_fd = -1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
57 static vo_mpegpes_t *pes;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
58
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
59 /* suboptions */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
60 static int output = -1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
61 static char *device = NULL;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
62
28828
56eee6ffba9b Make data related to suboption parsing const in libvo
reimar
parents: 26739
diff changeset
63 static const opt_t subopts[] = {
30122
1772a5171ac7 Fix function declarations to avoid casting function pointers.
reimar
parents: 29263
diff changeset
64 {"output", OPT_ARG_INT, &output, int_non_neg},
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
65 {"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
66 {NULL}
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
67 };
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
68
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
69 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
70 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
71 "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
72 "ivtv",
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
73 "Benjamin Zores",
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
74 ""
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
75 };
25220
c9e9ac2008c2 Mark the vo_functions_t definitions as const where possible.
reimar
parents: 25216
diff changeset
76 const LIBVO_EXTERN (ivtv)
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
77
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
78 /* ivtv internals */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
79
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
80 static uint32_t
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
81 ivtv_reset (int blank_screen)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
82 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
83 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
84 struct ivtv_cfg_start_decode sd1;
22335
2f43fee89f0e support for new ivtv api
ben
parents: 19978
diff changeset
85 int flags = 0;
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
86
22335
2f43fee89f0e support for new ivtv api
ben
parents: 19978
diff changeset
87 if (blank_screen)
2f43fee89f0e support for new ivtv api
ben
parents: 19978
diff changeset
88 flags |= IVTV_STOP_FL_HIDE_FRAME;
2f43fee89f0e support for new ivtv api
ben
parents: 19978
diff changeset
89 sd.flags = flags;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
90
19978
f04afca36cf4 use a more generic ioctl as the one used was deprecated with Linux 2.6.18 kernel
ben
parents: 19148
diff changeset
91 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
92 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
93 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
94 "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
95 return 1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
96 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
97
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
98 sd1.gop_offset = 0;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
99 sd1.muted_audio_frames = 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
100
19978
f04afca36cf4 use a more generic ioctl as the one used was deprecated with Linux 2.6.18 kernel
ben
parents: 19148
diff changeset
101 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
102 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
103 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
104 "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
105 return 1;
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
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
108 return 0;
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
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
111 int
31352
f924b5c78117 Mark first parameter of ivtv_write as const; it is never changed.
diego
parents: 30122
diff changeset
112 ivtv_write (const unsigned char *data, int len)
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
113 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
114 if (ivtv_fd < 0)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
115 return 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
116
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
117 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
118 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
119
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
120 /* video out functions */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
121
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
122 static int
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
123 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
124 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
125 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
126 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
127 return 0;
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
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
130 static int
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
131 preinit (const char *arg)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
132 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
133 struct v4l2_output vout;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
134 int err;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
135
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
136 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
137 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
138 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
139 "\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
140 "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
141 "\nOptions:\n"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
142 " device=/dev/videoX\n"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
143 " 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
144 " output=<0-...>\n"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
145 " 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
146 "\n" );
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
147 return -1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
148 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
149
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
150 if (!device)
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
151 device = strdup (DEFAULT_MPEG_DECODER);
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
152
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
153 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
154 if (ivtv_fd < 0)
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
155 {
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
156 free (device);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
157 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
158 return -1;
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
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
161 /* list available outputs */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
162 vout.index = 0;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
163 err = 1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
164 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
165 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
166 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
167 err = 0;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
168 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
169 vout.index++;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
170 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
171 if (err)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
172 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
173 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
174 free (device);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
175 return -1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
176 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
177 else
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
178 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
179
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
180 /* set user specified output */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
181 if (output != -1)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
182 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
183 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
184 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
185 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
186 "%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
187 free (device);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
188 return -1;
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
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
192 /* display device name */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
193 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
194 free (device);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
195
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
196 /* display current video output */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
197 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
198 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
199 vout.index = output;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
200 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
201 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
202 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
203 "%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
204 return -1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
205 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
206 else
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
207 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
208 "%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
209 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
210 else
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
211 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
212 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
213 "%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
214 return -1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
215 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
216
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
217 /* clear output */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
218 ivtv_reset (1);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
219
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
220 return 0;
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
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
223 static void
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
224 draw_osd (void)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
225 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
226 /* do nothing */
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
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
229 static int
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
230 draw_frame (uint8_t * src[])
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
231 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
232 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
233 return 0;
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
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
236 static void
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
237 flip_page (void)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
238 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
239 if (ivtv_fd < 0)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
240 return;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
241
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
242 if (!pes)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
243 return;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
244
19148
3b839a8d297a simplified mpeg packetizer used by hw mpeg decoders/vo - first round
nicodvb
parents: 19142
diff changeset
245 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
246 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
247 ivtv_write);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
248
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
249 /* 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
250 pes = NULL;
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
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
253 static int
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
254 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
255 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
256 return 0;
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
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
259 static void
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
260 uninit (void)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
261 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
262 if (ivtv_fd < 0)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
263 return;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
264
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
265 /* clear output */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
266 ivtv_reset (1);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
267
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
268 /* close device */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
269 close (ivtv_fd);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
270 ivtv_fd = -1;
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
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
273 static void
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
274 check_events (void)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
275 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
276 /* do nothing */
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
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
279 static int
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
280 query_format (uint32_t format)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
281 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
282 if (format != IMGFMT_MPEGPES)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
283 return 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
284
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
285 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
286 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
287
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
288 static int
33305
ddb45e9443ec Remove the variable arguments from the libvo control() functions.
iive
parents: 31353
diff changeset
289 control (uint32_t request, void *data)
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
290 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
291 switch (request)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
292 {
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
293 case VOCTRL_PAUSE:
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
294 case VOCTRL_RESUME:
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
295 return ivtv_reset (0);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
296
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
297 case VOCTRL_RESET:
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
298 return ivtv_reset (1);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
299
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
300 case VOCTRL_QUERY_FORMAT:
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
301 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
302 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28828
diff changeset
303
19137
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
304 return VO_NOTIMPL;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
305 }