Mercurial > mplayer.hg
annotate libvo/vo_directfb.c @ 3600:3094e7b6a15b
pre-cache fixed
author | arpi |
---|---|
date | Wed, 19 Dec 2001 02:16:43 +0000 |
parents | 8e56fe18e7fb |
children | 8148193fee93 |
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" |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
61 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
62 LIBVO_EXTERN(directfb) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
63 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
64 static vo_info_t vo_info = { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
65 "Direct Framebuffer Device", |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
66 "directfb", |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
67 "Jiri Svoboda Jiri.Svoboda@seznam.cz", |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
68 "" |
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 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
71 extern int verbose; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
72 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
73 /****************************** |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
74 * directfb * |
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 /* |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
78 * (Globals) |
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 static IDirectFB *dfb = NULL; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
81 static IDirectFBSurface *primary = NULL; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
82 static IDirectFBInputDevice *keyboard = NULL; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
83 static IDirectFBDisplayLayer *videolayer = NULL; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
84 static DFBDisplayLayerConfig dlc; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
85 static int screen_width = 0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
86 static int screen_height = 0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
87 static DFBSurfacePixelFormat frame_format; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
88 static unsigned int frame_pixel_size = 0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
89 static unsigned int source_pixel_size = 0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
90 static int xoffset=0,yoffset=0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
91 #define DFBCHECK(x...) \ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
92 { \ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
93 DFBResult err = x; \ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
94 \ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
95 if (err != DFB_OK) \ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
96 { \ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
97 fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
98 DirectFBErrorFatal( #x, err ); \ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
99 } \ |
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 |
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 * 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
|
104 */ |
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 static IDirectFBSurface *frame = NULL; |
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 * A buffer for input events. |
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 static IDirectFBInputBuffer *buffer = NULL; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
112 |
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 * vo_directfb * |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
115 ******************************/ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
116 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
117 /* command line/config file options */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
118 #ifdef HAVE_FBDEV |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
119 extern char *fb_dev_name; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
120 #else |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
121 char *fb_dev_name; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
122 #endif |
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 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
|
125 unsigned char *srca, int stride, unsigned char *dst, |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
126 int dstride); |
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 static int in_width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
129 static int in_height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
130 static int out_width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
131 static int out_height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
132 static uint32_t pixel_format; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
133 static int fs; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
134 static int flip; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
135 static int stretch=0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
136 struct modes_t { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
137 int valid; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
138 unsigned int width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
139 unsigned int height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
140 int overx,overy; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
141 } modes [4]; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
142 static unsigned int best_bpp=5; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
143 static unsigned int preinit_done=0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
144 static int no_yuy2=1; |
3339 | 145 static int no_uyvy_support=1; |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
146 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
147 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
148 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
|
149 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
150 int overx=0,overy=0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
151 unsigned int index=bpp/8-1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
152 int allow_under=0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
153 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
154 //printf("Validator entered %i %i %i\n",width,height,bpp); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
155 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
156 overx=width-out_width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
157 overy=height-out_height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
158 if (!modes[index].valid) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
159 modes[index].valid=1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
160 modes[index].width=width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
161 modes[index].height=height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
162 modes[index].overx=overx; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
163 modes[index].overy=overy; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
164 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
165 if ((modes[index].overy<0)||(modes[index].overx<0)) allow_under=1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
166 if (abs(overx*overy)<abs(modes[index].overx * modes[index].overy)) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
167 if (((overx>=0)&&(overy>=0)) || allow_under) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
168 modes[index].valid=1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
169 modes[index].width=width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
170 modes[index].height=height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
171 modes[index].overx=overx; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
172 modes[index].overy=overy; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
173 // printf("Better mode added %i %i %i\n",width,height,bpp); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
174 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
175 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
176 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
177 return DFENUM_OK; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
178 } |
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 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
181 DFBEnumerationResult enum_layers_callback( unsigned int id, |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
182 DFBDisplayLayerCapabilities caps, |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
183 void *data ) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
184 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
185 IDirectFBDisplayLayer **layer = (IDirectFBDisplayLayer **)data; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
186 /* |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
187 printf( "\nLayer %d:\n", id ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
188 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
189 if (caps & DLCAPS_SURFACE) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
190 printf( " - Has a surface.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
191 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
192 if (caps & DLCAPS_ALPHACHANNEL) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
193 printf( " - Supports blending based on alpha channel.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
194 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
195 if (caps & DLCAPS_COLORKEYING) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
196 printf( " - Supports color keying.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
197 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
198 if (caps & DLCAPS_FLICKER_FILTERING) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
199 printf( " - Supports flicker filtering.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
200 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
201 if (caps & DLCAPS_INTERLACED_VIDEO) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
202 printf( " - Can natively display interlaced video.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
203 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
204 if (caps & DLCAPS_OPACITY) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
205 printf( " - Supports blending based on global alpha factor.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
206 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
207 if (caps & DLCAPS_SCREEN_LOCATION) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
208 printf( " - Can be positioned on the screen.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
209 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
210 if (caps & DLCAPS_BRIGHTNESS) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
211 printf( " - Brightness can be adjusted.\n" ); |
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 if (caps & DLCAPS_CONTRAST) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
214 printf( " - Contrast can be adjusted.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
215 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
216 if (caps & DLCAPS_HUE) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
217 printf( " - Hue can be adjusted.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
218 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
219 if (caps & DLCAPS_SATURATION) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
220 printf( " - Saturation can be adjusted.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
221 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
222 printf("\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 /* We take the first layer not being the primary */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
225 if (id != DLID_PRIMARY) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
226 DFBResult ret; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
227 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
228 ret = dfb->GetDisplayLayer( dfb, id, layer ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
229 if (ret) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
230 DirectFBError( "dfb->GetDisplayLayer failed", ret ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
231 else |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
232 return DFENUM_CANCEL; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
233 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
234 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
235 return DFENUM_OK; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
236 } |
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 static uint32_t preinit() |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
239 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
240 DFBSurfaceDescription dsc; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
241 DFBResult ret; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
242 DFBDisplayLayerConfigFlags failed; |
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 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
245 if (preinit_done) return 1; |
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 /* |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
248 * (Initialize) |
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 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
251 // if (!dfb) { |
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 DFBCHECK (DirectFBInit (NULL,NULL)); |
3339 | 254 |
255 if ((directfb_major_version >= 0) && | |
256 (directfb_minor_version >= 9) && | |
257 (directfb_micro_version >= 7)) | |
258 no_uyvy_support = 0; | |
259 else | |
260 { | |
261 no_uyvy_support = 1; | |
262 printf("vo_directfb: no UYVY support. Version: %d.%d.%d\n", | |
263 directfb_major_version, directfb_minor_version, | |
264 directfb_micro_version); | |
265 } | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
266 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
267 if (!fb_dev_name && !(fb_dev_name = getenv("FRAMEBUFFER"))) fb_dev_name = "/dev/fb0"; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
268 DFBCHECK (DirectFBSetOption ("fbdev",fb_dev_name)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
269 |
3588
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
270 // uncomment this if you do not wish to create a new vt for DirectFB |
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
271 // DFBCHECK (DirectFBSetOption ("no-vt-switch",fb_dev_name)); |
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
272 |
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
273 // uncomment this if you want to allow vt switching |
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
274 // DFBCHECK (DirectFBSetOption ("vt-switching",fb_dev_name)); |
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
275 DFBCHECK (DirectFBSetOption ("bg-color","00000000")); |
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
276 |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
277 DFBCHECK (DirectFBCreate (&dfb)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
278 DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN)); |
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 // 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
|
281 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
282 /* Enumerate display layers */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
283 DFBCHECK (dfb->EnumDisplayLayers( dfb, enum_layers_callback, &videolayer )); |
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 if (!videolayer) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
286 // no yuy2 layer -> fallback to RGB |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
287 // printf( "\nNo additional layers have been found.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
288 no_yuy2 = 1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
289 // preinit_done = 1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
290 } else { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
291 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
292 // there is an additional layer so test it for YUV |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
293 dlc.flags = /*DLCONF_WIDTH | DLCONF_HEIGHT | */DLCONF_PIXELFORMAT; //| DLCONF_OPTIONS; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
294 /* dlc.width = dsc.width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
295 dlc.height = dsc.height;*/ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
296 dlc.pixelformat = DSPF_YUY2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
297 // dlc.options = DLOP_INTERLACED_VIDEO; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
298 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
299 /* Test the configuration, getting failed fields */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
300 ret = videolayer->TestConfiguration( videolayer, &dlc, &failed ); |
3339 | 301 if (ret == DFB_UNSUPPORTED && no_uyvy_support == 0) { |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
302 // printf("Videolayer does not support YUY2"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
303 dlc.pixelformat = DSPF_UYVY; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
304 ret = videolayer->TestConfiguration( videolayer, &dlc, &failed ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
305 if (ret != DFB_UNSUPPORTED) { no_yuy2 = 0;} |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
306 } else { no_yuy2 = 0;} |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
307 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
308 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
309 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
310 // just look at RGB things |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
311 modes[0].valid=0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
312 modes[1].valid=0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
313 modes[2].valid=0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
314 modes[3].valid=0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
315 DFBCHECK (dfb->EnumVideoModes(dfb,enum_modes_callback,NULL)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
316 // printf("No YUY2 %i\n",no_yuy2); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
317 // } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
318 preinit_done=1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
319 return 1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
320 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
321 } |
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 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
324 static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
325 uint32_t d_height, uint32_t fullscreen, char *title, |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
326 uint32_t format) |
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 /* |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
329 * (Locals) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
330 */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
331 DFBSurfaceDescription dsc; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
332 DFBResult ret; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
333 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
334 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
335 int vm = fullscreen & 0x02; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
336 int zoom = fullscreen & 0x04; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
337 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
338 fs = fullscreen & 0x01; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
339 flip = fullscreen & 0x08; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
340 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
341 pixel_format=format; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
342 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
343 in_width = width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
344 in_height = height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
345 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
346 if (d_width) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
347 out_width = d_width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
348 out_height = d_height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
349 } else { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
350 d_width = out_width = width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
351 d_height = out_height = height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
352 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
353 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
354 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
355 if (!preinit()) return 1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
356 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
357 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
358 if (vm) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
359 // need better algorithm just hack |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
360 if (modes[source_pixel_size-1].valid) dfb->SetVideoMode(dfb,modes[source_pixel_size-1].width,modes[source_pixel_size-1].height,source_pixel_size); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
361 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
362 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
363 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
364 if (!no_yuy2) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
365 // try to set proper w a h values matching image size |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
366 dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT;// | DLCONF_OPTIONS; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
367 dlc.width = in_width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
368 dlc.height = in_height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
369 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
370 ret = videolayer->SetConfiguration( videolayer, &dlc ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
371 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
372 /* if (ret) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
373 printf("Set layer size failed\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
374 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
375 */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
376 dlc.flags = DLCONF_PIXELFORMAT;// | DLCONF_OPTIONS; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
377 //dlc.pixelformat = DSPF_YUY2; should be set by preinit |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
378 //dlc.options = (vcaps & DVCAPS_INTERLACED) ? DLOP_INTERLACED_VIDEO : 0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
379 no_yuy2=1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
380 /* switch (dlc.pixelformat) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
381 case DSPF_ARGB: printf("Directfb frame format ARGB\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
382 frame_pixel_size = 4; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
383 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
384 case DSPF_RGB32: printf("Directfb frame format RGB32\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
385 frame_pixel_size = 4; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
386 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
387 case DSPF_RGB24: printf("Directfb frame format RGB24\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
388 frame_pixel_size = 3; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
389 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
390 case DSPF_RGB16: printf("Directfb frame format RGB16\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
391 frame_pixel_size = 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
392 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
393 case DSPF_RGB15: printf("Directfb frame format RGB15\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
394 frame_pixel_size = 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
395 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
396 case DSPF_YUY2: printf("Directfb frame format YUY2\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
397 frame_pixel_size = 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
398 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
399 case DSPF_UYVY: printf("Directfb frame format UYVY\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
400 frame_pixel_size = 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
401 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
402 default: printf("Directfb - unknown format ->exit\n"); return 1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
403 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
404 */ ret =videolayer->SetConfiguration( videolayer, &dlc ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
405 if (!ret) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
406 // printf("SetConfiguration for layer OK\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
407 ret = videolayer->GetSurface( videolayer, &primary ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
408 if (!ret){ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
409 no_yuy2=0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
410 // printf("Get surface for layer OK\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
411 /* dsc.width=in_width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
412 dsc.height=in_height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
413 dsc.flags = DSDESC_CAPS | DSDESC_HEIGHT | DSDESC_WIDTH; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
414 dsc.caps = DSCAPS_VIDEOONLY;//| DSCAPS_FLIPPING; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
415 primary->SetConfiguration(priamry,&dsc);*/ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
416 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
417 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
418 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
419 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
420 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
421 // mam pro flip pouzit tenhle flip nebo bitblt |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
422 dsc.flags = DSDESC_CAPS | DSDESC_PIXELFORMAT; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
423 dsc.caps = DSCAPS_PRIMARY | DSCAPS_VIDEOONLY;//| DSCAPS_FLIPPING; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
424 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
425 switch (format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
426 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
|
427 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
|
428 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
|
429 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
|
430 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
|
431 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
|
432 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
|
433 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
|
434 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
|
435 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
436 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
437 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
438 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
439 if (no_yuy2) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
440 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary )); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
441 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
442 else {// try to set pos for YUY2 layer and proper aspect ratio |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
443 |
3341 | 444 extern float monitor_aspect; |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
445 |
3341 | 446 float h=(float)out_height,w=(float)out_width/monitor_aspect; |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
447 float aspect=h/w; |
3341 | 448 // printf("in out d: %d %d, %d %d, %d %d\n",in_width,in_height,out_width,out_height,d_width,d_height); |
449 // printf ("Aspect y/x=%f/%f=%f\n",h,w,aspect); | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
450 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
451 // if (fs) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
452 // scale fullscreen |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
453 if (aspect>1) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
454 aspect=w/h; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
455 ret = videolayer->SetScreenLocation(videolayer,(1-aspect)/2,0,aspect,1); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
456 } else { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
457 ret = videolayer->SetScreenLocation(videolayer,0,(1-aspect)/2,1,aspect); |
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 // } else { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
460 // beacase I can't get real screen size values I can't scale properly in other way then fullscreen |
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 // if (ret) printf("SetScreenLocation failed\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
463 } |
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 DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
466 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
467 DFBCHECK (primary->GetPixelFormat (primary, &frame_format)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
468 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
469 // temporary buffer buffer |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
470 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
|
471 dsc.caps = DSCAPS_SYSTEMONLY; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
472 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
473 dsc.width = in_width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
474 dsc.height = in_height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
475 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
476 // 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
|
477 /* |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
478 switch (frame_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
479 case DSPF_ARGB: printf("Directfb frame format ARGB\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
480 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
481 case DSPF_RGB32: printf("Directfb frame format RGB32\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
482 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
483 case DSPF_RGB24: printf("Directfb frame format RGB24\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
484 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
485 case DSPF_RGB16: printf("Directfb frame format RGB16\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
486 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
487 case DSPF_RGB15: printf("Directfb frame format RGB15\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
488 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
489 case DSPF_YUY2: printf("Directfb frame format YUY2\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
490 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
491 default: printf("Directfb - unknown format ->exit\n"); return 1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
492 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
493 */ |
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 switch (format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
496 case IMGFMT_RGB32: dsc.pixelformat = DSPF_ARGB; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
497 case IMGFMT_BGR32: dsc.pixelformat = DSPF_ARGB; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
498 case IMGFMT_RGB24: dsc.pixelformat = DSPF_RGB24; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
499 case IMGFMT_BGR24: dsc.pixelformat = DSPF_RGB24; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
500 case IMGFMT_RGB16: dsc.pixelformat = DSPF_RGB16; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
501 case IMGFMT_BGR16: dsc.pixelformat = DSPF_RGB16; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
502 case IMGFMT_RGB15: dsc.pixelformat = DSPF_RGB15; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
503 case IMGFMT_BGR15: dsc.pixelformat = DSPF_RGB15; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
504 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
|
505 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
506 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
507 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
508 /* |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
509 * 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
|
510 */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
511 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &frame)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
512 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
513 DFBCHECK (frame->GetPixelFormat (frame, &frame_format)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
514 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
515 switch (frame_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
516 case DSPF_ARGB: //printf("Directfb frame format ARGB\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
517 frame_pixel_size = 4; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
518 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
519 case DSPF_RGB32: //printf("Directfb frame format RGB32\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
520 frame_pixel_size = 4; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
521 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
522 case DSPF_RGB24: //printf("Directfb frame format RGB24\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
523 frame_pixel_size = 3; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
524 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
525 case DSPF_RGB16: //printf("Directfb frame format RGB16\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
526 frame_pixel_size = 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
527 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
528 case DSPF_RGB15: //printf("Directfb frame format RGB15\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
529 frame_pixel_size = 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
530 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
531 case DSPF_YUY2: //printf("Directfb frame format YUY2\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
532 frame_pixel_size = 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
533 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
534 case DSPF_UYVY: //printf("Directfb frame format UYVY\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
535 frame_pixel_size = 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
536 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
537 default: printf("Directfb - unknown format ->exit\n"); return 1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
538 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
539 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
540 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
541 if (zoom) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
542 printf("-zoom is not yet supported\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
543 // return 1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
544 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
545 /* |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
546 if (fs) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
547 printf("-fs can degrade image and performance\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
548 // return 1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
549 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
550 */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
551 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
|
552 printf("Screensize is smaller than video size !\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
553 // return 1; // doesn't matter we will |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
554 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
555 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
556 if ((fs) && (no_yuy2)) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
557 // aspect ratio correction for fullscreen |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
558 out_height=d_height*screen_width/d_width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
559 if (out_height <= screen_height) {out_width=screen_width;} else {out_width=screen_width*screen_height/d_height; out_height=screen_height;}; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
560 // printf("Going fullscreen !\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
561 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
562 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
563 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
564 /* |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
565 * (Get keyboard) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
566 */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
567 DFBCHECK (dfb->GetInputDevice (dfb, DIDID_KEYBOARD, &keyboard)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
568 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
569 /* |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
570 * Create an input buffer for the keyboard. |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
571 */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
572 DFBCHECK (keyboard->CreateInputBuffer (keyboard, &buffer)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
573 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
574 // yuv2rgb transform init |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
575 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
576 if (((format == IMGFMT_YV12) || (format == IMGFMT_YUY2)) && no_yuy2){ yuv2rgb_init(frame_pixel_size * 8,MODE_RGB);}; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
577 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
578 if (((out_width != in_width) || (out_height != in_height)) && (no_yuy2)) {stretch = 1;} else stretch=0; //yuy doesn't like strech and should not be needed |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
579 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
580 if (no_yuy2) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
581 xoffset = (screen_width - out_width) / 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
582 yoffset = (screen_height - out_height) / 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
583 } else { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
584 xoffset = 0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
585 yoffset = 0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
586 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
587 // printf("in out d: %d %d, %d %d, %d %d\n",in_width,in_height,out_width,out_height,d_width,d_height); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
588 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
589 return 0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
590 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
591 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
592 static uint32_t query_format(uint32_t format) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
593 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
594 int ret = 0x4; /* osd/sub is supported on every bpp */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
595 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
596 preinit(); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
597 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
598 // printf("Format query: %s\n",vo_format_name(format)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
599 switch (format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
600 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
601 // 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
|
602 // so we couldn't report supported formats well |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
603 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
604 // Just support those detected by preinit |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
605 case IMGFMT_RGB32: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
606 case IMGFMT_BGR32: if (modes[3].valid) return ret|0x2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
607 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
608 case IMGFMT_RGB24: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
609 case IMGFMT_BGR24: if (modes[2].valid) return ret|0x2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
610 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
611 case IMGFMT_RGB16: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
612 case IMGFMT_BGR16: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
613 case IMGFMT_RGB15: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
614 case IMGFMT_BGR15: if (modes[1].valid) return ret|0x2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
615 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
616 case IMGFMT_YUY2: if (!no_yuy2) return ret|0x2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
617 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
618 case IMGFMT_YV12: if (!no_yuy2) return ret|0x2; else return ret|0x1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
619 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
620 // YV12 should work in all cases |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
621 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
622 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
623 return 0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
624 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
625 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
626 static const vo_info_t *get_info(void) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
627 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
628 return &vo_info; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
629 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
630 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
631 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
|
632 unsigned char *srca, int stride) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
633 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
634 void *dst; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
635 int pitch; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
636 int len; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
637 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
638 DFBCHECK (frame->Lock(frame,DSLF_WRITE,&dst,&pitch)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
639 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
640 switch(frame_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
641 case DSPF_RGB32: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
642 case DSPF_ARGB: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
643 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
|
644 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
645 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
646 case DSPF_RGB24: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
647 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
|
648 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
649 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
650 case DSPF_RGB16: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
651 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
|
652 break; |
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 case DSPF_RGB15: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
655 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
|
656 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
657 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
658 case DSPF_YUY2: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
659 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
|
660 break; |
3341 | 661 |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
662 case DSPF_UYVY: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
663 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
|
664 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
665 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
666 DFBCHECK (frame->Unlock(frame)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
667 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
668 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
669 static uint32_t draw_frame(uint8_t *src[]) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
670 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
671 void *dst; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
672 int pitch; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
673 int len; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
674 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
675 DFBCHECK (frame->Lock(frame,DSLF_WRITE,&dst,&pitch)); |
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 switch (frame_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
678 case DSPF_ARGB: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
679 case DSPF_RGB32: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
680 case DSPF_RGB24: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
681 case DSPF_RGB16: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
682 case DSPF_RGB15:switch (pixel_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
683 case IMGFMT_YV12: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
684 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
|
685 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
686 /* 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
|
687 /* case IMGFMT_YUY2: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
688 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
|
689 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
|
690 break;*/ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
691 // RGB - just copy |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
692 default: if (source_pixel_size==frame_pixel_size) {memcpy(dst,src[0],in_width * in_height * frame_pixel_size);}; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
693 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
694 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
695 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
696 case DSPF_YUY2: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
697 switch (pixel_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
698 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
|
699 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
700 case IMGFMT_YUY2: { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
701 int i; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
702 for (i=0;i<in_height;i++) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
703 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
|
704 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
705 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
706 /*len = in_width * in_height * pitch; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
707 memcpy(dst,src[0],len);*/ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
708 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
709 // 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
|
710 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
711 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
712 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
713 DFBCHECK (frame->Unlock(frame)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
714 return 0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
715 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
716 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
717 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
|
718 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
719 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
720 int err; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
721 void *dst; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
722 uint8_t *s; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
723 int pitch; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
724 int i; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
725 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
726 err = frame->Lock(frame,DSLF_WRITE,&dst,&pitch); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
727 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
728 // printf("Drawslice\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
729 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
730 switch (frame_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
731 case DSPF_ARGB: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
732 case DSPF_RGB32: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
733 case DSPF_RGB24: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
734 case DSPF_RGB16: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
735 case DSPF_RGB15: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
736 switch (pixel_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
737 case IMGFMT_YV12: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
738 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
|
739 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
740 // how to handle this? need conversion |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
741 /* case IMGFMT_YUY2: { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
742 int i; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
743 for (i=0;i<=h;i++) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
744 yuv2rgb(dst+ (i+y) * pitch + frame_pixel_size*x,src[0]+i*stride[0],src[0]+1+i*stride[0],src[0]+3+i*stride[0],1,(w+1)/2,frame_pixel_size*2,4,4); //odd pixels |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
745 yuv2rgb(dst+ (i+y) * pitch + frame_pixel_size*x +1,src[0]+i*stride[0]+2,src[0]+1+i*stride[0],src[0]+3+i*stride[0],1,(w)/2,frame_pixel_size*2,4,4); //odd pixels |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
746 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
747 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
748 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
749 */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
750 default: if (source_pixel_size==frame_pixel_size) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
751 dst += x * frame_pixel_size; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
752 s = src[0]; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
753 for (i=y;i<=(y+h);i++) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
754 memcpy(dst,s,w); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
755 dst += (pitch); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
756 s += stride[0]; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
757 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
758 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
759 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
760 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
761 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
762 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
763 case DSPF_YUY2: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
764 switch (pixel_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
765 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
|
766 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
767 case IMGFMT_YUY2: { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
768 dst += x * frame_pixel_size; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
769 s = src[0]; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
770 for (i=y;i<=(y+h);i++) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
771 memcpy(dst,s,w); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
772 dst += (pitch); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
773 s += stride[0]; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
774 }; |
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 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
777 // 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
|
778 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
779 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
780 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
781 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
782 frame->Unlock(frame); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
783 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
784 return 0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
785 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
786 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
787 extern void mplayer_put_key(int code); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
788 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
789 #include "../linux/keycodes.h" |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
790 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
791 static void check_events(void) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
792 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
793 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
794 DFBInputEvent event; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
795 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
796 if (buffer->GetEvent (buffer, &event) == DFB_OK) { |
3341 | 797 if (event.type == DIET_KEYPRESS) { |
798 switch (event.keycode) { | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
799 case DIKC_ESCAPE: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
800 mplayer_put_key('q'); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
801 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
802 case DIKC_KP_PLUS: mplayer_put_key('+');break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
803 case DIKC_KP_MINUS: mplayer_put_key('-');break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
804 case DIKC_TAB: mplayer_put_key('\t');break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
805 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
|
806 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
|
807 case DIKC_UP: mplayer_put_key(KEY_UP);break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
808 case DIKC_DOWN: mplayer_put_key(KEY_DOWN);break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
809 case DIKC_LEFT: mplayer_put_key(KEY_LEFT);break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
810 case DIKC_RIGHT: mplayer_put_key(KEY_RIGHT);break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
811 case DIKC_ASTERISK: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
812 case DIKC_KP_MULT:mplayer_put_key('*');break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
813 case DIKC_KP_DIV: mplayer_put_key('/');break; |
3341 | 814 case DIKC_INSERT: mplayer_put_key(KEY_INSERT);break; |
815 case DIKC_DELETE: mplayer_put_key(KEY_DELETE);break; | |
816 case DIKC_HOME: mplayer_put_key(KEY_HOME);break; | |
817 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
|
818 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
819 default:mplayer_put_key(event.key_ascii); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
820 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
821 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
822 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
823 // 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
|
824 // and this causes problems during seek) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
825 // temporary workabout should be solved in the future |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
826 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
827 buffer->Reset(buffer); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
828 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
829 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
830 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
831 static void draw_osd(void) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
832 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
833 vo_draw_text(in_width, in_height, draw_alpha); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
834 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
835 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
836 static void flip_page(void) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
837 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
838 DFBSurfaceBlittingFlags flags=DSBLIT_NOFX; |
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 DFBCHECK (primary->SetBlittingFlags(primary,flags)); |
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 if (stretch) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
843 DFBRectangle rect; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
844 rect.x=xoffset; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
845 rect.y=yoffset; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
846 rect.w=out_width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
847 rect.h=out_height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
848 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
849 DFBCHECK (primary->StretchBlit(primary,frame,NULL,&rect)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
850 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
851 else { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
852 DFBCHECK (primary->Blit(primary,frame,NULL,xoffset,yoffset)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
853 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
854 // DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAITFORSYNC)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
855 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
856 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
857 static void uninit(void) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
858 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
859 if (verbose > 0) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
860 printf("uninit\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
861 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
862 /* |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
863 * (Release) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
864 */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
865 // printf("Release buffer\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
866 buffer->Release (buffer); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
867 // printf("Release keyb\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
868 keyboard->Release (keyboard); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
869 // printf("Release frame\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
870 frame->Release (frame); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
871 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
872 // 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
|
873 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
874 // printf("Release primary\n"); |
3588
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
875 primary->Release (primary); |
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
876 // switch off BES |
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
877 if (videolayer) videolayer->SetOpacity(videolayer,0); |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
878 // printf("Release videolayer\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
879 // if (videolayer) videolayer->Release(videolayer); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
880 // printf("Release dfb\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
881 // dfb->Release (dfb); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
882 // preinit_done=0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
883 |
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 |