Mercurial > mplayer.hg
annotate libvo/vo_directfb.c @ 5039:da65bafd5e99
very obsoleted...
author | arpi |
---|---|
date | Mon, 11 Mar 2002 00:58:32 +0000 |
parents | 693b917ac916 |
children | c663455448e8 |
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 */ |
5026
693b917ac916
DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents:
4596
diff
changeset
|
111 |
693b917ac916
DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents:
4596
diff
changeset
|
112 #ifdef HAVE_DIRECTFB099 |
693b917ac916
DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents:
4596
diff
changeset
|
113 static IDirectFBEventBuffer *buffer = NULL; |
693b917ac916
DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents:
4596
diff
changeset
|
114 #else |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
115 static IDirectFBInputBuffer *buffer = NULL; |
5026
693b917ac916
DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents:
4596
diff
changeset
|
116 #endif |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
117 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
118 /****************************** |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
119 * vo_directfb * |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
120 ******************************/ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
121 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
122 /* command line/config file options */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
123 #ifdef HAVE_FBDEV |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
124 extern char *fb_dev_name; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
125 #else |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
126 char *fb_dev_name; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
127 #endif |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
128 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
129 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
|
130 unsigned char *srca, int stride, unsigned char *dst, |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
131 int dstride); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
132 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
133 static int in_width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
134 static int in_height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
135 static int out_width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
136 static int out_height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
137 static uint32_t pixel_format; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
138 static int fs; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
139 static int flip; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
140 static int stretch=0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
141 struct modes_t { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
142 int valid; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
143 unsigned int width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
144 unsigned int height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
145 int overx,overy; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
146 } modes [4]; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
147 static unsigned int best_bpp=5; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
148 static unsigned int preinit_done=0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
149 static int no_yuy2=1; |
3339 | 150 static int no_uyvy_support=1; |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
151 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
152 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
153 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
|
154 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
155 int overx=0,overy=0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
156 unsigned int index=bpp/8-1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
157 int allow_under=0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
158 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
159 //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
|
160 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
161 overx=width-out_width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
162 overy=height-out_height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
163 if (!modes[index].valid) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
164 modes[index].valid=1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
165 modes[index].width=width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
166 modes[index].height=height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
167 modes[index].overx=overx; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
168 modes[index].overy=overy; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
169 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
170 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
|
171 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
|
172 if (((overx>=0)&&(overy>=0)) || allow_under) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
173 modes[index].valid=1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
174 modes[index].width=width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
175 modes[index].height=height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
176 modes[index].overx=overx; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
177 modes[index].overy=overy; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
178 // 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
|
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 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
182 return DFENUM_OK; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
183 } |
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 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
186 DFBEnumerationResult enum_layers_callback( unsigned int id, |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
187 DFBDisplayLayerCapabilities caps, |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
188 void *data ) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
189 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
190 IDirectFBDisplayLayer **layer = (IDirectFBDisplayLayer **)data; |
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 printf( "\nLayer %d:\n", id ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
193 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
194 if (caps & DLCAPS_SURFACE) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
195 printf( " - Has a surface.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
196 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
197 if (caps & DLCAPS_ALPHACHANNEL) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
198 printf( " - Supports blending based on alpha channel.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
199 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
200 if (caps & DLCAPS_COLORKEYING) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
201 printf( " - Supports color keying.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
202 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
203 if (caps & DLCAPS_FLICKER_FILTERING) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
204 printf( " - Supports flicker filtering.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
205 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
206 if (caps & DLCAPS_INTERLACED_VIDEO) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
207 printf( " - Can natively display interlaced video.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
208 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
209 if (caps & DLCAPS_OPACITY) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
210 printf( " - Supports blending based on global alpha factor.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
211 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
212 if (caps & DLCAPS_SCREEN_LOCATION) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
213 printf( " - Can be positioned on the screen.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
214 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
215 if (caps & DLCAPS_BRIGHTNESS) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
216 printf( " - Brightness can be adjusted.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
217 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
218 if (caps & DLCAPS_CONTRAST) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
219 printf( " - Contrast can be adjusted.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
220 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
221 if (caps & DLCAPS_HUE) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
222 printf( " - Hue can be adjusted.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
223 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
224 if (caps & DLCAPS_SATURATION) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
225 printf( " - Saturation can be adjusted.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
226 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
227 printf("\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
228 */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
229 /* We take the first layer not being the primary */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
230 if (id != DLID_PRIMARY) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
231 DFBResult ret; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
232 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
233 ret = dfb->GetDisplayLayer( dfb, id, layer ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
234 if (ret) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
235 DirectFBError( "dfb->GetDisplayLayer failed", ret ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
236 else |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
237 return DFENUM_CANCEL; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
238 } |
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 return DFENUM_OK; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
241 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
242 |
4354 | 243 static uint32_t preinit(const char *arg) |
3275
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 DFBSurfaceDescription dsc; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
246 DFBResult ret; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
247 DFBDisplayLayerConfigFlags failed; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
248 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
249 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
250 if (preinit_done) return 1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
251 |
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 * (Initialize) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
254 */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
255 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
256 // if (!dfb) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
257 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
258 DFBCHECK (DirectFBInit (NULL,NULL)); |
3339 | 259 |
260 if ((directfb_major_version >= 0) && | |
261 (directfb_minor_version >= 9) && | |
262 (directfb_micro_version >= 7)) | |
263 no_uyvy_support = 0; | |
264 else | |
265 { | |
266 no_uyvy_support = 1; | |
267 printf("vo_directfb: no UYVY support. Version: %d.%d.%d\n", | |
268 directfb_major_version, directfb_minor_version, | |
269 directfb_micro_version); | |
270 } | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
271 |
3651
8148193fee93
working with 0.9.6 too (0.9.6 is coming with debian woody)
alex
parents:
3588
diff
changeset
|
272 if ((directfb_major_version >= 0) && |
8148193fee93
working with 0.9.6 too (0.9.6 is coming with debian woody)
alex
parents:
3588
diff
changeset
|
273 (directfb_minor_version >= 9) && |
8148193fee93
working with 0.9.6 too (0.9.6 is coming with debian woody)
alex
parents:
3588
diff
changeset
|
274 (directfb_micro_version >= 7)) |
8148193fee93
working with 0.9.6 too (0.9.6 is coming with debian woody)
alex
parents:
3588
diff
changeset
|
275 { |
8148193fee93
working with 0.9.6 too (0.9.6 is coming with debian woody)
alex
parents:
3588
diff
changeset
|
276 if (!fb_dev_name && !(fb_dev_name = getenv("FRAMEBUFFER"))) fb_dev_name = "/dev/fb0"; |
8148193fee93
working with 0.9.6 too (0.9.6 is coming with debian woody)
alex
parents:
3588
diff
changeset
|
277 DFBCHECK (DirectFBSetOption ("fbdev",fb_dev_name)); |
8148193fee93
working with 0.9.6 too (0.9.6 is coming with debian woody)
alex
parents:
3588
diff
changeset
|
278 } |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
279 |
3588
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
280 // 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
|
281 // DFBCHECK (DirectFBSetOption ("no-vt-switch",fb_dev_name)); |
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
282 |
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
283 // uncomment this if you want to allow vt switching |
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
284 // DFBCHECK (DirectFBSetOption ("vt-switching",fb_dev_name)); |
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
285 DFBCHECK (DirectFBSetOption ("bg-color","00000000")); |
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
286 |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
287 DFBCHECK (DirectFBCreate (&dfb)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
288 DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
289 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
290 // 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
|
291 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
292 /* Enumerate display layers */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
293 DFBCHECK (dfb->EnumDisplayLayers( dfb, enum_layers_callback, &videolayer )); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
294 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
295 if (!videolayer) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
296 // no yuy2 layer -> fallback to RGB |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
297 // printf( "\nNo additional layers have been found.\n" ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
298 no_yuy2 = 1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
299 // preinit_done = 1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
300 } else { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
301 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
302 // 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
|
303 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
|
304 /* dlc.width = dsc.width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
305 dlc.height = dsc.height;*/ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
306 dlc.pixelformat = DSPF_YUY2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
307 // dlc.options = DLOP_INTERLACED_VIDEO; |
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 /* Test the configuration, getting failed fields */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
310 ret = videolayer->TestConfiguration( videolayer, &dlc, &failed ); |
3339 | 311 if (ret == DFB_UNSUPPORTED && no_uyvy_support == 0) { |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
312 // printf("Videolayer does not support YUY2"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
313 dlc.pixelformat = DSPF_UYVY; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
314 ret = videolayer->TestConfiguration( videolayer, &dlc, &failed ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
315 if (ret != DFB_UNSUPPORTED) { no_yuy2 = 0;} |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
316 } else { no_yuy2 = 0;} |
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 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
319 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
320 // just look at RGB things |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
321 modes[0].valid=0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
322 modes[1].valid=0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
323 modes[2].valid=0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
324 modes[3].valid=0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
325 DFBCHECK (dfb->EnumVideoModes(dfb,enum_modes_callback,NULL)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
326 // printf("No YUY2 %i\n",no_yuy2); |
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 preinit_done=1; |
4359
266ebffd8fc9
no longer required to call preinit from init and query_format, mplayer.c does this
alex
parents:
4354
diff
changeset
|
329 return 0; |
3275
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 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
332 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
333 |
4433 | 334 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
335 uint32_t d_height, uint32_t fullscreen, char *title, |
4433 | 336 uint32_t format,const vo_tune_info_t *info) |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
337 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
338 /* |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
339 * (Locals) |
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 DFBSurfaceDescription dsc; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
342 DFBResult ret; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
343 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
344 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
345 int vm = fullscreen & 0x02; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
346 int zoom = fullscreen & 0x04; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
347 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
348 fs = fullscreen & 0x01; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
349 flip = fullscreen & 0x08; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
350 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
351 pixel_format=format; |
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 in_width = width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
354 in_height = height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
355 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
356 if (d_width) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
357 out_width = d_width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
358 out_height = d_height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
359 } else { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
360 d_width = out_width = width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
361 d_height = out_height = height; |
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 |
4359
266ebffd8fc9
no longer required to call preinit from init and query_format, mplayer.c does this
alex
parents:
4354
diff
changeset
|
365 // if (!preinit(NULL)) return 1; |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
366 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
367 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
368 if (vm) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
369 // need better algorithm just hack |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
370 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
|
371 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
372 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
373 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
374 if (!no_yuy2) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
375 // 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
|
376 dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT;// | DLCONF_OPTIONS; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
377 dlc.width = in_width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
378 dlc.height = in_height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
379 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
380 ret = videolayer->SetConfiguration( videolayer, &dlc ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
381 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
382 /* if (ret) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
383 printf("Set layer size failed\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
384 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
385 */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
386 dlc.flags = DLCONF_PIXELFORMAT;// | DLCONF_OPTIONS; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
387 //dlc.pixelformat = DSPF_YUY2; should be set by preinit |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
388 //dlc.options = (vcaps & DVCAPS_INTERLACED) ? DLOP_INTERLACED_VIDEO : 0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
389 no_yuy2=1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
390 /* switch (dlc.pixelformat) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
391 case DSPF_ARGB: printf("Directfb frame format ARGB\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
392 frame_pixel_size = 4; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
393 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
394 case DSPF_RGB32: printf("Directfb frame format RGB32\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
395 frame_pixel_size = 4; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
396 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
397 case DSPF_RGB24: printf("Directfb frame format RGB24\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
398 frame_pixel_size = 3; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
399 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
400 case DSPF_RGB16: printf("Directfb frame format RGB16\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
401 frame_pixel_size = 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
402 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
403 case DSPF_RGB15: printf("Directfb frame format RGB15\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
404 frame_pixel_size = 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
405 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
406 case DSPF_YUY2: printf("Directfb frame format YUY2\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
407 frame_pixel_size = 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
408 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
409 case DSPF_UYVY: printf("Directfb frame format UYVY\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
410 frame_pixel_size = 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
411 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
412 default: printf("Directfb - unknown format ->exit\n"); return 1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
413 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
414 */ ret =videolayer->SetConfiguration( videolayer, &dlc ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
415 if (!ret) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
416 // printf("SetConfiguration for layer OK\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
417 ret = videolayer->GetSurface( videolayer, &primary ); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
418 if (!ret){ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
419 no_yuy2=0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
420 // printf("Get surface for layer OK\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
421 /* dsc.width=in_width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
422 dsc.height=in_height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
423 dsc.flags = DSDESC_CAPS | DSDESC_HEIGHT | DSDESC_WIDTH; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
424 dsc.caps = DSCAPS_VIDEOONLY;//| DSCAPS_FLIPPING; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
425 primary->SetConfiguration(priamry,&dsc);*/ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
426 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
427 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
428 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
429 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
430 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
431 // mam pro flip pouzit tenhle flip nebo bitblt |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
432 dsc.flags = DSDESC_CAPS | DSDESC_PIXELFORMAT; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
433 dsc.caps = DSCAPS_PRIMARY | DSCAPS_VIDEOONLY;//| DSCAPS_FLIPPING; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
434 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
435 switch (format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
436 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
|
437 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
|
438 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
|
439 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
|
440 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
|
441 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
|
442 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
|
443 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
|
444 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
|
445 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
446 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
447 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
448 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
449 if (no_yuy2) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
450 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary )); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
451 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
452 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
|
453 |
3341 | 454 extern float monitor_aspect; |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
455 |
3341 | 456 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
|
457 float aspect=h/w; |
3341 | 458 // printf("in out d: %d %d, %d %d, %d %d\n",in_width,in_height,out_width,out_height,d_width,d_height); |
459 // 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
|
460 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
461 // if (fs) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
462 // scale fullscreen |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
463 if (aspect>1) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
464 aspect=w/h; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
465 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
|
466 } else { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
467 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
|
468 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
469 // } else { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
470 // 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
|
471 // }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
472 // if (ret) printf("SetScreenLocation failed\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
473 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
474 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
475 DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
476 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
477 DFBCHECK (primary->GetPixelFormat (primary, &frame_format)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
478 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
479 // temporary buffer buffer |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
480 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
|
481 dsc.caps = DSCAPS_SYSTEMONLY; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
482 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
483 dsc.width = in_width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
484 dsc.height = in_height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
485 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
486 // 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
|
487 /* |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
488 switch (frame_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
489 case DSPF_ARGB: printf("Directfb frame format ARGB\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 case DSPF_RGB32: printf("Directfb frame format RGB32\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
492 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
493 case DSPF_RGB24: printf("Directfb frame format RGB24\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
494 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
495 case DSPF_RGB16: printf("Directfb frame format RGB16\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
496 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
497 case DSPF_RGB15: printf("Directfb frame format RGB15\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
498 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
499 case DSPF_YUY2: printf("Directfb frame format YUY2\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
500 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
501 default: printf("Directfb - unknown format ->exit\n"); return 1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
502 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
503 */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
504 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
505 switch (format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
506 case IMGFMT_RGB32: dsc.pixelformat = DSPF_ARGB; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
507 case IMGFMT_BGR32: dsc.pixelformat = DSPF_ARGB; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
508 case IMGFMT_RGB24: dsc.pixelformat = DSPF_RGB24; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
509 case IMGFMT_BGR24: dsc.pixelformat = DSPF_RGB24; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
510 case IMGFMT_RGB16: dsc.pixelformat = DSPF_RGB16; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
511 case IMGFMT_BGR16: dsc.pixelformat = DSPF_RGB16; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
512 case IMGFMT_RGB15: dsc.pixelformat = DSPF_RGB15; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
513 case IMGFMT_BGR15: dsc.pixelformat = DSPF_RGB15; break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
514 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
|
515 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
516 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
517 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
518 /* |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
519 * 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
|
520 */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
521 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &frame)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
522 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
523 DFBCHECK (frame->GetPixelFormat (frame, &frame_format)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
524 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
525 switch (frame_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
526 case DSPF_ARGB: //printf("Directfb frame format ARGB\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
527 frame_pixel_size = 4; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
528 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
529 case DSPF_RGB32: //printf("Directfb frame format RGB32\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
530 frame_pixel_size = 4; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
531 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
532 case DSPF_RGB24: //printf("Directfb frame format RGB24\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
533 frame_pixel_size = 3; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
534 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
535 case DSPF_RGB16: //printf("Directfb frame format RGB16\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
536 frame_pixel_size = 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
537 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
538 case DSPF_RGB15: //printf("Directfb frame format RGB15\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
539 frame_pixel_size = 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
540 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
541 case DSPF_YUY2: //printf("Directfb frame format YUY2\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
542 frame_pixel_size = 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
543 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
544 case DSPF_UYVY: //printf("Directfb frame format UYVY\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
545 frame_pixel_size = 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
546 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
547 default: printf("Directfb - unknown format ->exit\n"); return 1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
548 } |
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 (zoom) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
552 printf("-zoom is not yet supported\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
553 // return 1; |
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) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
557 printf("-fs can degrade image and performance\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
558 // return 1; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
559 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
560 */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
561 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
|
562 printf("Screensize is smaller than video size !\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
563 // return 1; // doesn't matter we will |
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 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
566 if ((fs) && (no_yuy2)) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
567 // aspect ratio correction for fullscreen |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
568 out_height=d_height*screen_width/d_width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
569 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
|
570 // printf("Going fullscreen !\n"); |
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 |
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 /* |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
575 * (Get keyboard) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
576 */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
577 DFBCHECK (dfb->GetInputDevice (dfb, DIDID_KEYBOARD, &keyboard)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
578 |
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 * Create an input buffer for the keyboard. |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
581 */ |
5026
693b917ac916
DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents:
4596
diff
changeset
|
582 #ifdef HAVE_DIRECTFB099 |
693b917ac916
DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents:
4596
diff
changeset
|
583 DFBCHECK (keyboard->CreateEventBuffer (DICAPS_ALL, &buffer)); |
693b917ac916
DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents:
4596
diff
changeset
|
584 #else |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
585 DFBCHECK (keyboard->CreateInputBuffer (keyboard, &buffer)); |
5026
693b917ac916
DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents:
4596
diff
changeset
|
586 #endif |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
587 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
588 // yuv2rgb transform init |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
589 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
590 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
|
591 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
592 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
|
593 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
594 if (no_yuy2) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
595 xoffset = (screen_width - out_width) / 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
596 yoffset = (screen_height - out_height) / 2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
597 } else { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
598 xoffset = 0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
599 yoffset = 0; |
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 // 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
|
602 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
603 return 0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
604 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
605 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
606 static uint32_t query_format(uint32_t format) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
607 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
608 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
|
609 |
4359
266ebffd8fc9
no longer required to call preinit from init and query_format, mplayer.c does this
alex
parents:
4354
diff
changeset
|
610 // preinit(NULL); |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
611 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
612 // printf("Format query: %s\n",vo_format_name(format)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
613 switch (format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
614 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
615 // 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
|
616 // so we couldn't report supported formats well |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
617 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
618 // Just support those detected by preinit |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
619 case IMGFMT_RGB32: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
620 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
|
621 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
622 case IMGFMT_RGB24: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
623 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
|
624 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
625 case IMGFMT_RGB16: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
626 case IMGFMT_BGR16: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
627 case IMGFMT_RGB15: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
628 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
|
629 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
630 case IMGFMT_YUY2: if (!no_yuy2) return ret|0x2; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
631 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
632 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
|
633 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
634 // YV12 should work in all cases |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
635 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
636 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
637 return 0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
638 } |
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 static const vo_info_t *get_info(void) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
641 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
642 return &vo_info; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
643 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
644 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
645 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
|
646 unsigned char *srca, int stride) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
647 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
648 void *dst; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
649 int pitch; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
650 int len; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
651 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
652 DFBCHECK (frame->Lock(frame,DSLF_WRITE,&dst,&pitch)); |
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 switch(frame_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
655 case DSPF_RGB32: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
656 case DSPF_ARGB: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
657 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
|
658 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
659 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
660 case DSPF_RGB24: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
661 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
|
662 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
663 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
664 case DSPF_RGB16: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
665 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
|
666 break; |
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 case DSPF_RGB15: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
669 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
|
670 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
671 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
672 case DSPF_YUY2: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
673 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
|
674 break; |
3341 | 675 |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
676 case DSPF_UYVY: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
677 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
|
678 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
679 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
680 DFBCHECK (frame->Unlock(frame)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
681 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
682 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
683 static uint32_t draw_frame(uint8_t *src[]) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
684 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
685 void *dst; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
686 int pitch; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
687 int len; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
688 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
689 DFBCHECK (frame->Lock(frame,DSLF_WRITE,&dst,&pitch)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
690 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
691 switch (frame_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
692 case DSPF_ARGB: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
693 case DSPF_RGB32: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
694 case DSPF_RGB24: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
695 case DSPF_RGB16: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
696 case DSPF_RGB15:switch (pixel_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
697 case IMGFMT_YV12: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
698 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
|
699 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
700 /* 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
|
701 /* case IMGFMT_YUY2: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
702 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
|
703 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
|
704 break;*/ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
705 // RGB - just copy |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
706 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
|
707 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
708 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
709 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
710 case DSPF_YUY2: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
711 switch (pixel_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
712 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
|
713 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
714 case IMGFMT_YUY2: { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
715 int i; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
716 for (i=0;i<in_height;i++) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
717 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
|
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 /*len = in_width * in_height * pitch; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
721 memcpy(dst,src[0],len);*/ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
722 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
723 // 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
|
724 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
725 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
726 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
727 DFBCHECK (frame->Unlock(frame)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
728 return 0; |
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 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
731 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
|
732 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
733 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
734 int err; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
735 void *dst; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
736 uint8_t *s; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
737 int pitch; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
738 int i; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
739 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
740 err = frame->Lock(frame,DSLF_WRITE,&dst,&pitch); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
741 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
742 // printf("Drawslice\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
743 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
744 switch (frame_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
745 case DSPF_ARGB: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
746 case DSPF_RGB32: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
747 case DSPF_RGB24: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
748 case DSPF_RGB16: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
749 case DSPF_RGB15: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
750 switch (pixel_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
751 case IMGFMT_YV12: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
752 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
|
753 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
754 // how to handle this? need conversion |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
755 /* case IMGFMT_YUY2: { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
756 int i; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
757 for (i=0;i<=h;i++) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
758 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
|
759 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
|
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 */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
764 default: if (source_pixel_size==frame_pixel_size) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
765 dst += x * frame_pixel_size; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
766 s = src[0]; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
767 for (i=y;i<=(y+h);i++) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
768 memcpy(dst,s,w); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
769 dst += (pitch); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
770 s += stride[0]; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
771 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
772 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
773 break; |
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 case DSPF_YUY2: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
778 switch (pixel_format) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
779 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
|
780 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
781 case IMGFMT_YUY2: { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
782 dst += x * frame_pixel_size; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
783 s = src[0]; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
784 for (i=y;i<=(y+h);i++) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
785 memcpy(dst,s,w); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
786 dst += (pitch); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
787 s += stride[0]; |
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 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
790 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
791 // 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
|
792 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
793 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
794 }; |
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 frame->Unlock(frame); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
797 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
798 return 0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
799 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
800 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
801 extern void mplayer_put_key(int code); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
802 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
803 #include "../linux/keycodes.h" |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
804 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
805 static void check_events(void) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
806 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
807 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
808 DFBInputEvent event; |
5026
693b917ac916
DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents:
4596
diff
changeset
|
809 #ifdef HAVE_DIRECTFB099 |
693b917ac916
DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents:
4596
diff
changeset
|
810 if (buffer->GetEvent (buffer, DFB_EVENT(&event)) == DFB_OK) { |
693b917ac916
DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents:
4596
diff
changeset
|
811 #else |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
812 if (buffer->GetEvent (buffer, &event) == DFB_OK) { |
5026
693b917ac916
DirectFB 0.9.9 support - patch by Aubin Paul <aubin@punknews.org>
arpi
parents:
4596
diff
changeset
|
813 #endif |
3341 | 814 if (event.type == DIET_KEYPRESS) { |
815 switch (event.keycode) { | |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
816 case DIKC_ESCAPE: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
817 mplayer_put_key('q'); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
818 break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
819 case DIKC_KP_PLUS: mplayer_put_key('+');break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
820 case DIKC_KP_MINUS: mplayer_put_key('-');break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
821 case DIKC_TAB: mplayer_put_key('\t');break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
822 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
|
823 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
|
824 case DIKC_UP: mplayer_put_key(KEY_UP);break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
825 case DIKC_DOWN: mplayer_put_key(KEY_DOWN);break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
826 case DIKC_LEFT: mplayer_put_key(KEY_LEFT);break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
827 case DIKC_RIGHT: mplayer_put_key(KEY_RIGHT);break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
828 case DIKC_ASTERISK: |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
829 case DIKC_KP_MULT:mplayer_put_key('*');break; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
830 case DIKC_KP_DIV: mplayer_put_key('/');break; |
3341 | 831 case DIKC_INSERT: mplayer_put_key(KEY_INSERT);break; |
832 case DIKC_DELETE: mplayer_put_key(KEY_DELETE);break; | |
833 case DIKC_HOME: mplayer_put_key(KEY_HOME);break; | |
834 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
|
835 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
836 default:mplayer_put_key(event.key_ascii); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
837 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
838 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
839 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
840 // 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
|
841 // and this causes problems during seek) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
842 // temporary workabout should be solved in the future |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
843 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
844 buffer->Reset(buffer); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
845 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
846 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
847 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
848 static void draw_osd(void) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
849 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
850 vo_draw_text(in_width, in_height, draw_alpha); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
851 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
852 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
853 static void flip_page(void) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
854 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
855 DFBSurfaceBlittingFlags flags=DSBLIT_NOFX; |
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 DFBCHECK (primary->SetBlittingFlags(primary,flags)); |
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 (stretch) { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
860 DFBRectangle rect; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
861 rect.x=xoffset; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
862 rect.y=yoffset; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
863 rect.w=out_width; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
864 rect.h=out_height; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
865 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
866 DFBCHECK (primary->StretchBlit(primary,frame,NULL,&rect)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
867 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
868 else { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
869 DFBCHECK (primary->Blit(primary,frame,NULL,xoffset,yoffset)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
870 }; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
871 // DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAITFORSYNC)); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
872 } |
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 static void uninit(void) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
875 { |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
876 if (verbose > 0) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
877 printf("uninit\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
878 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
879 /* |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
880 * (Release) |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
881 */ |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
882 // printf("Release buffer\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
883 buffer->Release (buffer); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
884 // printf("Release keyb\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
885 keyboard->Release (keyboard); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
886 // printf("Release frame\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
887 frame->Release (frame); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
888 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
889 // 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
|
890 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
891 // printf("Release primary\n"); |
3588
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
892 primary->Release (primary); |
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
893 // switch off BES |
8e56fe18e7fb
Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents:
3341
diff
changeset
|
894 if (videolayer) videolayer->SetOpacity(videolayer,0); |
3275
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
895 // printf("Release videolayer\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
896 // if (videolayer) videolayer->Release(videolayer); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
897 // printf("Release dfb\n"); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
898 // dfb->Release (dfb); |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
899 // preinit_done=0; |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
900 |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
901 } |
38344371432f
vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff
changeset
|
902 |
4596 | 903 static uint32_t control(uint32_t request, void *data, ...) |
4352 | 904 { |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
905 switch (request) { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
906 case VOCTRL_QUERY_FORMAT: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
907 return query_format(*((uint32_t*)data)); |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
908 } |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4433
diff
changeset
|
909 return VO_NOTIMPL; |
4352 | 910 } |