Mercurial > mplayer.hg
annotate libvo/vo_directfb.c @ 6447:751a5775ac35
direct rendering (hopefully at least, TFM for the video filters is a bit nonexistent or iam just too stupid) ;)
uninit
author | michael |
---|---|
date | Sun, 16 Jun 2002 13:45:52 +0000 |
parents | ae3cfbfc8e3f |
children | 9d34c286f0ba |
rev | line source |
---|---|
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1 /* |
3341 | 2 MPlayer video driver for DirectFramebuffer device |
3 | |
4 (C) 2001 | |
5 | |
6 Written by Jiri Svoboda <Jiri.Svoboda@seznam.cz> | |
7 | |
8 Inspired by vo_sdl and vo_fbdev. | |
9 | |
10 To get second head working delete line 120 | |
11 from fbdev.c (from DirectFB sources version 0.9.7) | |
12 Line contains following: | |
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 | 15 Parts of this code taken from DirectFB examples: |
16 (c) Copyright 2000 convergence integrated media GmbH. | |
17 All rights reserved. | |
18 | |
19 This library is free software; you can redistribute it and/or | |
20 modify it under the terms of the GNU Lesser General Public | |
21 License as published by the Free Software Foundation; either | |
22 version 2 of the License, or (at your option) any later version. | |
23 | |
24 This library is distributed in the hope that it will be useful, | |
25 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
27 Lesser General Public License for more details. | |
28 | |
29 You should have received a copy of the GNU Lesser General Public | |
30 License along with this library; if not, write to the | |
31 Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
32 Boston, MA 02111-1307, USA. | |
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 | 61 |
5189 | 62 #include "aspect.h" |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
63 |
5611 | 64 #ifndef min |
65 #define min(x,y) (((x)<(y))?(x):(y)) | |
66 #endif | |
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 | 91 static unsigned int screen_width = 0; |
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 | 139 static uint32_t in_width; |
140 static uint32_t in_height; | |
141 static uint32_t out_width=1; | |
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 | 154 // videolayer stuff |
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 | 157 //some info about videolayer - filled on preinit |
158 struct vlayer_t { | |
159 int iv12; | |
160 int i420; | |
161 int yuy2; | |
162 int uyvy; | |
163 int brightness; | |
164 int saturation; | |
165 int contrast; | |
166 int hue; | |
167 } videolayercaps; | |
168 // workabout for DirectFB bug | |
169 static int buggyYV12BitBlt=0; | |
170 static int memcpyBitBlt=0; | |
171 #define DIRECTRENDER | |
172 #ifdef DIRECTRENDER | |
173 static int dr_enabled=0; | |
174 static int framelocked=0; | |
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 { |
6262
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
182 int overx=0,overy=0,closer=0,over=0; |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
183 unsigned int index=bpp/8-1; |
6262
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
184 int we_are_under=0; |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
185 |
5189 | 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 } |
6262
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
197 if ((modes[index].overy<0)||(modes[index].overx<0)) we_are_under=1; // stored mode is smaller than req mode |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
198 if (abs(overx*overy)<abs(modes[index].overx * modes[index].overy)) closer=1; // current mode is closer to desired res |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
199 if ((overx>=0)&&(overy>=0)) over=1; // current mode is bigger or equaul to desired res |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
200 if ((closer && (over || we_are_under)) || (we_are_under && over)) { |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
201 modes[index].valid=1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
202 modes[index].width=width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
203 modes[index].height=height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
204 modes[index].overx=overx; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
205 modes[index].overy=overy; |
5189 | 206 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
|
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 | 218 if (verbose) { |
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 | 227 #ifdef HAVE_DIRECTFB0910 |
228 if (caps & DLCAPS_SRC_COLORKEY) | |
229 printf( " - Supports source based color keying.\n" ); | |
230 | |
231 if (caps & DLCAPS_DST_COLORKEY) | |
232 printf( " - Supports destination based color keying.\n" ); | |
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 | 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 | 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 | 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 | 287 |
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 |
6262
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
300 // disable YV12 for dfb until 0.9.11 - there is a bug in dfb! should be revised with every dfb version until bug is fixed in dfb. |
5189 | 301 if ((directfb_major_version <= 0) && |
302 (directfb_minor_version <= 9) && | |
6262
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
303 (directfb_micro_version <= 11)) { |
5189 | 304 buggyYV12BitBlt=1; |
305 if (verbose) printf("DirectFB: Buggy YV12BitBlt!\n"); | |
306 } | |
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 | 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 | 312 DFBCHECK (DirectFBSetOption ("vt-switching","")); |
313 #ifdef HAVE_DIRECTFB099 | |
314 // uncomment this if you want to hide gfx cursor (req dfb >=0.9.9) | |
315 DFBCHECK (DirectFBSetOption ("no-cursor","")); | |
316 #endif | |
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 | 329 if (verbose) printf("DirectFB: No videolayer found\n"); |
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 | 332 videolayeractive=0; |
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 | 336 // there is an additional layer so test it for YUV formats |
337 // some videolayers support RGB formats - not used now | |
338 if (verbose) printf("DirectFB: Testing videolayer caps\n"); | |
339 | |
340 dlc.flags = DLCONF_PIXELFORMAT; | |
341 #ifdef HAVE_DIRECTFB099 | |
342 dlc.pixelformat = DSPF_YV12; | |
343 ret = videolayer->TestConfiguration( videolayer, &dlc, &failed ); | |
344 if (ret==DFB_OK) { | |
345 videolayercaps.iv12=1; | |
346 if (verbose) printf("DirectFB: Videolayer supports YV12 format\n"); | |
347 } else { | |
348 videolayercaps.iv12=0; | |
349 if (verbose) printf("DirectFB: Videolayer doesn't support YV12 format\n"); | |
350 }; | |
351 | |
352 dlc.pixelformat = DSPF_I420; | |
353 ret = videolayer->TestConfiguration( videolayer, &dlc, &failed ); | |
354 if (ret==DFB_OK) { | |
355 videolayercaps.i420=1; | |
356 if (verbose) printf("DirectFB: Videolayer supports I420 format\n"); | |
357 } else { | |
358 videolayercaps.i420=0; | |
359 if (verbose) printf("DirectFB: Videolayer doesn't support I420 format\n"); | |
360 }; | |
361 #else | |
362 videolayercaps.yuy2=0; | |
363 #endif | |
364 | |
365 dlc.pixelformat = DSPF_YUY2; | |
366 ret = videolayer->TestConfiguration( videolayer, &dlc, &failed ); | |
367 if (ret==DFB_OK) { | |
368 videolayercaps.yuy2=1; | |
369 if (verbose) printf("DirectFB: Videolayer supports YUY2 format\n"); | |
370 } else { | |
371 videolayercaps.yuy2=0; | |
372 if (verbose) printf("DirectFB: Videolayer doesn't support YUY2 format\n"); | |
373 }; | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
374 |
5189 | 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 | 377 if (ret==DFB_OK) { |
378 videolayercaps.uyvy=1; | |
379 if (verbose) printf("DirectFB: Videolayer supports UYVY format\n"); | |
380 } else { | |
381 videolayercaps.uyvy=0; | |
382 if (verbose) printf("DirectFB: Videolayer doesn't support UYVY format\n"); | |
383 }; | |
384 | |
385 // test for color caps | |
386 { | |
387 DFBDisplayLayerCapabilities caps; | |
388 videolayer->GetCapabilities(videolayer,&caps); | |
389 if (caps & DLCAPS_BRIGHTNESS) { | |
390 videolayercaps.brightness=1; | |
391 } else { | |
392 videolayercaps.brightness=0; | |
393 }; | |
394 | |
395 if (caps & DLCAPS_CONTRAST) { | |
396 videolayercaps.contrast=1; | |
397 } else { | |
398 videolayercaps.contrast=0; | |
399 }; | |
400 | |
401 if (caps & DLCAPS_HUE) { | |
402 videolayercaps.hue=1; | |
403 } else { | |
404 videolayercaps.hue=0; | |
405 }; | |
406 | |
407 if (caps & DLCAPS_SATURATION) { | |
408 videolayercaps.saturation=1; | |
409 } else { | |
410 videolayercaps.saturation=0; | |
411 }; | |
412 | |
413 | |
414 } | |
415 | |
416 | |
417 // is there a working yuv ? if no we will not use videolayer | |
418 if ((videolayercaps.iv12==0)&&(videolayercaps.i420==0)&&(videolayercaps.yuy2==0)&&(videolayercaps.uyvy==0)) { | |
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 | 421 videolayer->SetOpacity(videolayer,0); |
422 videolayer->Release(videolayer); | |
423 } else { | |
5258
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
424 videolayerpresent=1; |
5189 | 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 | 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 | 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 | 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 | 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 | 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 | 484 d_width = out_width = in_width; |
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 | 488 // just look at RGB things for main layer - once again - now we now desired screen size |
489 modes[0].valid=0; | |
490 modes[1].valid=0; | |
491 modes[2].valid=0; | |
492 modes[3].valid=0; | |
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 if (vm) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
496 // need better algorithm just hack |
6262
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
497 switch (format) { |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
498 case IMGFMT_RGB32: |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
499 case IMGFMT_BGR32: |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
500 if (modes[3].valid) { |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
501 dfb->SetVideoMode(dfb,modes[3].width,modes[3].height,32); |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
502 if (verbose) printf("DirectFB: Trying to set videomode [%ix%i 32 bpp]\n",modes[3].width,modes[3].height); |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
503 }; |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
504 break; |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
505 case IMGFMT_RGB24: |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
506 case IMGFMT_BGR24: |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
507 if (modes[2].valid) { |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
508 dfb->SetVideoMode(dfb,modes[2].width,modes[2].height,24); |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
509 if (verbose) printf("DirectFB: Trying to set videomode [%ix%i 24 bpp]\n",modes[2].width,modes[2].height); |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
510 }; |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
511 break; |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
512 case IMGFMT_RGB16: |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
513 case IMGFMT_BGR16: |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
514 case IMGFMT_RGB15: |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
515 case IMGFMT_BGR15: |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
516 if (modes[1].valid) { |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
517 dfb->SetVideoMode(dfb,modes[1].width,modes[1].height,16); |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
518 if (verbose) printf("DirectFB: Trying to set videomode [%ix%i 16 bpp]\n",modes[1].width,modes[1].height); |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
519 }; |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
520 break; |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
521 |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
522 default: // try all of them in order 16bit 24bit 32bit 8bit |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
523 if (modes[1].valid) { |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
524 dfb->SetVideoMode(dfb,modes[1].width,modes[1].height,16); |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
525 if (verbose) printf("DirectFB: Trying to set videomode [%ix%i 16 bpp]\n",modes[1].width,modes[1].height); |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
526 } |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
527 else if (modes[2].valid) { |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
528 dfb->SetVideoMode(dfb,modes[2].width,modes[2].height,24); |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
529 if (verbose) printf("DirectFB: Trying to set videomode [%ix%i 24 bpp]\n",modes[2].width,modes[2].height); |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
530 } |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
531 else if (modes[3].valid) { |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
532 dfb->SetVideoMode(dfb,modes[3].width,modes[3].height,32); |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
533 if (verbose) printf("DirectFB: Trying to set videomode [%ix%i 32 bpp]\n",modes[3].width,modes[3].height); |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
534 } |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
535 else if (modes[0].valid) { |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
536 dfb->SetVideoMode(dfb,modes[0].width,modes[0].height,8); |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
537 if (verbose) printf("DirectFB: Trying to set videomode [%ix%i 8 bpp]\n",modes[0].width,modes[0].height); |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
538 } |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
539 break; |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
540 }; |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
541 |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
542 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
543 |
5258
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
544 // release primary if it is already allocated |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
545 if (primaryallocated) { |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
546 if (verbose ) printf("DirectFB: Release primary\n"); |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
547 primary->Release (primary); |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
548 primaryallocated=0; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
549 }; |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
550 |
5258
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
551 videolayeractive=0; // will be enabled on succes later |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
552 |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
553 if (videolayerpresent) { |
5189 | 554 |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
555 // try to set proper w a h values matching image size |
5189 | 556 dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT; |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
557 dlc.width = in_width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
558 dlc.height = in_height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
559 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
560 ret = videolayer->SetConfiguration( videolayer, &dlc ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
561 |
5189 | 562 if (ret) { |
563 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
|
564 }; |
5189 | 565 |
566 // try to set correct pixel format (closest to required) | |
567 | |
568 dlc.flags = DLCONF_PIXELFORMAT; | |
569 dlc.pixelformat = 0; | |
570 switch (pixel_format) { | |
571 case IMGFMT_YV12: | |
572 #ifdef HAVE_DIRECTFB099 | |
573 if (videolayercaps.i420==1) { | |
574 dlc.pixelformat=DSPF_I420; | |
575 break; | |
576 } else if (videolayercaps.iv12==1) { | |
577 dlc.pixelformat=DSPF_YV12; | |
578 break; | |
579 }; | |
580 | |
581 #endif | |
582 case IMGFMT_YUY2: if (videolayercaps.yuy2==1) { | |
583 dlc.pixelformat=DSPF_YUY2; | |
584 break; | |
585 // temporary disabled - do not have conv tool to uyvy | |
586 /* } else if (videolayercaps.uyvy==1) { | |
587 dlc.pixelformat=DSPF_UYVY; | |
588 break; | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
589 */ |
5189 | 590 #ifdef HAVE_DIRECTFB099 |
591 } else if (videolayercaps.i420==1) { | |
592 dlc.pixelformat=DSPF_I420; | |
593 break; | |
594 } else if (videolayercaps.iv12==1) { | |
595 dlc.pixelformat=DSPF_YV12; | |
596 break; | |
597 #endif | |
598 }; | |
599 // shouldn't happen - if it reaches here -> bug | |
600 | |
5258
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
601 case IMGFMT_RGB32: dlc.pixelformat = DSPF_ARGB; break; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
602 case IMGFMT_BGR32: dlc.pixelformat = DSPF_ARGB; break; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
603 case IMGFMT_RGB24: dlc.pixelformat = DSPF_RGB24; break; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
604 case IMGFMT_BGR24: dlc.pixelformat = DSPF_RGB24; break; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
605 case IMGFMT_RGB16: dlc.pixelformat = DSPF_RGB16; break; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
606 case IMGFMT_BGR16: dlc.pixelformat = DSPF_RGB16; break; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
607 case IMGFMT_RGB15: dlc.pixelformat = DSPF_RGB15; break; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
608 case IMGFMT_BGR15: dlc.pixelformat = DSPF_RGB15; break; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
609 default: dlc.pixelformat = DSPF_RGB24; break; |
5189 | 610 } |
611 | |
612 if (verbose) switch (dlc.pixelformat) { | |
613 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
|
614 break; |
5189 | 615 case DSPF_RGB32: printf("DirectFB: layer format RGB32\n"); |
616 break; | |
617 case DSPF_RGB24: printf("DirectFB: layer format RGB24\n"); | |
618 break; | |
619 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
|
620 break; |
5189 | 621 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
|
622 break; |
5189 | 623 case DSPF_YUY2: printf("DirectFB: layer format YUY2\n"); |
624 break; | |
625 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
|
626 break; |
5189 | 627 #ifdef HAVE_DIRECTFB099 |
628 case DSPF_YV12: printf("DirectFB: layer format YV12\n"); | |
629 break; | |
630 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
|
631 break; |
5189 | 632 #endif |
633 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
|
634 } |
5189 | 635 |
636 ret =videolayer->SetConfiguration( videolayer, &dlc ); | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
637 if (!ret) { |
5189 | 638 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
|
639 ret = videolayer->GetSurface( videolayer, &primary ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
640 if (!ret){ |
5189 | 641 videolayeractive=1; |
642 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
|
643 primaryallocated=1; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
644 } else { |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
645 videolayeractive=0; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
646 if (videolayer) videolayer->SetOpacity(videolayer,0); |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
647 }; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
648 } else { |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
649 videolayeractive=0; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
650 if (videolayer) videolayer->SetOpacity(videolayer,0); |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
651 }; |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
652 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
653 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
654 |
5189 | 655 // 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
|
656 dsc.flags = DSDESC_CAPS | DSDESC_PIXELFORMAT; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
657 dsc.caps = DSCAPS_PRIMARY | DSCAPS_VIDEOONLY;//| DSCAPS_FLIPPING; |
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 switch (format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
660 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
|
661 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
|
662 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
|
663 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
|
664 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
|
665 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
|
666 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
|
667 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
|
668 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
|
669 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
670 |
5189 | 671 if (!videolayeractive) { |
672 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary )); | |
5258
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
673 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
|
674 primaryallocated=1; |
5189 | 675 } |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
676 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
677 DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
678 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
679 DFBCHECK (primary->GetPixelFormat (primary, &frame_format)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
680 |
5258
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
681 // temporary frame buffer |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
682 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
|
683 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
684 dsc.width = in_width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
685 dsc.height = in_height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
686 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
687 // 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
|
688 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
689 switch (format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
690 case IMGFMT_RGB32: dsc.pixelformat = DSPF_ARGB; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
691 case IMGFMT_BGR32: dsc.pixelformat = DSPF_ARGB; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
692 case IMGFMT_RGB24: dsc.pixelformat = DSPF_RGB24; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
693 case IMGFMT_BGR24: dsc.pixelformat = DSPF_RGB24; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
694 case IMGFMT_RGB16: dsc.pixelformat = DSPF_RGB16; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
695 case IMGFMT_BGR16: dsc.pixelformat = DSPF_RGB16; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
696 case IMGFMT_RGB15: dsc.pixelformat = DSPF_RGB15; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
697 case IMGFMT_BGR15: dsc.pixelformat = DSPF_RGB15; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
698 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
|
699 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
700 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
701 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
702 /* |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
703 * 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
|
704 */ |
5189 | 705 #ifdef HAVE_DIRECTFB099 |
706 if (((dsc.pixelformat==DSPF_YV12)||(dsc.pixelformat==DSPF_I420)) && buggyYV12BitBlt) { | |
707 memcpyBitBlt = 1; | |
708 } else { | |
709 memcpyBitBlt = 0; | |
710 }; | |
711 #else | |
712 memcpyBitBlt = 0; | |
713 #endif | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
714 |
5258
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
715 // release frame if it is already allocated |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
716 if (frameallocated) { |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
717 if (verbose ) printf("DirectFB: Release frame\n"); |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
718 frame->Release (frame); |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
719 frameallocated=0; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
720 }; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
721 |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
722 |
5189 | 723 // prevent from memcpy from videomemory to videomemory |
724 /* if (memcpyBitBlt) { | |
725 dsc.caps = DSCAPS_SYSTEMONLY; | |
726 } else { | |
727 dsc.caps = DSCAPS_VIDEOONLY; | |
728 } | |
729 ret = dfb->CreateSurface( dfb, &dsc, &frame); | |
730 if (ret) { | |
731 if (verbose) printf ("DirectFB: Trying do create buffer in system memory (2)\n");*/ | |
732 dsc.caps = DSCAPS_SYSTEMONLY; | |
733 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &frame)); | |
5258
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
734 frameallocated=1; |
5189 | 735 // } |
736 | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
737 DFBCHECK (frame->GetPixelFormat (frame, &frame_format)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
738 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
739 switch (frame_format) { |
5189 | 740 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
|
741 frame_pixel_size = 4; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
742 break; |
5189 | 743 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
|
744 frame_pixel_size = 4; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
745 break; |
5189 | 746 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
|
747 frame_pixel_size = 3; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
748 break; |
5189 | 749 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
|
750 frame_pixel_size = 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
751 break; |
5189 | 752 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
|
753 frame_pixel_size = 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
754 break; |
5189 | 755 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
|
756 frame_pixel_size = 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
757 break; |
5189 | 758 case DSPF_UYVY: if (verbose) printf("DirectFB: frame format UYVY\n"); |
759 frame_pixel_size = 2; | |
760 break; | |
761 #ifdef HAVE_DIRECTFB099 | |
762 case DSPF_YV12: if (verbose) printf("DirectFB: frame format YV12\n"); | |
763 frame_pixel_size = 1; | |
764 break; | |
765 case DSPF_I420: if (verbose) printf("DirectFB: frame format I420\n"); | |
766 frame_pixel_size = 1; | |
767 break; | |
768 #endif | |
769 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
|
770 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
771 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
772 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
|
773 printf("Screensize is smaller than video size !\n"); |
5189 | 774 // return 1; // doesn't matter we will rescale |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
775 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
776 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
777 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
778 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
779 // yuv2rgb transform init |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
780 |
5189 | 781 if (((format == IMGFMT_YV12) || (format == IMGFMT_YUY2)) && (!videolayeractive)){ yuv2rgb_init(frame_pixel_size * 8,MODE_RGB);}; |
782 | |
783 // picture size and position | |
784 | |
785 aspect_save_orig(in_width,in_height); | |
786 aspect_save_prescale(d_width,d_height); | |
787 if (videolayeractive) {// try to set pos for YUY2 layer and proper aspect ratio | |
788 aspect_save_screenres(10000,10000); | |
789 aspect(&out_width,&out_height,A_ZOOM); | |
790 | |
791 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
|
792 |
5189 | 793 xoffset = 0; |
794 yoffset = 0; | |
795 } else { | |
796 // aspect ratio correction for zoom to fullscreen | |
797 aspect_save_screenres(screen_width,screen_height); | |
798 | |
799 if(fs) /* -fs */ | |
800 aspect(&out_width,&out_height,A_ZOOM); | |
801 else | |
802 aspect(&out_width,&out_height,A_NOZOOM); | |
803 | |
804 | |
805 xoffset = (screen_width - out_width) / 2; | |
806 yoffset = (screen_height - out_height) / 2; | |
807 } | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
808 |
5189 | 809 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 |
810 | |
811 if ((verbose)&&(memcpyBitBlt)) printf("DirectFB: Using memcpyBitBlt\n"); | |
812 #ifdef DIRECTRENDER | |
813 //direct rendering is enabled in case of sane buffer and im format | |
814 if ((format==IMGFMT_RGB32)&&(frame_format ==DSPF_ARGB) || | |
815 (format==IMGFMT_BGR32)&&(frame_format ==DSPF_ARGB) || | |
816 (format==IMGFMT_RGB24)&&(frame_format ==DSPF_RGB24) || | |
817 (format==IMGFMT_BGR24)&&(frame_format ==DSPF_RGB24) || | |
818 (format==IMGFMT_RGB16)&&(frame_format ==DSPF_RGB16) || | |
819 (format==IMGFMT_BGR16)&&(frame_format ==DSPF_RGB16) || | |
820 (format==IMGFMT_RGB15)&&(frame_format ==DSPF_RGB15) || | |
821 (format==IMGFMT_BGR15)&&(frame_format ==DSPF_RGB15) || | |
822 #ifdef HAVE_DIRECTFB099 | |
823 (format==IMGFMT_YUY2)&&(frame_format ==DSPF_YUY2) || | |
824 (format==IMGFMT_YV12)&&(frame_format ==DSPF_I420) || | |
825 (format==IMGFMT_YV12)&&(frame_format ==DSPF_YV12)){ | |
826 #else | |
827 (format==IMGFMT_YUY2)&&(frame_format ==DSPF_YUY2)){ | |
828 #endif | |
829 dr_enabled=1; | |
830 if (verbose) printf("DirectFB: Direct rendering supported\n"); | |
831 } else { | |
832 dr_enabled=0; | |
833 if (verbose) printf("DirectFB: Direct rendering not supported\n"); | |
834 }; | |
835 #endif | |
836 | |
837 | |
838 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
|
839 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
840 return 0; |
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 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
843 static uint32_t query_format(uint32_t format) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
844 { |
6211 | 845 int ret = VFCAP_CSP_SUPPORTED|VFCAP_OSD; /* osd/sub is supported on every bpp */ |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
846 |
4359
266ebffd8fc9
no longer required to call preinit from init and query_format, mplayer.c does this
alex
parents:
4354
diff
changeset
|
847 // preinit(NULL); |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
848 |
5189 | 849 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
|
850 switch (format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
851 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
852 // 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
|
853 // so we couldn't report supported formats well |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
854 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
855 // Just support those detected by preinit |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
856 case IMGFMT_RGB32: |
6211 | 857 case IMGFMT_BGR32: if (modes[3].valid) return ret; |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
858 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
859 case IMGFMT_RGB24: |
6211 | 860 case IMGFMT_BGR24: if (modes[2].valid) return ret; |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
861 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
862 case IMGFMT_RGB16: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
863 case IMGFMT_BGR16: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
864 case IMGFMT_RGB15: |
6211 | 865 case IMGFMT_BGR15: if (modes[1].valid) return ret; |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
866 break; |
5258
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
867 case IMGFMT_YUY2: if (videolayerpresent) { |
5189 | 868 if (videolayercaps.yuy2) { |
6211 | 869 return ret|VFCAP_CSP_SUPPORTED_BY_HW; |
5189 | 870 } else { |
6211 | 871 return ret; |
5189 | 872 }; |
873 }; | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
874 break; |
5258
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
875 case IMGFMT_YV12: if ((videolayerpresent) && |
5189 | 876 (videolayercaps.i420 || videolayercaps.iv12)) |
6211 | 877 return ret|VFCAP_CSP_SUPPORTED_BY_HW; |
878 else return ret; | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
879 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
880 // YV12 should work in all cases |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
881 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
882 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
883 return 0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
884 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
885 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
886 static const vo_info_t *get_info(void) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
887 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
888 return &vo_info; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
889 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
890 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
891 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
|
892 unsigned char *srca, int stride) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
893 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
894 void *dst; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
895 int pitch; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
896 int len; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
897 |
5189 | 898 #ifdef DIRECTRENDER |
899 if(framelocked) { | |
900 frame->Unlock(frame); | |
901 framelocked=0; | |
902 }; | |
903 #endif | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
904 DFBCHECK (frame->Lock(frame,DSLF_WRITE,&dst,&pitch)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
905 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
906 switch(frame_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
907 case DSPF_RGB32: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
908 case DSPF_ARGB: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
909 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
|
910 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
911 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
912 case DSPF_RGB24: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
913 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
|
914 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
915 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
916 case DSPF_RGB16: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
917 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
|
918 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
919 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
920 case DSPF_RGB15: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
921 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
|
922 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
923 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
924 case DSPF_YUY2: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
925 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
|
926 break; |
3341 | 927 |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
928 case DSPF_UYVY: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
929 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
|
930 break; |
5189 | 931 |
932 #ifdef HAVE_DIRECTFB099 | |
933 case DSPF_I420: | |
934 case DSPF_YV12: | |
935 vo_draw_alpha_yv12(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + frame_pixel_size*x0,pitch); | |
936 break; | |
937 #endif | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
938 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
939 DFBCHECK (frame->Unlock(frame)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
940 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
941 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
942 static uint32_t draw_frame(uint8_t *src[]) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
943 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
944 void *dst; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
945 int pitch; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
946 int len; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
947 |
5189 | 948 // printf("Drawframe\n"); |
949 #ifdef DIRECTRENDER | |
950 if(framelocked) { | |
951 frame->Unlock(frame); | |
952 framelocked=0; | |
953 }; | |
954 #endif | |
955 | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
956 DFBCHECK (frame->Lock(frame,DSLF_WRITE,&dst,&pitch)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
957 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
958 switch (frame_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
959 case DSPF_ARGB: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
960 case DSPF_RGB32: |
5189 | 961 case DSPF_RGB24: |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
962 case DSPF_RGB16: |
5189 | 963 case DSPF_RGB15: switch (pixel_format) { |
964 case IMGFMT_YV12: | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
965 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
|
966 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
967 /* 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
|
968 /* case IMGFMT_YUY2: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
969 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
|
970 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
|
971 break;*/ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
972 // RGB - just copy |
5189 | 973 default: if (source_pixel_size==frame_pixel_size) { |
974 if (pitch==(in_width*frame_pixel_size)) { | |
975 memcpy(dst,src[0],in_width * in_height * source_pixel_size); | |
976 } else { | |
977 int i; | |
978 int sp=in_width*source_pixel_size; | |
979 int ll=min(sp,pitch); | |
980 for (i=0;i<in_height;i++) { | |
981 memcpy(dst+i*pitch,src[0]+i*sp,ll); | |
982 }; | |
983 }; | |
984 }; | |
985 }; | |
986 break; | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
987 case DSPF_YUY2: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
988 switch (pixel_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
989 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
|
990 break; |
5189 | 991 case IMGFMT_YUY2: if (pitch==(in_width*2)) { |
992 memcpy(dst,src[0],in_width * in_height * source_pixel_size); | |
993 } else { | |
994 int i; | |
995 for (i=0;i<in_height;i++) { | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
996 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
|
997 } |
5189 | 998 } |
999 break; | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1000 // hopefully there will be no RGB in this case otherwise convert - not implemented |
5189 | 1001 }; |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1002 break; |
5189 | 1003 |
1004 #ifdef HAVE_DIRECTFB099 | |
1005 case DSPF_YV12: | |
1006 switch (pixel_format) { | |
1007 case IMGFMT_YV12: { | |
1008 int i; | |
1009 int p=min(in_width,pitch); | |
1010 for (i=0;i<in_height;i++) { | |
1011 memcpy(dst+i*pitch,src[0]+i*in_width,p); | |
1012 } | |
1013 dst += pitch*in_height; | |
1014 p = p/2; | |
1015 for (i=0;i<in_height/2;i++) { | |
1016 memcpy(dst+i*pitch/2,src[2]+i*in_width/2,p); | |
1017 } | |
1018 dst += pitch*in_height/4; | |
1019 for (i=0;i<in_height/2;i++) { | |
1020 memcpy(dst+i*pitch/2,src[1]+i*in_width/2,p); | |
1021 } | |
1022 }; | |
1023 break; | |
1024 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); | |
1025 break; | |
1026 // hopefully there will be no RGB in this case otherwise convert - not implemented | |
1027 } | |
1028 break; | |
1029 case DSPF_I420: | |
1030 switch (pixel_format) { | |
1031 case IMGFMT_YV12: { | |
1032 int i; | |
1033 int p=min(in_width,pitch); | |
1034 for (i=0;i<in_height;i++) { | |
1035 memcpy(dst+i*pitch,src[0]+i*in_width,p); | |
1036 } | |
1037 dst += pitch*in_height; | |
1038 p = p/2; | |
1039 for (i=0;i<in_height/2;i++) { | |
1040 memcpy(dst+i*pitch/2,src[1]+i*in_width/2,p); | |
1041 } | |
1042 dst += pitch*in_height/4; | |
1043 for (i=0;i<in_height/2;i++) { | |
1044 memcpy(dst+i*pitch/2,src[2]+i*in_width/2,p); | |
1045 } | |
1046 }; | |
1047 break; | |
1048 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); | |
1049 break; | |
1050 // hopefully there will be no RGB in this case otherwise convert - not implemented | |
1051 } | |
1052 break; | |
1053 #endif | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1054 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1055 DFBCHECK (frame->Unlock(frame)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1056 return 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 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
|
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 int err; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1063 void *dst; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1064 uint8_t *s; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1065 int pitch; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1066 int i; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1067 |
5189 | 1068 #ifdef DIRECTRENDER |
1069 if(framelocked) { | |
1070 frame->Unlock(frame); | |
1071 framelocked=0; | |
1072 }; | |
1073 #endif | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1074 |
5189 | 1075 err = frame->Lock(frame,DSLF_WRITE,&dst,&pitch); |
1076 // err = primary->Lock(primary,DSLF_WRITE,&dst,&pitch); // for direct rendering | |
1077 | |
1078 // 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
|
1079 |
5189 | 1080 if (err) { |
1081 printf("DirectFB: Frame lock failed!"); | |
1082 return 1; | |
1083 }; | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1084 switch (frame_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1085 case DSPF_ARGB: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1086 case DSPF_RGB32: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1087 case DSPF_RGB24: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1088 case DSPF_RGB16: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1089 case DSPF_RGB15: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1090 switch (pixel_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1091 case IMGFMT_YV12: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1092 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
|
1093 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1094 default: if (source_pixel_size==frame_pixel_size) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1095 dst += x * frame_pixel_size; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1096 s = src[0]; |
5189 | 1097 for (i=y;i<(y+h);i++) { |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1098 memcpy(dst,s,w); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1099 dst += (pitch); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1100 s += stride[0]; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1101 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1102 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1103 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1104 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1105 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1106 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1107 case DSPF_YUY2: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1108 switch (pixel_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1109 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
|
1110 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1111 // 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
|
1112 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1113 break; |
5189 | 1114 |
1115 #ifdef HAVE_DIRECTFB099 | |
1116 case DSPF_YV12: | |
1117 switch (pixel_format) { | |
5258
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1118 case IMGFMT_YV12: { |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1119 void *d,*s; |
5189 | 1120 int i; |
5258
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1121 d = dst + pitch*y + x; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1122 s = src[0]; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1123 for (i=0;i<h;i++) { |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1124 memcpy(d,s,w); |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1125 d+=pitch; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1126 s+=stride[0]; |
5189 | 1127 } |
5258
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1128 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
|
1129 s = src[2]; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1130 for (i=0;i<h/2;i++) { |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1131 memcpy(d,s,w/2); |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1132 d+=pitch/2; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1133 s+=stride[2]; |
5189 | 1134 } |
5258
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1135 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
|
1136 s = src[1]; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1137 for (i=0;i<h/2;i++) { |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1138 memcpy(d,s,w/2); |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1139 d+=pitch/2; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1140 s+=stride[1]; |
5189 | 1141 } |
1142 }; | |
1143 break; | |
1144 /* case IMGFMT_YUY2: { | |
1145 int i; | |
1146 for (i=y;i<(y+h);i++) { | |
1147 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); | |
1148 } | |
1149 } | |
1150 | |
1151 break; | |
1152 */ // hopefully there will be no RGB in this case otherwise convert - not implemented | |
1153 } | |
1154 break; | |
1155 | |
1156 case DSPF_I420: | |
1157 switch (pixel_format) { | |
1158 case IMGFMT_YV12: { | |
5258
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1159 void *d,*s; |
5189 | 1160 int i; |
5258
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1161 d = dst + pitch*y + x; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1162 s = src[0]; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1163 for (i=0;i<h;i++) { |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1164 memcpy(d,s,w); |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1165 d+=pitch; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1166 s+=stride[0]; |
5189 | 1167 } |
5258
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1168 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
|
1169 s = src[1]; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1170 for (i=0;i<h/2;i++) { |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1171 memcpy(d,s,w/2); |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1172 d+=pitch/2; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1173 s+=stride[1]; |
5189 | 1174 } |
5258
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1175 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
|
1176 s = src[2]; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1177 for (i=0;i<h/2;i++) { |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1178 memcpy(d,s,w/2); |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1179 d+=pitch/2; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1180 s+=stride[2]; |
5189 | 1181 } |
5258
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1182 }; |
5189 | 1183 break; |
1184 /* case IMGFMT_YUY2: { | |
1185 int i; | |
1186 for (i=y;i<(y+h);i++) { | |
1187 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); | |
1188 } | |
1189 } | |
1190 | |
1191 break; | |
1192 */ // hopefully there will be no RGB in this case otherwise convert - not implemented | |
1193 } | |
1194 break; | |
1195 #endif | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1196 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1197 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1198 frame->Unlock(frame); |
5189 | 1199 // primary->Unlock(primary); |
1200 | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1201 return 0; |
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 extern void mplayer_put_key(int code); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1205 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1206 #include "../linux/keycodes.h" |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1207 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1208 static void check_events(void) |
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 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1211 DFBInputEvent event; |
5189 | 1212 //if (verbose) printf ("DirectFB: Check events entered\n"); |
6262
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1213 #ifdef HAVE_DIRECTFB0910 |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1214 if (buffer->GetEvent(buffer, DFB_EVENT (&event)) == DFB_OK) { |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1215 #else |
5189 | 1216 if (buffer->GetEvent(buffer, &event) == DFB_OK) { |
6262
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1217 #endif |
3341 | 1218 if (event.type == DIET_KEYPRESS) { |
6262
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1219 #ifdef HAVE_DIRECTFB0911 |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1220 switch (event.key_symbol) { |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1221 case DIKS_ESCAPE: |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1222 mplayer_put_key('q'); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1223 break; |
6262
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1224 case DIKS_PAGE_UP: mplayer_put_key(KEY_PAGE_UP);break; |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1225 case DIKS_PAGE_DOWN: mplayer_put_key(KEY_PAGE_DOWN);break; |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1226 case DIKS_CURSOR_UP: mplayer_put_key(KEY_UP);break; |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1227 case DIKS_CURSOR_DOWN: mplayer_put_key(KEY_DOWN);break; |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1228 case DIKS_CURSOR_LEFT: mplayer_put_key(KEY_LEFT);break; |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1229 case DIKS_CURSOR_RIGHT: mplayer_put_key(KEY_RIGHT);break; |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1230 case DIKS_INSERT: mplayer_put_key(KEY_INSERT);break; |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1231 case DIKS_DELETE: mplayer_put_key(KEY_DELETE);break; |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1232 case DIKS_HOME: mplayer_put_key(KEY_HOME);break; |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1233 case DIKS_END: mplayer_put_key(KEY_END);break; |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1234 |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1235 default:mplayer_put_key(event.key_symbol); |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1236 }; |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1237 #else /* DirectFB < 0.9.11 */ |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1238 switch (event.keycode) { |
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1239 case DIKC_ESCAPE: mplayer_put_key('q');break; |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1240 case DIKC_KP_PLUS: mplayer_put_key('+');break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1241 case DIKC_KP_MINUS: mplayer_put_key('-');break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1242 case DIKC_TAB: mplayer_put_key('\t');break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1243 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
|
1244 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
|
1245 case DIKC_UP: mplayer_put_key(KEY_UP);break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1246 case DIKC_DOWN: mplayer_put_key(KEY_DOWN);break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1247 case DIKC_LEFT: mplayer_put_key(KEY_LEFT);break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1248 case DIKC_RIGHT: mplayer_put_key(KEY_RIGHT);break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1249 case DIKC_ASTERISK: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1250 case DIKC_KP_MULT:mplayer_put_key('*');break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1251 case DIKC_KP_DIV: mplayer_put_key('/');break; |
3341 | 1252 case DIKC_INSERT: mplayer_put_key(KEY_INSERT);break; |
1253 case DIKC_DELETE: mplayer_put_key(KEY_DELETE);break; | |
1254 case DIKC_HOME: mplayer_put_key(KEY_HOME);break; | |
1255 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
|
1256 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1257 default:mplayer_put_key(event.key_ascii); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1258 }; |
6262
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1259 #endif |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1260 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1261 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1262 // 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
|
1263 // and this causes problems during seek) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1264 // temporary workabout should be solved in the future |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1265 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1266 buffer->Reset(buffer); |
5189 | 1267 //if (verbose) printf ("DirectFB: Check events finished\n"); |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1268 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1269 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1270 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1271 static void draw_osd(void) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1272 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1273 vo_draw_text(in_width, in_height, draw_alpha); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1274 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1275 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1276 static void flip_page(void) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1277 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1278 DFBSurfaceBlittingFlags flags=DSBLIT_NOFX; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1279 |
5189 | 1280 // if (verbose) printf("DirectFB: Flip page entered"); |
1281 | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1282 DFBCHECK (primary->SetBlittingFlags(primary,flags)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1283 |
5189 | 1284 #ifdef DIRECTRENDER |
1285 if(framelocked) { | |
1286 frame->Unlock(frame); | |
1287 framelocked=0; | |
1288 }; | |
1289 #endif | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1290 if (stretch) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1291 DFBRectangle rect; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1292 rect.x=xoffset; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1293 rect.y=yoffset; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1294 rect.w=out_width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1295 rect.h=out_height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1296 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1297 DFBCHECK (primary->StretchBlit(primary,frame,NULL,&rect)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1298 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1299 else { |
5189 | 1300 #ifdef HAVE_DIRECTFB099 |
1301 if (!memcpyBitBlt) { | |
1302 #endif | |
1303 DFBCHECK (primary->Blit(primary,frame,NULL,xoffset,yoffset)); | |
1304 #ifdef HAVE_DIRECTFB099 | |
1305 } else { | |
1306 | |
1307 int err,err2; | |
1308 void *dst,*src; | |
1309 int pitch,pitch2; | |
1310 | |
1311 // printf("MemcpyBlit"); | |
1312 | |
1313 err = frame->Lock(frame,DSLF_READ,&src,&pitch); | |
1314 err2 = primary->Lock(primary,DSLF_WRITE,&dst,&pitch2); | |
1315 | |
1316 // printf("DirectFB: pitch=%i pitch2=%i\n",pitch,pitch2); | |
1317 | |
1318 | |
1319 if (pitch==pitch2) { | |
1320 memcpy(dst,src,in_height * pitch * 1.5); | |
1321 } else | |
1322 { | |
1323 int i; | |
1324 int p=min(pitch,pitch2); | |
1325 for (i=0;i<in_height;i++) { | |
1326 memcpy (dst+i*pitch2,src+i*pitch,p); | |
1327 }; | |
1328 dst+= in_height * pitch2; | |
1329 src+= in_height * pitch; | |
1330 p=p/2; | |
1331 for (i=0;i<in_height/2;i++) { | |
1332 memcpy (dst+i*pitch2/2,src+i*pitch/2,p); | |
1333 }; | |
1334 dst+= in_height * pitch2/4; | |
1335 src+= in_height * pitch/4; | |
1336 for (i=0;i<in_height/2;i++) { | |
1337 memcpy (dst+i*pitch2/2,src+i*pitch/2,p); | |
1338 }; | |
1339 } | |
1340 frame->Unlock(frame); | |
1341 primary->Unlock(primary); | |
1342 }; | |
1343 #endif | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1344 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1345 // DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAITFORSYNC)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1346 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1347 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1348 static void uninit(void) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1349 { |
5189 | 1350 if (verbose ) printf("DirectFB: uninit entered\n"); |
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 * (Release) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1353 */ |
5189 | 1354 if (verbose ) printf("DirectFB: Release buffer\n"); |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1355 buffer->Release (buffer); |
5189 | 1356 if (verbose ) printf("DirectFB: Release keyboard\n"); |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1357 keyboard->Release (keyboard); |
5258
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1358 if (frameallocated) { |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1359 if (verbose ) printf("DirectFB: Release frame\n"); |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1360 frame->Release (frame); |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1361 frameallocated=0; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1362 }; |
c9ccddcbdd81
ixes bug in draw_slice and also fixes compilance to
atmos4
parents:
5189
diff
changeset
|
1363 |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1364 // 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
|
1365 |
5189 | 1366 if (verbose ) printf("DirectFB: Release primary\n"); |
3588
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
1367 primary->Release (primary); |
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
1368 // switch off BES |
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
1369 if (videolayer) videolayer->SetOpacity(videolayer,0); |
5189 | 1370 |
1371 #ifdef HAVE_DIRECTFB099 | |
1372 if (verbose&&videolayer ) printf("DirectFB: Release videolayer\n"); | |
1373 if (videolayer) videolayer->Release(videolayer); | |
1374 | |
1375 if (verbose ) printf("DirectFB: Release DirectFB library\n"); | |
1376 dfb->Release (dfb); | |
1377 #endif | |
1378 | |
1379 if (verbose ) printf("DirectFB: Uninit done.\n"); | |
1380 } | |
1381 | |
1382 static int directfb_set_video_eq( const vidix_video_eq_t *info) | |
1383 { | |
1384 if (videolayeractive) { | |
1385 DFBColorAdjustment ca; | |
1386 float factor = (float)0xffff / 2000.0; | |
1387 | |
1388 ca.flags=DCAF_NONE; | |
1389 | |
1390 if ((videolayercaps.brightness)&&(info->cap&VEQ_CAP_BRIGHTNESS)) { | |
1391 ca.brightness = info->brightness * factor +0x8000; | |
1392 ca.flags |= DCAF_BRIGHTNESS; | |
1393 if (verbose) printf("DirectFB: SetVEq Brightness 0x%X %i\n",ca.brightness,info->brightness); | |
1394 } | |
1395 | |
1396 if ((videolayercaps.contrast)&&(info->cap&VEQ_CAP_CONTRAST)) { | |
1397 ca.contrast = info->contrast * factor + 0x8000; | |
1398 ca.flags |= DCAF_CONTRAST; | |
1399 if (verbose) printf("DirectFB: SetVEq Contrast 0x%X %i\n",ca.contrast,info->contrast); | |
1400 } | |
1401 | |
1402 if ((videolayercaps.hue)&&(info->cap&VEQ_CAP_HUE)) { | |
1403 ca.hue = info->hue * factor + 0x8000; | |
1404 ca.flags |= DCAF_HUE; | |
1405 if (verbose) printf("DirectFB: SetVEq Hue 0x%X %i\n",ca.hue,info->hue); | |
1406 } | |
1407 | |
6262
ae3cfbfc8e3f
-updates vo_directfb (+configure&makefile) according to planned changes
arpi
parents:
6211
diff
changeset
|
1408 if ((videolayercaps.saturation)&&(info->cap&VEQ_CAP_SATURATION)) { |
5189 | 1409 ca.saturation = info->saturation * factor + 0x8000; |
1410 ca.flags |= DCAF_SATURATION; | |
1411 if (verbose) printf("DirectFB: SetVEq Saturation 0x%X %i\n",ca.saturation,info->saturation); | |
1412 } | |
1413 | |
1414 videolayer->SetColorAdjustment(videolayer,&ca); | |
1415 }; | |
1416 return 0; | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1417 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1418 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
1419 |
5189 | 1420 static int directfb_get_video_eq( vidix_video_eq_t *info) |
1421 { | |
1422 if (videolayeractive) { | |
1423 DFBColorAdjustment ca; | |
1424 float factor = 2000.0 / (float)0xffff; | |
1425 videolayer->GetColorAdjustment(videolayer,&ca); | |
1426 | |
1427 if ((videolayercaps.brightness)&&(ca.flags&DCAF_BRIGHTNESS)) { | |
1428 info->brightness = (ca.brightness-0x8000) * factor; | |
1429 info->cap |= VEQ_CAP_BRIGHTNESS; | |
1430 if (verbose) printf("DirectFB: GetVEq Brightness 0x%X %i\n",ca.brightness,info->brightness); | |
1431 } | |
1432 | |
1433 if ((videolayercaps.contrast)&&(ca.flags&DCAF_CONTRAST)) { | |
1434 info->contrast = (ca.contrast-0x8000) * factor; | |
1435 info->cap |= VEQ_CAP_CONTRAST; | |
1436 if (verbose) printf("DirectFB: GetVEq Contrast 0x%X %i\n",ca.contrast,info->contrast); | |
1437 } | |
1438 | |
1439 if ((videolayercaps.hue)&&(ca.flags&DCAF_HUE)) { | |
1440 info->hue = (ca.hue-0x8000) * factor; | |
1441 info->cap |= VEQ_CAP_HUE; | |
1442 if (verbose) printf("DirectFB: GetVEq Hue 0x%X %i\n",ca.hue,info->hue); | |
1443 } | |
1444 | |
1445 if ((videolayercaps.saturation)&&(ca.flags&DCAF_SATURATION)) { | |
1446 info->saturation = (ca.saturation-0x8000) * factor; | |
1447 info->cap |= VEQ_CAP_SATURATION; | |
1448 if (verbose) printf("DirectFB: GetVEq Saturation 0x%X %i\n",ca.saturation,info->saturation); | |
1449 } | |
1450 | |
1451 }; | |
1452 return 0; | |
1453 } | |
1454 static void query_vaa(vo_vaa_t *vaa) | |
1455 { | |
1456 memset(vaa,0,sizeof(vo_vaa_t)); | |
1457 vaa->get_video_eq = directfb_get_video_eq; | |
1458 vaa->set_video_eq = directfb_set_video_eq; | |
1459 } | |
1460 | |
1461 #ifdef DIRECTRENDER | |
1462 static uint32_t get_image(mp_image_t *mpi){ | |
1463 int err; | |
1464 void *dst; | |
1465 int pitch; | |
1466 | |
1467 // printf("DirectFB: get_image() called\n"); | |
1468 | |
1469 // now we are always in system memory (in this version - mybe will change in future) | |
1470 // if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram | |
1471 | |
1472 // printf("width=%d vs. pitch=%d, flags=0x%X \n",mpi->width,pitch,mpi->flags); | |
1473 if((mpi->width==pitch/frame_pixel_size) || | |
1474 (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH))){ | |
1475 // we're lucky or codec accepts stride => ok, let's go! | |
1476 if(mpi->flags&MP_IMGFLAG_PLANAR){ | |
1477 | |
1478 #ifdef HAVE_DIRECTFB099 | |
1479 err = frame->Lock(frame,DSLF_WRITE/*|DSLF_READ*/,&dst,&pitch); | |
1480 // err = primary->Lock(primary,DSLF_WRITE,&dst,&pitch); // for real direct rendering | |
1481 | |
1482 if (err) { | |
1483 printf("DirectFB: Frame lock failed!"); | |
1484 return VO_FALSE; | |
1485 }; | |
1486 framelocked=1; | |
1487 | |
1488 //YV12 format | |
1489 mpi->planes[0]=dst; | |
1490 switch(frame_format) { | |
1491 case DSPF_I420: mpi->planes[1]=dst + pitch*in_height; | |
1492 mpi->planes[2]=mpi->planes[1] + pitch*in_height/4; | |
1493 break; | |
1494 case DSPF_YV12: mpi->planes[2]=dst + pitch*in_height; | |
1495 mpi->planes[1]=mpi->planes[1] + pitch*in_height/4; | |
1496 break; | |
1497 | |
1498 } | |
1499 mpi->width=mpi->stride[0]=pitch; | |
1500 mpi->stride[1]=mpi->stride[2]=pitch/2; | |
1501 #else | |
1502 return VO_FALSE; | |
1503 #endif | |
1504 } else { | |
1505 err = frame->Lock(frame,DSLF_WRITE/*|DSLF_READ*/,&dst,&pitch); | |
1506 // err = primary->Lock(primary,DSLF_WRITE,&dst,&pitch); // for real direct rendering | |
1507 | |
1508 if (err) { | |
1509 printf("DirectFB: Frame lock failed!"); | |
1510 return VO_FALSE; | |
1511 }; | |
1512 framelocked=1; | |
1513 //YUY2 and RGB formats | |
1514 mpi->planes[0]=dst; | |
1515 mpi->width=pitch/frame_pixel_size; | |
1516 mpi->stride[0]=pitch; | |
1517 } | |
1518 mpi->flags|=MP_IMGFLAG_DIRECT; | |
1519 // printf("DirectFB: get_image() SUCCESS -> Direct Rendering ENABLED\n"); | |
1520 return VO_TRUE; | |
1521 } | |
1522 | |
1523 if(framelocked) { | |
1524 frame->Unlock(frame); | |
1525 framelocked=0; | |
1526 }; | |
1527 return VO_FALSE; | |
1528 } | |
1529 #endif | |
1530 | |
4596 | 1531 static uint32_t control(uint32_t request, void *data, ...) |
4352 | 1532 { |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
1533 switch (request) { |
5189 | 1534 case VOCTRL_QUERY_VAA: |
1535 query_vaa((vo_vaa_t*)data); | |
1536 return VO_TRUE; | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
1537 case VOCTRL_QUERY_FORMAT: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
1538 return query_format(*((uint32_t*)data)); |
5189 | 1539 #ifdef DIRECTRENDER |
1540 case VOCTRL_GET_IMAGE: | |
1541 // printf("DirectFB: control(VOCTRL_GET_IMAGE) called\n"); | |
1542 if (dr_enabled) return get_image(data); | |
1543 #endif | |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
1544 } |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
1545 return VO_NOTIMPL; |
4352 | 1546 } |