xine-lib: xine-lib-1.2.13/src/dxr3/video_out_dxr3.h Source File

xine-lib 1.2.13-20230125hg15249

video_out_dxr3.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2000-2020 the xine project
3 *
4 * This file is part of xine, a unix video player.
5 *
6 * xine is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * xine is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 */
20
21#if defined(HAVE_CONFIG_H) && !defined(__XINE_LIB_CONFIG_H__)
22# error config.h not included
23#endif
24
25#ifdef HAVE_X11
26# include <X11/Xlib.h>
27#endif
28
29#include <xine/xine_internal.h>
30#include <xine/vo_scale.h>
31#include "dxr3_scr.h"
32#include "dxr3.h"
33
34/* the number of supported encoders */
35#define SUPPORTED_ENCODER_COUNT 3
36
37
38/* plugin structures */
39 typedef struct encoder_data_s encoder_data_t;
40 typedef struct spu_encoder_s spu_encoder_t;
41
42 typedef enum { ENC_FAME, ENC_RTE, ENC_LAVC } encoder_type;
43
44
45 struct coeff {
46 float k,m;
47};
48
49 typedef struct dxr3_overlay_s {
50 xine_t *xine;
51
52 int fd_control;
53
54 int xoffset;
55 int yoffset;
56 int xcorr;
57 int jitter;
58 int stability;
59 int colorkey;
60 float color_interval;
61 int screen_xres;
62 int screen_yres;
63 int screen_depth;
64 int shrink;
65
66 struct coeff colcal_upper[3];
67 struct coeff colcal_lower[3];
68} dxr3_overlay_t;
69
70 typedef struct dxr3_driver_class_s {
71 video_driver_class_t video_driver_class;
72 xine_t *xine;
73
74 int visual_type;
75 int instance; /* we allow only one instance of this plugin */
76
77 int devnum;
78} dxr3_driver_class_t;
79
80 typedef struct dxr3_driver_s {
81 vo_driver_t vo_driver;
82 dxr3_driver_class_t *class;
83 dxr3_scr_t *scr; /* to provide dxr3 clocking */
84
85 int fd_control;
86 pthread_mutex_t video_device_lock;
87 int fd_video;
88 pthread_mutex_t spu_device_lock;
89 int fd_spu; /* to access the relevant dxr3 devices */
90 int clut_cluttered; /* to tell spu decoder that it has to restore the palette */
91
92 int enhanced_mode;
93 int swap_fields; /* swap fields */
94 int add_bars; /* add black bars to correct a.r. */
95
96 int aspect;
97 int tv_mode;
98 int pan_scan;
99 int overlay_enabled;
100 int tv_switchable; /* can switch from overlay<->tvout */
101 int widescreen_enabled;
102 em8300_bcs_t bcs;
103
104 encoder_data_t *enc; /* mpeg encoder data */
105 spu_encoder_t *spu_enc; /* spu encoder */
106 int need_update; /* the mpeg encoder needs to be updated */
107
108 uint32_t video_iheight; /* input height (before adding black bars) */
109 uint32_t video_oheight; /* output height (after adding black bars) */
110 uint32_t video_width;
111 double video_ratio;
112 int video_aspect;
113 int top_bar; /* the height of the upper black bar */
114
115 vo_scale_t scale;
116 alphablend_t alphablend_extra_data;
117
118 dxr3_overlay_t overlay;
119#ifdef HAVE_X11
120 Display *display;
121 Drawable win;
122 GC gc;
123 XColor black;
124 XColor key;
125#endif
126
127} dxr3_driver_t;
128
129 typedef struct dxr3_frame_s {
130 vo_frame_t vo_frame;
131 uint32_t oheight;
132 int aspect, pan_scan;
133 void *mem; /* allocated for YV12 or YUY2 buffers */
134 uint8_t *real_base[3]; /* yuv/yuy2 buffers in mem aligned on 16 */
135 int swap_fields; /* shifts Y buffer one line to exchange odd/even lines */
136} dxr3_frame_t;
137
138 struct encoder_data_s {
139 encoder_type type;
140 int (*on_update_format)(dxr3_driver_t *, dxr3_frame_t *);
141 int (*on_frame_copy)(dxr3_driver_t *, dxr3_frame_t *, uint8_t **src);
142 int (*on_display_frame)(dxr3_driver_t *, dxr3_frame_t *);
143 int (*on_unneeded)(dxr3_driver_t *);
144 int (*on_close)(dxr3_driver_t *);
145
146 /* this is only used by the libavcodec encoder */
147 void *handle;
148};
149
150 struct spu_encoder_s {
151 vo_overlay_t *overlay;
152 int need_reencode;
153 uint8_t *target;
154 int size;
155 int malloc_size;
156 uint32_t color[16];
157 uint8_t trans[4];
158 int map[OVL_PALETTE_SIZE];
159 uint32_t hili_color[16];
160 uint8_t hili_trans[4];
161 int clip_map[OVL_PALETTE_SIZE];
162};
163
164/* mpeg encoder plugins initialization functions */
165#ifdef HAVE_LIBRTE
166int dxr3_rte_init(dxr3_driver_t *);
167#endif
168#ifdef HAVE_LIBFAME
169int dxr3_fame_init(dxr3_driver_t *);
170#endif
171int dxr3_lavc_init(dxr3_driver_t *, plugin_node_t *);
172
173/* spu encoder functions */
174 spu_encoder_t *dxr3_spu_encoder_init(void);
175void dxr3_spu_encode(spu_encoder_t *);
176
177#define dxr3_video_setpts(fd,arg) dxr3_compat_ioctl((fd), EM8300_IOCTL_VIDEO_SETPTS, (arg))
178#define dxr3_spu_setpts(fd,arg) dxr3_compat_ioctl((fd), EM8300_IOCTL_SPU_SETPTS, (arg))
179#define dxr3_spu_setpalette(fd,arg) dxr3_compat_ioctl((fd), EM8300_IOCTL_SPU_SETPALETTE, (arg))
180#define dxr3_spu_button(fd,arg) dxr3_compat_ioctl((fd), EM8300_IOCTL_SPU_BUTTON, (arg))
181int dxr3_compat_ioctl (int, int, void *);
dxr3.h
dxr3_scr.h
OVL_PALETTE_SIZE
#define OVL_PALETTE_SIZE
Definition video_out.h:294
alphablend_t
Definition alphablend.h:30
coeff
Definition video_out_dxr3.h:45
coeff::m
float m
Definition video_out_dxr3.h:46
coeff::k
float k
Definition video_out_dxr3.h:46
dxr3_driver_class_s
Definition video_out_dxr3.h:70
dxr3_driver_class_s::devnum
int devnum
Definition video_out_dxr3.h:77
dxr3_driver_class_s::xine
xine_t * xine
Definition video_out_dxr3.h:72
dxr3_driver_class_s::instance
int instance
Definition video_out_dxr3.h:75
dxr3_driver_class_s::video_driver_class
video_driver_class_t video_driver_class
Definition video_out_dxr3.h:71
dxr3_driver_class_s::visual_type
int visual_type
Definition video_out_dxr3.h:74
dxr3_driver_s
Definition video_out_dxr3.h:80
dxr3_driver_s::tv_mode
int tv_mode
Definition video_out_dxr3.h:97
dxr3_driver_s::tv_switchable
int tv_switchable
Definition video_out_dxr3.h:100
dxr3_driver_s::add_bars
int add_bars
Definition video_out_dxr3.h:94
dxr3_driver_s::enhanced_mode
int enhanced_mode
Definition video_out_dxr3.h:92
dxr3_driver_s::overlay
dxr3_overlay_t overlay
Definition video_out_dxr3.h:118
dxr3_driver_s::clut_cluttered
int clut_cluttered
Definition video_out_dxr3.h:90
dxr3_driver_s::video_aspect
int video_aspect
Definition video_out_dxr3.h:112
dxr3_driver_s::spu_enc
spu_encoder_t * spu_enc
Definition video_out_dxr3.h:105
dxr3_driver_s::video_width
uint32_t video_width
Definition video_out_dxr3.h:110
dxr3_driver_s::widescreen_enabled
int widescreen_enabled
Definition video_out_dxr3.h:101
dxr3_driver_s::video_ratio
double video_ratio
Definition video_out_dxr3.h:111
dxr3_driver_s::scr
dxr3_scr_t * scr
Definition video_out_dxr3.h:83
dxr3_driver_s::bcs
em8300_bcs_t bcs
Definition video_out_dxr3.h:102
dxr3_driver_s::spu_device_lock
pthread_mutex_t spu_device_lock
Definition video_out_dxr3.h:88
dxr3_driver_s::overlay_enabled
int overlay_enabled
Definition video_out_dxr3.h:99
dxr3_driver_s::video_device_lock
pthread_mutex_t video_device_lock
Definition video_out_dxr3.h:86
dxr3_driver_s::fd_spu
int fd_spu
Definition video_out_dxr3.h:89
dxr3_driver_s::aspect
int aspect
Definition video_out_dxr3.h:96
dxr3_driver_s::vo_driver
vo_driver_t vo_driver
Definition video_out_dxr3.h:81
dxr3_driver_s::need_update
int need_update
Definition video_out_dxr3.h:106
dxr3_driver_s::fd_control
int fd_control
Definition video_out_dxr3.h:85
dxr3_driver_s::fd_video
int fd_video
Definition video_out_dxr3.h:87
dxr3_driver_s::pan_scan
int pan_scan
Definition video_out_dxr3.h:98
dxr3_driver_s::swap_fields
int swap_fields
Definition video_out_dxr3.h:93
dxr3_driver_s::top_bar
int top_bar
Definition video_out_dxr3.h:113
dxr3_driver_s::scale
vo_scale_t scale
Definition video_out_dxr3.h:115
dxr3_driver_s::alphablend_extra_data
alphablend_t alphablend_extra_data
Definition video_out_dxr3.h:116
dxr3_driver_s::video_iheight
uint32_t video_iheight
Definition video_out_dxr3.h:108
dxr3_driver_s::video_oheight
uint32_t video_oheight
Definition video_out_dxr3.h:109
dxr3_driver_s::enc
encoder_data_t * enc
Definition video_out_dxr3.h:104
dxr3_frame_s
Definition video_out_dxr3.h:129
dxr3_frame_s::swap_fields
int swap_fields
Definition video_out_dxr3.h:135
dxr3_frame_s::vo_frame
vo_frame_t vo_frame
Definition video_out_dxr3.h:130
dxr3_frame_s::pan_scan
int pan_scan
Definition video_out_dxr3.h:132
dxr3_frame_s::oheight
uint32_t oheight
Definition video_out_dxr3.h:131
dxr3_frame_s::aspect
int aspect
Definition video_out_dxr3.h:132
dxr3_frame_s::mem
void * mem
Definition video_out_dxr3.h:133
dxr3_frame_s::real_base
uint8_t * real_base[3]
Definition video_out_dxr3.h:134
dxr3_overlay_s
Definition video_out_dxr3.h:49
dxr3_overlay_s::screen_depth
int screen_depth
Definition video_out_dxr3.h:63
dxr3_overlay_s::fd_control
int fd_control
Definition video_out_dxr3.h:52
dxr3_overlay_s::color_interval
float color_interval
Definition video_out_dxr3.h:60
dxr3_overlay_s::screen_xres
int screen_xres
Definition video_out_dxr3.h:61
dxr3_overlay_s::xine
xine_t * xine
Definition video_out_dxr3.h:50
dxr3_overlay_s::xcorr
int xcorr
Definition video_out_dxr3.h:56
dxr3_overlay_s::colcal_upper
struct coeff colcal_upper[3]
Definition video_out_dxr3.h:66
dxr3_overlay_s::shrink
int shrink
Definition video_out_dxr3.h:64
dxr3_overlay_s::colorkey
int colorkey
Definition video_out_dxr3.h:59
dxr3_overlay_s::stability
int stability
Definition video_out_dxr3.h:58
dxr3_overlay_s::xoffset
int xoffset
Definition video_out_dxr3.h:54
dxr3_overlay_s::yoffset
int yoffset
Definition video_out_dxr3.h:55
dxr3_overlay_s::screen_yres
int screen_yres
Definition video_out_dxr3.h:62
dxr3_overlay_s::colcal_lower
struct coeff colcal_lower[3]
Definition video_out_dxr3.h:67
dxr3_overlay_s::jitter
int jitter
Definition video_out_dxr3.h:57
dxr3_scr_s
Definition dxr3_scr.h:25
em8300_bcs_t
Definition em8300.h:44
encoder_data_s
Definition video_out_dxr3.h:138
encoder_data_s::on_frame_copy
int(* on_frame_copy)(dxr3_driver_t *, dxr3_frame_t *, uint8_t **src)
Definition video_out_dxr3.h:141
encoder_data_s::on_unneeded
int(* on_unneeded)(dxr3_driver_t *)
Definition video_out_dxr3.h:143
encoder_data_s::on_close
int(* on_close)(dxr3_driver_t *)
Definition video_out_dxr3.h:144
encoder_data_s::handle
void * handle
Definition video_out_dxr3.h:147
encoder_data_s::type
encoder_type type
Definition video_out_dxr3.h:139
encoder_data_s::on_display_frame
int(* on_display_frame)(dxr3_driver_t *, dxr3_frame_t *)
Definition video_out_dxr3.h:142
encoder_data_s::on_update_format
int(* on_update_format)(dxr3_driver_t *, dxr3_frame_t *)
Definition video_out_dxr3.h:140
plugin_node_s
Definition plugin_catalog.h:44
spu_encoder_s
Definition video_out_dxr3.h:150
spu_encoder_s::clip_map
int clip_map[OVL_PALETTE_SIZE]
Definition video_out_dxr3.h:161
spu_encoder_s::hili_trans
uint8_t hili_trans[4]
Definition video_out_dxr3.h:160
spu_encoder_s::color
uint32_t color[16]
Definition video_out_dxr3.h:156
spu_encoder_s::malloc_size
int malloc_size
Definition video_out_dxr3.h:155
spu_encoder_s::size
int size
Definition video_out_dxr3.h:154
spu_encoder_s::target
uint8_t * target
Definition video_out_dxr3.h:153
spu_encoder_s::trans
uint8_t trans[4]
Definition video_out_dxr3.h:157
spu_encoder_s::overlay
vo_overlay_t * overlay
Definition video_out_dxr3.h:151
spu_encoder_s::need_reencode
int need_reencode
Definition video_out_dxr3.h:152
spu_encoder_s::map
int map[OVL_PALETTE_SIZE]
Definition video_out_dxr3.h:158
spu_encoder_s::hili_color
uint32_t hili_color[16]
Definition video_out_dxr3.h:159
video_driver_class_s
Definition video_out.h:449
vo_driver_t
Definition video_out.h:50
vo_frame_s
Definition video_out.h:70
vo_overlay_s
Definition video_out.h:495
vo_scale_s
Definition vo_scale.h:39
xine_s
Definition xine_internal.h:80
dxr3_overlay_t
struct dxr3_overlay_s dxr3_overlay_t
dxr3_driver_t
struct dxr3_driver_s dxr3_driver_t
dxr3_spu_encode
void dxr3_spu_encode(spu_encoder_t *)
Definition dxr3_spu_encoder.c:84
dxr3_lavc_init
int dxr3_lavc_init(dxr3_driver_t *, plugin_node_t *)
Definition ffmpeg_encoder.c:92
dxr3_compat_ioctl
int dxr3_compat_ioctl(int, int, void *)
Definition compat.c:31
dxr3_spu_encoder_init
spu_encoder_t * dxr3_spu_encoder_init(void)
Definition dxr3_spu_encoder.c:72
encoder_type
encoder_type
Definition video_out_dxr3.h:42
ENC_LAVC
@ ENC_LAVC
Definition video_out_dxr3.h:42
ENC_RTE
@ ENC_RTE
Definition video_out_dxr3.h:42
ENC_FAME
@ ENC_FAME
Definition video_out_dxr3.h:42
dxr3_frame_t
struct dxr3_frame_s dxr3_frame_t
dxr3_driver_class_t
struct dxr3_driver_class_s dxr3_driver_class_t
vo_scale.h
xine_internal.h
key
char key[16]
Definition xine_speex_decoder.c:94