mpg123-1.32.0

This commit is contained in:
Ozkan Sezer
2023-09-24 08:51:02 +03:00
parent 89d671ef14
commit 2279cffc0f
241 changed files with 18940 additions and 16360 deletions

View File

@@ -10,6 +10,8 @@
#include "mpg123app.h"
#include "mpg123.h"
#include "out123.h"
#include "syn123.h"
#include "version.h"
#include "local.h"
#ifdef HAVE_SYS_WAIT_H
@@ -50,6 +52,7 @@ static void long_usage(int err);
static void want_long_usage(char* arg, topt *);
static void print_title(FILE* o);
static void give_version(char* arg, topt *);
static void give_libversion(char* arg, topt *);
struct parameter param = {
FALSE , /* aggressiv */
@@ -244,7 +247,7 @@ void prev_dir(void)
void safe_exit(int code);
static void play_prebuffer(void)
void play_prebuffer(void)
{
/* Ensure that the prebuffer bit has been posted. */
if(prebuffer_fill)
@@ -484,7 +487,7 @@ static void set_appflag(char *arg, topt *opts)
#if defined(NETWORK) || defined(NET123)
static void set_httpauth(char *arg, topt *opts)
{
param.httpauth = compat_strdup(arg);
param.httpauth = INT123_compat_strdup(arg);
// Do not advertise the password for all system users.
memset(arg, 'x', strlen(arg));
}
@@ -495,7 +498,7 @@ static void set_httpauth_file(char *arg, topt *opts)
int good = 0;
if(fd >= 0)
{
ssize_t rdb = read(fd, buf, sizeof(buf));
mpg123_ssize_t rdb = read(fd, buf, sizeof(buf));
// If the file filled the whole buffer, this is too much.
// realistic limits for aith are 255:255.
if(rdb > 0 && rdb < sizeof(buf))
@@ -701,6 +704,7 @@ topt opts[] = {
{'?', "help", 0, want_usage, 0, 0 },
{0 , "longhelp" , 0, want_long_usage, 0, 0 },
{0 , "version" , 0, give_version, 0, 0 },
{0, "libversion" , 0, give_libversion, 0, 0 },
{'l', "listentry", GLO_ARG | GLO_LONG, 0, &param.listentry, 0 },
{0, "continue", GLO_LONG, set_appflag, &appflag, MPG123APP_CONTINUE },
{0, "rva-mix", GLO_INT, 0, &param.rva, 1 },
@@ -719,6 +723,7 @@ topt opts[] = {
{0, "resync-limit", GLO_ARG | GLO_LONG, 0, &param.resync_limit, 0},
{0, "pitch", GLO_ARG|GLO_DOUBLE, 0, &param.pitch, 0},
{0, "pauseloop", GLO_ARG|GLO_DOUBLE, 0, &param.pauseloop, 0},
{0, "presetloop", GLO_ARG|GLO_DOUBLE, 0, &param.pauseloop, 0},
#ifdef NETWORK
{0, "ignore-mime", GLO_LONG, set_appflag, &appflag, MPG123APP_IGNORE_MIME },
#endif
@@ -805,7 +810,7 @@ int play_frame(void)
memcpy(prebuffer, audio, bytes);
prebuffer_fill = bytes;
bytes = 0;
debug1("prebuffered %"SIZE_P" bytes", prebuffer_fill);
debug1("prebuffered %"SIZE_P" bytes", (size_p)prebuffer_fill);
}
if(param.checkrange)
{
@@ -1009,9 +1014,9 @@ int main(int sys_argc, char ** sys_argv)
* so using _wpgmptr with unicode paths after UTF8 conversion is broken on Windows
*/
fullprogname = compat_strdup(_pgmptr);
fullprogname = INT123_compat_strdup(_pgmptr);
#else
fullprogname = compat_strdup(argv[0]);
fullprogname = INT123_compat_strdup(argv[0]);
#endif
if(!fullprogname)
@@ -1287,10 +1292,10 @@ int main(int sys_argc, char ** sys_argv)
For one it serves for track skip when not in terminal control mode.
The more important use being a graceful exit, including telling the buffer process what's going on. */
if(!param.remote)
catchsignal(SIGINT, catch_interrupt);
INT123_catchsignal(SIGINT, catch_interrupt);
/* Need to catch things to exit cleanly, not messing up the terminal. */
catchsignal(SIGTERM, catch_fatal_term);
catchsignal(SIGPIPE, catch_fatal_pipe);
INT123_catchsignal(SIGTERM, catch_fatal_term);
INT123_catchsignal(SIGPIPE, catch_fatal_pipe);
#endif
/* Now either check caps myself or query buffer for that. */
if(audio_setup(ao, mh))
@@ -1329,8 +1334,10 @@ int main(int sys_argc, char ** sys_argv)
}
if(param.delay > 0)
{
// How much control do we want here? Jumping around would mean to get out of the
// delay phase and just mess everything up. Pause/unpause would be the only
// sensible playback controls. Maybe we can enforce that.
controlled_drain();
/* One should enable terminal control during that sleeping phase! */
if(param.verbose > 2) fprintf(stderr, "Note: pausing %i seconds before next track.\n", param.delay);
#ifdef WIN32
Sleep(param.delay*1000);
@@ -1339,6 +1346,7 @@ int main(int sys_argc, char ** sys_argv)
#endif
}
if(!APPFLAG(MPG123APP_CONTINUE)) frames_left = param.frame_number;
term_new_track();
debug1("Going to play %s", strcmp(fname, "-") ? fname : "standard input");
// If a previous track did not cause error, we forget the success to
@@ -1501,13 +1509,13 @@ int main(int sys_argc, char ** sys_argv)
if(!param.quiet)
{
double secs;
double secs = 0;
long frank;
fprintf(stderr, "\n");
if(mpg123_getstate(mh, MPG123_FRANKENSTEIN, &frank, NULL) == MPG123_OK && frank)
fprintf(stderr, "This was a Frankenstein track.\n");
mpg123_position(mh, 0, 0, NULL, NULL, &secs, NULL);
position_info(mh, 0, ao, NULL, NULL, &secs, NULL, NULL, NULL);
fprintf(stderr,"[%d:%02d] Decoding of %s finished.\n", (int)(secs / 60), ((int)secs) % 60, filename);
}
else if(param.verbose) fprintf(stderr, "\n");
@@ -1716,7 +1724,7 @@ static void long_usage(int err)
#ifndef GENERIC
fprintf(o," --title set terminal title to filename\n");
#endif
fprintf(o," --pauseloop <s> loop interval in (fractional) seconds\n");
fprintf(o," --presetloop <s> preset loop interval in (fractional) seconds\n");
fprintf(o," --name <n> set instance name (used in various places)\n");
fprintf(o," --long-tag spacy id3 display with every item on a separate line\n");
fprintf(o," --lyrics show lyrics (from ID3v2 USLT frame)\n");
@@ -1740,6 +1748,7 @@ static void long_usage(int err)
fprintf(o," -? --help give compact help\n");
fprintf(o," --longhelp give this long help listing\n");
fprintf(o," --version give name / version string\n");
fprintf(o," --libversion give version info on mpg123 libraries\n");
fprintf(o,"\nSee the manpage "PACKAGE_NAME"(1) for more information.\n");
mpg123_free_string(enclist);
@@ -1754,7 +1763,19 @@ static void want_long_usage(char* arg, topt *opts)
static void give_version(char* arg, topt *opts)
{
fprintf(stdout, PACKAGE_NAME" "PACKAGE_VERSION"\n");
fprintf(stdout, PACKAGE_NAME " " MPG123_VERSION "\n");
safe_exit(0);
}
static void give_libversion(char* arg, topt *opts)
{
unsigned int pl = 0;
unsigned int al = mpg123_libversion(&pl);
printf("libmpg123 from mpg123 %s, API version %u, patchlevel %u\n", mpg123_distversion(NULL, NULL, NULL), al, pl);
al = out123_libversion(&pl);
printf("libout123 from mpg123 %s, API version %u, patchlevel %u\n", out123_distversion(NULL, NULL, NULL), al, pl);
al = syn123_libversion(&pl);
printf("libsyn123 from mpg123 %s, API version %u, patchlevel %u\n", syn123_distversion(NULL, NULL, NULL), al, pl);
safe_exit(0);
}