Mercurial > mplayer.hg
annotate libvo/vo_bl.c @ 20970:5e7183c4d01c
r20972: defined MSGTR_OSDVideo
r20969: document new key binding for switching video streams in MPEG-TS
author | voroshil |
---|---|
date | Fri, 17 Nov 2006 14:57:12 +0000 |
parents | fd51fd1ff231 |
children | bc9e95184521 |
rev | line source |
---|---|
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
1 /* |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
2 * vo_bl.c - playback using the Blinkenlights UPD protocol (and to files) |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
3 * |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
4 * UDP socket handling copied from bsender.c part of blib-0.6: |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
5 * http://sven.gimp.org/blinkenlights/ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
6 * Copyright (c) 2001-2001 The Blinkenlights Crew: |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
7 * Sven Neumann <sven@gimp.org> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
8 * Michael Natterer <mitch@gimp.org> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
9 * Daniel Mack <daniel@yoobay.net> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
10 * (these portions are licensed under GNU GPL v2 or "(at your option) |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
11 * any later version") |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
12 * |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
13 * Other stuff: Copyright (C) Rik Snel 2002, License GNU GPL v2 |
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> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
30 #include <sys/mman.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
31 #include <sys/ioctl.h> |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
32 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
33 #include "config.h" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
34 |
10281 | 35 #ifndef HAVE_WINSOCK2 |
36 #define closesocket close | |
37 #include <netdb.h> | |
38 #include <sys/socket.h> | |
39 #include <netinet/in.h> | |
40 #else | |
41 #include <winsock2.h> | |
42 #endif | |
43 | |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
44 #include "video_out.h" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
45 #include "video_out_internal.h" |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
13000
diff
changeset
|
46 #include "mp_msg.h" |
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
13000
diff
changeset
|
47 #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
|
48 #include "fastmemcpy.h" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
49 |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7326
diff
changeset
|
50 static vo_info_t info = |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
51 { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
52 "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
|
53 "bl", |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
54 "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
|
55 "" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
56 }; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
57 |
8148
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7326
diff
changeset
|
58 LIBVO_EXTERN (bl) |
5b39e79af5fe
removed get_info, using the same sheme as in libmpcodecs instead
alex
parents:
7326
diff
changeset
|
59 |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
60 /* General variables */ |
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 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
|
63 static unsigned char *tmp = NULL; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
64 static int framenum, yoff, stride; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
65 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
|
66 static int prevpts = -1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
67 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
68 typedef struct { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
69 char *name; /* filename */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
70 FILE *fp; |
15158
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
71 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
|
72 } bl_file_t; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
73 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
74 typedef struct { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
75 char *name; /* hostname */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
76 int port; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
77 int fd; /* file descriptor */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
78 } bl_host_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; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
82 int img_format; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
83 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
84 int channels; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
85 int width; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
86 int height; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
87 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
|
88 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
89 /* file output functions */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
90 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
|
91 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
|
92 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
|
93 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
94 /* network output functions */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
95 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
|
96 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
|
97 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
|
98 } bl_properties_t; |
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 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
|
101 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
102 /* 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
|
103 #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
|
104 #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
|
105 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
|
106 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
|
107 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
|
108 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
|
109 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
110 typedef struct { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
111 uint32_t magic; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
112 uint16_t height; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
113 uint16_t width; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
114 uint16_t channels; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
115 uint16_t maxval; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
116 unsigned char data[0]; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
117 } bl_packet_t; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
118 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
119 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
|
120 static int bl_size; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
121 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
122 /* bml output functions */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
123 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
|
124 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
|
125 if (!f->fp) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
126 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
|
127 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
128 } |
15158
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
129 f->header_written = 0; |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
130 return 0; |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
131 } |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
132 |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
133 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
|
134 int j, k; |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
135 if( ! f->header_written ) |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
136 { |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
137 fprintf(f->fp, |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
138 "<?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
|
139 "<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
|
140 " <header>\n" |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
141 " <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
|
142 " <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
|
143 " </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
|
144 f->header_written = 1; |
d570dfbf9ef6
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
13787
diff
changeset
|
145 } |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
146 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
|
147 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
|
148 fprintf(f->fp, " <row>"); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
149 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
|
150 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
|
151 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
|
152 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
153 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
|
154 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
155 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
156 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
|
157 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
|
158 fclose(f->fp); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
159 } |
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 /* Blinkenlights UDP protocol */ |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
162 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
|
163 struct sockaddr_in addr; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
164 struct hostent *dest; |
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 dest = gethostbyname(h->name); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
167 if (!dest) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
168 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
|
169 "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
|
170 return 1; |
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 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
173 h->fd = -1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
174 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
|
175 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
|
176 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
177 memcpy(&addr.sin_addr.s_addr, dest->h_addr_list[0], dest->h_length); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
178 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
179 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
|
180 if (h->fd < 0) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
181 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
|
182 "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
|
183 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
184 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
185 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
|
186 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
|
187 h->name); |
10281 | 188 closesocket(h->fd); |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
189 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
190 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
191 return 0; |
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 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
194 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
|
195 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
|
196 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
|
197 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
198 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
199 static void udp_close(bl_host_t *h) { |
10281 | 200 closesocket(h->fd); |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
201 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
202 |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
203 #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
|
204 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
205 static bl_properties_t bls[NO_BLS] = { |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
206 { "hdl", IMGFMT_YV12, 1, 18, 8, 8, |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
207 &bml_init, &bml_write_frame, &bml_close, |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
208 &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
|
209 { "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
|
210 &bml_init, &bml_write_frame, &bml_close, |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
211 &udp_init, &udp_send, &udp_close }, |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
212 { "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
|
213 &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
|
214 &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
|
215 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15952
diff
changeset
|
216 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
|
217 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
|
218 { |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
219 void * ptr; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
220 |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
221 /* adapt size of Blinkenlights UDP stream to size of movie */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
222 if (bl->width < 0 || bl->height < 0) { |
15952
7a33ae1f8e6d
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
15212
diff
changeset
|
223 if (bl->width < 0) { /* use width of movie */ |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
224 bl->width = width; |
15952
7a33ae1f8e6d
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
15212
diff
changeset
|
225 bl_packet->width = htons(bl->width); |
7a33ae1f8e6d
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
15212
diff
changeset
|
226 } |
7a33ae1f8e6d
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
15212
diff
changeset
|
227 if (bl->height < 0) { /* use height of movie */ |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
228 bl->height = height; |
15952
7a33ae1f8e6d
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
15212
diff
changeset
|
229 bl_packet->height = htons(bl->height); |
7a33ae1f8e6d
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
15212
diff
changeset
|
230 } |
13000
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
231 /* check for maximum size of UDP packet */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
232 if (12 + bl->width*bl->height*bl->channels > 65507) { |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
233 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
|
234 bl->width, bl->height, bl->channels); |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
235 return 1; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
236 } |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
237 /* resize frame and tmp buffers */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
238 bl_size = 12 + bl->width*bl->height*bl->channels; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
239 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
|
240 if (ptr) |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
241 bl_packet = (bl_packet_t*)ptr; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
242 else { |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
243 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
|
244 return 1; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
245 } |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
246 image = ((unsigned char*)bl_packet + 12); /* pointer to image data */ |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
247 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
|
248 if (ptr) |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
249 tmp = (unsigned char*)ptr; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
250 else { |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
251 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
|
252 return 1; |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
253 } |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
254 } |
076e87baf7c0
--Patch by Stefan '1stein' Schuermans <1stein@schuermans.info>:
rik
parents:
10594
diff
changeset
|
255 |
7326
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
256 framenum = 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
257 if (format != IMGFMT_YV12) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
258 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
|
259 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
260 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
261 if (width > bl->width) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
262 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
|
263 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
264 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
265 if (height > bl->height) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
266 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
|
267 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
268 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
269 if (!image) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
270 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
|
271 return 1; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
272 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
273 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
|
274 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
|
275 return 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
276 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
277 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
278 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
|
279 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
280 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
281 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
|
282 int i; |
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 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
|
285 bl->write_frame(&bl_files[i], tmp, (vo_pts - prevpts)/90); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
286 memcpy(tmp, image, bl->width*bl->height*bl->channels); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
287 prevpts = vo_pts; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
288 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
289 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
|
290 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
291 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
292 framenum++; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
293 return; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
294 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
295 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15952
diff
changeset
|
296 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
|
297 return 0; |
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 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15952
diff
changeset
|
300 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
|
301 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
|
302 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
|
303 return 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
304 } |
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 static void uninit(void) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
307 int i; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
308 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
|
309 free(bl_packet); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
310 bl_packet = NULL; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
311 free(bl_subdevice); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
312 bl_subdevice = NULL; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
313 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
|
314 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
|
315 no_bl_files = 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
316 no_bl_hosts = 0; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
317 bl = NULL; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
318 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
319 |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
320 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
|
321 } |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
322 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15952
diff
changeset
|
323 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
|
324 int wf, int hf, int xf, int yf) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
325 int i, j, w, h, x, y; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
326 uint8_t *dst; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
327 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
|
328 uint8_t *src1=srcimg[1]; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
329 uint8_t *src2=srcimg[2]; |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
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++) { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
334 memcpy(dst,src,w); |
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 { |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
427 mp_msg(MSGT_VO, MSGL_ERR, "bl: syntax error in entry %d in subdevice %s, should be a comma seperated\nlist of host=name:port and file=foo.bml\n", no_bl_hosts, no_bl_files, arg); |
ec3e58120e2a
extensible blinkenlights driver, can currently be used for the Arcade http://www.blinkenlights.de/arcade
rik
parents:
diff
changeset
|
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 } |