Mercurial > mplayer.hg
annotate libvo/vo_bl.c @ 12443:ae4ae7ab636c
ENCA support (http://trific.ath.cx/software/enca/)
author | henry |
---|---|
date | Sat, 08 May 2004 17:52:25 +0000 |
parents | 57bdcdb061d7 |
children | 076e87baf7c0 |
rev | line source |
---|---|
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
1 /* |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
2 * vo_bl.c - playback using the Blinkenlights UPD protocol (and to files) |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
3 * |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
4 * UDP socket handling copied from bsender.c part of blib-0.6: |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
5 * http://sven.gimp.org/blinkenlights/ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
6 * Copyright (c) 2001-2001 The Blinkenlights Crew: |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
7 * Sven Neumann <sven@gimp.org> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
8 * Michael Natterer <mitch@gimp.org> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
9 * Daniel Mack <daniel@yoobay.net> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
10 * (these portions are licensed under GNU GPL v2 or "(at your option) |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
11 * any later version") |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
12 * |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
13 * Other stuff: Copyright (C) Rik Snel 2002, License GNU GPL v2 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
14 */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
15 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
16 #include <stdio.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
17 #include <stdlib.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
18 #include <string.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
19 #include <unistd.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
20 #include <fcntl.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
21 #include <errno.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
22 #include <sys/stat.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
23 #include <sys/types.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
24 #include <sys/time.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
25 #include <sys/mman.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
26 #include <sys/ioctl.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
27 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
28 #include "config.h" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
29 |
10281 | 30 #ifndef HAVE_WINSOCK2 |
31 #define closesocket close | |
32 #include <netdb.h> | |
33 #include <sys/socket.h> | |
34 #include <netinet/in.h> | |
35 #else | |
36 #include <winsock2.h> | |
37 #endif | |
38 | |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
39 #include "video_out.h" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
40 #include "video_out_internal.h" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
41 #include "../mp_msg.h" |
10594
57bdcdb061d7
Removed the historic cfgparser and switched full to the new config parser (altought some macros still remain for compatibility). As a side effect 90% of the warning messages are gone from the core. Things should be cleaner now and less confusing for newbies.
alex
parents:
10281
diff
changeset
|
42 #include "../m_option.h" |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
43 #include "fastmemcpy.h" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
44 |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7326
diff
changeset
|
45 static vo_info_t info = |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
46 { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
47 "Blinkenlights driver: http://www.blinkenlights.de", |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
48 "bl", |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
49 "Rik Snel <snel@phys.uu.nl>", |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
50 "" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
51 }; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
52 |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7326
diff
changeset
|
53 LIBVO_EXTERN (bl) |
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7326
diff
changeset
|
54 |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
55 /* General variables */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
56 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
57 static unsigned char *image = NULL; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
58 static unsigned char *tmp = NULL; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
59 static int framenum, yoff, stride; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
60 static char *bl_subdevice = NULL; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
61 static int prevpts = -1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
62 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
63 typedef struct { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
64 char *name; /* filename */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
65 FILE *fp; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
66 } bl_file_t; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
67 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
68 typedef struct { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
69 char *name; /* hostname */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
70 int port; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
71 int fd; /* file descriptor */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
72 } bl_host_t; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
73 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
74 typedef struct { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
75 char *name; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
76 int img_format; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
77 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
78 int channels; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
79 int width; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
80 int height; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
81 int bpc; /* bits per component: bpc = 3, channels = 3 => bpp = 24*/ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
82 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
83 /* file output functions */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
84 int (*init_file)(bl_file_t *file); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
85 void (*write_frame)(bl_file_t *file, unsigned char *i, int duration); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
86 void (*close_file)(bl_file_t *file); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
87 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
88 /* network output functions */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
89 int (*init_connection)(bl_host_t *host); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
90 void (*send_frame)(bl_host_t *host); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
91 void (*close_connection)(bl_host_t *host); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
92 } bl_properties_t; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
93 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
94 static bl_properties_t *bl = NULL; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
95 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
96 /* arbitrary limit because I am too lazy to do proper memory management */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
97 #define BL_MAX_FILES 16 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
98 #define BL_MAX_HOSTS 16 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
99 static bl_file_t bl_files[BL_MAX_FILES]; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
100 static bl_host_t bl_hosts[BL_MAX_HOSTS]; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
101 static int no_bl_files = 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
102 static int no_bl_hosts = 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
103 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
104 typedef struct { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
105 uint32_t magic; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
106 uint16_t height; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
107 uint16_t width; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
108 uint16_t channels; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
109 uint16_t maxval; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
110 unsigned char data[0]; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
111 } bl_packet_t; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
112 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
113 static bl_packet_t *bl_packet = NULL; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
114 static int bl_size; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
115 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
116 /* bml output functions */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
117 static int bml_init(bl_file_t *f) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
118 f->fp = fopen(f->name, "w"); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
119 if (!f->fp) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
120 mp_msg(MSGT_VO, MSGL_ERR, "bl: error opening %s\n", f->name); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
121 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
122 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
123 fprintf(f->fp, |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
124 "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
125 "<blm width=\"%d\" height=\"%d\" bits=\"%d\" channels=\"%d\">\n" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
126 " <header>\n" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
127 " <title>Movie autogenerated by MPlayer</title>\n" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
128 " <url>http://www.mplayerhq.hu</url>\n" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
129 " </header>\n", bl->width, bl->height, bl->bpc, bl->channels); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
130 return 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
131 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
132 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
133 static void bml_write_frame(bl_file_t *f, unsigned char *i, int duration) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
134 int j, k; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
135 fprintf(f->fp, " <frame duration=\"%d\">\n", duration); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
136 for (j = 0; j < bl->height; j++) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
137 fprintf(f->fp, " <row>"); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
138 for (k = 0; k < bl->width; k++) |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
139 fprintf(f->fp, "%02x", *(i + j * bl->width + k)); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
140 fprintf(f->fp, "</row>\n"); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
141 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
142 fprintf(f->fp, " </frame>\n"); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
143 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
144 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
145 static void bml_close(bl_file_t *f) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
146 fprintf(f->fp, "</blm>\n"); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
147 fclose(f->fp); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
148 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
149 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
150 /* Blinkenlights UDP protocol */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
151 static int udp_init(bl_host_t *h) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
152 struct sockaddr_in addr; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
153 struct hostent *dest; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
154 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
155 dest = gethostbyname(h->name); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
156 if (!dest) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
157 mp_msg(MSGT_VO, MSGL_ERR, |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
158 "unable to resolve host %s\n", h->name); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
159 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
160 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
161 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
162 h->fd = -1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
163 addr.sin_family = AF_INET; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
164 addr.sin_port = htons(h->port); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
165 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
166 memcpy(&addr.sin_addr.s_addr, dest->h_addr_list[0], dest->h_length); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
167 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
168 h->fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
169 if (h->fd < 0) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
170 mp_msg(MSGT_VO, MSGL_ERR, |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
171 "couldn't create socket for %s\n", h->name); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
172 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
173 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
174 if (connect(h->fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
175 mp_msg(MSGT_VO, MSGL_ERR, "couldn't connect socket for %s\n", |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
176 h->name); |
10281 | 177 closesocket(h->fd); |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
178 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
179 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
180 return 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
181 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
182 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
183 static void udp_send(bl_host_t *h) { |
10206
35e306346e59
Using recv/send instead read/write for proper MinGW support (it's a 4.2BSD standard). Patch by FloDt <flodt8@yahoo.de>
alex
parents:
8171
diff
changeset
|
184 if (send(h->fd, bl_packet, bl_size, 0) != bl_size) |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
185 mp_msg(MSGT_VO, MSGL_ERR, "unable to send to %s\n", h->name); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
186 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
187 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
188 static void udp_close(bl_host_t *h) { |
10281 | 189 closesocket(h->fd); |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
190 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
191 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
192 #define NO_BLS 2 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
193 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
194 /* currently only arcade is supported, hdl can be supported |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
195 * in principle and future projects can be supported if their |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
196 * parameters become known */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
197 static bl_properties_t bls[NO_BLS] = { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
198 { "hdl", IMGFMT_BGR1, 1, 18, 8, 1, |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
199 NULL, NULL, NULL, NULL, NULL, NULL }, |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
200 { "arcade", IMGFMT_YV12, 1, 26, 20, 8, |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
201 &bml_init, &bml_write_frame, &bml_close, |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
202 &udp_init, &udp_send, &udp_close } }; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
203 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
204 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
205 uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format) |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
206 { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
207 framenum = 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
208 if (format != IMGFMT_YV12) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
209 mp_msg(MSGT_VO, MSGL_ERR, "vo_bl called with wrong format"); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
210 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
211 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
212 if (width > bl->width) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
213 mp_msg(MSGT_VO, MSGL_ERR, "bl: width of movie too large %d > %d\n", width, bl->width); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
214 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
215 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
216 if (height > bl->height) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
217 mp_msg(MSGT_VO, MSGL_ERR, "bl: height of movie too large %d > %d\n", height, bl->height); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
218 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
219 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
220 if (!image) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
221 mp_msg(MSGT_VO, MSGL_ERR, "bl: image should be initialized, internal error\n"); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
222 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
223 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
224 memset(image, 0, bl->width*bl->height*3); /* blank the image */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
225 mp_msg(MSGT_VO, MSGL_V, "vo_config bl called\n"); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
226 return 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
227 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
228 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
229 static void draw_osd(void) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
230 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
231 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
232 static void flip_page (void) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
233 int i; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
234 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
235 if (prevpts >= 0) for (i = 0; i < no_bl_files; i++) |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
236 bl->write_frame(&bl_files[i], tmp, (vo_pts - prevpts)/90); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
237 memcpy(tmp, image, bl->width*bl->height*bl->channels); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
238 prevpts = vo_pts; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
239 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
240 for (i = 0; i < no_bl_hosts; i++) bl->send_frame(&bl_hosts[i]); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
241 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
242 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
243 framenum++; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
244 return; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
245 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
246 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
247 static uint32_t draw_frame(uint8_t * src[]) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
248 int i, j; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
249 char *source, *dest; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
250 //printf("draw frame called\n"); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
251 #if 0 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
252 zr_info_t *zr = &zr_info[j]; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
253 geo_t *g = &zr->g; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
254 source = src[0] + 2*g->yoff*zr->vdec*zr->stride + 2*g->xoff; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
255 dest = zr->image + 2*zr->off_y; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
256 for (i = 0; i < g->height/zr->vdec; i++) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
257 memcpy(dest, source, zr->image_width*2); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
258 dest += 2*zr->image_width; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
259 source += zr->vdec*zr->stride; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
260 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
261 #endif |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
262 return 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
263 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
264 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
265 static uint32_t query_format(uint32_t format) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
266 if (format == bl->img_format) |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
267 return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
268 return 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
269 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
270 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
271 static void uninit(void) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
272 int i; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
273 mp_msg(MSGT_VO, MSGL_V, "bl: uninit called\n"); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
274 free(bl_packet); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
275 bl_packet = NULL; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
276 free(bl_subdevice); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
277 bl_subdevice = NULL; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
278 for (i = 0; i < no_bl_files; i++) bl->close_file(&bl_files[i]); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
279 for (i = 0; i < no_bl_hosts; i++) bl->close_connection(&bl_hosts[i]); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
280 no_bl_files = 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
281 no_bl_hosts = 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
282 bl = NULL; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
283 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
284 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
285 static void check_events(void) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
286 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
287 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
288 static uint32_t draw_slice(uint8_t *srcimg[], int stride[], |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
289 int wf, int hf, int xf, int yf) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
290 int i, j, w, h, x, y; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
291 uint8_t *dst; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
292 uint8_t *src=srcimg[0]; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
293 uint8_t *src1=srcimg[1]; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
294 uint8_t *src2=srcimg[2]; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
295 w = wf; h = hf; x = xf; y = yf; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
296 dst=image; /* + zr->off_y + zr->image_width*(y/zr->vdec)+x;*/ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
297 // copy Y: |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
298 for (i = 0; i < h; i++) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
299 memcpy(dst,src,w); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
300 dst+=bl->width; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
301 src+=stride[0]; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
302 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
303 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
304 return 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
305 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
306 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
307 static uint32_t preinit(const char *arg) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
308 char *p, *q; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
309 int end = 0, i; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
310 if (!arg || strlen(arg) == 0) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
311 mp_msg(MSGT_VO, MSGL_ERR, "bl: subdevice must be given, example: -vo bl:arcade:host=localhost\n"); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
312 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
313 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
314 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
315 bl_subdevice = malloc(strlen(arg) + 1); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
316 if (!bl_subdevice) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
317 mp_msg(MSGT_VO, MSGL_ERR, "bl: out of memory error\n"); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
318 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
319 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
320 p = bl_subdevice; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
321 strcpy(p, arg); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
322 mp_msg(MSGT_VO, MSGL_V, "bl: preinit called with %s\n", arg); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
323 if (strncmp(p, "arcade", 6)) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
324 mp_msg(MSGT_VO, MSGL_ERR, "bl: subdevice must start with arcade, this is the only supported output format\nat the moment, i.e. -vo bl:arcade:host=localhost\n"); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
325 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
326 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
327 bl = &bls[1]; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
328 p += 6; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
329 if (*p == '\0') { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
330 no_bl_hosts = 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
331 bl_hosts[0].name = "localhost"; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
332 bl_hosts[0].port = 2323; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
333 mp_msg(MSGT_VO, MSGL_V, "bl: no hosts/files specified, using localhost:2323\n"); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
334 end = 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
335 } else if (*p != ':') { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
336 mp_msg(MSGT_VO, MSGL_ERR, "bl: syntax error in subdevice\n"); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
337 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
338 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
339 p++; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
340 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
341 while (!end) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
342 q = p + 5; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
343 if (!strncmp(p, "file=", 5)) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
344 if (no_bl_files == BL_MAX_FILES) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
345 mp_msg(MSGT_VO, MSGL_ERR, "bl: maximum number of hosts reached (%d)\n", BL_MAX_FILES); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
346 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
347 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
348 p += 5; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
349 while (*q != ',' && *q != '\0') q++; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
350 if (*q == '\0') end = 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
351 *q = '\0'; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
352 bl_files[no_bl_files].name = p; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
353 mp_msg(MSGT_VO, MSGL_V, "blfile[%d]: %s\n", |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
354 no_bl_files, p); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
355 no_bl_files++; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
356 } else if (!strncmp(p, "host=", 5)) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
357 if (no_bl_hosts == BL_MAX_HOSTS) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
358 mp_msg(MSGT_VO, MSGL_ERR, "bl: maximum number of hosts reached (%d)\n", BL_MAX_HOSTS); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
359 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
360 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
361 p += 5; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
362 while (*q != ',' && *q != '\0' && *q != ':') q++; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
363 if (*q == ':') { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
364 *q++ = '\0'; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
365 bl_hosts[no_bl_hosts].name = p; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
366 bl_hosts[no_bl_hosts].port = atoi(q); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
367 while (*q != ',' && *q != '\0') q++; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
368 if (*q == '\0') end = 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
369 } else { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
370 /* use default port */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
371 if (*q == '\0') end = 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
372 *q = '\0'; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
373 bl_hosts[no_bl_hosts].name = p; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
374 bl_hosts[no_bl_hosts].port = 2323; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
375 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
376 mp_msg(MSGT_VO, MSGL_V, |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
377 "blhost[%d]: %s:%d\n", |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
378 no_bl_hosts, p, |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
379 bl_hosts[no_bl_hosts].port); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
380 no_bl_hosts++; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
381 } else { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
382 mp_msg(MSGT_VO, MSGL_ERR, "bl: syntax error in entry %d in subdevice %s, should be a comma seperated\nlist of host=name:port and file=foo.bml\n", no_bl_hosts, no_bl_files, arg); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
383 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
384 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
385 p = ++q; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
386 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
387 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
388 bl_size = bl->width*bl->height*bl->channels + 12; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
389 /* enough space for RGB 24 bit + header */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
390 bl_packet = malloc(bl->width*bl->height*3+12); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
391 image = ((unsigned char*)bl_packet + 12); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
392 tmp = malloc(bl->width*bl->height*bl->channels); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
393 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
394 if (!bl_packet || !tmp) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
395 mp_msg(MSGT_VO, MSGL_ERR, "bl: out of memory error\n"); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
396 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
397 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
398 bl_packet->magic = htonl(0x23542666); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
399 bl_packet->width = htons(bl->width); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
400 bl_packet->height = htons(bl->height); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
401 bl_packet->channels = htons(bl->channels); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
402 bl_packet->maxval = htons(2<<bl->bpc - 1); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
403 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
404 /* open all files */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
405 for (i = 0; i < no_bl_files; i++) |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
406 if (bl->init_file(&bl_files[i])) return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
407 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
408 /* open all sockets */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
409 for (i = 0; i < no_bl_hosts; i++) |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
410 if (bl->init_connection(&bl_hosts[i])) return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
411 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
412 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
413 return 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
414 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
415 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
416 static uint32_t control(uint32_t request, void *data, ...) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
417 switch (request) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
418 case VOCTRL_QUERY_FORMAT: |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
419 return query_format(*((uint32_t*)data)); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
420 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
421 return VO_NOTIMPL; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
422 } |