audioc: Switch to blocking file descriptors.
[paraslash.git] / vss.h
diff --git a/vss.h b/vss.h
index 545647b7fda1806b042fb4d9dcad29acbe762197..ed2cd7852f92d505e04ec68dbf4608f277e3cfde 100644 (file)
--- a/vss.h
+++ b/vss.h
@@ -1,37 +1,55 @@
 /*
- * Copyright (C) 2005-2007 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2005-2010 Andre Noll <maan@systemlinux.org>
  *
- *     This program is free software; you can redistribute it and/or modify
- *     it under the terms of the GNU General Public License as published by
- *     the Free Software Foundation; either version 2 of the License, or
- *     (at your option) any later version.
- *
- *     This program is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- *     You should have received a copy of the GNU General Public License
- *     along with this program; if not, write to the Free Software
- *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Licensed under the GPL v2. For licencing details see COPYING.
  */
 
-/** \file vss.h exported functions from vss.c (para_server) */
-void vss_init(void);
-void vss_send_chunk(void);
-struct timeval *vss_preselect(void);
-const char *audio_format_name(int);
+/** \file vss.h Exported functions from vss.c (para_server). */
+
+void init_vss_task(int afs_socket);
 unsigned int vss_playing(void);
 unsigned int vss_next(void);
 unsigned int vss_repos(void);
 unsigned int vss_paused(void);
-char *vss_get_header(int *header_len);
+unsigned int vss_stopped(void);
 struct timeval *vss_chunk_time(void);
-int guess_audio_format(const char *name);
 const char *supported_audio_formats(void);
-/* status flags */
+
+/** Stop playing after current audio file. */
 #define VSS_NOMORE 1
+/** Skip remaining part of current audio file. */
 #define VSS_NEXT 2
+/** A reposition request was sent by a client. */
 #define VSS_REPOS 4
+/** Currently playing. */
 #define VSS_PLAYING 8
-#define VSS_CHANGE 16
+
+/**
+ * Each paraslash sender may register arbitrary many clients to the virtual
+ * streaming system, possibly with varying fec parameters. In order to do so,
+ * it must allocate a \a fec_client_parms structure and pass it to \ref
+ * add_fec_client.
+ *
+ * Clients are automatically removed from that list by the vss if an error
+ * occurs, or if the sender requests deletion of a client by calling \ref
+ * vss_del_fec_client().
+ */
+struct fec_client;
+
+/** FEC parameters requested by FEC clients. */
+struct fec_client_parms {
+       /** Number of data slices plus redundant slices. */
+       uint8_t slices_per_group;
+       /** Number of slices minus number of redundant slices. */
+       uint8_t data_slices_per_group;
+       /** Maximal number of bytes per slice. */
+       uint16_t max_slice_bytes;
+       /** Called by vss.c when the next slice should be sent. */
+       int (*send)(char *buf, size_t num_bytes, void *private_data);
+       /** Passed verbatim to \a send(). */
+       void *private_data;
+};
+
+int vss_add_fec_client(struct fec_client_parms *fcp, struct fec_client **result);
+void vss_del_fec_client(struct fec_client *fc);
+size_t vss_get_fec_eof_packet(const char **buf);