]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge branch 'refs/heads/t/para_play'
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 16 May 2020 10:14:23 +0000 (12:14 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sat, 16 May 2020 10:15:09 +0000 (12:15 +0200)
A single patch which adds --end-of-playlist to control the behaviour
of para_play when the end of the playlist is reached.

Cooking for three weeks.

* refs/heads/t/para_play:
  play: New option: --end-of-playlist.

1  2 
NEWS.md
error.h
play.c

diff --combined NEWS.md
index 34aad072bfd0d5743c2177bf042f2e919f20a676,55ef3be947ee76d6b0937b33988b0cd960c0e985..de0aa1b462d3158e2325c383cd4cec7e569b46b9
+++ b/NEWS.md
@@@ -1,34 -1,6 +1,35 @@@
  NEWS
  ====
  
 +----------------------------------------------
 +0.6.3 (to be announced) "generalized activity"
 +----------------------------------------------
 +
 +- The ff command now accepts a negative argument to instruct the
 +  virtual streaming system to jump backwards in the current audio
 +  stream. The old syntax (e.g., "ff 30-") is still supported but it
 +  is deprecated and no longer documented. The compatibility code is
 +  sheduled for removal after 0.7.0.
 +- para_afh: New option: --preserve to reset the modification time to
 +  the value of the original file after meta data modification.
 +- Overhaul of the compress filter code. The refined algorithm should
 +  reduce clipping. The meaning of --aggressiveness has changed, see the
 +  updated and extended documentation of the compress filter for details.
 +- Cleanup of the audio format handler code.
 +- We now build the tree using the .ONESHELL feature of GNU make,
 +  which results in a significant speedup.
 +- Two robustness fixes for FreeBSD.
 +- para_client now supports RFC4716 private keys as generated with
 +  ssh-keygen -m RFC4716. In fact, this key format has been made the
 +  default, and the former PEM keys will be depreciated at some point.
 +- The ogg audio format handlers learned to detect holes and now report
 +  the correct duration also if ogg pages are missing in the file. This
 +  affects ogg/vorbis ogg/speex and ogg/opus.
 +- Robustness improvements for para_mixer.
 +- A fix for an old bug that could cause the server to crash or report
 +  garbage in its status output.
++- New para_play option: --end-of-playlist
 +
  --------------------------------------
  0.6.2 (2018-06-30) "elastic diversity"
  --------------------------------------
diff --combined error.h
index 8ef9e37d9cc4630178641b59146e0e77f4c0567e,cd080031dd0a5f77868b11f9e16121d02ca91dc1..fe44ff5c50487744881ea1d21d1007528a2ecd70
+++ b/error.h
@@@ -83,6 -83,7 +83,7 @@@
        PARA_ERROR(EMPTY, "file is empty"), \
        PARA_ERROR(ENCRYPT, "encrypt error"), \
        PARA_ERROR(EOF, "end of file"), \
+       PARA_ERROR(EOP, "end of playlist"), \
        PARA_ERROR(FEC_BAD_IDX, "invalid index vector"), \
        PARA_ERROR(FECDEC_EOF, "received eof packet"), \
        PARA_ERROR(FECDEC_OVERRUN, "fecdec output buffer overrun"), \
        PARA_ERROR(OGG_PACKET_IN, "ogg_stream_packetin() failed"), \
        PARA_ERROR(OGG_STREAM_FLUSH, "ogg_stream_flush() failed"), \
        PARA_ERROR(OGG_SYNC, "internal ogg storage overflow"), \
 +      PARA_ERROR(OPENSSH_PARSE, "could not parse openssh private key"), \
        PARA_ERROR(OPUS_COMMENT, "invalid or corrupted opus comment"), \
        PARA_ERROR(OPUS_DECODE, "opus decode error"), \
        PARA_ERROR(OPUS_HEADER, "invalid opus header"), \
@@@ -267,10 -267,11 +268,10 @@@ extern const char * const para_errlist[
   */
  #define SYSTEM_ERROR_BIT 30
  
 -/**
 - * Like the SYSTEM_ERROR_BIT, but indicates an error from the osl library.
 - */
 +/** Like SYSTEM_ERROR_BIT, but for errors from the osl library. */
  #define OSL_ERROR_BIT 29
  
 +/** Like SYSTEM_ERROR_BIT, but for errors from the lopsub library. */
  #define LLS_ERROR_BIT 28
  
  /** Check whether the system error bit is set. */
diff --combined play.c
index 86edc4d4e4f47bc1bd38197ed5982e97df9f72cf,e8dfbde94683fae0a8a10c19874dcb1ba7ae195e..2346c6b0101045d51e87b5d40abb5b983df6f014
--- 1/play.c
--- 2/play.c
+++ b/play.c
@@@ -219,7 -219,6 +219,6 @@@ static long unsigned get_play_time(void
        return result;
  }
  
  static void wipe_receiver_node(void)
  {
        PARA_NOTICE_LOG("cleaning up receiver node\n");
@@@ -434,6 -433,15 +433,15 @@@ static int next_valid_file(void
        int i, j = pt->current_file;
        unsigned num_inputs = lls_num_inputs(play_lpr);
  
+       if (j == num_inputs - 1) {
+               switch (OPT_UINT32_VAL(END_OF_PLAYLIST)) {
+               case EOP_LOOP: break;
+               case EOP_STOP:
+                       pt->playing = false;
+                       return 0;
+               case EOP_QUIT: return -E_EOP;
+               }
+       }
        for (i = 0; i < num_inputs; i++) {
                j = (j + 1) % num_inputs;
                if (!pt->invalid[j])
@@@ -1238,14 -1246,17 +1246,13 @@@ int main(int argc, char *argv[]
        int ret;
        unsigned num_inputs;
  
 -      /* needed this early to make help work */
 -      recv_init();
 -
        sched.default_timeout.tv_sec = 5;
        parse_config_or_die(argc, argv);
 -      AFH_RECV->init();
        session_open();
        num_inputs = lls_num_inputs(play_lpr);
        init_shuffle_map();
        pt->invalid = para_calloc(sizeof(*pt->invalid) * num_inputs);
        pt->rq = CRT_FILE_CHANGE;
-       pt->current_file = num_inputs - 1;
        pt->playing = true;
        pt->task = task_register(&(struct task_info){
                .name = "play",