annotate libvo/vo_ivtv.c @ 20706:6ae01628975f

Initialize fontconfig in VFCTRL_INIT_EOSD handler. Recent libass api changes moved fontconfig initialization to filter's config() function. It is bad, because cache update can take a long time, resulting in unpleasant sound effects. This change restores the original behaviour.
author eugeni
date Sun, 05 Nov 2006 18:56:31 +0000
parents f04afca36cf4
children 2f43fee89f0e
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 /*
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
2 * Copyright (C) 2006 Benjamin Zores
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
3 * Video output for WinTV PVR-150/250/350 (a.k.a IVTV) cards.
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
4 * TV-Out through hardware MPEG decoder.
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
5 * Based on some old code from ivtv driver authors.
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
6 * See http://ivtvdriver.org/index.php/Main_Page for more details on the
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
7 * cards supported by the ivtv driver.
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
8 *
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
12 * (at your option) any later version.
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
13 *
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
17 * GNU General Public License for more details.
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
18 *
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
20 * along with this program; if not, write to the Free Software Foundation,
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
21 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
22 */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
23
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
24 #include "config.h"
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 #include <stdio.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
27 #include <stdlib.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
28 #include <string.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
29 #include <errno.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
30 #include <sys/types.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
31 #include <sys/stat.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
32 #include <sys/ioctl.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
33 #include <fcntl.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
34 #include <unistd.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
35 #include <stdlib.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
36 #include <inttypes.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
37 #include <linux/types.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
38 #include <linux/videodev2.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
39 #include <linux/ivtv.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
40 #include <linux/ioctl.h>
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
41
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
42 #include "mp_msg.h"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
43 #include "subopt-helper.h"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
44 #include "video_out.h"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
45 #include "video_out_internal.h"
19142
4c22e1d84ac9 updated mpeg_packetizer include to new localization
ben
parents: 19137
diff changeset
46 #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
47
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
48 #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
49 #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
50
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
51 /* ivtv private */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
52 int ivtv_fd = -1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
53 static vo_mpegpes_t *pes;
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 /* suboptions */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
56 static int output = -1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
57 static char *device = NULL;
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 static opt_t subopts[] = {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
60 {"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
61 {"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
62 {NULL}
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
63 };
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
64
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
65 static vo_info_t info =
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 "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
68 "ivtv",
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
69 "Benjamin Zores",
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 };
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
72 LIBVO_EXTERN (ivtv)
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 /* ivtv internals */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
75
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
76 static uint32_t
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
77 ivtv_reset (int blank_screen)
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 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
80 struct ivtv_cfg_start_decode sd1;
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 sd.hide_last = blank_screen;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
83 sd.pts_stop = 0;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
84
19978
f04afca36cf4 use a more generic ioctl as the one used was deprecated with Linux 2.6.18 kernel
ben
parents: 19148
diff changeset
85 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
86 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
87 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
88 "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
89 return 1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
90 }
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 sd1.gop_offset = 0;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
93 sd1.muted_audio_frames = 0;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
94
19978
f04afca36cf4 use a more generic ioctl as the one used was deprecated with Linux 2.6.18 kernel
ben
parents: 19148
diff changeset
95 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
96 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
97 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
98 "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
99 return 1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
100 }
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 return 0;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
103 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
104
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
105 int
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
106 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
107 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
108 if (ivtv_fd < 0)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
109 return 0;
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 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
112 }
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 /* video out functions */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
115
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
116 static int
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
117 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
118 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
119 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
120 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
121 return 0;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
122 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
123
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
124 static int
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
125 preinit (const char *arg)
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 struct v4l2_output vout;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
128 int err;
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 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
131 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
132 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
133 "\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
134 "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
135 "\nOptions:\n"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
136 " device=/dev/videoX\n"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
137 " 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
138 " output=<0-...>\n"
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
139 " 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
140 "\n" );
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
141 return -1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
142 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
143
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
144 if (!device)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
145 device = strdup (DEFAULT_MPEG_DECODER);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
146
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
147 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
148 if (ivtv_fd < 0)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
149 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
150 free (device);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
151 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
152 return -1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
153 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
154
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
155 /* list available outputs */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
156 vout.index = 0;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
157 err = 1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
158 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
159 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
160 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
161 err = 0;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
162 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
163 vout.index++;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
164 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
165 if (err)
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 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
168 free (device);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
169 return -1;
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 else
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, "\n");
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
173
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
174 /* set user specified output */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
175 if (output != -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 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
178 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
179 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
180 "%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
181 free (device);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
182 return -1;
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 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
185
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
186 /* display device name */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
187 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
188 free (device);
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 /* display current video output */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
191 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
192 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
193 vout.index = output;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
194 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
195 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
196 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
197 "%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
198 return -1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
199 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
200 else
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_INFO,
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
202 "%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
203 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
204 else
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 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
207 "%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
208 return -1;
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
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
211 /* clear output */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
212 ivtv_reset (1);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
213
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
214 return 0;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
215 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
216
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
217 static void
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
218 draw_osd (void)
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 /* do nothing */
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 int
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
224 draw_frame (uint8_t * src[])
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 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
227 return 0;
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
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
230 static void
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
231 flip_page (void)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
232 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
233 if (ivtv_fd < 0)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
234 return;
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 if (!pes)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
237 return;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
238
19148
3b839a8d297a simplified mpeg packetizer used by hw mpeg decoders/vo - first round
nicodvb
parents: 19142
diff changeset
239 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
240 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
241 ivtv_write);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
242
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
243 /* 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
244 pes = NULL;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
245 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
246
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
247 static int
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
248 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
249 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
250 return 0;
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 void
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
254 uninit (void)
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 if (ivtv_fd < 0)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
257 return;
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 /* clear output */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
260 ivtv_reset (1);
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 /* close device */
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
263 close (ivtv_fd);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
264 ivtv_fd = -1;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
265 }
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 static void
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
268 check_events (void)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
269 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
270 /* do nothing */
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 int
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
274 query_format (uint32_t format)
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 if (format != IMGFMT_MPEGPES)
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
277 return 0;
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 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
280 }
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 static int
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
283 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
284 {
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
285 switch (request)
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 case VOCTRL_PAUSE:
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
288 case VOCTRL_RESUME:
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
289 return ivtv_reset (0);
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 case VOCTRL_RESET:
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
292 return ivtv_reset (1);
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
293
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
294 case VOCTRL_QUERY_FORMAT:
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
295 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
296 }
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
297
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
298 return VO_NOTIMPL;
d9656bb2ae0e new vo driver for ivtv cards tv-out through internal h/w mpeg decoder
ben
parents:
diff changeset
299 }