From 3e92fcb6f07d8e6ee4bbcc06d26d569173d6c109 Mon Sep 17 00:00:00 2001 From: Andre Date: Wed, 1 Nov 2006 14:48:06 +0100 Subject: [PATCH] Add documentation of para_write --- Doxyfile | 2 +- write.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/Doxyfile b/Doxyfile index b8d50d13..ba35867d 100644 --- a/Doxyfile +++ b/Doxyfile @@ -487,7 +487,7 @@ EXCLUDE_SYMLINKS = NO # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* -EXCLUDE_PATTERNS = list.h *.cmdline.* krell.* gui* SFont* write.c gcc-compat.h rc4.h recv.c para.h fade.c config.h sdl_gui.c filter.c slider.c dbadm.c +EXCLUDE_PATTERNS = list.h *.cmdline.* krell.* gui* SFont* gcc-compat.h rc4.h recv.c para.h fade.c config.h sdl_gui.c filter.c slider.c dbadm.c # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see diff --git a/write.c b/write.c index 7f29665d..bf5ce629 100644 --- a/write.c +++ b/write.c @@ -16,6 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ +/** \file write.c Paraslash's standalone wav/raw player */ + #include "para.h" #include "string.h" #include "write.cmdline.h" @@ -29,17 +31,31 @@ INIT_WRITE_ERRLISTS; +/** + * check if given buffer contains a valid wave header + */ struct check_wav_task { + /** the buffer to check */ char *buf; + /** number of bytes loaded in \a buf */ size_t *loaded; + /** non-zero if end of file was reached */ int *eof; + /** number of channels specified in wav header given by \a buf */ unsigned channels; + /** samplerate specified in wav header given by \a buf */ unsigned samplerate; + /** the task structure for this task */ struct task task; }; +/** + * delay writing until given time + */ struct initial_delay_task { + /** the time the first data should be written out */ struct timeval start_time; + /** the task structure for this task */ struct task task; }; @@ -49,6 +65,7 @@ struct check_wav_task cwt; struct initial_delay_task idt; static struct writer_node_group *wng; +/** length of a standard wav header */ #define WAV_HEADER_LEN 44 /** @@ -96,6 +113,12 @@ static void initial_delay_pre_select(struct sched *s, struct task *t) s->timeout = diff; } +/** + * all log messages are written to stderr + * + * \param ll: loglevel + * \param fmt: format string + */ void para_log(int ll, const char* fmt,...) { va_list argp; @@ -205,6 +228,13 @@ static void cwt_event_handler(struct task *t) register_task(&idt.task); } +/** + * para_write's main function + * + * It registers the stdin task, the check_wav_task, the task for initial delay + * and all tasks for actually writing out the stream. + * + */ int main(int argc, char *argv[]) { int ret = -E_WRITE_SYNTAX; -- 2.39.5