annotate libvo/vo_directfb.c @ 6017:12460040d86b

partial fix
author arpi
date Wed, 08 May 2002 20:53:00 +0000
parents f3283d1c7e41
children a59795bd14d0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1 /*
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
2 MPlayer video driver for DirectFramebuffer device
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
3
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
4 (C) 2001
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
5
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
6 Written by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
7
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
8 Inspired by vo_sdl and vo_fbdev.
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
9
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
10 To get second head working delete line 120
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
11 from fbdev.c (from DirectFB sources version 0.9.7)
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
12 Line contains following:
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
13 fbdev->fd = open( "/dev/fb0", O_RDWR );
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
14
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
15 Parts of this code taken from DirectFB examples:
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
16 (c) Copyright 2000 convergence integrated media GmbH.
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
17 All rights reserved.
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
18
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
19 This library is free software; you can redistribute it and/or
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
20 modify it under the terms of the GNU Lesser General Public
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
21 License as published by the Free Software Foundation; either
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
22 version 2 of the License, or (at your option) any later version.
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
23
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
24 This library is distributed in the hope that it will be useful,
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
25 but WITHOUT ANY WARRANTY; without even the implied warranty of
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
26 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
27 Lesser General Public License for more details.
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
28
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
29 You should have received a copy of the GNU Lesser General Public
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
30 License along with this library; if not, write to the
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
31 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
32 Boston, MA 02111-1307, USA.
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
33 */
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
34
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
35 // directfb includes
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
36
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
37 #include <directfb.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
38
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
39 // other things
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
40
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
41 #include <stdio.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
42 #include <stdlib.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
43 #include <string.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
44 #include <fcntl.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
45 #include <unistd.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
46 #include <errno.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
47 #include <ctype.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
48 #include <assert.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
49
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
50 #include <sys/mman.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
51 #include <sys/ioctl.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
52 #include <sys/kd.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
53 #include <linux/fb.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
54
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
55 #include "config.h"
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
56 #include "video_out.h"
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
57 #include "video_out_internal.h"
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
58 #include "fastmemcpy.h"
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
59 #include "sub.h"
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
60 #include "../postproc/rgb2rgb.h"
5611
0fad81defb4f 0.1 bugfix
arpi
parents: 5607
diff changeset
61
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
62 #include "aspect.h"
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
63
5611
0fad81defb4f 0.1 bugfix
arpi
parents: 5607
diff changeset
64 #ifndef min
0fad81defb4f 0.1 bugfix
arpi
parents: 5607
diff changeset
65 #define min(x,y) (((x)<(y))?(x):(y))
0fad81defb4f 0.1 bugfix
arpi
parents: 5607
diff changeset
66 #endif
0fad81defb4f 0.1 bugfix
arpi
parents: 5607
diff changeset
67
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
68 LIBVO_EXTERN(directfb)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
69
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
70 static vo_info_t vo_info = {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
71 "Direct Framebuffer Device",
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
72 "directfb",
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
73 "Jiri Svoboda Jiri.Svoboda@seznam.cz",
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
74 ""
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
75 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
76
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
77 extern int verbose;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
78
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
79 /******************************
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
80 * directfb *
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
81 ******************************/
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
82
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
83 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
84 * (Globals)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
85 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
86 static IDirectFB *dfb = NULL;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
87 static IDirectFBSurface *primary = NULL;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
88 static IDirectFBInputDevice *keyboard = NULL;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
89 static IDirectFBDisplayLayer *videolayer = NULL;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
90 static DFBDisplayLayerConfig dlc;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
91 static unsigned int screen_width = 0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
92 static unsigned int screen_height = 0;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
93 static DFBSurfacePixelFormat frame_format;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
94 static unsigned int frame_pixel_size = 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
95 static unsigned int source_pixel_size = 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
96 static int xoffset=0,yoffset=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
97 #define DFBCHECK(x...) \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
98 { \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
99 DFBResult err = x; \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
100 \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
101 if (err != DFB_OK) \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
102 { \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
103 fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
104 DirectFBErrorFatal( #x, err ); \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
105 } \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
106 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
107
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
108 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
109 * The frame is to be loaded into a surface that we can blit from.
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
110 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
111
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
112 static IDirectFBSurface *frame = NULL;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
113
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
114 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
115 * A buffer for input events.
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
116 */
5026
693b917ac916 DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents: 4596
diff changeset
117
693b917ac916 DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents: 4596
diff changeset
118 #ifdef HAVE_DIRECTFB099
693b917ac916 DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents: 4596
diff changeset
119 static IDirectFBEventBuffer *buffer = NULL;
693b917ac916 DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents: 4596
diff changeset
120 #else
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
121 static IDirectFBInputBuffer *buffer = NULL;
5026
693b917ac916 DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents: 4596
diff changeset
122 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
123
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
124 /******************************
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
125 * vo_directfb *
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
126 ******************************/
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
127
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
128 /* command line/config file options */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
129 #ifdef HAVE_FBDEV
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
130 extern char *fb_dev_name;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
131 #else
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
132 char *fb_dev_name;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
133 #endif
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
134
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
135 static void (*draw_alpha_p)(int w, int h, unsigned char *src,
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
136 unsigned char *srca, int stride, unsigned char *dst,
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
137 int dstride);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
138
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
139 static uint32_t in_width;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
140 static uint32_t in_height;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
141 static uint32_t out_width=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
142 static uint32_t out_height=1;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
143 static uint32_t pixel_format;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
144 static int fs;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
145 static int flip;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
146 static int stretch=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
147 struct modes_t {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
148 int valid;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
149 unsigned int width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
150 unsigned int height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
151 int overx,overy;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
152 } modes [4];
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
153 static unsigned int best_bpp=5;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
154 // videolayer stuff
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
155 static int videolayeractive=0;
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
156 static int videolayerpresent=0;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
157 //some info about videolayer - filled on preinit
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
158 struct vlayer_t {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
159 int iv12;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
160 int i420;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
161 int yuy2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
162 int uyvy;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
163 int brightness;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
164 int saturation;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
165 int contrast;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
166 int hue;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
167 } videolayercaps;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
168 // workabout for DirectFB bug
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
169 static int buggyYV12BitBlt=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
170 static int memcpyBitBlt=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
171 #define DIRECTRENDER
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
172 #ifdef DIRECTRENDER
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
173 static int dr_enabled=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
174 static int framelocked=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
175 #endif
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
176 // primary & frame stuff
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
177 static int frameallocated=0;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
178 static int primaryallocated=0;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
179
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
180 DFBEnumerationResult enum_modes_callback( unsigned int width,unsigned int height,unsigned int bpp, void *data)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
181 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
182 int overx=0,overy=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
183 unsigned int index=bpp/8-1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
184 int allow_under=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
185
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
186 if (verbose) printf("DirectFB: Validator entered %i %i %i\n",width,height,bpp);
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
187
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
188 overx=width-out_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
189 overy=height-out_height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
190 if (!modes[index].valid) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
191 modes[index].valid=1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
192 modes[index].width=width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
193 modes[index].height=height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
194 modes[index].overx=overx;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
195 modes[index].overy=overy;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
196 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
197 if ((modes[index].overy<0)||(modes[index].overx<0)) allow_under=1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
198 if (abs(overx*overy)<abs(modes[index].overx * modes[index].overy)) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
199 if (((overx>=0)&&(overy>=0)) || allow_under) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
200 modes[index].valid=1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
201 modes[index].width=width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
202 modes[index].height=height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
203 modes[index].overx=overx;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
204 modes[index].overy=overy;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
205 if (verbose) printf("DirectFB:Better mode added %i %i %i\n",width,height,bpp);
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
206 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
207 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
208
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
209 return DFENUM_OK;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
210 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
211
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
212
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
213 DFBEnumerationResult enum_layers_callback( unsigned int id,
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
214 DFBDisplayLayerCapabilities caps,
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
215 void *data )
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
216 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
217 IDirectFBDisplayLayer **layer = (IDirectFBDisplayLayer **)data;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
218 if (verbose) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
219 printf("\nDirectFB: Layer %d:\n", id );
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
220
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
221 if (caps & DLCAPS_SURFACE)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
222 printf( " - Has a surface.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
223
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
224 if (caps & DLCAPS_ALPHACHANNEL)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
225 printf( " - Supports blending based on alpha channel.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
226
5890
f3283d1c7e41 DFB 0.9.10 update patch by Jiri.
atmos4
parents: 5611
diff changeset
227 #ifdef HAVE_DIRECTFB0910
f3283d1c7e41 DFB 0.9.10 update patch by Jiri.
atmos4
parents: 5611
diff changeset
228 if (caps & DLCAPS_SRC_COLORKEY)
f3283d1c7e41 DFB 0.9.10 update patch by Jiri.
atmos4
parents: 5611
diff changeset
229 printf( " - Supports source based color keying.\n" );
f3283d1c7e41 DFB 0.9.10 update patch by Jiri.
atmos4
parents: 5611
diff changeset
230
f3283d1c7e41 DFB 0.9.10 update patch by Jiri.
atmos4
parents: 5611
diff changeset
231 if (caps & DLCAPS_DST_COLORKEY)
f3283d1c7e41 DFB 0.9.10 update patch by Jiri.
atmos4
parents: 5611
diff changeset
232 printf( " - Supports destination based color keying.\n" );
f3283d1c7e41 DFB 0.9.10 update patch by Jiri.
atmos4
parents: 5611
diff changeset
233 #else
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
234 if (caps & DLCAPS_COLORKEYING)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
235 printf( " - Supports color keying.\n" );
5890
f3283d1c7e41 DFB 0.9.10 update patch by Jiri.
atmos4
parents: 5611
diff changeset
236 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
237
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
238 if (caps & DLCAPS_FLICKER_FILTERING)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
239 printf( " - Supports flicker filtering.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
240
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
241 if (caps & DLCAPS_INTERLACED_VIDEO)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
242 printf( " - Can natively display interlaced video.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
243
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
244 if (caps & DLCAPS_OPACITY)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
245 printf( " - Supports blending based on global alpha factor.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
246
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
247 if (caps & DLCAPS_SCREEN_LOCATION)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
248 printf( " - Can be positioned on the screen.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
249
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
250 if (caps & DLCAPS_BRIGHTNESS)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
251 printf( " - Brightness can be adjusted.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
252
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
253 if (caps & DLCAPS_CONTRAST)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
254 printf( " - Contrast can be adjusted.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
255
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
256 if (caps & DLCAPS_HUE)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
257 printf( " - Hue can be adjusted.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
258
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
259 if (caps & DLCAPS_SATURATION)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
260 printf( " - Saturation can be adjusted.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
261
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
262 printf("\n");
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
263 }
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
264 /* We take the first layer not being the primary */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
265 if (id != DLID_PRIMARY) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
266 DFBResult ret;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
267
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
268 ret = dfb->GetDisplayLayer( dfb, id, layer );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
269 if (ret)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
270 DirectFBError( "dfb->GetDisplayLayer failed", ret );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
271 else
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
272 return DFENUM_CANCEL;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
273 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
274
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
275 return DFENUM_OK;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
276 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
277
4354
5018e8014ebd fixed preinit conflict
alex
parents: 4352
diff changeset
278 static uint32_t preinit(const char *arg)
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
279 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
280 DFBSurfaceDescription dsc;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
281 DFBResult ret;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
282 DFBDisplayLayerConfigFlags failed;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
283
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
284 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
285 * (Initialize)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
286 */
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
287
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
288 if (verbose) printf("DirectFB: Preinit entered\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
289
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
290 DFBCHECK (DirectFBInit (NULL,NULL));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
291
3651
8148193fee93 working with 0.9.6 too (0.9.6 is coming with debian woody)
alex
parents: 3588
diff changeset
292 if ((directfb_major_version >= 0) &&
8148193fee93 working with 0.9.6 too (0.9.6 is coming with debian woody)
alex
parents: 3588
diff changeset
293 (directfb_minor_version >= 9) &&
8148193fee93 working with 0.9.6 too (0.9.6 is coming with debian woody)
alex
parents: 3588
diff changeset
294 (directfb_micro_version >= 7))
8148193fee93 working with 0.9.6 too (0.9.6 is coming with debian woody)
alex
parents: 3588
diff changeset
295 {
8148193fee93 working with 0.9.6 too (0.9.6 is coming with debian woody)
alex
parents: 3588
diff changeset
296 if (!fb_dev_name && !(fb_dev_name = getenv("FRAMEBUFFER"))) fb_dev_name = "/dev/fb0";
8148193fee93 working with 0.9.6 too (0.9.6 is coming with debian woody)
alex
parents: 3588
diff changeset
297 DFBCHECK (DirectFBSetOption ("fbdev",fb_dev_name));
8148193fee93 working with 0.9.6 too (0.9.6 is coming with debian woody)
alex
parents: 3588
diff changeset
298 }
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
299
5890
f3283d1c7e41 DFB 0.9.10 update patch by Jiri.
atmos4
parents: 5611
diff changeset
300 // disable YV12 for dfb until 0.9.10 - there is a bug in dfb! should be revised with every dfb version until bug is fixed in dfb.
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
301 if ((directfb_major_version <= 0) &&
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
302 (directfb_minor_version <= 9) &&
5890
f3283d1c7e41 DFB 0.9.10 update patch by Jiri.
atmos4
parents: 5611
diff changeset
303 (directfb_micro_version <= 10)) {
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
304 buggyYV12BitBlt=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
305 if (verbose) printf("DirectFB: Buggy YV12BitBlt!\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
306 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
307
3588
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
308 // uncomment this if you do not wish to create a new vt for DirectFB
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
309 DFBCHECK (DirectFBSetOption ("no-vt-switch",""));
3588
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
310
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
311 // uncomment this if you want to allow vt switching
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
312 DFBCHECK (DirectFBSetOption ("vt-switching",""));
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
313 #ifdef HAVE_DIRECTFB099
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
314 // uncomment this if you want to hide gfx cursor (req dfb >=0.9.9)
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
315 DFBCHECK (DirectFBSetOption ("no-cursor",""));
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
316 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
317
3588
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
318 DFBCHECK (DirectFBSetOption ("bg-color","00000000"));
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
319
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
320 DFBCHECK (DirectFBCreate (&dfb));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
321 DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
322
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
323 // lets try to get YUY2 layer - borrowed from DirectFb examples
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
324
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
325 /* Enumerate display layers */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
326 DFBCHECK (dfb->EnumDisplayLayers( dfb, enum_layers_callback, &videolayer ));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
327
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
328 if (!videolayer) {
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
329 if (verbose) printf("DirectFB: No videolayer found\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
330 // no videolayer found
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
331 // printf( "\nNo additional layers have been found.\n" );
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
332 videolayeractive=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
333
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
334 } else {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
335
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
336 // there is an additional layer so test it for YUV formats
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
337 // some videolayers support RGB formats - not used now
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
338 if (verbose) printf("DirectFB: Testing videolayer caps\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
339
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
340 dlc.flags = DLCONF_PIXELFORMAT;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
341 #ifdef HAVE_DIRECTFB099
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
342 dlc.pixelformat = DSPF_YV12;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
343 ret = videolayer->TestConfiguration( videolayer, &dlc, &failed );
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
344 if (ret==DFB_OK) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
345 videolayercaps.iv12=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
346 if (verbose) printf("DirectFB: Videolayer supports YV12 format\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
347 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
348 videolayercaps.iv12=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
349 if (verbose) printf("DirectFB: Videolayer doesn't support YV12 format\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
350 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
351
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
352 dlc.pixelformat = DSPF_I420;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
353 ret = videolayer->TestConfiguration( videolayer, &dlc, &failed );
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
354 if (ret==DFB_OK) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
355 videolayercaps.i420=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
356 if (verbose) printf("DirectFB: Videolayer supports I420 format\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
357 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
358 videolayercaps.i420=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
359 if (verbose) printf("DirectFB: Videolayer doesn't support I420 format\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
360 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
361 #else
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
362 videolayercaps.yuy2=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
363 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
364
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
365 dlc.pixelformat = DSPF_YUY2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
366 ret = videolayer->TestConfiguration( videolayer, &dlc, &failed );
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
367 if (ret==DFB_OK) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
368 videolayercaps.yuy2=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
369 if (verbose) printf("DirectFB: Videolayer supports YUY2 format\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
370 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
371 videolayercaps.yuy2=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
372 if (verbose) printf("DirectFB: Videolayer doesn't support YUY2 format\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
373 };
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
374
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
375 dlc.pixelformat = DSPF_UYVY;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
376 ret = videolayer->TestConfiguration( videolayer, &dlc, &failed );
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
377 if (ret==DFB_OK) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
378 videolayercaps.uyvy=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
379 if (verbose) printf("DirectFB: Videolayer supports UYVY format\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
380 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
381 videolayercaps.uyvy=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
382 if (verbose) printf("DirectFB: Videolayer doesn't support UYVY format\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
383 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
384
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
385 // test for color caps
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
386 {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
387 DFBDisplayLayerCapabilities caps;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
388 videolayer->GetCapabilities(videolayer,&caps);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
389 if (caps & DLCAPS_BRIGHTNESS) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
390 videolayercaps.brightness=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
391 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
392 videolayercaps.brightness=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
393 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
394
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
395 if (caps & DLCAPS_CONTRAST) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
396 videolayercaps.contrast=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
397 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
398 videolayercaps.contrast=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
399 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
400
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
401 if (caps & DLCAPS_HUE) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
402 videolayercaps.hue=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
403 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
404 videolayercaps.hue=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
405 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
406
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
407 if (caps & DLCAPS_SATURATION) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
408 videolayercaps.saturation=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
409 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
410 videolayercaps.saturation=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
411 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
412
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
413
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
414 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
415
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
416
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
417 // is there a working yuv ? if no we will not use videolayer
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
418 if ((videolayercaps.iv12==0)&&(videolayercaps.i420==0)&&(videolayercaps.yuy2==0)&&(videolayercaps.uyvy==0)) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
419 // videolayer doesn't work with yuv so release it
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
420 videolayerpresent=0;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
421 videolayer->SetOpacity(videolayer,0);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
422 videolayer->Release(videolayer);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
423 } else {
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
424 videolayerpresent=1;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
425 };
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
426 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
427
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
428 // just look at RGB things for main layer
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
429 modes[0].valid=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
430 modes[1].valid=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
431 modes[2].valid=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
432 modes[3].valid=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
433 DFBCHECK (dfb->EnumVideoModes(dfb,enum_modes_callback,NULL));
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
434
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
435 /*
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
436 * (Get keyboard)
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
437 */
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
438 DFBCHECK (dfb->GetInputDevice (dfb, DIDID_KEYBOARD, &keyboard));
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
439
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
440 /*
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
441 * Create an input buffer for the keyboard.
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
442 */
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
443 #ifdef HAVE_DIRECTFB099
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
444 DFBCHECK (keyboard->CreateEventBuffer (keyboard, &buffer));
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
445 #else
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
446 DFBCHECK (keyboard->CreateInputBuffer (keyboard, &buffer));
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
447 #endif
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
448 // just to start with clean ...
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
449 buffer->Reset(buffer);
4359
266ebffd8fc9 no longer required to call preinit from init and query_format, mplayer.c does this
alex
parents: 4354
diff changeset
450 return 0;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
451
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
452 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
453
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
454
4433
df8e0f71cc3c new info for tuning
nick
parents: 4359
diff changeset
455 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
456 uint32_t d_height, uint32_t fullscreen, char *title,
4433
df8e0f71cc3c new info for tuning
nick
parents: 4359
diff changeset
457 uint32_t format,const vo_tune_info_t *info)
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
458 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
459 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
460 * (Locals)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
461 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
462 DFBSurfaceDescription dsc;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
463 DFBResult ret;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
464
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
465
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
466 int vm = fullscreen & 0x02;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
467 int zoom = fullscreen & 0x04;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
468
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
469 if (verbose) printf("DirectFB: Config entered [%ix%i]\n",width,height);
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
470 if (verbose) printf("DirectFB: With requested format: %s\n",vo_format_name(format));
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
471
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
472 fs = fullscreen & 0x01;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
473 flip = fullscreen & 0x08;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
474
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
475 pixel_format=format;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
476
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
477 in_width = width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
478 in_height = height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
479
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
480 if (d_width) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
481 out_width = d_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
482 out_height = d_height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
483 } else {
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
484 d_width = out_width = in_width;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
485 d_height = out_height = in_height;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
486 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
487
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
488 // just look at RGB things for main layer - once again - now we now desired screen size
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
489 modes[0].valid=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
490 modes[1].valid=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
491 modes[2].valid=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
492 modes[3].valid=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
493 DFBCHECK (dfb->EnumVideoModes(dfb,enum_modes_callback,NULL));
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
494
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
495
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
496 if (vm) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
497 // need better algorithm just hack
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
498 if (modes[source_pixel_size-1].valid) dfb->SetVideoMode(dfb,modes[source_pixel_size-1].width,modes[source_pixel_size-1].height,source_pixel_size);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
499 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
500
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
501 // release primary if it is already allocated
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
502 if (primaryallocated) {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
503 if (verbose ) printf("DirectFB: Release primary\n");
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
504 primary->Release (primary);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
505 primaryallocated=0;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
506 };
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
507
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
508 videolayeractive=0; // will be enabled on succes later
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
509
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
510 if (videolayerpresent) {
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
511
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
512 // try to set proper w a h values matching image size
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
513 dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
514 dlc.width = in_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
515 dlc.height = in_height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
516
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
517 ret = videolayer->SetConfiguration( videolayer, &dlc );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
518
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
519 if (ret) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
520 if (verbose) printf("DirectFB: Set layer size failed\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
521 };
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
522
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
523 // try to set correct pixel format (closest to required)
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
524
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
525 dlc.flags = DLCONF_PIXELFORMAT;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
526 dlc.pixelformat = 0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
527 switch (pixel_format) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
528 case IMGFMT_YV12:
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
529 #ifdef HAVE_DIRECTFB099
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
530 if (videolayercaps.i420==1) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
531 dlc.pixelformat=DSPF_I420;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
532 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
533 } else if (videolayercaps.iv12==1) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
534 dlc.pixelformat=DSPF_YV12;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
535 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
536 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
537
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
538 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
539 case IMGFMT_YUY2: if (videolayercaps.yuy2==1) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
540 dlc.pixelformat=DSPF_YUY2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
541 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
542 // temporary disabled - do not have conv tool to uyvy
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
543 /* } else if (videolayercaps.uyvy==1) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
544 dlc.pixelformat=DSPF_UYVY;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
545 break;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
546 */
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
547 #ifdef HAVE_DIRECTFB099
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
548 } else if (videolayercaps.i420==1) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
549 dlc.pixelformat=DSPF_I420;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
550 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
551 } else if (videolayercaps.iv12==1) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
552 dlc.pixelformat=DSPF_YV12;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
553 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
554 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
555 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
556 // shouldn't happen - if it reaches here -> bug
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
557
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
558 case IMGFMT_RGB32: dlc.pixelformat = DSPF_ARGB; break;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
559 case IMGFMT_BGR32: dlc.pixelformat = DSPF_ARGB; break;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
560 case IMGFMT_RGB24: dlc.pixelformat = DSPF_RGB24; break;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
561 case IMGFMT_BGR24: dlc.pixelformat = DSPF_RGB24; break;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
562 case IMGFMT_RGB16: dlc.pixelformat = DSPF_RGB16; break;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
563 case IMGFMT_BGR16: dlc.pixelformat = DSPF_RGB16; break;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
564 case IMGFMT_RGB15: dlc.pixelformat = DSPF_RGB15; break;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
565 case IMGFMT_BGR15: dlc.pixelformat = DSPF_RGB15; break;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
566 default: dlc.pixelformat = DSPF_RGB24; break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
567 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
568
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
569 if (verbose) switch (dlc.pixelformat) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
570 case DSPF_ARGB: printf("DirectFB: layer format ARGB\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
571 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
572 case DSPF_RGB32: printf("DirectFB: layer format RGB32\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
573 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
574 case DSPF_RGB24: printf("DirectFB: layer format RGB24\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
575 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
576 case DSPF_RGB16: printf("DirectFB: layer format RGB16\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
577 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
578 case DSPF_RGB15: printf("DirectFB: layer format RGB15\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
579 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
580 case DSPF_YUY2: printf("DirectFB: layer format YUY2\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
581 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
582 case DSPF_UYVY: printf("DirectFB: layer format UYVY\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
583 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
584 #ifdef HAVE_DIRECTFB099
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
585 case DSPF_YV12: printf("DirectFB: layer format YV12\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
586 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
587 case DSPF_I420: printf("DirectFB: layer format I420\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
588 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
589 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
590 default: printf("DirectFB: - unknown format ->exit\n"); return 1;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
591 }
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
592
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
593 ret =videolayer->SetConfiguration( videolayer, &dlc );
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
594 if (!ret) {
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
595 if (verbose) printf("DirectFB: SetConfiguration for layer OK\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
596 ret = videolayer->GetSurface( videolayer, &primary );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
597 if (!ret){
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
598 videolayeractive=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
599 if (verbose) printf("DirectFB: Get surface for layer OK\n");
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
600 primaryallocated=1;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
601 } else {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
602 videolayeractive=0;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
603 if (videolayer) videolayer->SetOpacity(videolayer,0);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
604 };
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
605 } else {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
606 videolayeractive=0;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
607 if (videolayer) videolayer->SetOpacity(videolayer,0);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
608 };
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
609
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
610 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
611
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
612 // for flipping we will use BitBlt not integrated directfb flip
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
613 dsc.flags = DSDESC_CAPS | DSDESC_PIXELFORMAT;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
614 dsc.caps = DSCAPS_PRIMARY | DSCAPS_VIDEOONLY;//| DSCAPS_FLIPPING;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
615
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
616 switch (format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
617 case IMGFMT_RGB32: dsc.pixelformat = DSPF_ARGB; source_pixel_size= 4; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
618 case IMGFMT_BGR32: dsc.pixelformat = DSPF_ARGB; source_pixel_size= 4; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
619 case IMGFMT_RGB24: dsc.pixelformat = DSPF_RGB24; source_pixel_size= 3; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
620 case IMGFMT_BGR24: dsc.pixelformat = DSPF_RGB24; source_pixel_size= 3; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
621 case IMGFMT_RGB16: dsc.pixelformat = DSPF_RGB16; source_pixel_size= 2; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
622 case IMGFMT_BGR16: dsc.pixelformat = DSPF_RGB16; source_pixel_size= 2; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
623 case IMGFMT_RGB15: dsc.pixelformat = DSPF_RGB15; source_pixel_size= 2; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
624 case IMGFMT_BGR15: dsc.pixelformat = DSPF_RGB15; source_pixel_size= 2; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
625 default: dsc.pixelformat = DSPF_RGB24; source_pixel_size=2; break; //YUV formats
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
626 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
627
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
628 if (!videolayeractive) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
629 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary ));
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
630 if (verbose) printf("DirectFB: Get primary surface OK\n");
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
631 primaryallocated=1;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
632 }
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
633
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
634 DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
635
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
636 DFBCHECK (primary->GetPixelFormat (primary, &frame_format));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
637
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
638 // temporary frame buffer
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
639 dsc.flags = DSDESC_CAPS | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_WIDTH;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
640
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
641 dsc.width = in_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
642 dsc.height = in_height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
643
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
644 // at this time use pixel req format or format of main disp
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
645
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
646 switch (format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
647 case IMGFMT_RGB32: dsc.pixelformat = DSPF_ARGB; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
648 case IMGFMT_BGR32: dsc.pixelformat = DSPF_ARGB; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
649 case IMGFMT_RGB24: dsc.pixelformat = DSPF_RGB24; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
650 case IMGFMT_BGR24: dsc.pixelformat = DSPF_RGB24; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
651 case IMGFMT_RGB16: dsc.pixelformat = DSPF_RGB16; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
652 case IMGFMT_BGR16: dsc.pixelformat = DSPF_RGB16; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
653 case IMGFMT_RGB15: dsc.pixelformat = DSPF_RGB15; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
654 case IMGFMT_BGR15: dsc.pixelformat = DSPF_RGB15; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
655 default: dsc.pixelformat = frame_format; break; // uknown or YUV -> retain layer format eg. RGB or YUY2
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
656 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
657
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
658
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
659 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
660 * Create a surface based on the description of the source frame
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
661 */
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
662 #ifdef HAVE_DIRECTFB099
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
663 if (((dsc.pixelformat==DSPF_YV12)||(dsc.pixelformat==DSPF_I420)) && buggyYV12BitBlt) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
664 memcpyBitBlt = 1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
665 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
666 memcpyBitBlt = 0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
667 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
668 #else
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
669 memcpyBitBlt = 0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
670 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
671
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
672 // release frame if it is already allocated
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
673 if (frameallocated) {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
674 if (verbose ) printf("DirectFB: Release frame\n");
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
675 frame->Release (frame);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
676 frameallocated=0;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
677 };
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
678
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
679
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
680 // prevent from memcpy from videomemory to videomemory
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
681 /* if (memcpyBitBlt) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
682 dsc.caps = DSCAPS_SYSTEMONLY;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
683 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
684 dsc.caps = DSCAPS_VIDEOONLY;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
685 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
686 ret = dfb->CreateSurface( dfb, &dsc, &frame);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
687 if (ret) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
688 if (verbose) printf ("DirectFB: Trying do create buffer in system memory (2)\n");*/
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
689 dsc.caps = DSCAPS_SYSTEMONLY;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
690 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &frame));
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
691 frameallocated=1;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
692 // }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
693
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
694 DFBCHECK (frame->GetPixelFormat (frame, &frame_format));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
695
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
696 switch (frame_format) {
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
697 case DSPF_ARGB: if (verbose) printf("DirectFB: frame format ARGB\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
698 frame_pixel_size = 4;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
699 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
700 case DSPF_RGB32: if (verbose) printf("DirectFB: frame format RGB32\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
701 frame_pixel_size = 4;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
702 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
703 case DSPF_RGB24: if (verbose) printf("DirectFB: frame format RGB24\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
704 frame_pixel_size = 3;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
705 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
706 case DSPF_RGB16: if (verbose) printf("DirectFB: frame format RGB16\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
707 frame_pixel_size = 2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
708 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
709 case DSPF_RGB15: if (verbose) printf("DirectFB: frame format RGB15\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
710 frame_pixel_size = 2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
711 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
712 case DSPF_YUY2: if (verbose) printf("DirectFB: frame format YUY2\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
713 frame_pixel_size = 2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
714 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
715 case DSPF_UYVY: if (verbose) printf("DirectFB: frame format UYVY\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
716 frame_pixel_size = 2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
717 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
718 #ifdef HAVE_DIRECTFB099
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
719 case DSPF_YV12: if (verbose) printf("DirectFB: frame format YV12\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
720 frame_pixel_size = 1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
721 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
722 case DSPF_I420: if (verbose) printf("DirectFB: frame format I420\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
723 frame_pixel_size = 1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
724 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
725 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
726 default: printf("DirectFB: - unknown format ->exit\n"); return 1;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
727 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
728
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
729 if ((out_width < in_width || out_height < in_height) && (!fs)) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
730 printf("Screensize is smaller than video size !\n");
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
731 // return 1; // doesn't matter we will rescale
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
732 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
733
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
734
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
735
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
736 // yuv2rgb transform init
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
737
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
738 if (((format == IMGFMT_YV12) || (format == IMGFMT_YUY2)) && (!videolayeractive)){ yuv2rgb_init(frame_pixel_size * 8,MODE_RGB);};
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
739
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
740 // picture size and position
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
741
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
742 aspect_save_orig(in_width,in_height);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
743 aspect_save_prescale(d_width,d_height);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
744 if (videolayeractive) {// try to set pos for YUY2 layer and proper aspect ratio
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
745 aspect_save_screenres(10000,10000);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
746 aspect(&out_width,&out_height,A_ZOOM);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
747
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
748 ret = videolayer->SetScreenLocation(videolayer,(1-(float)out_width/10000)/2,(1-(float)out_height/10000)/2,((float)out_width/10000),((float)out_height/10000));
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
749
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
750 xoffset = 0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
751 yoffset = 0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
752 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
753 // aspect ratio correction for zoom to fullscreen
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
754 aspect_save_screenres(screen_width,screen_height);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
755
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
756 if(fs) /* -fs */
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
757 aspect(&out_width,&out_height,A_ZOOM);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
758 else
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
759 aspect(&out_width,&out_height,A_NOZOOM);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
760
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
761
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
762 xoffset = (screen_width - out_width) / 2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
763 yoffset = (screen_height - out_height) / 2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
764 }
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
765
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
766 if (((out_width != in_width) || (out_height != in_height)) && (!videolayeractive)) {stretch = 1;} else stretch=0; //yuy doesn't like strech and should not be needed
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
767
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
768 if ((verbose)&&(memcpyBitBlt)) printf("DirectFB: Using memcpyBitBlt\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
769 #ifdef DIRECTRENDER
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
770 //direct rendering is enabled in case of sane buffer and im format
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
771 if ((format==IMGFMT_RGB32)&&(frame_format ==DSPF_ARGB) ||
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
772 (format==IMGFMT_BGR32)&&(frame_format ==DSPF_ARGB) ||
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
773 (format==IMGFMT_RGB24)&&(frame_format ==DSPF_RGB24) ||
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
774 (format==IMGFMT_BGR24)&&(frame_format ==DSPF_RGB24) ||
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
775 (format==IMGFMT_RGB16)&&(frame_format ==DSPF_RGB16) ||
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
776 (format==IMGFMT_BGR16)&&(frame_format ==DSPF_RGB16) ||
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
777 (format==IMGFMT_RGB15)&&(frame_format ==DSPF_RGB15) ||
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
778 (format==IMGFMT_BGR15)&&(frame_format ==DSPF_RGB15) ||
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
779 #ifdef HAVE_DIRECTFB099
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
780 (format==IMGFMT_YUY2)&&(frame_format ==DSPF_YUY2) ||
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
781 (format==IMGFMT_YV12)&&(frame_format ==DSPF_I420) ||
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
782 (format==IMGFMT_YV12)&&(frame_format ==DSPF_YV12)){
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
783 #else
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
784 (format==IMGFMT_YUY2)&&(frame_format ==DSPF_YUY2)){
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
785 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
786 dr_enabled=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
787 if (verbose) printf("DirectFB: Direct rendering supported\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
788 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
789 dr_enabled=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
790 if (verbose) printf("DirectFB: Direct rendering not supported\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
791 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
792 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
793
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
794
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
795 if (verbose) printf("DirectFB: Config finished [%ix%i]\n",out_width,out_height);
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
796
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
797 return 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
798 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
799
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
800 static uint32_t query_format(uint32_t format)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
801 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
802 int ret = 0x4; /* osd/sub is supported on every bpp */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
803
4359
266ebffd8fc9 no longer required to call preinit from init and query_format, mplayer.c does this
alex
parents: 4354
diff changeset
804 // preinit(NULL);
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
805
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
806 if (verbose ) printf("DirectFB: Format query: %s\n",vo_format_name(format));
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
807 switch (format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
808
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
809 // RGB mode works only if color depth is same as on screen and this driver doesn't know before init
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
810 // so we couldn't report supported formats well
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
811
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
812 // Just support those detected by preinit
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
813 case IMGFMT_RGB32:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
814 case IMGFMT_BGR32: if (modes[3].valid) return ret|0x2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
815 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
816 case IMGFMT_RGB24:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
817 case IMGFMT_BGR24: if (modes[2].valid) return ret|0x2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
818 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
819 case IMGFMT_RGB16:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
820 case IMGFMT_BGR16:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
821 case IMGFMT_RGB15:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
822 case IMGFMT_BGR15: if (modes[1].valid) return ret|0x2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
823 break;
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
824 case IMGFMT_YUY2: if (videolayerpresent) {
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
825 if (videolayercaps.yuy2) {
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
826 return ret|0x2|0x1;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
827 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
828 return ret|0x1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
829 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
830 };
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
831 break;
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
832 case IMGFMT_YV12: if ((videolayerpresent) &&
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
833 (videolayercaps.i420 || videolayercaps.iv12))
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
834 return ret|0x2|0x1; else return ret|0x1;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
835 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
836 // YV12 should work in all cases
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
837 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
838
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
839 return 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
840 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
841
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
842 static const vo_info_t *get_info(void)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
843 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
844 return &vo_info;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
845 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
846
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
847 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src,
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
848 unsigned char *srca, int stride)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
849 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
850 void *dst;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
851 int pitch;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
852 int len;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
853
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
854 #ifdef DIRECTRENDER
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
855 if(framelocked) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
856 frame->Unlock(frame);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
857 framelocked=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
858 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
859 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
860 DFBCHECK (frame->Lock(frame,DSLF_WRITE,&dst,&pitch));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
861
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
862 switch(frame_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
863 case DSPF_RGB32:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
864 case DSPF_ARGB:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
865 vo_draw_alpha_rgb32(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + frame_pixel_size*x0,pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
866 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
867
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
868 case DSPF_RGB24:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
869 vo_draw_alpha_rgb24(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + frame_pixel_size*x0,pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
870 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
871
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
872 case DSPF_RGB16:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
873 vo_draw_alpha_rgb16(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + frame_pixel_size*x0,pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
874 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
875
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
876 case DSPF_RGB15:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
877 vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + frame_pixel_size*x0,pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
878 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
879
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
880 case DSPF_YUY2:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
881 vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + frame_pixel_size*x0,pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
882 break;
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
883
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
884 case DSPF_UYVY:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
885 vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + frame_pixel_size*x0 + 1,pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
886 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
887
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
888 #ifdef HAVE_DIRECTFB099
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
889 case DSPF_I420:
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
890 case DSPF_YV12:
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
891 vo_draw_alpha_yv12(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + frame_pixel_size*x0,pitch);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
892 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
893 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
894 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
895 DFBCHECK (frame->Unlock(frame));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
896 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
897
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
898 static uint32_t draw_frame(uint8_t *src[])
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
899 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
900 void *dst;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
901 int pitch;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
902 int len;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
903
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
904 // printf("Drawframe\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
905 #ifdef DIRECTRENDER
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
906 if(framelocked) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
907 frame->Unlock(frame);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
908 framelocked=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
909 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
910 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
911
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
912 DFBCHECK (frame->Lock(frame,DSLF_WRITE,&dst,&pitch));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
913
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
914 switch (frame_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
915 case DSPF_ARGB:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
916 case DSPF_RGB32:
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
917 case DSPF_RGB24:
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
918 case DSPF_RGB16:
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
919 case DSPF_RGB15: switch (pixel_format) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
920 case IMGFMT_YV12:
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
921 yuv2rgb(dst,src[0],src[1],src[2],in_width,in_height,pitch,in_width,in_width/2);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
922 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
923 /* how to handle this? need conversion from YUY2 to RGB*/
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
924 /* case IMGFMT_YUY2:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
925 yuv2rgb(dst,src[0],src[0]+1,src[0]+3,1,in_height*in_width/2,frame_pixel_size*2,4,4); //odd pixels
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
926 yuv2rgb(dst+1,src[0]+2,src[0]+1,src[0]+3,1,in_height*in_width/2,frame_pixel_size*2,4,4); //even pixels
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
927 break;*/
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
928 // RGB - just copy
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
929 default: if (source_pixel_size==frame_pixel_size) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
930 if (pitch==(in_width*frame_pixel_size)) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
931 memcpy(dst,src[0],in_width * in_height * source_pixel_size);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
932 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
933 int i;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
934 int sp=in_width*source_pixel_size;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
935 int ll=min(sp,pitch);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
936 for (i=0;i<in_height;i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
937 memcpy(dst+i*pitch,src[0]+i*sp,ll);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
938 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
939 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
940 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
941 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
942 break;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
943 case DSPF_YUY2:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
944 switch (pixel_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
945 case IMGFMT_YV12: yv12toyuy2(src[0],src[1],src[2],dst,in_width,in_height,in_width,in_width >>1,pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
946 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
947 case IMGFMT_YUY2: if (pitch==(in_width*2)) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
948 memcpy(dst,src[0],in_width * in_height * source_pixel_size);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
949 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
950 int i;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
951 for (i=0;i<in_height;i++) {
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
952 memcpy(dst+i*pitch,src[0]+i*in_width*2,in_width*2);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
953 }
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
954 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
955 break;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
956 // hopefully there will be no RGB in this case otherwise convert - not implemented
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
957 };
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
958 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
959
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
960 #ifdef HAVE_DIRECTFB099
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
961 case DSPF_YV12:
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
962 switch (pixel_format) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
963 case IMGFMT_YV12: {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
964 int i;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
965 int p=min(in_width,pitch);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
966 for (i=0;i<in_height;i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
967 memcpy(dst+i*pitch,src[0]+i*in_width,p);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
968 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
969 dst += pitch*in_height;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
970 p = p/2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
971 for (i=0;i<in_height/2;i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
972 memcpy(dst+i*pitch/2,src[2]+i*in_width/2,p);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
973 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
974 dst += pitch*in_height/4;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
975 for (i=0;i<in_height/2;i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
976 memcpy(dst+i*pitch/2,src[1]+i*in_width/2,p);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
977 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
978 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
979 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
980 case IMGFMT_YUY2: yuy2toyv12(src[0],dst,dst+pitch*in_height+pitch*in_height/4,dst+pitch*in_height,in_width,in_height,pitch,pitch/2,pitch/2);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
981 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
982 // hopefully there will be no RGB in this case otherwise convert - not implemented
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
983 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
984 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
985 case DSPF_I420:
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
986 switch (pixel_format) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
987 case IMGFMT_YV12: {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
988 int i;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
989 int p=min(in_width,pitch);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
990 for (i=0;i<in_height;i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
991 memcpy(dst+i*pitch,src[0]+i*in_width,p);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
992 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
993 dst += pitch*in_height;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
994 p = p/2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
995 for (i=0;i<in_height/2;i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
996 memcpy(dst+i*pitch/2,src[1]+i*in_width/2,p);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
997 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
998 dst += pitch*in_height/4;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
999 for (i=0;i<in_height/2;i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1000 memcpy(dst+i*pitch/2,src[2]+i*in_width/2,p);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1001 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1002 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1003 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1004 case IMGFMT_YUY2: yuy2toyv12(src[0],dst,dst+pitch*in_height,dst+pitch*in_height+pitch*in_height/4,in_width,in_height,pitch,pitch/2,pitch/2);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1005 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1006 // hopefully there will be no RGB in this case otherwise convert - not implemented
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1007 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1008 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1009 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1010 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1011 DFBCHECK (frame->Unlock(frame));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1012 return 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1013 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1014
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1015 static uint32_t draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1016 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1017
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1018 int err;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1019 void *dst;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1020 uint8_t *s;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1021 int pitch;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1022 int i;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1023
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1024 #ifdef DIRECTRENDER
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1025 if(framelocked) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1026 frame->Unlock(frame);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1027 framelocked=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1028 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1029 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1030
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1031 err = frame->Lock(frame,DSLF_WRITE,&dst,&pitch);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1032 // err = primary->Lock(primary,DSLF_WRITE,&dst,&pitch); // for direct rendering
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1033
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1034 // printf("Drawslice w=%i h=%i x=%i y=%i pitch=%i\n",w,h,x,y,pitch);
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1035
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1036 if (err) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1037 printf("DirectFB: Frame lock failed!");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1038 return 1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1039 };
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1040 switch (frame_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1041 case DSPF_ARGB:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1042 case DSPF_RGB32:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1043 case DSPF_RGB24:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1044 case DSPF_RGB16:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1045 case DSPF_RGB15:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1046 switch (pixel_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1047 case IMGFMT_YV12:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1048 yuv2rgb(dst+ y * pitch + frame_pixel_size*x ,src[0],src[1],src[2],w,h,pitch,stride[0],stride[1]);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1049 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1050 default: if (source_pixel_size==frame_pixel_size) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1051 dst += x * frame_pixel_size;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1052 s = src[0];
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1053 for (i=y;i<(y+h);i++) {
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1054 memcpy(dst,s,w);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1055 dst += (pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1056 s += stride[0];
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1057 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1058 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1059 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1060
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1061 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1062 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1063 case DSPF_YUY2:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1064 switch (pixel_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1065 case IMGFMT_YV12: yv12toyuy2(src[0],src[1],src[2],dst + pitch*y + frame_pixel_size*x ,w,h,stride[0],stride[1],pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1066 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1067 // hopefully there will be no RGB in this case otherwise convert - not implemented
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1068 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1069 break;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1070
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1071 #ifdef HAVE_DIRECTFB099
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1072 case DSPF_YV12:
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1073 switch (pixel_format) {
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1074 case IMGFMT_YV12: {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1075 void *d,*s;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1076 int i;
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1077 d = dst + pitch*y + x;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1078 s = src[0];
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1079 for (i=0;i<h;i++) {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1080 memcpy(d,s,w);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1081 d+=pitch;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1082 s+=stride[0];
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1083 }
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1084 d = dst + pitch*in_height + pitch*y/4 + x/2;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1085 s = src[2];
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1086 for (i=0;i<h/2;i++) {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1087 memcpy(d,s,w/2);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1088 d+=pitch/2;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1089 s+=stride[2];
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1090 }
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1091 d = dst + pitch*in_height + pitch*in_height/4 + pitch*y/4 + x/2;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1092 s = src[1];
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1093 for (i=0;i<h/2;i++) {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1094 memcpy(d,s,w/2);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1095 d+=pitch/2;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1096 s+=stride[1];
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1097 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1098 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1099 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1100 /* case IMGFMT_YUY2: {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1101 int i;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1102 for (i=y;i<(y+h);i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1103 yuy2toyv12(src[0]+i*stride[0],dst+i*pitch+x*frame_pixel_size,dst+pitch*(in_height+i/2)+x*frame_pixel_size/2,dst+pitch*(in_height+in_height/4+i/2)+x*frame_pixel_size/2,w,h,pitch,pitch/2,pitch/2);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1104 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1105 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1106
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1107 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1108 */ // hopefully there will be no RGB in this case otherwise convert - not implemented
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1109 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1110 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1111
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1112 case DSPF_I420:
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1113 switch (pixel_format) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1114 case IMGFMT_YV12: {
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1115 void *d,*s;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1116 int i;
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1117 d = dst + pitch*y + x;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1118 s = src[0];
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1119 for (i=0;i<h;i++) {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1120 memcpy(d,s,w);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1121 d+=pitch;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1122 s+=stride[0];
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1123 }
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1124 d = dst + pitch*in_height + pitch*y/4 + x/2;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1125 s = src[1];
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1126 for (i=0;i<h/2;i++) {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1127 memcpy(d,s,w/2);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1128 d+=pitch/2;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1129 s+=stride[1];
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1130 }
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1131 d = dst + pitch*in_height + pitch*in_height/4 + pitch*y/4 + x/2;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1132 s = src[2];
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1133 for (i=0;i<h/2;i++) {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1134 memcpy(d,s,w/2);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1135 d+=pitch/2;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1136 s+=stride[2];
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1137 }
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1138 };
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1139 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1140 /* case IMGFMT_YUY2: {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1141 int i;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1142 for (i=y;i<(y+h);i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1143 yuy2toyv12(src[0]+i*stride[0],dst+i*pitch+x*frame_pixel_size,dst+pitch*(in_height+in_height/4+i/2)+x*frame_pixel_size/2,dst+pitch*(in_height+i/2)+x*frame_pixel_size/2,w,h,pitch,pitch/2,pitch/2);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1144 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1145 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1146
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1147 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1148 */ // hopefully there will be no RGB in this case otherwise convert - not implemented
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1149 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1150 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1151 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1152 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1153
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1154 frame->Unlock(frame);
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1155 // primary->Unlock(primary);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1156
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1157 return 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1158 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1159
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1160 extern void mplayer_put_key(int code);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1161
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1162 #include "../linux/keycodes.h"
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1163
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1164 static void check_events(void)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1165 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1166
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1167 DFBInputEvent event;
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1168 //if (verbose) printf ("DirectFB: Check events entered\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1169 if (buffer->GetEvent(buffer, &event) == DFB_OK) {
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
1170 if (event.type == DIET_KEYPRESS) {
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
1171 switch (event.keycode) {
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1172 case DIKC_ESCAPE:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1173 mplayer_put_key('q');
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1174 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1175 case DIKC_KP_PLUS: mplayer_put_key('+');break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1176 case DIKC_KP_MINUS: mplayer_put_key('-');break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1177 case DIKC_TAB: mplayer_put_key('\t');break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1178 case DIKC_PAGEUP: mplayer_put_key(KEY_PAGE_UP);break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1179 case DIKC_PAGEDOWN: mplayer_put_key(KEY_PAGE_DOWN);break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1180 case DIKC_UP: mplayer_put_key(KEY_UP);break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1181 case DIKC_DOWN: mplayer_put_key(KEY_DOWN);break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1182 case DIKC_LEFT: mplayer_put_key(KEY_LEFT);break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1183 case DIKC_RIGHT: mplayer_put_key(KEY_RIGHT);break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1184 case DIKC_ASTERISK:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1185 case DIKC_KP_MULT:mplayer_put_key('*');break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1186 case DIKC_KP_DIV: mplayer_put_key('/');break;
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
1187 case DIKC_INSERT: mplayer_put_key(KEY_INSERT);break;
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
1188 case DIKC_DELETE: mplayer_put_key(KEY_DELETE);break;
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
1189 case DIKC_HOME: mplayer_put_key(KEY_HOME);break;
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
1190 case DIKC_END: mplayer_put_key(KEY_END);break;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1191
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1192 default:mplayer_put_key(event.key_ascii);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1193 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1194 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1195 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1196 // empty buffer, because of repeating (keyboard repeat is faster than key handling
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1197 // and this causes problems during seek)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1198 // temporary workabout should be solved in the future
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1199
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1200 buffer->Reset(buffer);
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1201 //if (verbose) printf ("DirectFB: Check events finished\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1202
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1203 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1204
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1205 static void draw_osd(void)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1206 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1207 vo_draw_text(in_width, in_height, draw_alpha);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1208 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1209
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1210 static void flip_page(void)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1211 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1212 DFBSurfaceBlittingFlags flags=DSBLIT_NOFX;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1213
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1214 // if (verbose) printf("DirectFB: Flip page entered");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1215
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1216 DFBCHECK (primary->SetBlittingFlags(primary,flags));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1217
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1218 #ifdef DIRECTRENDER
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1219 if(framelocked) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1220 frame->Unlock(frame);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1221 framelocked=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1222 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1223 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1224 if (stretch) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1225 DFBRectangle rect;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1226 rect.x=xoffset;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1227 rect.y=yoffset;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1228 rect.w=out_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1229 rect.h=out_height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1230
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1231 DFBCHECK (primary->StretchBlit(primary,frame,NULL,&rect));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1232 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1233 else {
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1234 #ifdef HAVE_DIRECTFB099
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1235 if (!memcpyBitBlt) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1236 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1237 DFBCHECK (primary->Blit(primary,frame,NULL,xoffset,yoffset));
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1238 #ifdef HAVE_DIRECTFB099
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1239 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1240
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1241 int err,err2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1242 void *dst,*src;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1243 int pitch,pitch2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1244
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1245 // printf("MemcpyBlit");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1246
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1247 err = frame->Lock(frame,DSLF_READ,&src,&pitch);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1248 err2 = primary->Lock(primary,DSLF_WRITE,&dst,&pitch2);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1249
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1250 // printf("DirectFB: pitch=%i pitch2=%i\n",pitch,pitch2);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1251
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1252
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1253 if (pitch==pitch2) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1254 memcpy(dst,src,in_height * pitch * 1.5);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1255 } else
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1256 {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1257 int i;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1258 int p=min(pitch,pitch2);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1259 for (i=0;i<in_height;i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1260 memcpy (dst+i*pitch2,src+i*pitch,p);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1261 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1262 dst+= in_height * pitch2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1263 src+= in_height * pitch;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1264 p=p/2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1265 for (i=0;i<in_height/2;i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1266 memcpy (dst+i*pitch2/2,src+i*pitch/2,p);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1267 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1268 dst+= in_height * pitch2/4;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1269 src+= in_height * pitch/4;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1270 for (i=0;i<in_height/2;i++) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1271 memcpy (dst+i*pitch2/2,src+i*pitch/2,p);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1272 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1273 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1274 frame->Unlock(frame);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1275 primary->Unlock(primary);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1276 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1277 #endif
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1278 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1279 // DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAITFORSYNC));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1280 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1281
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1282 static void uninit(void)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1283 {
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1284 if (verbose ) printf("DirectFB: uninit entered\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1285 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1286 * (Release)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1287 */
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1288 if (verbose ) printf("DirectFB: Release buffer\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1289 buffer->Release (buffer);
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1290 if (verbose ) printf("DirectFB: Release keyboard\n");
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1291 keyboard->Release (keyboard);
5258
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1292 if (frameallocated) {
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1293 if (verbose ) printf("DirectFB: Release frame\n");
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1294 frame->Release (frame);
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1295 frameallocated=0;
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1296 };
c9ccddcbdd81 ixes bug in draw_slice and also fixes compilance to
atmos4
parents: 5189
diff changeset
1297
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1298 // we will not release dfb and layer because there could be a new film
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1299
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1300 if (verbose ) printf("DirectFB: Release primary\n");
3588
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
1301 primary->Release (primary);
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
1302 // switch off BES
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
1303 if (videolayer) videolayer->SetOpacity(videolayer,0);
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1304
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1305 #ifdef HAVE_DIRECTFB099
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1306 if (verbose&&videolayer ) printf("DirectFB: Release videolayer\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1307 if (videolayer) videolayer->Release(videolayer);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1308
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1309 if (verbose ) printf("DirectFB: Release DirectFB library\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1310 dfb->Release (dfb);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1311 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1312
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1313 if (verbose ) printf("DirectFB: Uninit done.\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1314 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1315
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1316 static int directfb_set_video_eq( const vidix_video_eq_t *info)
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1317 {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1318 if (videolayeractive) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1319 DFBColorAdjustment ca;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1320 float factor = (float)0xffff / 2000.0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1321
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1322 ca.flags=DCAF_NONE;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1323
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1324 if ((videolayercaps.brightness)&&(info->cap&VEQ_CAP_BRIGHTNESS)) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1325 ca.brightness = info->brightness * factor +0x8000;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1326 ca.flags |= DCAF_BRIGHTNESS;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1327 if (verbose) printf("DirectFB: SetVEq Brightness 0x%X %i\n",ca.brightness,info->brightness);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1328 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1329
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1330 if ((videolayercaps.contrast)&&(info->cap&VEQ_CAP_CONTRAST)) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1331 ca.contrast = info->contrast * factor + 0x8000;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1332 ca.flags |= DCAF_CONTRAST;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1333 if (verbose) printf("DirectFB: SetVEq Contrast 0x%X %i\n",ca.contrast,info->contrast);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1334 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1335
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1336 if ((videolayercaps.hue)&&(info->cap&VEQ_CAP_HUE)) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1337 ca.hue = info->hue * factor + 0x8000;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1338 ca.flags |= DCAF_HUE;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1339 if (verbose) printf("DirectFB: SetVEq Hue 0x%X %i\n",ca.hue,info->hue);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1340 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1341
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1342 if ((videolayercaps.saturation)&&(info->cap&VEQ_CAP_HUE)) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1343 ca.saturation = info->saturation * factor + 0x8000;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1344 ca.flags |= DCAF_SATURATION;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1345 if (verbose) printf("DirectFB: SetVEq Saturation 0x%X %i\n",ca.saturation,info->saturation);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1346 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1347
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1348 videolayer->SetColorAdjustment(videolayer,&ca);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1349 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1350 return 0;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1351
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1352 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1353
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1354 static int directfb_get_video_eq( vidix_video_eq_t *info)
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1355 {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1356 if (videolayeractive) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1357 DFBColorAdjustment ca;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1358 float factor = 2000.0 / (float)0xffff;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1359 videolayer->GetColorAdjustment(videolayer,&ca);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1360
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1361 if ((videolayercaps.brightness)&&(ca.flags&DCAF_BRIGHTNESS)) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1362 info->brightness = (ca.brightness-0x8000) * factor;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1363 info->cap |= VEQ_CAP_BRIGHTNESS;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1364 if (verbose) printf("DirectFB: GetVEq Brightness 0x%X %i\n",ca.brightness,info->brightness);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1365 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1366
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1367 if ((videolayercaps.contrast)&&(ca.flags&DCAF_CONTRAST)) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1368 info->contrast = (ca.contrast-0x8000) * factor;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1369 info->cap |= VEQ_CAP_CONTRAST;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1370 if (verbose) printf("DirectFB: GetVEq Contrast 0x%X %i\n",ca.contrast,info->contrast);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1371 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1372
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1373 if ((videolayercaps.hue)&&(ca.flags&DCAF_HUE)) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1374 info->hue = (ca.hue-0x8000) * factor;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1375 info->cap |= VEQ_CAP_HUE;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1376 if (verbose) printf("DirectFB: GetVEq Hue 0x%X %i\n",ca.hue,info->hue);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1377 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1378
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1379 if ((videolayercaps.saturation)&&(ca.flags&DCAF_SATURATION)) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1380 info->saturation = (ca.saturation-0x8000) * factor;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1381 info->cap |= VEQ_CAP_SATURATION;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1382 if (verbose) printf("DirectFB: GetVEq Saturation 0x%X %i\n",ca.saturation,info->saturation);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1383 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1384
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1385 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1386 return 0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1387 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1388 static void query_vaa(vo_vaa_t *vaa)
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1389 {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1390 memset(vaa,0,sizeof(vo_vaa_t));
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1391 vaa->get_video_eq = directfb_get_video_eq;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1392 vaa->set_video_eq = directfb_set_video_eq;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1393 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1394
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1395 #ifdef DIRECTRENDER
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1396 static uint32_t get_image(mp_image_t *mpi){
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1397 int err;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1398 void *dst;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1399 int pitch;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1400
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1401 // printf("DirectFB: get_image() called\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1402
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1403 // now we are always in system memory (in this version - mybe will change in future)
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1404 // if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1405
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1406 // printf("width=%d vs. pitch=%d, flags=0x%X \n",mpi->width,pitch,mpi->flags);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1407 if((mpi->width==pitch/frame_pixel_size) ||
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1408 (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH))){
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1409 // we're lucky or codec accepts stride => ok, let's go!
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1410 if(mpi->flags&MP_IMGFLAG_PLANAR){
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1411
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1412 #ifdef HAVE_DIRECTFB099
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1413 err = frame->Lock(frame,DSLF_WRITE/*|DSLF_READ*/,&dst,&pitch);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1414 // err = primary->Lock(primary,DSLF_WRITE,&dst,&pitch); // for real direct rendering
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1415
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1416 if (err) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1417 printf("DirectFB: Frame lock failed!");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1418 return VO_FALSE;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1419 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1420 framelocked=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1421
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1422 //YV12 format
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1423 mpi->planes[0]=dst;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1424 switch(frame_format) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1425 case DSPF_I420: mpi->planes[1]=dst + pitch*in_height;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1426 mpi->planes[2]=mpi->planes[1] + pitch*in_height/4;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1427 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1428 case DSPF_YV12: mpi->planes[2]=dst + pitch*in_height;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1429 mpi->planes[1]=mpi->planes[1] + pitch*in_height/4;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1430 break;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1431
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1432 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1433 mpi->width=mpi->stride[0]=pitch;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1434 mpi->stride[1]=mpi->stride[2]=pitch/2;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1435 #else
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1436 return VO_FALSE;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1437 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1438 } else {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1439 err = frame->Lock(frame,DSLF_WRITE/*|DSLF_READ*/,&dst,&pitch);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1440 // err = primary->Lock(primary,DSLF_WRITE,&dst,&pitch); // for real direct rendering
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1441
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1442 if (err) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1443 printf("DirectFB: Frame lock failed!");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1444 return VO_FALSE;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1445 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1446 framelocked=1;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1447 //YUY2 and RGB formats
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1448 mpi->planes[0]=dst;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1449 mpi->width=pitch/frame_pixel_size;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1450 mpi->stride[0]=pitch;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1451 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1452 mpi->flags|=MP_IMGFLAG_DIRECT;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1453 // printf("DirectFB: get_image() SUCCESS -> Direct Rendering ENABLED\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1454 return VO_TRUE;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1455 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1456
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1457 if(framelocked) {
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1458 frame->Unlock(frame);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1459 framelocked=0;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1460 };
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1461 return VO_FALSE;
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1462 }
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1463 #endif
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1464
4596
c35d7ce151b3 10000hl to Holm... control MUST BE static...
arpi
parents: 4592
diff changeset
1465 static uint32_t control(uint32_t request, void *data, ...)
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3651
diff changeset
1466 {
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
1467 switch (request) {
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1468 case VOCTRL_QUERY_VAA:
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1469 query_vaa((vo_vaa_t*)data);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1470 return VO_TRUE;
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
1471 case VOCTRL_QUERY_FORMAT:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
1472 return query_format(*((uint32_t*)data));
5189
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1473 #ifdef DIRECTRENDER
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1474 case VOCTRL_GET_IMAGE:
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1475 // printf("DirectFB: control(VOCTRL_GET_IMAGE) called\n");
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1476 if (dr_enabled) return get_image(data);
c663455448e8 updates by Jiri.Svoboda@seznam.cz
arpi
parents: 5026
diff changeset
1477 #endif
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
1478 }
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
1479 return VO_NOTIMPL;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3651
diff changeset
1480 }