Mercurial > mplayer.hg
annotate libvo/vo_bl.c @ 26354:8a43b830b4f5
Add a config.mak variable to control compilation of the Win32 GUI.
author | diego |
---|---|
date | Fri, 11 Apr 2008 07:28:32 +0000 |
parents | c99d53b76ee5 |
children | 5a30f5bc23a0 |
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 * |
25426
288d00a5c11e
change license from GPLv2 to 'GPL v2 or later', requested by Diego, I can do that since I wrote the files (based on other stuff from MPlayer (and some external things under GPL v2 or later))
rik
parents:
25220
diff
changeset
|
13 * Other stuff: Copyright (C) Rik Snel 2002, License GNU GPL v2 or later |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
14 * |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
15 * patch from Stefan Schuermans <1stein@schuermans.info>: |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
16 * - correction of "maxval" in Blinkenlights UDP protcol |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
17 * - new scheme for new HDL |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
18 * - new scheme for grayscale in arbitrary size |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
19 */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
20 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
21 #include <stdio.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
22 #include <stdlib.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
23 #include <string.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
24 #include <unistd.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
25 #include <fcntl.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
26 #include <errno.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
27 #include <sys/stat.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
28 #include <sys/types.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
29 #include <sys/time.h> |
26105 | 30 #ifdef HAVE_SYS_MMAN_H |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
31 #include <sys/mman.h> |
26105 | 32 #endif |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
33 #include <sys/ioctl.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
34 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
35 #include "config.h" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
36 |
10281 | 37 #ifndef HAVE_WINSOCK2 |
38 #define closesocket close | |
39 #include <netdb.h> | |
40 #include <sys/socket.h> | |
41 #include <netinet/in.h> | |
42 #else | |
43 #include <winsock2.h> | |
44 #endif | |
45 | |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
46 #include "video_out.h" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
47 #include "video_out_internal.h" |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
13000
diff
changeset
|
48 #include "mp_msg.h" |
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
13000
diff
changeset
|
49 #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
|
50 #include "fastmemcpy.h" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
51 |
25216 | 52 static const 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
|
53 { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
54 "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
|
55 "bl", |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
56 "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
|
57 "" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
58 }; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
59 |
25220
c9e9ac2008c2
Mark the vo_functions_t definitions as const where possible.
reimar
parents:
25216
diff
changeset
|
60 const LIBVO_EXTERN (bl) |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7326
diff
changeset
|
61 |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
62 /* General variables */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
63 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
64 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
|
65 static unsigned char *tmp = NULL; |
25521
5b70080c41d2
Remove unused static variables, fixes the warnings:
diego
parents:
25520
diff
changeset
|
66 static int framenum; |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
67 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
|
68 static int prevpts = -1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
69 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
70 typedef struct { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
71 char *name; /* filename */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
72 FILE *fp; |
15158
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
73 int header_written; /* if header was written already */ |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
74 } bl_file_t; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
75 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
76 typedef struct { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
77 char *name; /* hostname */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
78 int port; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
79 int fd; /* file descriptor */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
80 } bl_host_t; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
81 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
82 typedef struct { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
83 char *name; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
84 int img_format; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
85 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
86 int channels; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
87 int width; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
88 int height; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
89 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
|
90 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
91 /* file output functions */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
92 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
|
93 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
|
94 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
|
95 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
96 /* network output functions */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
97 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
|
98 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
|
99 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
|
100 } bl_properties_t; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
101 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
102 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
|
103 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
104 /* 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
|
105 #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
|
106 #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
|
107 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
|
108 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
|
109 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
|
110 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
|
111 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
112 typedef struct { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
113 uint32_t magic; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
114 uint16_t height; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
115 uint16_t width; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
116 uint16_t channels; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
117 uint16_t maxval; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
118 unsigned char data[0]; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
119 } bl_packet_t; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
120 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
121 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
|
122 static int bl_size; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
123 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
124 /* bml output functions */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
125 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
|
126 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
|
127 if (!f->fp) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
128 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
|
129 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
130 } |
15158
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
131 f->header_written = 0; |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
132 return 0; |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
133 } |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
134 |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
135 static void bml_write_frame(bl_file_t *f, unsigned char *i, int duration) { |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
136 int j, k; |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
137 if( ! f->header_written ) |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
138 { |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
139 fprintf(f->fp, |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
140 "<?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
|
141 "<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
|
142 " <header>\n" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
143 " <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
|
144 " <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
|
145 " </header>\n", bl->width, bl->height, bl->bpc, bl->channels); |
15158
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
146 f->header_written = 1; |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
147 } |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
148 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
|
149 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
|
150 fprintf(f->fp, " <row>"); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
151 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
|
152 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
|
153 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
|
154 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
155 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
|
156 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
157 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
158 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
|
159 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
|
160 fclose(f->fp); |
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 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
163 /* Blinkenlights UDP protocol */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
164 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
|
165 struct sockaddr_in addr; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
166 struct hostent *dest; |
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 dest = gethostbyname(h->name); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
169 if (!dest) { |
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 "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
|
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 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
175 h->fd = -1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
176 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
|
177 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
|
178 |
23458
973e53dc7df5
Do not use fast_memcpy for small size copy, esp. when the size is constant
reimar
parents:
23457
diff
changeset
|
179 memcpy(&addr.sin_addr.s_addr, dest->h_addr_list[0], dest->h_length); |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
180 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
181 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
|
182 if (h->fd < 0) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
183 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
|
184 "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
|
185 return 1; |
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 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
|
188 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
|
189 h->name); |
10281 | 190 closesocket(h->fd); |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
191 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
192 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
193 return 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
194 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
195 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
196 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
|
197 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
|
198 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
|
199 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
200 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
201 static void udp_close(bl_host_t *h) { |
10281 | 202 closesocket(h->fd); |
7326
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 |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
205 #define NO_BLS 3 |
7326
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 static bl_properties_t bls[NO_BLS] = { |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
208 { "hdl", IMGFMT_YV12, 1, 18, 8, 8, |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
209 &bml_init, &bml_write_frame, &bml_close, |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
210 &udp_init, &udp_send, &udp_close }, |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
211 { "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
|
212 &bml_init, &bml_write_frame, &bml_close, |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
213 &udp_init, &udp_send, &udp_close }, |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
214 { "grayscale", IMGFMT_YV12, 1, -1, -1, 8, /* use width and height of movie */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
215 &bml_init, &bml_write_frame, &bml_close, |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
216 &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
|
217 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15952
diff
changeset
|
218 static int config(uint32_t width, uint32_t height, uint32_t d_width, |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
15158
diff
changeset
|
219 uint32_t d_height, uint32_t flags, char *title, uint32_t format) |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
220 { |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
221 void * ptr; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
222 |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
223 /* adapt size of Blinkenlights UDP stream to size of movie */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
224 if (bl->width < 0 || bl->height < 0) { |
15952
7a33ae1f8e6d
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
15212
diff
changeset
|
225 if (bl->width < 0) { /* use width of movie */ |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
226 bl->width = width; |
15952
7a33ae1f8e6d
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
15212
diff
changeset
|
227 bl_packet->width = htons(bl->width); |
7a33ae1f8e6d
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
15212
diff
changeset
|
228 } |
7a33ae1f8e6d
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
15212
diff
changeset
|
229 if (bl->height < 0) { /* use height of movie */ |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
230 bl->height = height; |
15952
7a33ae1f8e6d
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
15212
diff
changeset
|
231 bl_packet->height = htons(bl->height); |
7a33ae1f8e6d
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
15212
diff
changeset
|
232 } |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
233 /* check for maximum size of UDP packet */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
234 if (12 + bl->width*bl->height*bl->channels > 65507) { |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
235 mp_msg(MSGT_VO, MSGL_ERR, "bl: %dx%d-%d does not fit into an UDP packet\n", |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
236 bl->width, bl->height, bl->channels); |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
237 return 1; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
238 } |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
239 /* resize frame and tmp buffers */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
240 bl_size = 12 + bl->width*bl->height*bl->channels; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
241 ptr = realloc(bl_packet, 12 + bl->width*bl->height*3); /* space for header and image data */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
242 if (ptr) |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
243 bl_packet = (bl_packet_t*)ptr; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
244 else { |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
245 mp_msg(MSGT_VO, MSGL_ERR, "bl: out of memory error\n"); |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
246 return 1; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
247 } |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
248 image = ((unsigned char*)bl_packet + 12); /* pointer to image data */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
249 ptr = realloc(tmp, bl->width*bl->height*3); /* space for image data only */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
250 if (ptr) |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
251 tmp = (unsigned char*)ptr; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
252 else { |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
253 mp_msg(MSGT_VO, MSGL_ERR, "bl: out of memory error\n"); |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
254 return 1; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
255 } |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
256 } |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
257 |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
258 framenum = 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
259 if (format != IMGFMT_YV12) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
260 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
|
261 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
262 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
263 if (width > bl->width) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
264 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
|
265 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
266 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
267 if (height > bl->height) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
268 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
|
269 return 1; |
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 if (!image) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
272 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
|
273 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
274 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
275 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
|
276 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
|
277 return 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
278 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
279 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
280 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
|
281 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
282 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
283 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
|
284 int i; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
285 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
286 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
|
287 bl->write_frame(&bl_files[i], tmp, (vo_pts - prevpts)/90); |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
22283
diff
changeset
|
288 fast_memcpy(tmp, image, bl->width*bl->height*bl->channels); |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
289 prevpts = vo_pts; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
290 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
291 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
|
292 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
293 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
294 framenum++; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
295 return; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
296 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
297 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15952
diff
changeset
|
298 static int draw_frame(uint8_t * src[]) { |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
299 return 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
300 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
301 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15952
diff
changeset
|
302 static int query_format(uint32_t format) { |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
303 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
|
304 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
|
305 return 0; |
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 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
308 static void uninit(void) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
309 int i; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
310 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
|
311 free(bl_packet); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
312 bl_packet = NULL; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
313 free(bl_subdevice); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
314 bl_subdevice = NULL; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
315 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
|
316 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
|
317 no_bl_files = 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
318 no_bl_hosts = 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
319 bl = NULL; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
320 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
321 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
322 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
|
323 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
324 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15952
diff
changeset
|
325 static int draw_slice(uint8_t *srcimg[], int stride[], |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
326 int wf, int hf, int xf, int yf) { |
25520 | 327 int i, w, h, x, y; |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
328 uint8_t *dst; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
329 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
|
330 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
|
331 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
|
332 // copy Y: |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
333 for (i = 0; i < h; i++) { |
23457
a124f3abc1ec
Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents:
22283
diff
changeset
|
334 fast_memcpy(dst,src,w); |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
335 dst+=bl->width; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
336 src+=stride[0]; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
337 |
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 return 0; |
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 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15952
diff
changeset
|
342 static int preinit(const char *arg) { |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
343 char *p, *q; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
344 int end = 0, i; |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
345 char txt[256]; |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
346 if (!arg || strlen(arg) == 0) { |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
347 mp_msg(MSGT_VO, MSGL_ERR, "bl: subdevice must be given, example: -vo bl:arcade:host=localhost:2323\n"); |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
348 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
349 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
350 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
351 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
|
352 if (!bl_subdevice) { |
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_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
|
354 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
355 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
356 p = bl_subdevice; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
357 strcpy(p, arg); |
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_V, "bl: preinit called with %s\n", arg); |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
359 for (i = 0; i < NO_BLS; i++) { |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
360 if (!strncmp(p, bls[i].name, strlen(bls[i].name))) |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
361 break; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
362 } |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
363 if (i >= NO_BLS) { |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
364 txt[0] = 0; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
365 for (i = 0; i < NO_BLS; i++) |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
366 if (strlen( txt ) + 4 + strlen( bls[i].name ) + 1 < sizeof(txt)) |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
367 sprintf( txt + strlen( txt ), "%s%s", |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
368 txt[0] == 0 ? "" : i == NO_BLS - 1 ? " or " : ", ", bls[i].name ); |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
369 mp_msg(MSGT_VO, MSGL_ERR, "bl: subdevice must start with %s\nbl: i.e. -vo bl:arcade:host=localhost:2323\n", txt); |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
370 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
371 } |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
372 bl = &bls[i]; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
373 p += strlen(bls[i].name); |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
374 if (*p == '\0') { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
375 no_bl_hosts = 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
376 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
|
377 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
|
378 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
|
379 end = 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
380 } else if (*p != ':') { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
381 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
|
382 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
383 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
384 p++; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
385 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
386 while (!end) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
387 q = p + 5; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
388 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
|
389 if (no_bl_files == BL_MAX_FILES) { |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
390 mp_msg(MSGT_VO, MSGL_ERR, "bl: maximum number of files reached (%d)\n", BL_MAX_FILES); |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
391 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
392 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
393 p += 5; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
394 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
|
395 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
|
396 *q = '\0'; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
397 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
|
398 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
|
399 no_bl_files, p); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
400 no_bl_files++; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
401 } 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
|
402 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
|
403 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
|
404 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
405 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
406 p += 5; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
407 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
|
408 if (*q == ':') { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
409 *q++ = '\0'; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
410 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
|
411 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
|
412 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
|
413 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
|
414 } else { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
415 /* use default port */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
416 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
|
417 *q = '\0'; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
418 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
|
419 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
|
420 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
421 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
|
422 "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
|
423 no_bl_hosts, p, |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
424 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
|
425 no_bl_hosts++; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
426 } else { |
25675
fcac7e2a38fc
fix bug in error message (found by Diego through a compiler warning)
rik
parents:
25521
diff
changeset
|
427 mp_msg(MSGT_VO, MSGL_ERR, "bl: syntax error in entry %d in subdevice %s, should be a comma separated\nlist of host=name:port and file=foo.bml\n", no_bl_hosts + no_bl_files, arg); |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
428 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
429 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
430 p = ++q; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
431 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
432 |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
433 if (bl->width >= 0 && bl->height >= 0) { /* size already known */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
434 bl_size = 12 + bl->width*bl->height*bl->channels; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
435 bl_packet = malloc(12 + bl->width*bl->height*3); /* space for header and image data */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
436 image = ((unsigned char*)bl_packet + 12); /* pointer to image data */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
437 tmp = malloc(bl->width*bl->height*3); /* space for image data only */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
438 } |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
439 else { /* size unknown yet */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
440 bl_size = 12; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
441 bl_packet = malloc(12 + 3); /* space for header and a pixel */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
442 image = ((unsigned char*)bl_packet + 12); /* pointer to image data */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
443 tmp = malloc(3); /* space for a pixel only */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
444 } |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
445 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
446 if (!bl_packet || !tmp) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
447 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
|
448 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
449 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
450 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
|
451 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
|
452 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
|
453 bl_packet->channels = htons(bl->channels); |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
454 bl_packet->maxval = htons((1 << bl->bpc) - 1); |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
455 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
456 /* open all files */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
457 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
|
458 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
|
459 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
460 /* open all sockets */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
461 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
|
462 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
|
463 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
464 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
465 return 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
466 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
467 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15952
diff
changeset
|
468 static int control(uint32_t request, void *data, ...) { |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
469 switch (request) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
470 case VOCTRL_QUERY_FORMAT: |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
471 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
|
472 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
473 return VO_NOTIMPL; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
474 } |