xine-lib  1.2.9
video_out_dxr3.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2000-2011 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 #ifdef HAVE_CONFIG_H
22 # include "config.h"
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 */
41 
43 
44 
45 struct coeff {
46  float k,m;
47 };
48 
49 typedef struct dxr3_overlay_s {
51 
53 
54  int xoffset;
55  int yoffset;
56  int xcorr;
57  int jitter;
58  int stability;
59  int colorkey;
64  int shrink;
65 
66  struct coeff colcal_upper[3];
67  struct coeff colcal_lower[3];
69 
70 typedef struct dxr3_driver_class_s {
73 
75  int instance; /* we allow only one instance of this plugin */
76 
77  int devnum;
78 
79  dxr3_scr_t *scr; /* to provide dxr3 clocking */
81 
82 typedef struct dxr3_driver_s {
85 
87  pthread_mutex_t video_device_lock;
88  int fd_video;
89  pthread_mutex_t spu_device_lock;
90  int fd_spu; /* to access the relevant dxr3 devices */
91  int clut_cluttered; /* to tell spu decoder that it has to restore the palette */
92 
94  int swap_fields; /* swap fields */
95  int add_bars; /* add black bars to correct a.r. */
96 
97  int aspect;
98  int tv_mode;
99  int pan_scan;
101  int tv_switchable; /* can switch from overlay<->tvout */
104 
105  encoder_data_t *enc; /* mpeg encoder data */
106  spu_encoder_t *spu_enc; /* spu encoder */
107  int need_update; /* the mpeg encoder needs to be updated */
108 
109  uint32_t video_iheight; /* input height (before adding black bars) */
110  uint32_t video_oheight; /* output height (after adding black bars) */
111  uint32_t video_width;
112  double video_ratio;
114  int top_bar; /* the height of the upper black bar */
115 
118 
120 #ifdef HAVE_X11
121  Display *display;
122  Drawable win;
123  GC gc;
124  XColor black;
125  XColor key;
126 #endif
127 
128 } dxr3_driver_t;
129 
130 typedef struct dxr3_frame_s {
132  uint32_t oheight;
134  void *mem; /* allocated for YV12 or YUY2 buffers */
135  uint8_t *real_base[3]; /* yuv/yuy2 buffers in mem aligned on 16 */
136  int swap_fields; /* shifts Y buffer one line to exchange odd/even lines */
137 } dxr3_frame_t;
138 
142  int (*on_frame_copy)(dxr3_driver_t *, dxr3_frame_t *, uint8_t **src);
146 
147  /* this is only used by the libavcodec encoder */
148  void *handle;
149 };
150 
154  uint8_t *target;
155  int size;
157  uint32_t color[16];
158  uint8_t trans[4];
160  uint32_t hili_color[16];
161  uint8_t hili_trans[4];
163 };
164 
165 /* mpeg encoder plugins initialization functions */
166 #ifdef HAVE_LIBRTE
167 int dxr3_rte_init(dxr3_driver_t *);
168 #endif
169 #ifdef HAVE_LIBFAME
170 int dxr3_fame_init(dxr3_driver_t *);
171 #endif
173 
174 /* spu encoder functions */
177 
178 #define dxr3_video_setpts(fd,arg) dxr3_compat_ioctl((fd), EM8300_IOCTL_VIDEO_SETPTS, (arg))
179 #define dxr3_spu_setpts(fd,arg) dxr3_compat_ioctl((fd), EM8300_IOCTL_SPU_SETPTS, (arg))
180 #define dxr3_spu_setpalette(fd,arg) dxr3_compat_ioctl((fd), EM8300_IOCTL_SPU_SETPALETTE, (arg))
181 #define dxr3_spu_button(fd,arg) dxr3_compat_ioctl((fd), EM8300_IOCTL_SPU_BUTTON, (arg))
182 int dxr3_compat_ioctl (int, int, void *);
vo_frame_t vo_frame
Definition: video_out_dxr3.h:131
int fd_control
Definition: video_out_dxr3.h:86
int fd_spu
Definition: video_out_dxr3.h:90
vo_driver_t vo_driver
Definition: video_out_dxr3.h:83
int colorkey
Definition: video_out_dxr3.h:59
Definition: video_out_dxr3.h:151
int clip_map[OVL_PALETTE_SIZE]
Definition: video_out_dxr3.h:162
int fd_video
Definition: video_out_dxr3.h:88
uint8_t hili_trans[4]
Definition: video_out_dxr3.h:161
Definition: alphablend.h:30
int instance
Definition: video_out_dxr3.h:75
int shrink
Definition: video_out_dxr3.h:64
Definition: video_out.h:476
struct dxr3_driver_class_s dxr3_driver_class_t
dxr3_scr_t * scr
Definition: video_out_dxr3.h:79
Definition: video_out_dxr3.h:49
Definition: video_out_dxr3.h:42
struct dxr3_driver_s dxr3_driver_t
uint32_t video_iheight
Definition: video_out_dxr3.h:109
int(* on_close)(dxr3_driver_t *)
Definition: video_out_dxr3.h:145
int swap_fields
Definition: video_out_dxr3.h:136
struct dxr3_frame_s dxr3_frame_t
int clut_cluttered
Definition: video_out_dxr3.h:91
float color_interval
Definition: video_out_dxr3.h:60
float m
Definition: video_out_dxr3.h:46
struct coeff colcal_upper[3]
Definition: video_out_dxr3.h:66
xine_t * xine
Definition: video_out_dxr3.h:72
int video_aspect
Definition: video_out_dxr3.h:113
int dxr3_lavc_init(dxr3_driver_t *, plugin_node_t *)
Definition: ffmpeg_encoder.c:84
struct dxr3_overlay_s dxr3_overlay_t
alphablend_t alphablend_extra_data
Definition: video_out_dxr3.h:117
Definition: plugin_catalog.h:44
int widescreen_enabled
Definition: video_out_dxr3.h:102
char key[16]
Definition: xine_speex_decoder.c:98
encoder_type type
Definition: video_out_dxr3.h:140
pthread_mutex_t video_device_lock
Definition: video_out_dxr3.h:87
Definition: video_out_dxr3.h:139
Definition: video_out_dxr3.h:45
int top_bar
Definition: video_out_dxr3.h:114
Definition: video_out_dxr3.h:70
int add_bars
Definition: video_out_dxr3.h:95
int visual_type
Definition: video_out_dxr3.h:74
int aspect
Definition: video_out_dxr3.h:97
int devnum
Definition: video_out_dxr3.h:77
vo_overlay_t * overlay
Definition: video_out_dxr3.h:152
double video_ratio
Definition: video_out_dxr3.h:112
int overlay_enabled
Definition: video_out_dxr3.h:100
int screen_yres
Definition: video_out_dxr3.h:62
int stability
Definition: video_out_dxr3.h:58
void * mem
Definition: video_out_dxr3.h:134
Definition: video_out.h:50
uint32_t video_oheight
Definition: video_out_dxr3.h:110
Definition: video_out_dxr3.h:42
#define OVL_PALETTE_SIZE
Definition: video_out.h:281
vo_scale_t scale
Definition: video_out_dxr3.h:116
dxr3_overlay_t overlay
Definition: video_out_dxr3.h:119
int(* on_unneeded)(dxr3_driver_t *)
Definition: video_out_dxr3.h:144
uint32_t color[16]
Definition: video_out_dxr3.h:157
Definition: em8300.h:44
int swap_fields
Definition: video_out_dxr3.h:94
Definition: video_out.h:60
void * handle
Definition: video_out_dxr3.h:148
int need_update
Definition: video_out_dxr3.h:107
int dxr3_compat_ioctl(int, int, void *)
Definition: compat.c:22
struct coeff colcal_lower[3]
Definition: video_out_dxr3.h:67
int malloc_size
Definition: video_out_dxr3.h:156
int jitter
Definition: video_out_dxr3.h:57
uint32_t oheight
Definition: video_out_dxr3.h:132
int(* on_update_format)(dxr3_driver_t *, dxr3_frame_t *)
Definition: video_out_dxr3.h:141
int tv_switchable
Definition: video_out_dxr3.h:101
int fd_control
Definition: video_out_dxr3.h:52
int(* on_frame_copy)(dxr3_driver_t *, dxr3_frame_t *, uint8_t **src)
Definition: video_out_dxr3.h:142
int xcorr
Definition: video_out_dxr3.h:56
int screen_depth
Definition: video_out_dxr3.h:63
uint8_t * target
Definition: video_out_dxr3.h:154
xine_t * xine
Definition: video_out_dxr3.h:50
int pan_scan
Definition: video_out_dxr3.h:133
int yoffset
Definition: video_out_dxr3.h:55
video_driver_class_t video_driver_class
Definition: video_out_dxr3.h:71
int tv_mode
Definition: video_out_dxr3.h:98
pthread_mutex_t spu_device_lock
Definition: video_out_dxr3.h:89
Definition: xine_internal.h:81
void dxr3_spu_encode(spu_encoder_t *)
Definition: dxr3_spu_encoder.c:80
encoder_type
Definition: video_out_dxr3.h:42
uint32_t video_width
Definition: video_out_dxr3.h:111
Definition: dxr3_scr.h:25
int size
Definition: video_out_dxr3.h:155
encoder_data_t * enc
Definition: video_out_dxr3.h:105
int xoffset
Definition: video_out_dxr3.h:54
float k
Definition: video_out_dxr3.h:46
uint8_t * real_base[3]
Definition: video_out_dxr3.h:135
int pan_scan
Definition: video_out_dxr3.h:99
int map[OVL_PALETTE_SIZE]
Definition: video_out_dxr3.h:159
int screen_xres
Definition: video_out_dxr3.h:61
uint8_t trans[4]
Definition: video_out_dxr3.h:158
uint32_t hili_color[16]
Definition: video_out_dxr3.h:160
int enhanced_mode
Definition: video_out_dxr3.h:93
Definition: video_out.h:430
Definition: video_out_dxr3.h:82
int need_reencode
Definition: video_out_dxr3.h:153
spu_encoder_t * dxr3_spu_encoder_init(void)
Definition: dxr3_spu_encoder.c:68
int aspect
Definition: video_out_dxr3.h:133
spu_encoder_t * spu_enc
Definition: video_out_dxr3.h:106
Definition: video_out_dxr3.h:42
em8300_bcs_t bcs
Definition: video_out_dxr3.h:103
Definition: video_out_dxr3.h:130
Definition: vo_scale.h:39
int(* on_display_frame)(dxr3_driver_t *, dxr3_frame_t *)
Definition: video_out_dxr3.h:143