annotate libvo/vo_ggi.c @ 1132:80a0f8aa2360

Added for development only this is in pre-alpha state, do not use!
author atmosfear
date Fri, 15 Jun 2001 16:31:19 +0000
parents
children c33f8b7488d1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1132
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
1 /*
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
2 vo_ggi.c - General Graphics Interface (GGI) Renderer for MPlayer
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
3
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
4 (C) Alex Beregszaszi <alex@naxine.org>
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
5
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
6 Uses libGGI - http://www.ggi-project.org/
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
7 */
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
8
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
9 #define DISP
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
10
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
11 #include <stdio.h>
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
12 #include <stdlib.h>
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
13 #include <string.h>
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
14 #include <errno.h>
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
15
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
16 #include "config.h"
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
17 #include "video_out.h"
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
18 #include "video_out_internal.h"
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
19
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
20 #include "yuv2rgb.h"
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
21
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
22 #include <ggi/ggi.h>
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
23 #include "fastmemcpy.h"
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
24
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
25 LIBVO_EXTERN (ggi)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
26
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
27 static vo_info_t vo_info =
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
28 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
29 "General Graphics Interface (GGI) output",
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
30 "ggi",
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
31 "Alex Beregszaszi <alex@naxine.org>",
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
32 ""
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
33 };
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
34
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
35 extern int verbose;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
36
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
37 static char *ggi_output_name = NULL;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
38 static ggi_visual_t ggi_vis;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
39 static ggi_directbuffer *ggi_buffer;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
40 static int bpp = 0;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
41 static uint32_t virt_width;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
42 static uint32_t virt_height;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
43 static ggi_pixel white;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
44 static ggi_pixel black;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
45
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
46 static int ggi_setmode(uint32_t d_width, uint32_t d_height, int d_depth, int format)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
47 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
48 ggi_mode mode =
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
49 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
50 1, /* frames */
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
51 { GGI_AUTO, GGI_AUTO }, /* visible */
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
52 { GGI_AUTO, GGI_AUTO }, /* virt */
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
53 { GGI_AUTO, GGI_AUTO }, /* size */
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
54 GT_AUTO, /* graphtype */
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
55 { GGI_AUTO, GGI_AUTO } /* dots per pixel */
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
56 };
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
57 ggi_color pal[256];
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
58 int depth;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
59
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
60 mode.visible.x = mode.virt.x = d_width;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
61 mode.visible.y = mode.virt.y = d_height;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
62
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
63 switch(d_depth)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
64 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
65 case 1:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
66 mode.graphtype = GT_1BIT;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
67 depth = 1;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
68 break;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
69 case 2:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
70 mode.graphtype = GT_2BIT;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
71 depth = 2;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
72 break;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
73 case 4:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
74 mode.graphtype = GT_4BIT;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
75 depth = 4;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
76 break;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
77 case 8:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
78 mode.graphtype = GT_8BIT;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
79 depth = 8;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
80 break;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
81 case 15:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
82 mode.graphtype = GT_15BIT;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
83 depth = 15;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
84 break;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
85 case 16:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
86 mode.graphtype = GT_16BIT;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
87 depth = 16;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
88 break;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
89 case 24:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
90 mode.graphtype = GT_24BIT;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
91 depth = 24;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
92 break;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
93 case 32:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
94 mode.graphtype = GT_32BIT;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
95 depth = 32;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
96 break;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
97 default:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
98 printf("ggi-setmode: unknown bit depth - using auto\n");
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
99 mode.graphtype = GT_AUTO;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
100 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
101
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
102 ggiCheckMode(ggi_vis, &mode);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
103
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
104 if (ggiSetMode(ggi_vis, &mode) != 0)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
105 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
106 printf("ggi-setmode: unable to set mode\n");
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
107 ggiClose(ggi_vis);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
108 ggiExit();
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
109 return(-1);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
110 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
111
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
112 virt_width = mode.virt.x;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
113 virt_height = mode.virt.y;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
114 vo_screenwidth = mode.visible.x;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
115 vo_screenheight = mode.visible.y;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
116 vo_depthonscreen = depth;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
117 bpp = depth; /* byte per pixel = depth ? */
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
118
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
119
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
120 #ifdef get_db_info
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
121 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
122 const ggi_directbuffer *db = ggiDBGetBuffer(ggi_vis, 0);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
123
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
124 if (db)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
125 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
126 vo_depthonscreen = db->buffer.plb.pixelformat->depth;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
127 bpp = db->buffer.plb.pixelformat->size / 8;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
128 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
129 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
130 #endif
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
131
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
132 if (GT_SCHEME(mode.graphtype) == GT_PALETTE)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
133 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
134 ggiSetColorfulPalette(ggi_vis);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
135 ggiGetPalette(ggi_vis, 0, 1 << bpp, pal);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
136 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
137
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
138 if (verbose)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
139 printf("ggi-setmode: %dx%d (virt: %dx%d) %d depth, %d bpp\n", vo_screenwidth,
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
140 vo_screenheight, virt_width, virt_height, vo_depthonscreen, bpp);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
141
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
142 return(0);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
143 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
144
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
145
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
146 static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width,
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
147 uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
148 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
149 printf("\nggi: THIS DRIVER IS IN PRE-ALPHA PHASE, DO NOT USE!\n\n");
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
150 if (ggiInit() != 0)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
151 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
152 printf("ggi-init: unable to initialize GGI\n");
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
153 return(-1);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
154 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
155
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
156 if ((ggi_vis = ggiOpen(ggi_output_name)) == NULL)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
157 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
158 printf("ggi-init: unable to open GGI for %s output\n",
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
159 (ggi_output_name == NULL) ? "default" : ggi_output_name);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
160 ggiExit();
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
161 return(-1);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
162 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
163
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
164 switch(format)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
165 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
166 case IMGFMT_RGB8:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
167 bpp = 8;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
168 break;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
169 case IMGFMT_RGB15:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
170 bpp = 15;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
171 break;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
172 case IMGFMT_RGB16:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
173 bpp = 16;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
174 break;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
175 case IMGFMT_RGB24:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
176 bpp = 24;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
177 break;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
178 case IMGFMT_RGB32:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
179 bpp = 32;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
180 break;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
181 case IMGFMT_BGR8:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
182 bpp = 8;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
183 break;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
184 case IMGFMT_BGR15:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
185 bpp = 15;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
186 break;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
187 case IMGFMT_BGR16:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
188 bpp = 16;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
189 break;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
190 case IMGFMT_BGR24:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
191 bpp = 24;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
192 break;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
193 case IMGFMT_BGR32:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
194 bpp = 32;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
195 break;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
196 case IMGFMT_YV12: /* rgb, 24bit */
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
197 bpp = 16;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
198 yuv2rgb_init(32/*screendepth*/, MODE_RGB);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
199 break;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
200 default:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
201 printf("ggi-init: no suitable image format found\n");
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
202 return(-1);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
203 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
204
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
205 ggiSetFlags(ggi_vis, GGIFLAG_ASYNC);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
206
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
207 if (ggi_setmode(d_width, d_height, 32/*bpp*/, format) != 0)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
208 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
209 printf("ggi-init: setmode returned with error\n");
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
210 return(-1);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
211 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
212
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
213 ggi_buffer = (ggi_directbuffer *)ggiDBGetBuffer(ggi_vis, 0);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
214
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
215 if (ggi_buffer == NULL)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
216 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
217 printf("ggi-init: double buffering is not available\n");
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
218 ggiClose(ggi_vis);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
219 ggiExit();
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
220 return(-1);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
221 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
222
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
223 if (!(ggi_buffer->type & GGI_DB_SIMPLE_PLB) ||
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
224 (ggi_buffer->page_size != 0) ||
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
225 (ggi_buffer->write == NULL) ||
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
226 (ggi_buffer->noaccess != 0) ||
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
227 (ggi_buffer->align != 0))
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
228 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
229 printf("ggi-init: incorrect video memory type\n");
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
230 ggiClose(ggi_vis);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
231 ggiExit();
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
232 return(-1);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
233 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
234
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
235 /* just for fun */
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
236 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
237 ggi_color col;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
238
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
239 /* set black */
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
240 col.r = col.g = col.b = 0x0000;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
241 black = ggiMapColor(ggi_vis, &col);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
242
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
243 /* set white */
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
244 col.r = col.g = col.b = 0xffff;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
245 white = ggiMapColor(ggi_vis, &col);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
246
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
247 ggiSetGCForeground(ggi_vis, white);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
248 ggiSetGCBackground(ggi_vis, black);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
249 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
250
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
251 return(0);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
252 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
253
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
254 static const vo_info_t* get_info(void)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
255 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
256 return &vo_info;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
257 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
258
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
259 static uint32_t draw_frame(uint8_t *src[])
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
260 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
261 uint8_t *ptr;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
262 int y, x, i;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
263 /*int bppmul = vo_depthonscreen/8;*/
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
264
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
265 ggiResourceAcquire(ggi_buffer->resource, GGI_ACTYPE_WRITE);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
266 ggiSetDisplayFrame(ggi_vis, ggi_buffer->frame);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
267 ggiSetWriteFrame(ggi_vis, ggi_buffer->frame);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
268
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
269 ptr = ggi_buffer->write;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
270
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
271 // for (i = 1; i < 3; i++)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
272 /* for (x = 0; x < virt_width; x++)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
273 for (y = 0; y < virt_height; y++)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
274 *ptr++ = src[0][x*virt_height+y];*/
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
275 memcpy(ptr,src[0],virt_width*virt_height*(bpp/8));
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
276
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
277 ggiPuts(ggi_vis, x/2, y-10, "MPlayer GGI");
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
278
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
279 ggiResourceRelease(ggi_buffer->resource);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
280 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
281
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
282 static void flip_page(void)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
283 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
284 check_events();
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
285 ggiFlush(ggi_vis);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
286 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
287
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
288 static uint32_t draw_slice(uint8_t *src[], int stride[], int w, int h,
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
289 int x, int y)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
290 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
291 uint8_t *dst;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
292
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
293 dst = ggi_buffer->write + (virt_width * y + x) * (bpp/8);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
294 yuv2rgb(dst, src[0], src[1], src[2], w, h, virt_width*(bpp/8),
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
295 stride[0], stride[1]);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
296 //draw_frame(dst);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
297
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
298 // dst = image_data + (virt_width * y + x) * (bpp/8);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
299 // yuv2rgb(dst, src[0], src[1], src[2], w, h, virt_width*(bpp/8),
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
300 // stride[0], stride[1]);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
301 return(0);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
302 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
303
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
304 static uint32_t query_format(uint32_t format)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
305 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
306 switch(format){
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
307 case IMGFMT_YV12:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
308 return 1;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
309 case IMGFMT_RGB8:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
310 case IMGFMT_RGB15:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
311 case IMGFMT_RGB16:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
312 case IMGFMT_RGB24:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
313 case IMGFMT_RGB32:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
314 case IMGFMT_BGR8:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
315 case IMGFMT_BGR15:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
316 case IMGFMT_BGR16:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
317 case IMGFMT_BGR24:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
318 case IMGFMT_BGR32:
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
319 return 1;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
320 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
321 return 0;
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
322 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
323
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
324 static void uninit(void)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
325 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
326 ggiResourceRelease(ggi_buffer->resource);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
327 ggiClose(ggi_vis);
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
328 ggiExit();
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
329 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
330
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
331 static void check_events(void)
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
332 {
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
333 /* add ggiPollEvent stuff */
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
334 }
80a0f8aa2360 Added for development only this is in pre-alpha state, do not use!
atmosfear
parents:
diff changeset
335