]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - play.c
paraslash 0.7.3
[paraslash.git] / play.c
diff --git a/play.c b/play.c
index 262f69ee4dc3d57686904fafb5597e1d955a189d..bd183b6b8dd48906e08cf142d7ff8c1e05aad48a 100644 (file)
--- a/play.c
+++ b/play.c
@@ -7,6 +7,7 @@
 #include <lopsub.h>
 
 #include "recv_cmd.lsg.h"
+#include "filter_cmd.lsg.h"
 #include "play_cmd.lsg.h"
 #include "write_cmd.lsg.h"
 #include "play.lsg.h"
 #include "write.h"
 #include "fd.h"
 
-/**
- * Besides playback tasks which correspond to the receiver/filter/writer nodes,
- * para_play creates two further tasks: The play task and the i9e task. It is
- * important whether a function can be called in the context of para_play or
- * i9e or both. As a rule, all command handlers are called only in i9e context via
- * the line handler (input mode) or the key handler (command mode) below.
- *
- * Playlist handling is done exclusively in play context.
- */
-
 /** Array of error strings. */
 DEFINE_PARA_ERRLIST;
 
@@ -239,8 +230,7 @@ static int get_playback_error(void)
                return 0;
        if (task_status(pt->rn.task) >= 0)
                return 0;
-       if (err == -E_BTR_EOF || err == -E_RECV_EOF || err == -E_EOF
-                       || err == -E_WRITE_COMMON_EOF)
+       if (err == -E_EOF)
                return 1;
        return err;
 }
@@ -266,6 +256,7 @@ static int eof_cleanup(void)
        if (decoder->close)
                decoder->close(&pt->fn);
        btr_remove_node(&pt->fn.btrn);
+       lls_free_parse_result(pt->fn.lpr, FILTER_CMD(pt->fn.filter_num));
        free(pt->fn.conf);
        memset(&pt->fn, 0, sizeof(struct filter_node));
 
@@ -1057,9 +1048,9 @@ static void session_open(void)
                char *dot_para = make_message("%s/.paraslash", home);
 
                free(home);
-               ret = para_mkdir(dot_para, 0777);
+               ret = para_mkdir(dot_para);
                /* warn, but otherwise ignore mkdir error */
-               if (ret < 0 && ret != -ERRNO_TO_PARA_ERROR(EEXIST))
+               if (ret < 0)
                        PARA_WARNING_LOG("Can not create %s: %s\n", dot_para,
                                para_strerror(-ret));
                history_file = make_message("%s/play.history", dot_para);
@@ -1246,10 +1237,25 @@ out:
 /**
  * The main function of para_play.
  *
- * \param argc Standard.
- * \param argv Standard.
+ * \param argc See man page.
+ * \param argv See man page.
+ *
+ * para_play distributes its work by submitting various tasks to the paraslash
+ * scheduler. The receiver, filter and writer tasks, which are used to play an
+ * audio file, require one task each to maintain their underlying buffer tree
+ * node. These tasks only exist when an audio file is playing.
+ *
+ * The i9 task, which is submitted and maintained by the i9e subsystem, reads
+ * an input line and calls the corresponding command handler such as com_stop()
+ * which is implemented in this file. The command handlers typically write a
+ * request to the global play_task structure, whose contents are read and acted
+ * upon by another task, the play task.
+ *
+ * As a rule, playlist handling is performed exclusively in play context, i.e.
+ * in the post-monitor step of the play task, while command handlers are only
+ * called in i9e context.
  *
- * \return \p EXIT_FAILURE or \p EXIT_SUCCESS.
+ * \return EXIT_FAILURE or EXIT_SUCCESS.
  */
 int main(int argc, char *argv[])
 {