XMMS2
common.h
Go to the documentation of this file.
1/* XMMS2 - X Music Multiplexer System
2 * Copyright (C) 2003-2011 XMMS2 Team
3 *
4 * PLUGINS ARE NOT CONSIDERED TO BE DERIVED WORK !!!
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 */
16
17#ifndef __VISUALIZATION_COMMON_H__
18#define __VISUALIZATION_COMMON_H__
19
20#include <glib.h>
21
22#include "xmmspriv/xmms_log.h"
25
26/**
27 * The structures for a vis client
28 */
29
30typedef struct {
31 union {
34 } transport;
36 unsigned short format;
39
40/* provided by object.c */
41xmms_vis_client_t *get_client (int32_t id);
42void delete_client (int32_t id);
43void send_data (int channels, int size, int16_t *buf);
44
45/* provided by unixshm.c / dummy.c */
46int32_t init_shm (xmms_visualization_t *vis, int32_t id, int32_t shmid, xmms_error_t *err);
48gboolean write_start_shm (int32_t id, xmmsc_vis_unixshm_t *t, xmmsc_vischunk_t **dest);
49void write_finish_shm (int32_t id, xmmsc_vis_unixshm_t *t, xmmsc_vischunk_t *dest);
50
51gboolean write_shm (xmmsc_vis_unixshm_t *t, xmms_vis_client_t *c, int32_t id, struct timeval *time, int channels, int size, short *buf);
52
53/* provided by udp.c */
54int32_t init_udp (xmms_visualization_t *vis, int32_t id, xmms_error_t *err);
56gboolean write_udp (xmmsc_vis_udp_t *t, xmms_vis_client_t *c, int32_t id, struct timeval *time, int channels, int size, short *buf, int socket);
57
58/* provided by format.c */
59void fft_init (void);
60short fill_buffer (int16_t *dest, xmmsc_vis_properties_t* prop, int channels, int size, short *src);
61
62/* never call a fetch without a guaranteed release following! */
63#define x_fetch_client(id) \
64 g_mutex_lock (vis->clientlock); \
65 c = get_client (id); \
66 if (!c) { \
67 xmms_error_set (err, XMMS_ERROR_INVAL, "invalid server-side identifier provided"); \
68 g_mutex_unlock (vis->clientlock); \
69 return -1; \
70 }
71#define x_release_client() \
72 g_mutex_unlock (vis->clientlock);
73
74/**
75 * The structures for the vis module
76 */
77
82 GIOChannel *socketio;
83
84 GMutex *clientlock;
85 int32_t clientc;
87};
88
89#endif
gboolean write_udp(xmmsc_vis_udp_t *t, xmms_vis_client_t *c, int32_t id, struct timeval *time, int channels, int size, short *buf, int socket)
Definition udp.c:182
int32_t init_udp(xmms_visualization_t *vis, int32_t id, xmms_error_t *err)
Definition udp.c:107
void write_finish_shm(int32_t id, xmmsc_vis_unixshm_t *t, xmmsc_vischunk_t *dest)
Definition dummy.c:33
gboolean write_start_shm(int32_t id, xmmsc_vis_unixshm_t *t, xmmsc_vischunk_t **dest)
Definition dummy.c:30
short fill_buffer(int16_t *dest, xmmsc_vis_properties_t *prop, int channels, int size, short *src)
Definition format.c:149
void cleanup_udp(xmmsc_vis_udp_t *t, xmms_socket_t socket)
Definition udp.c:174
void cleanup_shm(xmmsc_vis_unixshm_t *t)
Definition dummy.c:27
int32_t init_shm(xmms_visualization_t *vis, int32_t id, int32_t shmid, xmms_error_t *err)
Definition dummy.c:20
gboolean write_shm(xmmsc_vis_unixshm_t *t, xmms_vis_client_t *c, int32_t id, struct timeval *time, int channels, int size, short *buf)
Definition dummy.c:36
void fft_init(void)
Definition format.c:18
void send_data(int channels, int size, int16_t *buf)
struct xmms_output_St xmms_output_t
xmms_vis_client_t * get_client(int32_t id)
Definition object.c:73
void delete_client(int32_t id)
Definition object.c:84
xmmsc_vis_transport_t
Possible vis transports.
The structures for a vis client.
Definition common.h:30
xmmsc_vis_udp_t udp
Definition common.h:33
unsigned short format
Definition common.h:36
xmmsc_vis_transport_t type
Definition common.h:35
xmmsc_vis_properties_t prop
Definition common.h:37
xmmsc_vis_unixshm_t shm
Definition common.h:32
The structures for the vis module.
Definition common.h:78
GIOChannel * socketio
Definition common.h:82
xmms_socket_t socket
Definition common.h:81
GMutex * clientlock
Definition common.h:84
xmms_object_t object
Definition common.h:79
xmms_output_t * output
Definition common.h:80
xmms_vis_client_t ** clientv
Definition common.h:86
Properties of the delivered vis data.
data describing a udp transport
data describing a unixshm transport
Package format for vis data, encapsulated by unixshm or udp transport.
G_BEGIN_DECLS struct xmms_error_St xmms_error_t
int xmms_socket_t