mpg123-1.33.4

This commit is contained in:
Ozkan Sezer
2025-12-21 11:00:24 +03:00
parent 69118bb8bf
commit 2eb4320e16
10 changed files with 53 additions and 19 deletions

View File

@@ -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);
}
}

View File

@@ -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);

View File

@@ -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;

View File

@@ -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
*/

View File

@@ -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 ""