1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
/*
* Copyright (C) 2000-2001 the xine project
*
* This file is part of xine, a unix video player.
*
* xine is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* xine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
* $Id: dxr3_video_out.h,v 1.19 2002/04/04 00:08:36 miguelfreitas Exp $
*
*/
/*
* Globals for dxr3 videoout plugins
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <math.h>
#include <linux/em8300.h>
#include "video_out.h"
#include "xine_internal.h"
#include "alphablend.h"
/* for fast_memcpy: */
#include "xineutils.h"
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#ifdef HAVE_XINERAMA
#include <X11/extensions/Xinerama.h>
#endif
#include "../video_out/video_out_x11.h"
#define LOOKUP_DEV "dxr3.devicename"
#define DEFAULT_DEV "/dev/em8300"
/* image format used by dxr3_decoder to tag undecoded mpeg data */
#define IMGFMT_MPEG (('G'<<24)|('E'<<16)|('P'<<8)|'M')
/* values for fd_video indicating why it is closed */
#define CLOSED_FOR_DECODER -1
#define CLOSED_FOR_ENCODER -2
struct coeff {
float k,m;
};
typedef struct {
int fd_control;
int xoffset;
int yoffset;
int xcorr;
int jitter;
int stability;
int colorkey;
float color_interval;
int screen_xres;
int screen_yres;
int screen_depth;
struct coeff colcal_upper[3];
struct coeff colcal_lower[3];
} dxr3_overlay_t;
typedef enum { ENC_FAME, ENC_RTE } encoder_type;
typedef struct encoder_data_s encoder_data_t;
typedef struct dxr3_driver_s {
vo_driver_t vo_driver;
config_values_t *config;
int fd_control;
int fd_video;
int aspectratio;
int tv_mode;
int enhanced_mode; /* enhanced play mode */
int need_redraw;
em8300_bcs_t bcs;
char devname[128];
char devnum[3];
/* for encoder plugin */
encoder_data_t *enc; /* encoder data */
double fps; /* frames per second */
int format; /* color format */
const char *file_out;
int swap_fields; /* swap fields */
int add_bars; /* add black bars to correct a.r. */
/* height after adding black bars to correct a.r. */
int oheight;
int top_bar; /* number of lines in top black bar */
/* input height (before adding black bars) */
int video_iheight;
/* output height (after adding bars) */
int video_height;
/* for overlay */
dxr3_overlay_t overlay;
Display *display;
Drawable win;
GC gc;
XColor color;
int xpos, ypos;
int width, height;
int overlay_enabled;
int tv_switchable; /* can switch from overlay<->tvout */
int fullscreen_rectangle;
float desired_ratio;
int zoom_enabled; /* zoomed 16:9 mode */
int video_width;
int video_aspect;
char *user_data;
void (*frame_output_cb) (void *user_data,
int video_width, int video_height,
int *dest_x, int *dest_y,
int *dest_height, int *dest_width,
int *win_x, int *win_u);
/* void (*frame_output_cb) (char *userdata, int video_width,
int video_height, int *dest_x,
int *dest_y, int *dest_height, int *dest_width);
*/
} dxr3_driver_t;
typedef struct dxr3_frame_s {
vo_frame_t vo_frame;
int width, height,oheight;
uint8_t *mem; /* allocated for YV12 or YUY2 buffers */
uint8_t *real_base[3]; /* yuv/yuy2 buffers in mem aligned on 16 */
int copy_calls; /* counts calls to dxr3_frame_copy function */
int swap_fields; /* shifts Y buffer one line to exchange odd/even lines*/
} dxr3_frame_t;
struct encoder_data_s {
encoder_type type;
int (*on_update_format)(dxr3_driver_t *);
int (*on_frame_copy)(dxr3_driver_t *, dxr3_frame_t *, uint8_t **src);
int (*on_display_frame)(dxr3_driver_t *, dxr3_frame_t *);
int (*on_close)(dxr3_driver_t *);
};
/* func definitions */
int dxr3_redraw_needed(vo_driver_t *this_gen);
/* Overlay functions */
int dxr3_overlay_set_mode(dxr3_overlay_t *this, int mode);
int dxr3_overlay_set_attributes(dxr3_overlay_t *this);
int dxr3_overlay_set_screen(dxr3_overlay_t *this);
int dxr3_overlay_set_window(dxr3_overlay_t *this,
int xpos, int ypos, int width, int height);
void dxr3_overlay_adapt_area(dxr3_driver_t *this,
int xpos, int ypos, int width, int height);
void dxr3_overlay_update(dxr3_driver_t *this);
void dxr3_overlay_buggy_preinit(dxr3_overlay_t *this, int fd);
int dxr3_overlay_read_state(dxr3_overlay_t *this);
void dxr3_get_keycolor(dxr3_driver_t *this);
void dxr3_read_config(dxr3_driver_t *this, void *visual_gen);
void *malloc_aligned (size_t alignment, size_t size, void **mem);
void gather_screen_vars(dxr3_driver_t *this, x11_visual_t *vis);
/* xine accessable functions */
int dxr3_get_property (vo_driver_t *this_gen, int property);
int dxr3_set_property (vo_driver_t *this_gen, int property, int value);
void dxr3_get_property_min_max (vo_driver_t *this_gen, int property, int *min, int *max);
int dxr3_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *data);
|