annotate libvo/vo_cvidix.c @ 11167:cff5d0ca3275

sync
author nicolas
date Sat, 18 Oct 2003 14:50:25 +0000
parents 85f4534d1edb
children 30eccb0d1a64
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
1 /*
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
2 VIDIX accelerated overlay on black background
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
3 should work on any OS
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
4 TODO: implement blanking, aspect, geometry,fs etc.
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
5
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
6 (C) Sascha Sommer
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
7
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
8
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
9 */
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
10
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
11 #include <stdio.h>
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
12 #include <stdlib.h>
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
13 #include <string.h>
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
14 #include <math.h>
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
15 #include <errno.h>
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
16
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
17 #include "config.h"
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
18 #include "video_out.h"
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
19 #include "video_out_internal.h"
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
20
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
21 #include "mp_msg.h"
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
22
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
23 #include "vosub_vidix.h"
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
24 #include "../vidix/vidixlib.h"
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
25
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
26
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
27 static vo_info_t info = {
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
28 "VIDIX",
11017
afdf982f0673 consolevidix -> cvidix
faust3
parents: 10979
diff changeset
29 "cvidix",
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
30 "Sascha Sommer",
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
31 ""
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
32 };
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
33
11017
afdf982f0673 consolevidix -> cvidix
faust3
parents: 10979
diff changeset
34 LIBVO_EXTERN(cvidix)
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
35
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
36 #define UNUSED(x) ((void)(x)) /* Removes warning about unused arguments */
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
37
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
38 /* VIDIX related */
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
39 static char *vidix_name;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
40
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
41
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
42 static vidix_grkey_t gr_key;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
43
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
44 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,uint32_t d_height, uint32_t flags, char *title, uint32_t format){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
45 if(vidix_init(width, height, 0, 0, d_width, d_height, format, 32, 640, 480))mp_msg(MSGT_VO, MSGL_FATAL, "Can't initialize VIDIX driver: %s\n", strerror(errno));
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
46 /*set colorkey*/
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
47 vidix_start();
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
48 if(vidix_grkey_support()){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
49 vidix_grkey_get(&gr_key);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
50 gr_key.key_op = KEYS_PUT;
11158
85f4534d1edb Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents: 11019
diff changeset
51 if (vo_colorkey != 0xff000000)
85f4534d1edb Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents: 11019
diff changeset
52 {
85f4534d1edb Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents: 11019
diff changeset
53 gr_key.ckey.op = CKEY_TRUE;
85f4534d1edb Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents: 11019
diff changeset
54 gr_key.ckey.red = (vo_colorkey & 0x00FF0000) >> 16;
85f4534d1edb Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents: 11019
diff changeset
55 gr_key.ckey.green = (vo_colorkey & 0x0000FF00) >> 8;
85f4534d1edb Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents: 11019
diff changeset
56 gr_key.ckey.blue = vo_colorkey & 0x000000FF;
85f4534d1edb Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents: 11019
diff changeset
57 }
85f4534d1edb Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents: 11019
diff changeset
58 else
85f4534d1edb Colorkeying can be disabled. Fbdev, svga and vesa vidix colorkeying support
alex
parents: 11019
diff changeset
59 gr_key.ckey.op = CKEY_FALSE;
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
60 vidix_grkey_set(&gr_key);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
61 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
62 return 0;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
63 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
64
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
65 static void check_events(void){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
66 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
67
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
68 /* draw_osd, flip_page, draw_slice, draw_frame should be
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
69 overwritten with vidix functions (vosub_vidix.c) */
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
70 static void draw_osd(void){
11019
69daa4fb97d9 consolevidix -> cvidix
faust3
parents: 11017
diff changeset
71 mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix draw_osd!\n");
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
72 return;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
73 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
74
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
75 static void flip_page(void){
11019
69daa4fb97d9 consolevidix -> cvidix
faust3
parents: 11017
diff changeset
76 mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix flip_page!\n");
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
77 return;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
78 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
79
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
80 static uint32_t draw_slice(uint8_t *src[], int stride[],int w, int h, int x, int y){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
81 UNUSED(src);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
82 UNUSED(stride);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
83 UNUSED(w);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
84 UNUSED(h);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
85 UNUSED(x);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
86 UNUSED(y);
11019
69daa4fb97d9 consolevidix -> cvidix
faust3
parents: 11017
diff changeset
87 mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix draw_slice!\n");
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
88 return -1;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
89 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
90
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
91 static uint32_t draw_frame(uint8_t *src[]){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
92 UNUSED(src);
11019
69daa4fb97d9 consolevidix -> cvidix
faust3
parents: 11017
diff changeset
93 mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix draw_frame!\n");
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
94 return -1;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
95 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
96
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
97 static uint32_t query_format(uint32_t format){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
98 return(vidix_query_fourcc(format));
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
99 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
100
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
101 static void uninit(void){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
102 if(!vo_config_count) return;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
103 vidix_term();
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
104 if(vidix_name){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
105 free(vidix_name);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
106 vidix_name = NULL;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
107 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
108 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
109
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
110 static uint32_t preinit(const char *arg){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
111 if(arg)vidix_name = strdup(arg);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
112 else {
11019
69daa4fb97d9 consolevidix -> cvidix
faust3
parents: 11017
diff changeset
113 mp_msg(MSGT_VO, MSGL_INFO, "vo_cvidix: No vidix driver name provided, probing available ones!\n");
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
114 vidix_name = NULL;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
115 }
11019
69daa4fb97d9 consolevidix -> cvidix
faust3
parents: 11017
diff changeset
116 if(vidix_preinit(vidix_name, &video_out_cvidix))return 1;
10979
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
117 return 0;
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
118 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
119
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
120 static uint32_t control(uint32_t request, void *data, ...){
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
121 switch (request) {
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
122 case VOCTRL_QUERY_FORMAT:
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
123 return query_format(*((uint32_t*)data));
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
124 }
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
125 return vidix_control(request, data);
ea4426db0db5 new vidix vo modules for textmode console and windows
faust3
parents:
diff changeset
126 }