abe7a5702e286b2d6998c29f1c4ae6976d721adc
[paraslash.git] / vss.h
1 /*
2  * Copyright (C) 2005-2009 Andre Noll <maan@systemlinux.org>
3  *
4  * Licensed under the GPL v2. For licencing details see COPYING.
5  */
6
7 /** \file vss.h Exported functions from vss.c (para_server). */
8
9 void init_vss_task(int afs_socket);
10 unsigned int vss_playing(void);
11 unsigned int vss_next(void);
12 unsigned int vss_repos(void);
13 unsigned int vss_paused(void);
14 unsigned int vss_stopped(void);
15 struct timeval *vss_chunk_time(void);
16 const char *supported_audio_formats(void);
17
18 /** Stop playing after current audio file. */
19 #define VSS_NOMORE 1
20 /** Skip remaining part of current audio file. */
21 #define VSS_NEXT 2
22 /** A reposition request was sent by a client. */
23 #define VSS_REPOS 4
24 /** Currently playing. */
25 #define VSS_PLAYING 8
26 /** A client requested to change the audio file selector. */
27 #define VSS_CHANGE 16
28
29 /**
30  * Each paraslash sender may register arbitrary many clients to the virtual
31  * streaming system, possibly with varying fec parameters. In order to do so,
32  * it must allocate a \a fec_client_parms structure and pass it to \ref
33  * add_fec_client.
34  *
35  * Clients are automatically removed from that list by the vss if an error
36  * occurs, or if the sender requests deletion of a client by calling \ref
37  * vss_del_fec_client().
38  */
39 struct fec_client;
40
41 /** FEC parameters requested by FEC clients. */
42 struct fec_client_parms {
43         /** Number of data slices plus redundant slices. */
44         uint8_t slices_per_group;
45         /** Number of slices minus number of redundant slices. */
46         uint8_t data_slices_per_group;
47         /** Maximal number of bytes per slice. */
48         uint16_t max_slice_bytes;
49         /** Called by vss.c when the next slice should be sent. */
50         int (*send)(char *buf, size_t num_bytes, void *private_data);
51         /** Passed verbatim to \a send(). */
52         void *private_data;
53 };
54
55 int vss_add_fec_client(struct fec_client_parms *fcp, struct fec_client **result);
56 void vss_del_fec_client(struct fec_client *fc);
57 size_t vss_get_fec_eof_packet(const char **buf);