annotate libvo/vo_directfb.c @ 3440:03caf0beaecc

kernel32 hack for vivo audio
author arpi
date Mon, 10 Dec 2001 19:15:45 +0000
parents 59390e321c4e
children 8e56fe18e7fb
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
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
267 if (!fb_dev_name && !(fb_dev_name = getenv("FRAMEBUFFER"))) fb_dev_name = "/dev/fb0";
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
268 DFBCHECK (DirectFBSetOption ("fbdev",fb_dev_name));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
269
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
270 DFBCHECK (DirectFBCreate (&dfb));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
271 DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
272
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
273 // 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
274
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
275 /* Enumerate display layers */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
276 DFBCHECK (dfb->EnumDisplayLayers( dfb, enum_layers_callback, &videolayer ));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
277
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
278 if (!videolayer) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
279 // no yuy2 layer -> fallback to RGB
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
280 // printf( "\nNo additional layers have been found.\n" );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
281 no_yuy2 = 1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
282 // preinit_done = 1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
283 } else {
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 // 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
286 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
287 /* dlc.width = dsc.width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
288 dlc.height = dsc.height;*/
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
289 dlc.pixelformat = DSPF_YUY2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
290 // dlc.options = DLOP_INTERLACED_VIDEO;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
291
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
292 /* Test the configuration, getting failed fields */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
293 ret = videolayer->TestConfiguration( videolayer, &dlc, &failed );
3339
7e0eeb649420 compile if no uyvy support (test this change)
alex
parents: 3275
diff changeset
294 if (ret == DFB_UNSUPPORTED && no_uyvy_support == 0) {
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
295 // printf("Videolayer does not support YUY2");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
296 dlc.pixelformat = DSPF_UYVY;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
297 ret = videolayer->TestConfiguration( videolayer, &dlc, &failed );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
298 if (ret != DFB_UNSUPPORTED) { no_yuy2 = 0;}
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
299 } else { no_yuy2 = 0;}
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
300 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
301
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
302
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
303 // just look at RGB things
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
304 modes[0].valid=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
305 modes[1].valid=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
306 modes[2].valid=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
307 modes[3].valid=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
308 DFBCHECK (dfb->EnumVideoModes(dfb,enum_modes_callback,NULL));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
309 // printf("No YUY2 %i\n",no_yuy2);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
310 // }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
311 preinit_done=1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
312 return 1;
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
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
316
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
317 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
318 uint32_t d_height, uint32_t fullscreen, char *title,
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
319 uint32_t format)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
320 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
321 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
322 * (Locals)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
323 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
324 DFBSurfaceDescription dsc;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
325 DFBResult ret;
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 int vm = fullscreen & 0x02;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
329 int zoom = fullscreen & 0x04;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
330
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
331 fs = fullscreen & 0x01;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
332 flip = fullscreen & 0x08;
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 pixel_format=format;
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 in_width = width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
337 in_height = height;
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 if (d_width) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
340 out_width = d_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
341 out_height = d_height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
342 } else {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
343 d_width = out_width = width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
344 d_height = out_height = height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
345 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
346
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 if (!preinit()) return 1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
349
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 (vm) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
352 // need better algorithm just hack
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
353 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
354 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
355
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
356
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
357 if (!no_yuy2) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
358 // 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
359 dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT;// | DLCONF_OPTIONS;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
360 dlc.width = in_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
361 dlc.height = in_height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
362
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
363 ret = videolayer->SetConfiguration( videolayer, &dlc );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
364
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
365 /* if (ret) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
366 printf("Set layer size failed\n");
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 dlc.flags = DLCONF_PIXELFORMAT;// | DLCONF_OPTIONS;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
370 //dlc.pixelformat = DSPF_YUY2; should be set by preinit
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
371 //dlc.options = (vcaps & DVCAPS_INTERLACED) ? DLOP_INTERLACED_VIDEO : 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
372 no_yuy2=1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
373 /* switch (dlc.pixelformat) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
374 case DSPF_ARGB: printf("Directfb frame format ARGB\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
375 frame_pixel_size = 4;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
376 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
377 case DSPF_RGB32: printf("Directfb frame format RGB32\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
378 frame_pixel_size = 4;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
379 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
380 case DSPF_RGB24: printf("Directfb frame format RGB24\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
381 frame_pixel_size = 3;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
382 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
383 case DSPF_RGB16: printf("Directfb frame format RGB16\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
384 frame_pixel_size = 2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
385 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
386 case DSPF_RGB15: printf("Directfb frame format RGB15\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
387 frame_pixel_size = 2;
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_YUY2: printf("Directfb frame format YUY2\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
390 frame_pixel_size = 2;
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_UYVY: printf("Directfb frame format UYVY\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
393 frame_pixel_size = 2;
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 default: printf("Directfb - unknown format ->exit\n"); return 1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
396 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
397 */ ret =videolayer->SetConfiguration( videolayer, &dlc );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
398 if (!ret) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
399 // printf("SetConfiguration for layer OK\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
400 ret = videolayer->GetSurface( videolayer, &primary );
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
401 if (!ret){
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
402 no_yuy2=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
403 // printf("Get surface for layer OK\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
404 /* dsc.width=in_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
405 dsc.height=in_height;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
406 dsc.flags = DSDESC_CAPS | DSDESC_HEIGHT | DSDESC_WIDTH;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
407 dsc.caps = DSCAPS_VIDEOONLY;//| DSCAPS_FLIPPING;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
408 primary->SetConfiguration(priamry,&dsc);*/
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
409 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
410 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
411
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
412 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
413
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
414 // mam pro flip pouzit tenhle flip nebo bitblt
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
415 dsc.flags = DSDESC_CAPS | DSDESC_PIXELFORMAT;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
416 dsc.caps = DSCAPS_PRIMARY | DSCAPS_VIDEOONLY;//| DSCAPS_FLIPPING;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
417
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
418 switch (format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
419 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
420 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
421 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
422 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
423 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
424 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
425 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
426 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
427 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
428 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
429
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
430
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
431
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
432 if (no_yuy2) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
433 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary ));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
434 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
435 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
436
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
437 extern float monitor_aspect;
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
438
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
439 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
440 float aspect=h/w;
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
441 // 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
442 // 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
443
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
444 // if (fs) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
445 // scale fullscreen
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
446 if (aspect>1) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
447 aspect=w/h;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
448 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
449 } else {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
450 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
451 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
452 // } else {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
453 // 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
454 // };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
455 // if (ret) printf("SetScreenLocation failed\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
456 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
457
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
458 DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
459
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
460 DFBCHECK (primary->GetPixelFormat (primary, &frame_format));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
461
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
462 // temporary buffer buffer
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
463 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
464 dsc.caps = DSCAPS_SYSTEMONLY;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
465
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
466 dsc.width = in_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
467 dsc.height = in_height;
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 // 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
470 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
471 switch (frame_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
472 case DSPF_ARGB: printf("Directfb frame format ARGB\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
473 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
474 case DSPF_RGB32: printf("Directfb frame format RGB32\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
475 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
476 case DSPF_RGB24: printf("Directfb frame format RGB24\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
477 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
478 case DSPF_RGB16: printf("Directfb frame format RGB16\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
479 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
480 case DSPF_RGB15: printf("Directfb frame format RGB15\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
481 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
482 case DSPF_YUY2: printf("Directfb frame format YUY2\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
483 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
484 default: printf("Directfb - unknown format ->exit\n"); return 1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
485 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
486 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
487
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
488 switch (format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
489 case IMGFMT_RGB32: dsc.pixelformat = DSPF_ARGB; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
490 case IMGFMT_BGR32: dsc.pixelformat = DSPF_ARGB; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
491 case IMGFMT_RGB24: dsc.pixelformat = DSPF_RGB24; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
492 case IMGFMT_BGR24: dsc.pixelformat = DSPF_RGB24; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
493 case IMGFMT_RGB16: dsc.pixelformat = DSPF_RGB16; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
494 case IMGFMT_BGR16: dsc.pixelformat = DSPF_RGB16; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
495 case IMGFMT_RGB15: dsc.pixelformat = DSPF_RGB15; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
496 case IMGFMT_BGR15: dsc.pixelformat = DSPF_RGB15; break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
497 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
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
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
501 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
502 * 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
503 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
504 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &frame));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
505
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
506 DFBCHECK (frame->GetPixelFormat (frame, &frame_format));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
507
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
508 switch (frame_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
509 case DSPF_ARGB: //printf("Directfb frame format ARGB\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
510 frame_pixel_size = 4;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
511 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
512 case DSPF_RGB32: //printf("Directfb frame format RGB32\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
513 frame_pixel_size = 4;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
514 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
515 case DSPF_RGB24: //printf("Directfb frame format RGB24\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
516 frame_pixel_size = 3;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
517 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
518 case DSPF_RGB16: //printf("Directfb frame format RGB16\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
519 frame_pixel_size = 2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
520 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
521 case DSPF_RGB15: //printf("Directfb frame format RGB15\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
522 frame_pixel_size = 2;
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_YUY2: //printf("Directfb frame format YUY2\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
525 frame_pixel_size = 2;
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_UYVY: //printf("Directfb frame format UYVY\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
528 frame_pixel_size = 2;
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 default: printf("Directfb - unknown format ->exit\n"); return 1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
531 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
532
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
533
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
534 if (zoom) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
535 printf("-zoom is not yet supported\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
536 // return 1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
537 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
538 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
539 if (fs) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
540 printf("-fs can degrade image and performance\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
541 // return 1;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
542 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
543 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
544 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
545 printf("Screensize is smaller than video size !\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
546 // return 1; // doesn't matter we will
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
547 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
548
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
549 if ((fs) && (no_yuy2)) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
550 // aspect ratio correction for fullscreen
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
551 out_height=d_height*screen_width/d_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
552 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
553 // printf("Going fullscreen !\n");
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
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
557 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
558 * (Get keyboard)
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 DFBCHECK (dfb->GetInputDevice (dfb, DIDID_KEYBOARD, &keyboard));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
561
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
562 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
563 * Create an input buffer for the keyboard.
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
564 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
565 DFBCHECK (keyboard->CreateInputBuffer (keyboard, &buffer));
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 // clear the screen
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
568
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
569 if (no_yuy2) {DFBCHECK (primary->FillRectangle (primary, 0, 0, screen_width, screen_height));
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
570 }
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
571 else {
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
572 // create temporary surface and clean
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
573 DFBSurfaceDescription dsc;
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
574 DFBResult ret;
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
575 IDirectFBSurface *primary = NULL;
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
576 int sh,sw;
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
577
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
578 dsc.flags = DSDESC_CAPS;
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
579 dsc.caps = DSCAPS_PRIMARY | DSCAPS_VIDEOONLY;//| DSCAPS_FLIPPING;
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
580 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary));
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
581 DFBCHECK (primary->GetSize (primary, &sw, &sh));
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
582 DFBCHECK (primary->FillRectangle (primary, 0, 0, sw, sh));
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
583 primary->Release(primary);
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
584
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
585 }
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
586
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
587 // yuv2rgb transform init
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
588
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
589 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
590
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
591 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
592
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
593 if (no_yuy2) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
594 xoffset = (screen_width - out_width) / 2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
595 yoffset = (screen_height - out_height) / 2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
596 } else {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
597 xoffset = 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
598 yoffset = 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
599 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
600 // 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
601
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
602 return 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
603 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
604
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
605 static uint32_t query_format(uint32_t format)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
606 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
607 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
608
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
609 preinit();
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
610
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
611 // printf("Format query: %s\n",vo_format_name(format));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
612 switch (format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
613
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
614 // 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
615 // so we couldn't report supported formats well
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
616
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
617 // Just support those detected by preinit
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
618 case IMGFMT_RGB32:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
619 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
620 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
621 case IMGFMT_RGB24:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
622 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
623 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
624 case IMGFMT_RGB16:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
625 case IMGFMT_BGR16:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
626 case IMGFMT_RGB15:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
627 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
628 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
629 case IMGFMT_YUY2: if (!no_yuy2) return ret|0x2;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
630 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
631 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
632 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
633 // YV12 should work in all cases
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 return 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
637 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
638
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
639 static const vo_info_t *get_info(void)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
640 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
641 return &vo_info;
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
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
644 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
645 unsigned char *srca, int stride)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
646 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
647 void *dst;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
648 int pitch;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
649 int len;
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 DFBCHECK (frame->Lock(frame,DSLF_WRITE,&dst,&pitch));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
652
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
653 switch(frame_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
654 case DSPF_RGB32:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
655 case DSPF_ARGB:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
656 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
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_RGB24:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
660 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
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_RGB16:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
664 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
665 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
666
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
667 case DSPF_RGB15:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
668 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
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 case DSPF_YUY2:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
672 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
673 break;
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
674
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
675 case DSPF_UYVY:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
676 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
677 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
678 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
679 DFBCHECK (frame->Unlock(frame));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
680 }
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 static uint32_t draw_frame(uint8_t *src[])
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
683 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
684 void *dst;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
685 int pitch;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
686 int len;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
687
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
688 DFBCHECK (frame->Lock(frame,DSLF_WRITE,&dst,&pitch));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
689
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
690 switch (frame_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
691 case DSPF_ARGB:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
692 case DSPF_RGB32:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
693 case DSPF_RGB24:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
694 case DSPF_RGB16:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
695 case DSPF_RGB15:switch (pixel_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
696 case IMGFMT_YV12:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
697 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
698 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
699 /* 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
700 /* case IMGFMT_YUY2:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
701 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
702 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
703 break;*/
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
704 // RGB - just copy
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
705 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
706
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
707 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
708 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
709 case DSPF_YUY2:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
710 switch (pixel_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
711 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
712 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
713 case IMGFMT_YUY2: {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
714 int i;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
715 for (i=0;i<in_height;i++) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
716 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
717 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
718 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
719 /*len = in_width * in_height * pitch;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
720 memcpy(dst,src[0],len);*/
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
721 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
722 // 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
723 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
724 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
725 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
726 DFBCHECK (frame->Unlock(frame));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
727 return 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
728 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
729
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
730 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
731 {
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 int err;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
734 void *dst;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
735 uint8_t *s;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
736 int pitch;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
737 int i;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
738
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
739 err = frame->Lock(frame,DSLF_WRITE,&dst,&pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
740
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
741 // printf("Drawslice\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
742
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
743 switch (frame_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
744 case DSPF_ARGB:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
745 case DSPF_RGB32:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
746 case DSPF_RGB24:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
747 case DSPF_RGB16:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
748 case DSPF_RGB15:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
749 switch (pixel_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
750 case IMGFMT_YV12:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
751 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
752 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
753 // how to handle this? need conversion
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
754 /* case IMGFMT_YUY2: {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
755 int i;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
756 for (i=0;i<=h;i++) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
757 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
758 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
759 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
760 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
761 break;
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 default: if (source_pixel_size==frame_pixel_size) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
764 dst += x * frame_pixel_size;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
765 s = src[0];
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
766 for (i=y;i<=(y+h);i++) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
767 memcpy(dst,s,w);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
768 dst += (pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
769 s += stride[0];
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
770 };
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
771 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
772 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
773
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
774 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
775 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
776 case DSPF_YUY2:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
777 switch (pixel_format) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
778 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
779 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
780 case IMGFMT_YUY2: {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
781 dst += x * frame_pixel_size;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
782 s = src[0];
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
783 for (i=y;i<=(y+h);i++) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
784 memcpy(dst,s,w);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
785 dst += (pitch);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
786 s += stride[0];
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
787 };
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 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
790 // 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
791 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
792 break;
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
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
795 frame->Unlock(frame);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
796
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
797 return 0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
798 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
799
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
800 extern void mplayer_put_key(int code);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
801
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
802 #include "../linux/keycodes.h"
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
803
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
804 static void check_events(void)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
805 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
806
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
807 DFBInputEvent event;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
808
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
809 if (buffer->GetEvent (buffer, &event) == DFB_OK) {
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
810 if (event.type == DIET_KEYPRESS) {
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
811 switch (event.keycode) {
3275
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
812 case DIKC_ESCAPE:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
813 mplayer_put_key('q');
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
814 break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
815 case DIKC_KP_PLUS: mplayer_put_key('+');break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
816 case DIKC_KP_MINUS: mplayer_put_key('-');break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
817 case DIKC_TAB: mplayer_put_key('\t');break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
818 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
819 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
820 case DIKC_UP: mplayer_put_key(KEY_UP);break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
821 case DIKC_DOWN: mplayer_put_key(KEY_DOWN);break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
822 case DIKC_LEFT: mplayer_put_key(KEY_LEFT);break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
823 case DIKC_RIGHT: mplayer_put_key(KEY_RIGHT);break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
824 case DIKC_ASTERISK:
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
825 case DIKC_KP_MULT:mplayer_put_key('*');break;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
826 case DIKC_KP_DIV: mplayer_put_key('/');break;
3341
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
827 case DIKC_INSERT: mplayer_put_key(KEY_INSERT);break;
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
828 case DIKC_DELETE: mplayer_put_key(KEY_DELETE);break;
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
829 case DIKC_HOME: mplayer_put_key(KEY_HOME);break;
59390e321c4e -aspect ration correction
atmos4
parents: 3339
diff changeset
830 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
831
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
832 default:mplayer_put_key(event.key_ascii);
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 // 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
837 // and this causes problems during seek)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
838 // temporary workabout should be solved in the future
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 buffer->Reset(buffer);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
841
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
842 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
843
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
844 static void draw_osd(void)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
845 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
846 vo_draw_text(in_width, in_height, draw_alpha);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
847 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
848
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
849 static void flip_page(void)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
850 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
851 DFBSurfaceBlittingFlags flags=DSBLIT_NOFX;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
852
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
853 DFBCHECK (primary->SetBlittingFlags(primary,flags));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
854
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
855 if (stretch) {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
856 DFBRectangle rect;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
857 rect.x=xoffset;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
858 rect.y=yoffset;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
859 rect.w=out_width;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
860 rect.h=out_height;
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 DFBCHECK (primary->StretchBlit(primary,frame,NULL,&rect));
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 else {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
865 DFBCHECK (primary->Blit(primary,frame,NULL,xoffset,yoffset));
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 // DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAITFORSYNC));
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
868 }
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 static void uninit(void)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
871 {
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
872 if (verbose > 0)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
873 printf("uninit\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
874
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
875 /*
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
876 * (Release)
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
877 */
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
878 // printf("Release buffer\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
879 buffer->Release (buffer);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
880 // printf("Release keyb\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
881 keyboard->Release (keyboard);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
882 // printf("Release frame\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
883 frame->Release (frame);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
884
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
885 // 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
886
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
887 // printf("Release primary\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
888 // primary->Release (primary);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
889 // printf("Release videolayer\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
890 // if (videolayer) videolayer->Release(videolayer);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
891 // printf("Release dfb\n");
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
892 // dfb->Release (dfb);
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
893 // preinit_done=0;
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
894
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
895 }
38344371432f vo DirectFB support by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
arpi
parents:
diff changeset
896