annotate libvo/vo_directfb.c @ 4152:da00e9f57949

10l to Alban B. - restored removed verbose level setting
author arpi
date Mon, 14 Jan 2002 17:39:02 +0000
parents 8148193fee93
children ed5b85b713a3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
1 /*
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
2 MPlayer video driver for DirectFramebuffer device
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
3
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
4 (C) 2001
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
5
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
6 Written by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
7
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
8 Inspired by vo_sdl and vo_fbdev.
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
9
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
10 To get second head working delete line 120
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
11 from fbdev.c (from DirectFB sources version 0.9.7)
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
12 Line contains following:
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
13 fbdev->fd = open( "/dev/fb0", O_RDWR );
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
14
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
15 Parts of this code taken from DirectFB examples:
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
16 (c) Copyright 2000 convergence integrated media GmbH.
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
17 All rights reserved.
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
18
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
19 This library is free software; you can redistribute it and/or
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
20 modify it under the terms of the GNU Lesser General Public
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
21 License as published by the Free Software Foundation; either
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
22 version 2 of the License, or (at your option) any later version.
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
23
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
24 This library is distributed in the hope that it will be useful,
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
25 but WITHOUT ANY WARRANTY; without even the implied warranty of
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
26 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
27 Lesser General Public License for more details.
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
28
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
29 You should have received a copy of the GNU Lesser General Public
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
30 License along with this library; if not, write to the
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
31 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
32 Boston, MA 02111-1307, USA.
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
33 */
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
34
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
35 // directfb includes
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
36
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
37 #include <directfb.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
38
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
39 // other things
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
40
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
41 #include <stdio.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
42 #include <stdlib.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
43 #include <string.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
44 #include <fcntl.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
45 #include <unistd.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
46 #include <errno.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
47 #include <ctype.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
48 #include <assert.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
49
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
50 #include <sys/mman.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
51 #include <sys/ioctl.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
52 #include <sys/kd.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
53 #include <linux/fb.h>
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
54
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
55 #include "config.h"
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
56 #include "video_out.h"
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
57 #include "video_out_internal.h"
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
58 #include "fastmemcpy.h"
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
59 #include "sub.h"
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
60 #include "../postproc/rgb2rgb.h"
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
61
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
62 LIBVO_EXTERN(directfb)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
63
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
64 static vo_info_t vo_info = {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
65 "Direct Framebuffer Device",
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
66 "directfb",
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
67 "Jiri Svoboda Jiri.Svoboda@seznam.cz",
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
68 ""
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
69 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
70
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
71 extern int verbose;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
72
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
73 /******************************
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
74 * directfb *
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
75 ******************************/
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
76
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
77 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
78 * (Globals)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
79 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
80 static IDirectFB *dfb = NULL;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
81 static IDirectFBSurface *primary = NULL;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
82 static IDirectFBInputDevice *keyboard = NULL;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
83 static IDirectFBDisplayLayer *videolayer = NULL;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
84 static DFBDisplayLayerConfig dlc;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
85 static int screen_width = 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
86 static int screen_height = 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
87 static DFBSurfacePixelFormat frame_format;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
88 static unsigned int frame_pixel_size = 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
89 static unsigned int source_pixel_size = 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
90 static int xoffset=0,yoffset=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
91 #define DFBCHECK(x...) \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
92 { \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
93 DFBResult err = x; \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
94 \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
95 if (err != DFB_OK) \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
96 { \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
97 fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
98 DirectFBErrorFatal( #x, err ); \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
99 } \
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
100 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
101
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
102 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
103 * The frame is to be loaded into a surface that we can blit from.
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
104 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
105
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
106 static IDirectFBSurface *frame = NULL;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
107
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
108 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
109 * A buffer for input events.
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
110 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
111 static IDirectFBInputBuffer *buffer = NULL;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
112
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
113 /******************************
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
114 * vo_directfb *
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
115 ******************************/
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
116
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
117 /* command line/config file options */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
118 #ifdef HAVE_FBDEV
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
119 extern char *fb_dev_name;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
120 #else
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
121 char *fb_dev_name;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
122 #endif
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
123
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
124 static void (*draw_alpha_p)(int w, int h, unsigned char *src,
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
125 unsigned char *srca, int stride, unsigned char *dst,
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
126 int dstride);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
127
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
128 static int in_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
129 static int in_height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
130 static int out_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
131 static int out_height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
132 static uint32_t pixel_format;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
133 static int fs;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
134 static int flip;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
135 static int stretch=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
136 struct modes_t {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
137 int valid;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
138 unsigned int width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
139 unsigned int height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
140 int overx,overy;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
141 } modes [4];
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
142 static unsigned int best_bpp=5;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
143 static unsigned int preinit_done=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
144 static int no_yuy2=1;
3339
7e0eeb649420 compile if no uyvy support (test this change)
alex
parents: 3275
diff changeset
145 static int no_uyvy_support=1;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
146
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
147
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
148 DFBEnumerationResult enum_modes_callback( unsigned int width,unsigned int height,unsigned int bpp, void *data)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
149 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
150 int overx=0,overy=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
151 unsigned int index=bpp/8-1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
152 int allow_under=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
153
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
154 //printf("Validator entered %i %i %i\n",width,height,bpp);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
155
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
156 overx=width-out_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
157 overy=height-out_height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
158 if (!modes[index].valid) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
159 modes[index].valid=1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
160 modes[index].width=width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
161 modes[index].height=height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
162 modes[index].overx=overx;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
163 modes[index].overy=overy;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
164 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
165 if ((modes[index].overy<0)||(modes[index].overx<0)) allow_under=1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
166 if (abs(overx*overy)<abs(modes[index].overx * modes[index].overy)) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
167 if (((overx>=0)&&(overy>=0)) || allow_under) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
168 modes[index].valid=1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
169 modes[index].width=width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
170 modes[index].height=height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
171 modes[index].overx=overx;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
172 modes[index].overy=overy;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
173 // printf("Better mode added %i %i %i\n",width,height,bpp);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
174 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
175 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
176
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
177 return DFENUM_OK;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
178 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
179
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
180
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
181 DFBEnumerationResult enum_layers_callback( unsigned int id,
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
182 DFBDisplayLayerCapabilities caps,
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
183 void *data )
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
184 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
185 IDirectFBDisplayLayer **layer = (IDirectFBDisplayLayer **)data;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
186 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
187 printf( "\nLayer %d:\n", id );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
188
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
189 if (caps & DLCAPS_SURFACE)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
190 printf( " - Has a surface.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
191
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
192 if (caps & DLCAPS_ALPHACHANNEL)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
193 printf( " - Supports blending based on alpha channel.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
194
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
195 if (caps & DLCAPS_COLORKEYING)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
196 printf( " - Supports color keying.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
197
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
198 if (caps & DLCAPS_FLICKER_FILTERING)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
199 printf( " - Supports flicker filtering.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
200
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
201 if (caps & DLCAPS_INTERLACED_VIDEO)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
202 printf( " - Can natively display interlaced video.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
203
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
204 if (caps & DLCAPS_OPACITY)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
205 printf( " - Supports blending based on global alpha factor.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
206
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
207 if (caps & DLCAPS_SCREEN_LOCATION)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
208 printf( " - Can be positioned on the screen.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
209
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
210 if (caps & DLCAPS_BRIGHTNESS)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
211 printf( " - Brightness can be adjusted.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
212
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
213 if (caps & DLCAPS_CONTRAST)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
214 printf( " - Contrast can be adjusted.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
215
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
216 if (caps & DLCAPS_HUE)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
217 printf( " - Hue can be adjusted.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
218
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
219 if (caps & DLCAPS_SATURATION)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
220 printf( " - Saturation can be adjusted.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
221
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
222 printf("\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
223 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
224 /* We take the first layer not being the primary */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
225 if (id != DLID_PRIMARY) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
226 DFBResult ret;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
227
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
228 ret = dfb->GetDisplayLayer( dfb, id, layer );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
229 if (ret)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
230 DirectFBError( "dfb->GetDisplayLayer failed", ret );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
231 else
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
232 return DFENUM_CANCEL;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
233 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
234
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
235 return DFENUM_OK;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
236 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
237
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
238 static uint32_t preinit()
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
239 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
240 DFBSurfaceDescription dsc;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
241 DFBResult ret;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
242 DFBDisplayLayerConfigFlags failed;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
243
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
244
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
245 if (preinit_done) return 1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
246
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
247 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
248 * (Initialize)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
249 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
250
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
251 // if (!dfb) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
252
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
253 DFBCHECK (DirectFBInit (NULL,NULL));
3339
7e0eeb649420 compile if no uyvy support (test this change)
alex
parents: 3275
diff changeset
254
7e0eeb649420 compile if no uyvy support (test this change)
alex
parents: 3275
diff changeset
255 if ((directfb_major_version >= 0) &&
7e0eeb649420 compile if no uyvy support (test this change)
alex
parents: 3275
diff changeset
256 (directfb_minor_version >= 9) &&
7e0eeb649420 compile if no uyvy support (test this change)
alex
parents: 3275
diff changeset
257 (directfb_micro_version >= 7))
7e0eeb649420 compile if no uyvy support (test this change)
alex
parents: 3275
diff changeset
258 no_uyvy_support = 0;
7e0eeb649420 compile if no uyvy support (test this change)
alex
parents: 3275
diff changeset
259 else
7e0eeb649420 compile if no uyvy support (test this change)
alex
parents: 3275
diff changeset
260 {
7e0eeb649420 compile if no uyvy support (test this change)
alex
parents: 3275
diff changeset
261 no_uyvy_support = 1;
7e0eeb649420 compile if no uyvy support (test this change)
alex
parents: 3275
diff changeset
262 printf("vo_directfb: no UYVY support. Version: %d.%d.%d\n",
7e0eeb649420 compile if no uyvy support (test this change)
alex
parents: 3275
diff changeset
263 directfb_major_version, directfb_minor_version,
7e0eeb649420 compile if no uyvy support (test this change)
alex
parents: 3275
diff changeset
264 directfb_micro_version);
7e0eeb649420 compile if no uyvy support (test this change)
alex
parents: 3275
diff changeset
265 }
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
266
3651
8148193fee93 working with 0.9.6 too (0.9.6 is coming with debian woody)
alex
parents: 3588
diff changeset
267 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
268 (directfb_minor_version >= 9) &&
8148193fee93 working with 0.9.6 too (0.9.6 is coming with debian woody)
alex
parents: 3588
diff changeset
269 (directfb_micro_version >= 7))
8148193fee93 working with 0.9.6 too (0.9.6 is coming with debian woody)
alex
parents: 3588
diff changeset
270 {
8148193fee93 working with 0.9.6 too (0.9.6 is coming with debian woody)
alex
parents: 3588
diff changeset
271 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
272 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
273 }
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
274
3588
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
275 // 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
276 // DFBCHECK (DirectFBSetOption ("no-vt-switch",fb_dev_name));
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
277
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
278 // uncomment this if you want to allow vt switching
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
279 // DFBCHECK (DirectFBSetOption ("vt-switching",fb_dev_name));
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
280 DFBCHECK (DirectFBSetOption ("bg-color","00000000"));
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
281
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
282 DFBCHECK (DirectFBCreate (&dfb));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
283 DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
284
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
285 // 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
286
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
287 /* Enumerate display layers */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
288 DFBCHECK (dfb->EnumDisplayLayers( dfb, enum_layers_callback, &videolayer ));
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 if (!videolayer) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
291 // no yuy2 layer -> fallback to RGB
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
292 // printf( "\nNo additional layers have been found.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
293 no_yuy2 = 1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
294 // preinit_done = 1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
295 } else {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
296
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
297 // 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
298 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
299 /* dlc.width = dsc.width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
300 dlc.height = dsc.height;*/
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
301 dlc.pixelformat = DSPF_YUY2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
302 // dlc.options = DLOP_INTERLACED_VIDEO;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
303
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
304 /* Test the configuration, getting failed fields */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
305 ret = videolayer->TestConfiguration( videolayer, &dlc, &failed );
3339
7e0eeb649420 compile if no uyvy support (test this change)
alex
parents: 3275
diff changeset
306 if (ret == DFB_UNSUPPORTED && no_uyvy_support == 0) {
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
307 // printf("Videolayer does not support YUY2");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
308 dlc.pixelformat = DSPF_UYVY;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
309 ret = videolayer->TestConfiguration( videolayer, &dlc, &failed );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
310 if (ret != DFB_UNSUPPORTED) { no_yuy2 = 0;}
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
311 } else { no_yuy2 = 0;}
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
312 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
313
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
314
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
315 // just look at RGB things
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
316 modes[0].valid=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
317 modes[1].valid=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
318 modes[2].valid=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
319 modes[3].valid=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
320 DFBCHECK (dfb->EnumVideoModes(dfb,enum_modes_callback,NULL));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
321 // printf("No YUY2 %i\n",no_yuy2);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
322 // }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
323 preinit_done=1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
324 return 1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
325
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
326 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
327
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
328
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
329 static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width,
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
330 uint32_t d_height, uint32_t fullscreen, char *title,
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
331 uint32_t format)
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 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
334 * (Locals)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
335 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
336 DFBSurfaceDescription dsc;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
337 DFBResult ret;
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
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
340 int vm = fullscreen & 0x02;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
341 int zoom = fullscreen & 0x04;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
342
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
343 fs = fullscreen & 0x01;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
344 flip = fullscreen & 0x08;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
345
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
346 pixel_format=format;
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 in_width = width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
349 in_height = height;
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 if (d_width) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
352 out_width = d_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
353 out_height = d_height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
354 } else {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
355 d_width = out_width = width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
356 d_height = out_height = height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
357 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
358
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
359
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
360 if (!preinit()) return 1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
361
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
362
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
363 if (vm) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
364 // need better algorithm just hack
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
365 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
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
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
369 if (!no_yuy2) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
370 // 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
371 dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT;// | DLCONF_OPTIONS;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
372 dlc.width = in_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
373 dlc.height = in_height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
374
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
375 ret = videolayer->SetConfiguration( videolayer, &dlc );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
376
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
377 /* if (ret) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
378 printf("Set layer size failed\n");
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 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
381 dlc.flags = DLCONF_PIXELFORMAT;// | DLCONF_OPTIONS;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
382 //dlc.pixelformat = DSPF_YUY2; should be set by preinit
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
383 //dlc.options = (vcaps & DVCAPS_INTERLACED) ? DLOP_INTERLACED_VIDEO : 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
384 no_yuy2=1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
385 /* switch (dlc.pixelformat) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
386 case DSPF_ARGB: printf("Directfb frame format ARGB\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
387 frame_pixel_size = 4;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
388 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
389 case DSPF_RGB32: printf("Directfb frame format RGB32\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
390 frame_pixel_size = 4;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
391 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
392 case DSPF_RGB24: printf("Directfb frame format RGB24\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
393 frame_pixel_size = 3;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
394 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
395 case DSPF_RGB16: printf("Directfb frame format RGB16\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
396 frame_pixel_size = 2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
397 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
398 case DSPF_RGB15: printf("Directfb frame format RGB15\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
399 frame_pixel_size = 2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
400 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
401 case DSPF_YUY2: printf("Directfb frame format YUY2\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
402 frame_pixel_size = 2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
403 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
404 case DSPF_UYVY: printf("Directfb frame format UYVY\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
405 frame_pixel_size = 2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
406 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
407 default: printf("Directfb - unknown format ->exit\n"); return 1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
408 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
409 */ ret =videolayer->SetConfiguration( videolayer, &dlc );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
410 if (!ret) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
411 // printf("SetConfiguration for layer OK\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
412 ret = videolayer->GetSurface( videolayer, &primary );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
413 if (!ret){
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
414 no_yuy2=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
415 // printf("Get surface for layer OK\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
416 /* dsc.width=in_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
417 dsc.height=in_height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
418 dsc.flags = DSDESC_CAPS | DSDESC_HEIGHT | DSDESC_WIDTH;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
419 dsc.caps = DSCAPS_VIDEOONLY;//| DSCAPS_FLIPPING;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
420 primary->SetConfiguration(priamry,&dsc);*/
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
421 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
422 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
423
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
424 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
425
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
426 // mam pro flip pouzit tenhle flip nebo bitblt
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
427 dsc.flags = DSDESC_CAPS | DSDESC_PIXELFORMAT;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
428 dsc.caps = DSCAPS_PRIMARY | DSCAPS_VIDEOONLY;//| DSCAPS_FLIPPING;
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 switch (format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
431 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
432 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
433 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
434 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
435 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
436 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
437 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
438 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
439 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
440 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
441
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
442
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
443
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
444 if (no_yuy2) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
445 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary ));
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 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
448
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
449 extern float monitor_aspect;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
450
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
451 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
452 float aspect=h/w;
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
453 // printf("in out d: %d %d, %d %d, %d %d\n",in_width,in_height,out_width,out_height,d_width,d_height);
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
454 // 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
455
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
456 // if (fs) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
457 // scale fullscreen
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
458 if (aspect>1) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
459 aspect=w/h;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
460 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
461 } else {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
462 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
463 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
464 // } else {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
465 // 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
466 // };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
467 // if (ret) printf("SetScreenLocation failed\n");
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
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
470 DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height));
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 DFBCHECK (primary->GetPixelFormat (primary, &frame_format));
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 // temporary buffer buffer
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
475 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
476 dsc.caps = DSCAPS_SYSTEMONLY;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
477
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
478 dsc.width = in_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
479 dsc.height = in_height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
480
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
481 // 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
482 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
483 switch (frame_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
484 case DSPF_ARGB: printf("Directfb frame format ARGB\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
485 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
486 case DSPF_RGB32: printf("Directfb frame format RGB32\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
487 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
488 case DSPF_RGB24: printf("Directfb frame format RGB24\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
489 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
490 case DSPF_RGB16: printf("Directfb frame format RGB16\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
491 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
492 case DSPF_RGB15: printf("Directfb frame format RGB15\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
493 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
494 case DSPF_YUY2: printf("Directfb frame format YUY2\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
495 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
496 default: printf("Directfb - unknown format ->exit\n"); return 1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
497 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
498 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
499
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
500 switch (format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
501 case IMGFMT_RGB32: dsc.pixelformat = DSPF_ARGB; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
502 case IMGFMT_BGR32: dsc.pixelformat = DSPF_ARGB; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
503 case IMGFMT_RGB24: dsc.pixelformat = DSPF_RGB24; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
504 case IMGFMT_BGR24: dsc.pixelformat = DSPF_RGB24; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
505 case IMGFMT_RGB16: dsc.pixelformat = DSPF_RGB16; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
506 case IMGFMT_BGR16: dsc.pixelformat = DSPF_RGB16; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
507 case IMGFMT_RGB15: dsc.pixelformat = DSPF_RGB15; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
508 case IMGFMT_BGR15: dsc.pixelformat = DSPF_RGB15; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
509 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
510 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
511
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
512
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
513 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
514 * 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
515 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
516 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &frame));
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 DFBCHECK (frame->GetPixelFormat (frame, &frame_format));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
519
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
520 switch (frame_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
521 case DSPF_ARGB: //printf("Directfb frame format ARGB\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
522 frame_pixel_size = 4;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
523 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
524 case DSPF_RGB32: //printf("Directfb frame format RGB32\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
525 frame_pixel_size = 4;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
526 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
527 case DSPF_RGB24: //printf("Directfb frame format RGB24\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
528 frame_pixel_size = 3;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
529 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
530 case DSPF_RGB16: //printf("Directfb frame format RGB16\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
531 frame_pixel_size = 2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
532 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
533 case DSPF_RGB15: //printf("Directfb frame format RGB15\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
534 frame_pixel_size = 2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
535 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
536 case DSPF_YUY2: //printf("Directfb frame format YUY2\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
537 frame_pixel_size = 2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
538 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
539 case DSPF_UYVY: //printf("Directfb frame format UYVY\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
540 frame_pixel_size = 2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
541 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
542 default: printf("Directfb - unknown format ->exit\n"); return 1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
543 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
544
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
545
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
546 if (zoom) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
547 printf("-zoom is not yet supported\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
548 // return 1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
549 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
550 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
551 if (fs) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
552 printf("-fs can degrade image and performance\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 ((out_width < in_width || out_height < in_height) && (!fs)) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
557 printf("Screensize is smaller than video size !\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
558 // return 1; // doesn't matter we will
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 ((fs) && (no_yuy2)) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
562 // aspect ratio correction for fullscreen
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
563 out_height=d_height*screen_width/d_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
564 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
565 // printf("Going fullscreen !\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
566 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
567
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
568
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
569 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
570 * (Get keyboard)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
571 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
572 DFBCHECK (dfb->GetInputDevice (dfb, DIDID_KEYBOARD, &keyboard));
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 * Create an input buffer for the 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 (keyboard->CreateInputBuffer (keyboard, &buffer));
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 // yuv2rgb transform init
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
580
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
581 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
582
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
583 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
584
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
585 if (no_yuy2) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
586 xoffset = (screen_width - out_width) / 2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
587 yoffset = (screen_height - out_height) / 2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
588 } else {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
589 xoffset = 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
590 yoffset = 0;
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 // 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
593
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
594 return 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
595 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
596
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
597 static uint32_t query_format(uint32_t format)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
598 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
599 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
600
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
601 preinit();
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 // printf("Format query: %s\n",vo_format_name(format));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
604 switch (format) {
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 // 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
607 // so we couldn't report supported formats well
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
608
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
609 // Just support those detected by preinit
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
610 case IMGFMT_RGB32:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
611 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
612 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
613 case IMGFMT_RGB24:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
614 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
615 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
616 case IMGFMT_RGB16:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
617 case IMGFMT_BGR16:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
618 case IMGFMT_RGB15:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
619 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
620 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
621 case IMGFMT_YUY2: if (!no_yuy2) return ret|0x2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
622 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
623 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
624 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
625 // YV12 should work in all cases
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
626 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
627
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
628 return 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
629 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
630
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
631 static const vo_info_t *get_info(void)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
632 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
633 return &vo_info;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
634 }
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 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
637 unsigned char *srca, int stride)
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 void *dst;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
640 int pitch;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
641 int len;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
642
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
643 DFBCHECK (frame->Lock(frame,DSLF_WRITE,&dst,&pitch));
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 switch(frame_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
646 case DSPF_RGB32:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
647 case DSPF_ARGB:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
648 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
649 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
650
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
651 case DSPF_RGB24:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
652 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
653 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
654
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
655 case DSPF_RGB16:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
656 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
657 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
658
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
659 case DSPF_RGB15:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
660 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
661 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
662
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
663 case DSPF_YUY2:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
664 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
665 break;
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
666
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
667 case DSPF_UYVY:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
668 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
669 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
670 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
671 DFBCHECK (frame->Unlock(frame));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
672 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
673
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
674 static uint32_t draw_frame(uint8_t *src[])
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
675 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
676 void *dst;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
677 int pitch;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
678 int len;
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->Lock(frame,DSLF_WRITE,&dst,&pitch));
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 switch (frame_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
683 case DSPF_ARGB:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
684 case DSPF_RGB32:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
685 case DSPF_RGB24:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
686 case DSPF_RGB16:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
687 case DSPF_RGB15:switch (pixel_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
688 case IMGFMT_YV12:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
689 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
690 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
691 /* 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
692 /* case IMGFMT_YUY2:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
693 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
694 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
695 break;*/
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
696 // RGB - just copy
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
697 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
698
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
699 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
700 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
701 case DSPF_YUY2:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
702 switch (pixel_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
703 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
704 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
705 case IMGFMT_YUY2: {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
706 int i;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
707 for (i=0;i<in_height;i++) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
708 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
709 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
710 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
711 /*len = in_width * in_height * pitch;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
712 memcpy(dst,src[0],len);*/
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 // 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
715 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
716 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
717 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
718 DFBCHECK (frame->Unlock(frame));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
719 return 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
720 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
721
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
722 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
723 {
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 int err;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
726 void *dst;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
727 uint8_t *s;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
728 int pitch;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
729 int i;
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 err = frame->Lock(frame,DSLF_WRITE,&dst,&pitch);
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 // printf("Drawslice\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
734
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
735 switch (frame_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
736 case DSPF_ARGB:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
737 case DSPF_RGB32:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
738 case DSPF_RGB24:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
739 case DSPF_RGB16:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
740 case DSPF_RGB15:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
741 switch (pixel_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
742 case IMGFMT_YV12:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
743 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
744 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
745 // how to handle this? need conversion
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
746 /* case IMGFMT_YUY2: {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
747 int i;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
748 for (i=0;i<=h;i++) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
749 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
750 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
751 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
752 };
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 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
755 default: if (source_pixel_size==frame_pixel_size) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
756 dst += x * frame_pixel_size;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
757 s = src[0];
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
758 for (i=y;i<=(y+h);i++) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
759 memcpy(dst,s,w);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
760 dst += (pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
761 s += stride[0];
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
762 };
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 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
765
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
766 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
767 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
768 case DSPF_YUY2:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
769 switch (pixel_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
770 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
771 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
772 case IMGFMT_YUY2: {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
773 dst += x * frame_pixel_size;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
774 s = src[0];
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
775 for (i=y;i<=(y+h);i++) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
776 memcpy(dst,s,w);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
777 dst += (pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
778 s += stride[0];
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
779 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
780 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
781 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
782 // 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
783 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
784 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
785 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
786
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
787 frame->Unlock(frame);
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 return 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
790 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
791
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
792 extern void mplayer_put_key(int code);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
793
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
794 #include "../linux/keycodes.h"
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 static void check_events(void)
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
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
799 DFBInputEvent event;
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 if (buffer->GetEvent (buffer, &event) == DFB_OK) {
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
802 if (event.type == DIET_KEYPRESS) {
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
803 switch (event.keycode) {
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
804 case DIKC_ESCAPE:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
805 mplayer_put_key('q');
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
806 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
807 case DIKC_KP_PLUS: mplayer_put_key('+');break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
808 case DIKC_KP_MINUS: mplayer_put_key('-');break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
809 case DIKC_TAB: mplayer_put_key('\t');break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
810 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
811 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
812 case DIKC_UP: mplayer_put_key(KEY_UP);break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
813 case DIKC_DOWN: mplayer_put_key(KEY_DOWN);break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
814 case DIKC_LEFT: mplayer_put_key(KEY_LEFT);break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
815 case DIKC_RIGHT: mplayer_put_key(KEY_RIGHT);break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
816 case DIKC_ASTERISK:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
817 case DIKC_KP_MULT:mplayer_put_key('*');break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
818 case DIKC_KP_DIV: mplayer_put_key('/');break;
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
819 case DIKC_INSERT: mplayer_put_key(KEY_INSERT);break;
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
820 case DIKC_DELETE: mplayer_put_key(KEY_DELETE);break;
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
821 case DIKC_HOME: mplayer_put_key(KEY_HOME);break;
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
822 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
823
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
824 default:mplayer_put_key(event.key_ascii);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
825 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
826 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
827 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
828 // 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
829 // and this causes problems during seek)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
830 // temporary workabout should be solved in the future
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
831
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
832 buffer->Reset(buffer);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
833
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
834 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
835
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
836 static void draw_osd(void)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
837 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
838 vo_draw_text(in_width, in_height, draw_alpha);
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
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
841 static void flip_page(void)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
842 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
843 DFBSurfaceBlittingFlags flags=DSBLIT_NOFX;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
844
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
845 DFBCHECK (primary->SetBlittingFlags(primary,flags));
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 if (stretch) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
848 DFBRectangle rect;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
849 rect.x=xoffset;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
850 rect.y=yoffset;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
851 rect.w=out_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
852 rect.h=out_height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
853
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
854 DFBCHECK (primary->StretchBlit(primary,frame,NULL,&rect));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
855 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
856 else {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
857 DFBCHECK (primary->Blit(primary,frame,NULL,xoffset,yoffset));
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 // DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAITFORSYNC));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
860 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
861
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
862 static void uninit(void)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
863 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
864 if (verbose > 0)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
865 printf("uninit\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
866
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 * (Release)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
869 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
870 // printf("Release buffer\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
871 buffer->Release (buffer);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
872 // printf("Release keyb\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
873 keyboard->Release (keyboard);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
874 // printf("Release frame\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
875 frame->Release (frame);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
876
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
877 // 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
878
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
879 // printf("Release primary\n");
3588
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
880 primary->Release (primary);
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
881 // switch off BES
8e56fe18e7fb Applied patch by Jiri Svoboda <Jiri.Svoboda@seznam.cz>:
pl
parents: 3341
diff changeset
882 if (videolayer) videolayer->SetOpacity(videolayer,0);
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
883 // printf("Release videolayer\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
884 // if (videolayer) videolayer->Release(videolayer);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
885 // printf("Release dfb\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
886 // dfb->Release (dfb);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
887 // preinit_done=0;
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 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
890