From 2eb4320e161247a15f991a30e7919902a3629f19 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sun, 21 Dec 2025 11:00:24 +0300 Subject: [PATCH] mpg123-1.33.4 --- NEWS | 8 ++++++++ configure | 20 ++++++++++---------- mpg123.spec | 2 +- ports/cmake/src/CMakeLists.txt | 4 ++-- ports/cmake/src/config.cmake.h.in | 2 +- src/term.c | 28 +++++++++++++++++++++++++++- src/term_posix.c | 2 +- src/term_win32.c | 2 +- src/terms.h | 2 +- src/version.h | 2 +- 10 files changed, 53 insertions(+), 19 deletions(-) diff --git a/NEWS b/NEWS index 69e3f8d..d611d6d 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +1.33.4 +------ +- mpg123: In terminal control, ignore 7-bit escape sequences to avoid spurious + actions, e.g. when hitting cursor keys. Inspired by Peter Tirsek. +- ports/cmake: Avoid possibly conflicting use of SIZEOF_OFF_T CMake variable + when embedding mpg123 with other projects using cmake and different off_t + semantics. (bug 382) + 1.33.3 ------ - libmpg123: diff --git a/configure b/configure index 6fd6ffe..fcb4d6c 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for mpg123 1.33.3. +# Generated by GNU Autoconf 2.71 for mpg123 1.33.4. # # Report bugs to . # @@ -621,8 +621,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='mpg123' PACKAGE_TARNAME='mpg123' -PACKAGE_VERSION='1.33.3' -PACKAGE_STRING='mpg123 1.33.3' +PACKAGE_VERSION='1.33.4' +PACKAGE_STRING='mpg123 1.33.4' PACKAGE_BUGREPORT='maintainer@mpg123.org' PACKAGE_URL='' @@ -1727,7 +1727,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures mpg123 1.33.3 to adapt to many kinds of systems. +\`configure' configures mpg123 1.33.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1798,7 +1798,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of mpg123 1.33.3:";; + short | recursive ) echo "Configuration of mpg123 1.33.4:";; esac cat <<\_ACEOF @@ -2077,7 +2077,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -mpg123 configure 1.33.3 +mpg123 configure 1.33.4 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -2622,7 +2622,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by mpg123 $as_me 1.33.3, which was +It was created by mpg123 $as_me 1.33.4, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -3992,7 +3992,7 @@ fi # Define the identity of the package. PACKAGE='mpg123' - VERSION='1.33.3' + VERSION='1.33.4' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -22468,7 +22468,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by mpg123 $as_me 1.33.3, which was +This file was extended by mpg123 $as_me 1.33.4, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -22536,7 +22536,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -mpg123 config.status 1.33.3 +mpg123 config.status 1.33.4 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/mpg123.spec b/mpg123.spec index 98d1a1c..0fce290 100644 --- a/mpg123.spec +++ b/mpg123.spec @@ -3,7 +3,7 @@ # - devel packages for alsa, sdl, etc... to build the respective output modules. Summary: The fast console mpeg audio decoder/player. Name: mpg123 -Version: 1.33.3 +Version: 1.33.4 Release: 1 URL: http://www.mpg123.org/ License: GPL diff --git a/ports/cmake/src/CMakeLists.txt b/ports/cmake/src/CMakeLists.txt index 7861e35..f6a77b9 100644 --- a/ports/cmake/src/CMakeLists.txt +++ b/ports/cmake/src/CMakeLists.txt @@ -74,9 +74,9 @@ check_function_exists(execvp HAVE_EXECVP) check_function_exists(ctermid HAVE_CTERMID) check_function_exists(clock_gettime HAVE_CLOCK_GETTIME) -check_type_size(off_t SIZEOF_OFF_T) +check_type_size(off_t MPG123_SIZEOF_OFF_T) -if(SIZEOF_OFF_T LESS 8) +if(MPG123_SIZEOF_OFF_T LESS 8) check_function_exists(lseek64 LFS_LARGEFILE_64) if(LFS_LARGEFILE_64) diff --git a/ports/cmake/src/config.cmake.h.in b/ports/cmake/src/config.cmake.h.in index e2a4432..456b96f 100644 --- a/ports/cmake/src/config.cmake.h.in +++ b/ports/cmake/src/config.cmake.h.in @@ -146,7 +146,7 @@ #define PKGLIBDIR "@CMAKE_INSTALL_LIBDIR@/@PROJECT_NAME@" // CMake leaves it emtpy for non-existing type. Autoconf sets it to 0. -#define SIZEOF_OFF_T (@SIZEOF_OFF_T@+0) +#define SIZEOF_OFF_T (@MPG123_SIZEOF_OFF_T@+0) #cmakedefine STDERR_FILENO @STDERR_FILENO@ #cmakedefine STDIN_FILENO @STDIN_FILENO@ diff --git a/src/term.c b/src/term.c index 7d5a806..b932384 100644 --- a/src/term.c +++ b/src/term.c @@ -589,8 +589,34 @@ static void term_handle_key(mpg123_handle *fr, out123_handle *ao, char val) static void term_handle_input(mpg123_handle *fr, out123_handle *ao, int do_delay) { char val; - if(term_get_key(playstate==STATE_STOPPED, do_delay, &val)) + if(term_get_key(playstate==STATE_STOPPED, do_delay ? 1 : 0, &val)) { + // Crude ignoring of 7-bit escape sequences. 8-bit ones you better really handle + // in the terminal and do not pass on. The idea is that pressing cursor keys + // that contain plain characters in the triggered escape sequences should + // not confuse mpg123 terminal control At the same time, the user pressing + // ESC on its own should not confuse mpg123 into starting a sequence. + // So the assumption is quick succession of the bytes for real sequences. + // If the sequence has been ignoret, return, as this has been handled. Come + // back for real control. + if(val == 0x1b) // ESC, get next key, if any + { + int seq_len = 1; + if(term_get_key(FALSE, -1, &val)) + { + ++seq_len; + if(val == 'Z') // SCI, single character to drop, if any + term_get_key(FALSE, -1, &val); + else if(val == '[') // sequence begin + { + while(term_get_key(FALSE, -1, &val) && strchr("0123456789;", val)) + ++seq_len; + } // else simple single-character escape + } + mdebug("dropped escape sequence of length %d", seq_len); + return; + } else + mdebug("got key: %02x", val); term_handle_key(fr, ao, val); } } diff --git a/src/term_posix.c b/src/term_posix.c index fde077b..1e09885 100644 --- a/src/term_posix.c +++ b/src/term_posix.c @@ -207,7 +207,7 @@ int term_get_key(int stopped, int do_delay, char *val) } t.tv_sec=0; - t.tv_usec=(do_delay) ? 10*1000 : 0; + t.tv_usec = do_delay==1 ? 10*1000 : (do_delay==-1 ? 1*1000 : 0); FD_ZERO(&r); FD_SET(term_fd,&r); diff --git a/src/term_win32.c b/src/term_win32.c index be1eca4..16c54e4 100644 --- a/src/term_win32.c +++ b/src/term_win32.c @@ -98,7 +98,7 @@ int term_get_key(int stopped, int do_delay, char *val){ if(input == NULL || input == INVALID_HANDLE_VALUE) return 0; - while(WaitForSingleObject(input, stopped ? INFINITE : (do_delay ? 10 : 0)) == WAIT_OBJECT_0){ + while(WaitForSingleObject(input, stopped ? INFINITE : (do_delay==1 ? 10 : (do_delay==-1 ? 1 : 0))) == WAIT_OBJECT_0){ do_delay = 0; if(!ReadConsoleInput(input, &record, 1, &res)) return 0; diff --git a/src/terms.h b/src/terms.h index 328786b..68cf7ee 100644 --- a/src/terms.h +++ b/src/terms.h @@ -43,7 +43,7 @@ int term_setup(void); void term_restore(void); /** Check for and return a key press event. - * \param do_delay Wait for up to 10 ms for a key event if true. + * \param do_delay Wait for up to 10 ms for key event if 1, for 1 ms if -1, without delay for 0. * \param val address to store character to * \return 1 if there is a key, 0 if not */ diff --git a/src/version.h b/src/version.h index 7558cad..8eecbe2 100644 --- a/src/version.h +++ b/src/version.h @@ -16,7 +16,7 @@ // only single spaces as separator to ease parsing by build scripts #define MPG123_MAJOR 1 #define MPG123_MINOR 33 -#define MPG123_PATCH 3 +#define MPG123_PATCH 4 // Don't get too wild with that to avoid confusing m4. No brackets. // Also, it should fit well into a sane file name for the tarball. #define MPG123_SUFFIX ""