10979
|
1 /*
|
|
2 VIDIX accelerated overlay on black background
|
|
3 should work on any OS
|
|
4 TODO: implement blanking, aspect, geometry,fs etc.
|
|
5
|
|
6 (C) Sascha Sommer
|
|
7
|
|
8
|
|
9 */
|
|
10
|
|
11 #include <stdio.h>
|
|
12 #include <stdlib.h>
|
|
13 #include <string.h>
|
|
14 #include <math.h>
|
|
15 #include <errno.h>
|
|
16
|
|
17 #include "config.h"
|
|
18 #include "video_out.h"
|
|
19 #include "video_out_internal.h"
|
|
20
|
|
21 #include "mp_msg.h"
|
|
22
|
|
23 #include "vosub_vidix.h"
|
|
24 #include "../vidix/vidixlib.h"
|
|
25
|
|
26
|
|
27 static vo_info_t info = {
|
|
28 "VIDIX",
|
11017
|
29 "cvidix",
|
10979
|
30 "Sascha Sommer",
|
|
31 ""
|
|
32 };
|
|
33
|
11017
|
34 LIBVO_EXTERN(cvidix)
|
10979
|
35
|
|
36 #define UNUSED(x) ((void)(x)) /* Removes warning about unused arguments */
|
|
37
|
|
38 /* VIDIX related */
|
|
39 static char *vidix_name;
|
|
40
|
|
41
|
|
42 static vidix_grkey_t gr_key;
|
|
43
|
|
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){
|
|
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));
|
|
46 /*set colorkey*/
|
|
47 vidix_start();
|
|
48 if(vidix_grkey_support()){
|
|
49 vidix_grkey_get(&gr_key);
|
|
50 gr_key.key_op = KEYS_PUT;
|
|
51 gr_key.ckey.op = CKEY_TRUE;
|
|
52 gr_key.ckey.red = gr_key.ckey.green = gr_key.ckey.blue = 0;
|
|
53 vidix_grkey_set(&gr_key);
|
|
54 }
|
|
55 return 0;
|
|
56 }
|
|
57
|
|
58 static void check_events(void){
|
|
59 }
|
|
60
|
|
61 /* draw_osd, flip_page, draw_slice, draw_frame should be
|
|
62 overwritten with vidix functions (vosub_vidix.c) */
|
|
63 static void draw_osd(void){
|
11019
|
64 mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix draw_osd!\n");
|
10979
|
65 return;
|
|
66 }
|
|
67
|
|
68 static void flip_page(void){
|
11019
|
69 mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix flip_page!\n");
|
10979
|
70 return;
|
|
71 }
|
|
72
|
|
73 static uint32_t draw_slice(uint8_t *src[], int stride[],int w, int h, int x, int y){
|
|
74 UNUSED(src);
|
|
75 UNUSED(stride);
|
|
76 UNUSED(w);
|
|
77 UNUSED(h);
|
|
78 UNUSED(x);
|
|
79 UNUSED(y);
|
11019
|
80 mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix draw_slice!\n");
|
10979
|
81 return -1;
|
|
82 }
|
|
83
|
|
84 static uint32_t draw_frame(uint8_t *src[]){
|
|
85 UNUSED(src);
|
11019
|
86 mp_msg(MSGT_VO, MSGL_FATAL, "vo_cvidix: error: didn't use vidix draw_frame!\n");
|
10979
|
87 return -1;
|
|
88 }
|
|
89
|
|
90 static uint32_t query_format(uint32_t format){
|
|
91 return(vidix_query_fourcc(format));
|
|
92 }
|
|
93
|
|
94 static void uninit(void){
|
|
95 if(!vo_config_count) return;
|
|
96 vidix_term();
|
|
97 if(vidix_name){
|
|
98 free(vidix_name);
|
|
99 vidix_name = NULL;
|
|
100 }
|
|
101 }
|
|
102
|
|
103 static uint32_t preinit(const char *arg){
|
|
104 if(arg)vidix_name = strdup(arg);
|
|
105 else {
|
11019
|
106 mp_msg(MSGT_VO, MSGL_INFO, "vo_cvidix: No vidix driver name provided, probing available ones!\n");
|
10979
|
107 vidix_name = NULL;
|
|
108 }
|
11019
|
109 if(vidix_preinit(vidix_name, &video_out_cvidix))return 1;
|
10979
|
110 return 0;
|
|
111 }
|
|
112
|
|
113 static uint32_t control(uint32_t request, void *data, ...){
|
|
114 switch (request) {
|
|
115 case VOCTRL_QUERY_FORMAT:
|
|
116 return query_format(*((uint32_t*)data));
|
|
117 }
|
|
118 return vidix_control(request, data);
|
|
119 }
|