Mercurial > mplayer.hg
annotate libvo/vo_bl.c @ 33265:62c0471bcf8c
Free config.
It isn't freed so far.
author | ib |
---|---|
date | Tue, 03 May 2011 13:19:39 +0000 |
parents | 0f1b5b68af32 |
children | ddb45e9443ec |
rev | line source |
---|---|
27509
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
1 /* |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
2 * playback using the Blinkenlights UDP protocol (and to files) |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
3 * |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
4 * UDP socket handling copied from bsender.c part of blib-0.6: |
7326
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/ |
27509
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
6 * copyright (c) 2001-2001 The Blinkenlights Crew: |
7326
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> |
27509
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
10 * copyright (C) 2004 Stefan Schuermans <1stein@schuermans.info> |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
11 * other stuff: copyright (C) 2002 Rik Snel |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
12 * |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
13 * This file is part of MPlayer. |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
14 * |
27509
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
15 * MPlayer is free software; you can redistribute it and/or modify |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
16 * it under the terms of the GNU General Public License as published by |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
17 * the Free Software Foundation; either version 2 of the License, or |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
18 * (at your option) any later version. |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
19 * |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
20 * MPlayer is distributed in the hope that it will be useful, |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
23 * GNU General Public License for more details. |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
24 * |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
25 * You should have received a copy of the GNU General Public License along |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
26 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
27481
diff
changeset
|
27 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
28 */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
29 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
30 #include <stdio.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
31 #include <stdlib.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
32 #include <string.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
33 #include <unistd.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
34 #include <fcntl.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
35 #include <errno.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
36 #include <sys/stat.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
37 #include <sys/types.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
38 #include <sys/time.h> |
26105 | 39 #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
|
40 #include <sys/mman.h> |
26105 | 41 #endif |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
42 #include <sys/ioctl.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
43 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
44 #include "config.h" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
45 |
10281 | 46 #include <netdb.h> |
47 #include <sys/socket.h> | |
48 #include <netinet/in.h> | |
49 | |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
50 #include "video_out.h" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
51 #include "video_out_internal.h" |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
13000
diff
changeset
|
52 #include "mp_msg.h" |
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
13000
diff
changeset
|
53 #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
|
54 #include "fastmemcpy.h" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
55 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28697
diff
changeset
|
56 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
|
57 { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
58 "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
|
59 "bl", |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
60 "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
|
61 "" |
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 |
25220
c9e9ac2008c2
Mark the vo_functions_t definitions as const where possible.
reimar
parents:
25216
diff
changeset
|
64 const LIBVO_EXTERN (bl) |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7326
diff
changeset
|
65 |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
66 /* General variables */ |
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 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
|
69 static unsigned char *tmp = NULL; |
25521
5b70080c41d2
Remove unused static variables, fixes the warnings:
diego
parents:
25520
diff
changeset
|
70 static int framenum; |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
71 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
|
72 static int prevpts = -1; |
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; /* filename */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
76 FILE *fp; |
15158
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
77 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
|
78 } bl_file_t; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
79 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
80 typedef struct { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
81 char *name; /* hostname */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
82 int port; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
83 int fd; /* file descriptor */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
84 } bl_host_t; |
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 typedef struct { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
87 char *name; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
88 int img_format; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
89 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
90 int channels; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
91 int width; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
92 int height; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
93 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
|
94 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
95 /* file output functions */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
96 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
|
97 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
|
98 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
|
99 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
100 /* network output functions */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
101 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
|
102 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
|
103 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
|
104 } bl_properties_t; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
105 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
106 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
|
107 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
108 /* 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
|
109 #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
|
110 #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
|
111 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
|
112 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
|
113 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
|
114 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
|
115 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
116 typedef struct { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
117 uint32_t magic; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
118 uint16_t height; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
119 uint16_t width; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
120 uint16_t channels; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
121 uint16_t maxval; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
122 unsigned char data[0]; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
123 } bl_packet_t; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
124 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
125 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
|
126 static int bl_size; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
127 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
128 /* bml output functions */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
129 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
|
130 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
|
131 if (!f->fp) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
132 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
|
133 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
134 } |
15158
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
135 f->header_written = 0; |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
136 return 0; |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
137 } |
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 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
|
140 int j, k; |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
141 if( ! f->header_written ) |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
142 { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28697
diff
changeset
|
143 fprintf(f->fp, |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
144 "<?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
|
145 "<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
|
146 " <header>\n" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
147 " <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
|
148 " <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
|
149 " </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
|
150 f->header_written = 1; |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
151 } |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
152 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
|
153 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
|
154 fprintf(f->fp, " <row>"); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28697
diff
changeset
|
155 for (k = 0; k < bl->width; k++) |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
156 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
|
157 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
|
158 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
159 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
|
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 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
|
163 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
|
164 fclose(f->fp); |
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 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
167 /* Blinkenlights UDP protocol */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
168 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
|
169 struct sockaddr_in addr; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
170 struct hostent *dest; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
171 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
172 dest = gethostbyname(h->name); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
173 if (!dest) { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28697
diff
changeset
|
174 mp_msg(MSGT_VO, MSGL_ERR, |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
175 "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
|
176 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
177 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
178 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
179 h->fd = -1; |
28697
5b749a93fc89
Use memset to make sure all parts of struct sockaddr_in are always initialized.
reimar
parents:
27509
diff
changeset
|
180 memset(&addr, 0, sizeof(addr)); |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
181 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
|
182 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
|
183 |
23458
973e53dc7df5
Do not use fast_memcpy for small size copy, esp. when the size is constant
reimar
parents:
23457
diff
changeset
|
184 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
|
185 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
186 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
|
187 if (h->fd < 0) { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28697
diff
changeset
|
188 mp_msg(MSGT_VO, MSGL_ERR, |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
189 "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
|
190 return 1; |
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 if (connect(h->fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28697
diff
changeset
|
193 mp_msg(MSGT_VO, MSGL_ERR, "couldn't connect socket for %s\n", |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
194 h->name); |
27481
03c589c49c6d
Remove Windows-specific #ifdefs, the file does not compile on MinGW anyway.
diego
parents:
27474
diff
changeset
|
195 close(h->fd); |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
196 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
197 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
198 return 0; |
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_send(bl_host_t *h) { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28697
diff
changeset
|
202 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
|
203 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
|
204 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
205 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
206 static void udp_close(bl_host_t *h) { |
27481
03c589c49c6d
Remove Windows-specific #ifdefs, the file does not compile on MinGW anyway.
diego
parents:
27474
diff
changeset
|
207 close(h->fd); |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
208 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
209 |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
210 #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
|
211 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
212 static bl_properties_t bls[NO_BLS] = { |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
213 { "hdl", IMGFMT_YV12, 1, 18, 8, 8, |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
214 &bml_init, &bml_write_frame, &bml_close, |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
215 &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
|
216 { "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
|
217 &bml_init, &bml_write_frame, &bml_close, |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
218 &udp_init, &udp_send, &udp_close }, |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
219 { "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
|
220 &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
|
221 &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
|
222 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28697
diff
changeset
|
223 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
|
224 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
|
225 { |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
226 void * ptr; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
227 |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
228 /* adapt size of Blinkenlights UDP stream to size of movie */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
229 if (bl->width < 0 || bl->height < 0) { |
15952
7a33ae1f8e6d
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
15212
diff
changeset
|
230 if (bl->width < 0) { /* use width of movie */ |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
231 bl->width = width; |
15952
7a33ae1f8e6d
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
15212
diff
changeset
|
232 bl_packet->width = htons(bl->width); |
7a33ae1f8e6d
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
15212
diff
changeset
|
233 } |
7a33ae1f8e6d
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
15212
diff
changeset
|
234 if (bl->height < 0) { /* use height of movie */ |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
235 bl->height = height; |
15952
7a33ae1f8e6d
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
15212
diff
changeset
|
236 bl_packet->height = htons(bl->height); |
7a33ae1f8e6d
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
15212
diff
changeset
|
237 } |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
238 /* check for maximum size of UDP packet */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
239 if (12 + bl->width*bl->height*bl->channels > 65507) { |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
240 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
|
241 bl->width, bl->height, bl->channels); |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
242 return 1; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
243 } |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
244 /* resize frame and tmp buffers */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
245 bl_size = 12 + bl->width*bl->height*bl->channels; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
246 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
|
247 if (ptr) |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
248 bl_packet = (bl_packet_t*)ptr; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
249 else { |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
250 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
|
251 return 1; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
252 } |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
253 image = ((unsigned char*)bl_packet + 12); /* pointer to image data */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
254 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
|
255 if (ptr) |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
256 tmp = (unsigned char*)ptr; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
257 else { |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
258 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
|
259 return 1; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
260 } |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
261 } |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
262 |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
263 framenum = 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
264 if (format != IMGFMT_YV12) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
265 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
|
266 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
267 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
268 if (width > bl->width) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
269 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
|
270 return 1; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28697
diff
changeset
|
271 } |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
272 if (height > bl->height) { |
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_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
|
274 return 1; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28697
diff
changeset
|
275 } |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
276 if (!image) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
277 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
|
278 return 1; |
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 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
|
281 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
|
282 return 0; |
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 draw_osd(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 void flip_page (void) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
289 int i; |
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 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
|
292 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
|
293 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
|
294 prevpts = vo_pts; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
295 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
296 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
|
297 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
298 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
299 framenum++; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
300 return; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
301 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
302 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15952
diff
changeset
|
303 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
|
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 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15952
diff
changeset
|
307 static int query_format(uint32_t format) { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28697
diff
changeset
|
308 if (format == bl->img_format) |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
309 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
|
310 return 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
311 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
312 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
313 static void uninit(void) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
314 int i; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
315 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
|
316 free(bl_packet); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
317 bl_packet = NULL; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
318 free(bl_subdevice); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
319 bl_subdevice = NULL; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
320 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
|
321 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
|
322 no_bl_files = 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
323 no_bl_hosts = 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
324 bl = NULL; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
325 } |
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 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
|
328 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
329 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15952
diff
changeset
|
330 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
|
331 int wf, int hf, int xf, int yf) { |
25520 | 332 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
|
333 uint8_t *dst; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
334 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
|
335 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
|
336 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
|
337 // copy Y: |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
338 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
|
339 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
|
340 dst+=bl->width; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
341 src+=stride[0]; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
342 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
343 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
344 return 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
345 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
346 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15952
diff
changeset
|
347 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
|
348 char *p, *q; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
349 int end = 0, i; |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
350 char txt[256]; |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
351 if (!arg || strlen(arg) == 0) { |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
352 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
|
353 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
354 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28697
diff
changeset
|
355 |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
356 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
|
357 if (!bl_subdevice) { |
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: 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
|
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 = bl_subdevice; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
362 strcpy(p, arg); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
363 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
|
364 for (i = 0; i < NO_BLS; i++) { |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
365 if (!strncmp(p, bls[i].name, strlen(bls[i].name))) |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
366 break; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
367 } |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
368 if (i >= NO_BLS) { |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
369 txt[0] = 0; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
370 for (i = 0; i < NO_BLS; i++) |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
371 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
|
372 sprintf( txt + strlen( txt ), "%s%s", |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
373 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
|
374 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
|
375 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
376 } |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
377 bl = &bls[i]; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
378 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
|
379 if (*p == '\0') { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
380 no_bl_hosts = 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
381 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
|
382 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
|
383 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
|
384 end = 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
385 } else if (*p != ':') { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
386 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
|
387 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
388 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
389 p++; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
390 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
391 while (!end) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
392 q = p + 5; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
393 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
|
394 if (no_bl_files == BL_MAX_FILES) { |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
395 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
|
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 p += 5; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
399 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
|
400 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
|
401 *q = '\0'; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
402 bl_files[no_bl_files].name = p; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28697
diff
changeset
|
403 mp_msg(MSGT_VO, MSGL_V, "blfile[%d]: %s\n", |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
404 no_bl_files, p); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
405 no_bl_files++; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
406 } 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
|
407 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
|
408 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
|
409 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
410 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
411 p += 5; |
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 != ':') q++; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
413 if (*q == ':') { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
414 *q++ = '\0'; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
415 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
|
416 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
|
417 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
|
418 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
|
419 } else { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
420 /* use default port */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
421 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
|
422 *q = '\0'; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
423 bl_hosts[no_bl_hosts].name = p; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28697
diff
changeset
|
424 bl_hosts[no_bl_hosts].port = 2323; |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
425 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28697
diff
changeset
|
426 mp_msg(MSGT_VO, MSGL_V, |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28697
diff
changeset
|
427 "blhost[%d]: %s:%d\n", |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
428 no_bl_hosts, p, |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
429 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
|
430 no_bl_hosts++; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
431 } else { |
25675
fcac7e2a38fc
fix bug in error message (found by Diego through a compiler warning)
rik
parents:
25521
diff
changeset
|
432 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
|
433 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
434 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
435 p = ++q; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
436 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
437 |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
438 if (bl->width >= 0 && bl->height >= 0) { /* size already known */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
439 bl_size = 12 + bl->width*bl->height*bl->channels; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
440 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
|
441 image = ((unsigned char*)bl_packet + 12); /* pointer to image data */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
442 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
|
443 } |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
444 else { /* size unknown yet */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
445 bl_size = 12; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
446 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
|
447 image = ((unsigned char*)bl_packet + 12); /* pointer to image data */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
448 tmp = malloc(3); /* space for a pixel only */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
449 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28697
diff
changeset
|
450 |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
451 if (!bl_packet || !tmp) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
452 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
|
453 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
454 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
455 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
|
456 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
|
457 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
|
458 bl_packet->channels = htons(bl->channels); |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
459 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
|
460 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
461 /* open all files */ |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28697
diff
changeset
|
462 for (i = 0; i < no_bl_files; i++) |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
463 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
|
464 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
465 /* open all sockets */ |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28697
diff
changeset
|
466 for (i = 0; i < no_bl_hosts; i++) |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
467 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
|
468 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
469 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
470 return 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
471 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
472 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15952
diff
changeset
|
473 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
|
474 switch (request) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
475 case VOCTRL_QUERY_FORMAT: |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
476 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
|
477 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
478 return VO_NOTIMPL; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
479 } |