mirror of
http://mpg123.de/trunk/.git
synced 2025-10-25 04:37:34 +03:00
A commit motivated by SunOS veteran Winston. He gave SunOS 4.1.2 with gcc 2.7.0 a spin.
A commit that looks bigger than it is. Most files only got header #includes removed that are handled in mpg123.h . Then there are the corresponding changes in mpg123.h; together with the addition of safe_realloc for ancient systems. The ugly need for snprintf in make_remote_header() has been avoided by changing this one into print_remote_header(). The Question of size_t, ssize_t and off_t is handled in configure now; respectively in config.h.legacy . git-svn-id: svn://scm.orgis.org/mpg123/trunk@861 35dc7657-300d-0410-a2e5-dc2837fedb53
This commit is contained in:
@@ -30,7 +30,6 @@ AC_PROG_INSTALL
|
|||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
|
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
AC_C_BIGENDIAN
|
|
||||||
AC_INLINE
|
AC_INLINE
|
||||||
|
|
||||||
# Check if system supports termios
|
# Check if system supports termios
|
||||||
@@ -179,6 +178,12 @@ if test $ccalign = "yes"; then
|
|||||||
AC_DEFINE(CCALIGN, 1, [ Define if __attribute__((aligned(16))) works ])
|
AC_DEFINE(CCALIGN, 1, [ Define if __attribute__((aligned(16))) works ])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl ############## Types
|
||||||
|
|
||||||
|
AC_TYPE_SIZE_T()
|
||||||
|
AC_TYPE_SSIZE_T()
|
||||||
|
AC_TYPE_OFF_T()
|
||||||
|
|
||||||
dnl ############## Function Checks
|
dnl ############## Function Checks
|
||||||
|
|
||||||
AC_FUNC_MMAP
|
AC_FUNC_MMAP
|
||||||
|
|||||||
@@ -455,7 +455,7 @@ solaris-gcc-nas:
|
|||||||
sunos:
|
sunos:
|
||||||
$(MAKE) CC=gcc \
|
$(MAKE) CC=gcc \
|
||||||
OBJECTS="decode.o dct64.o audio_sun.o" \
|
OBJECTS="decode.o dct64.o audio_sun.o" \
|
||||||
CFLAGS="$(CFLAGS) $(CPPFLAGS) -O2 -DOPT_GENERIC -DSUNOS -DREAL_IS_FLOAT -DHAVE_MMAP \
|
CFLAGS="$(CFLAGS) $(CPPFLAGS) -O2 -DOPT_GENERIC -DSUNOS -DREAL_IS_FLOAT -DHAVE_MMAP -DHAVE_SYS_IOCTL_H -DHAVE_SUN_AUDIOIO_H \
|
||||||
-funroll-loops" \
|
-funroll-loops" \
|
||||||
mpg123-make
|
mpg123-make
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
initially written by Michael Hipp
|
initially written by Michael Hipp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include "mpg123.h"
|
#include "mpg123.h"
|
||||||
|
|
||||||
void audio_info_struct_init(struct audio_info_struct *ai)
|
void audio_info_struct_init(struct audio_info_struct *ai)
|
||||||
|
|||||||
@@ -6,15 +6,10 @@
|
|||||||
initially written by Juergen Schoew and Tomas Oegren
|
initially written by Juergen Schoew and Tomas Oegren
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/audio.h>
|
#include <sys/audio.h>
|
||||||
#include <stropts.h>
|
#include <stropts.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|||||||
@@ -36,9 +36,8 @@
|
|||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include "mpg123.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
@@ -47,7 +46,6 @@
|
|||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "mpg123.h"
|
|
||||||
|
|
||||||
#include "Alib.h" /* /opt/audio/include */
|
#include "Alib.h" /* /opt/audio/include */
|
||||||
#include "CUlib.h" /* /opt/audio/include */
|
#include "CUlib.h" /* /opt/audio/include */
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
#include "mpg123.h"
|
#include "mpg123.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <sys/asoundlib.h>
|
#include <sys/asoundlib.h>
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,6 @@
|
|||||||
#include <CoreServices/CoreServices.h>
|
#include <CoreServices/CoreServices.h>
|
||||||
#include <AudioUnit/AudioUnit.h>
|
#include <AudioUnit/AudioUnit.h>
|
||||||
#include <AudioToolbox/AudioToolbox.h>
|
#include <AudioToolbox/AudioToolbox.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#define FIFO_DURATION (0.5f)
|
#define FIFO_DURATION (0.5f)
|
||||||
|
|||||||
@@ -6,18 +6,10 @@
|
|||||||
initially written by Michael Hipp
|
initially written by Michael Hipp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "mpg123.h"
|
#include "mpg123.h"
|
||||||
|
#include <fcntl.h>
|
||||||
#include <sys/audio.h>
|
#include <sys/audio.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int audio_set_rate(struct audio_info_struct *ai)
|
static int audio_set_rate(struct audio_info_struct *ai)
|
||||||
{
|
{
|
||||||
if(ai->rate >= 0)
|
if(ai->rate >= 0)
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
initially written by Nicholas J. Humfrey
|
initially written by Nicholas J. Humfrey
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include <jack/jack.h>
|
#include <jack/jack.h>
|
||||||
|
|||||||
@@ -6,16 +6,11 @@
|
|||||||
initially written by Martin Denn
|
initially written by Martin Denn
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include "mpg123.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <audio/audiolib.h>
|
#include <audio/audiolib.h>
|
||||||
#include <audio/soundlib.h>
|
#include <audio/soundlib.h>
|
||||||
|
|
||||||
#include "mpg123.h"
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
AuServer *aud;
|
AuServer *aud;
|
||||||
|
|||||||
@@ -6,12 +6,8 @@
|
|||||||
initially written by Michael Hipp
|
initially written by Michael Hipp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "mpg123.h"
|
#include "mpg123.h"
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
initially written by Nicholas J. Humfrey
|
initially written by Nicholas J. Humfrey
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include <portaudio.h>
|
#include <portaudio.h>
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
initially written by Nicholas J. Humfrey
|
initially written by Nicholas J. Humfrey
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|||||||
@@ -6,13 +6,7 @@
|
|||||||
initially written (as it seems) by Thomas Woerner
|
initially written (as it seems) by Thomas Woerner
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/* #include <audio.h> */
|
/* #include <audio.h> */
|
||||||
#include <dmedia/audio.h>
|
#include <dmedia/audio.h>
|
||||||
|
|||||||
@@ -6,10 +6,6 @@
|
|||||||
initially written by Michael Hipp
|
initially written by Michael Hipp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include "mpg123.h"
|
#include "mpg123.h"
|
||||||
@@ -45,6 +41,9 @@ static void audio_set_format_helper(struct audio_info_struct *ai, audio_info_t *
|
|||||||
case -1:
|
case -1:
|
||||||
case AUDIO_FORMAT_SIGNED_16:
|
case AUDIO_FORMAT_SIGNED_16:
|
||||||
default:
|
default:
|
||||||
|
#ifndef AUDIO_ENCODING_LINEAR /* not supported */
|
||||||
|
#define AUDIO_ENCODING_LINEAR 3
|
||||||
|
#endif
|
||||||
ainfo->play.encoding = AUDIO_ENCODING_LINEAR;
|
ainfo->play.encoding = AUDIO_ENCODING_LINEAR;
|
||||||
ainfo->play.precision = 16;
|
ainfo->play.precision = 16;
|
||||||
break;
|
break;
|
||||||
@@ -159,7 +158,7 @@ int audio_open(struct audio_info_struct *ai)
|
|||||||
if(ai->fn < 0)
|
if(ai->fn < 0)
|
||||||
return ai->fn;
|
return ai->fn;
|
||||||
|
|
||||||
#ifdef SUNOS
|
#if defined(SUNOS) && defined(AUDIO_GETDEV)
|
||||||
{
|
{
|
||||||
int type;
|
int type;
|
||||||
if(ioctl(ai->fn, AUDIO_GETDEV, &type) == -1)
|
if(ioctl(ai->fn, AUDIO_GETDEV, &type) == -1)
|
||||||
@@ -193,8 +192,10 @@ int audio_open(struct audio_info_struct *ai)
|
|||||||
ainfo.play.port |= AUDIO_SPEAKER;
|
ainfo.play.port |= AUDIO_SPEAKER;
|
||||||
if(ai->output & AUDIO_OUT_HEADPHONES)
|
if(ai->output & AUDIO_OUT_HEADPHONES)
|
||||||
ainfo.play.port |= AUDIO_HEADPHONE;
|
ainfo.play.port |= AUDIO_HEADPHONE;
|
||||||
|
#ifdef AUDIO_LINE_OUT
|
||||||
if(ai->output & AUDIO_OUT_LINE_OUT)
|
if(ai->output & AUDIO_OUT_LINE_OUT)
|
||||||
ainfo.play.port |= AUDIO_LINE_OUT;
|
ainfo.play.port |= AUDIO_LINE_OUT;
|
||||||
|
#endif
|
||||||
|
|
||||||
if(ai->gain != -1)
|
if(ai->gain != -1)
|
||||||
ainfo.play.gain = ai->gain;
|
ainfo.play.gain = ai->gain;
|
||||||
@@ -222,7 +223,7 @@ int audio_get_formats(struct audio_info_struct *ai)
|
|||||||
audio_info_t ainfo;
|
audio_info_t ainfo;
|
||||||
int i,fmts=0;
|
int i,fmts=0;
|
||||||
|
|
||||||
for(i=0;i<4;i++) {
|
for(i=0;i<sizeof(tab)/sizeof(tab[0]);i++) {
|
||||||
AUDIO_INITINFO(&ainfo);
|
AUDIO_INITINFO(&ainfo);
|
||||||
ainfo.play.encoding = tab[i][0];
|
ainfo.play.encoding = tab[i][0];
|
||||||
ainfo.play.precision = tab[i][1];
|
ainfo.play.precision = tab[i][1];
|
||||||
|
|||||||
@@ -6,10 +6,7 @@
|
|||||||
initially written (as it seems) by Tony Million
|
initially written (as it seems) by Tony Million
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "mpg123.h"
|
#include "mpg123.h"
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
#ifndef NOXFERMEM
|
#ifndef NOXFERMEM
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
int outburst = MAXOUTBURST;
|
int outburst = MAXOUTBURST;
|
||||||
|
|||||||
30
src/common.c
30
src/common.c
@@ -7,16 +7,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#ifdef HAVE_INTTYPES_H
|
|
||||||
#include <inttypes.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
@@ -995,11 +988,10 @@ debug2("bitrate index: %i (%i)", fr->bitrate_index, tabsel_123[fr->lsf][1][fr->b
|
|||||||
|
|
||||||
/* concurring to print_rheader... here for control_generic */
|
/* concurring to print_rheader... here for control_generic */
|
||||||
const char* remote_header_help = "S <mpeg-version> <layer> <sampling freq> <mode(stereo/mono/...)> <mode_ext> <framesize> <stereo> <copyright> <error_protected> <emphasis> <bitrate> <extension> <vbr(0/1=yes/no)>";
|
const char* remote_header_help = "S <mpeg-version> <layer> <sampling freq> <mode(stereo/mono/...)> <mode_ext> <framesize> <stereo> <copyright> <error_protected> <emphasis> <bitrate> <extension> <vbr(0/1=yes/no)>";
|
||||||
void make_remote_header(struct frame* fr, char *target)
|
void print_remote_header(struct frame* fr)
|
||||||
{
|
{
|
||||||
/* redundancy */
|
|
||||||
static char *modes[4] = {"Stereo", "Joint-Stereo", "Dual-Channel", "Single-Channel"};
|
static char *modes[4] = {"Stereo", "Joint-Stereo", "Dual-Channel", "Single-Channel"};
|
||||||
snprintf(target, 1000, "S %s %d %ld %s %d %d %d %d %d %d %d %d %d",
|
generic_sendmsg("S %s %d %ld %s %d %d %d %d %d %d %d %d %d",
|
||||||
fr->mpeg25 ? "2.5" : (fr->lsf ? "2.0" : "1.0"),
|
fr->mpeg25 ? "2.5" : (fr->lsf ? "2.0" : "1.0"),
|
||||||
fr->lay,
|
fr->lay,
|
||||||
freqs[fr->sampling_frequency],
|
freqs[fr->sampling_frequency],
|
||||||
@@ -1015,24 +1007,6 @@ void make_remote_header(struct frame* fr, char *target)
|
|||||||
vbr);
|
vbr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef MPG123_REMOTE
|
|
||||||
void print_rheader(struct frame *fr)
|
|
||||||
{
|
|
||||||
static char *modes[4] = { "Stereo", "Joint-Stereo", "Dual-Channel", "Single-Channel" };
|
|
||||||
static char *layers[4] = { "Unknown" , "I", "II", "III" };
|
|
||||||
static char *mpeg_type[2] = { "1.0" , "2.0" };
|
|
||||||
|
|
||||||
/* version, layer, freq, mode, channels, bitrate, BPF, VBR*/
|
|
||||||
fprintf(stderr,"@I %s %s %ld %s %d %d %d %i\n",
|
|
||||||
mpeg_type[fr->lsf],layers[fr->lay],freqs[fr->sampling_frequency],
|
|
||||||
modes[fr->mode],fr->stereo,
|
|
||||||
vbr == ABR ? abr_rate : tabsel_123[fr->lsf][fr->lay-1][fr->bitrate_index],
|
|
||||||
fr->framesize+4,
|
|
||||||
vbr);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void print_header(struct frame *fr)
|
void print_header(struct frame *fr)
|
||||||
{
|
{
|
||||||
static char *modes[4] = { "Stereo", "Joint-Stereo", "Dual-Channel", "Single-Channel" };
|
static char *modes[4] = { "Stereo", "Joint-Stereo", "Dual-Channel", "Single-Channel" };
|
||||||
|
|||||||
@@ -86,7 +86,8 @@ MPEG 2.5
|
|||||||
|
|
||||||
/* for control_generic */
|
/* for control_generic */
|
||||||
extern const char* remote_header_help;
|
extern const char* remote_header_help;
|
||||||
void make_remote_header(struct frame* fr, char *target);
|
void print_remote_header(struct frame* fr);
|
||||||
|
void generic_sendmsg (const char *fmt, ...);
|
||||||
|
|
||||||
int position_info(struct frame* fr, unsigned long no, long buffsize, struct audio_info_struct* ai,
|
int position_info(struct frame* fr, unsigned long no, long buffsize, struct audio_info_struct* ai,
|
||||||
unsigned long* frames_left, double* current_seconds, double* seconds_left);
|
unsigned long* frames_left, double* current_seconds, double* seconds_left);
|
||||||
|
|||||||
@@ -27,3 +27,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define INDEX_SIZE 1000
|
#define INDEX_SIZE 1000
|
||||||
|
|
||||||
|
/* Define to `long int' if <sys/types.h> does not define. */
|
||||||
|
/* #undef off_t */
|
||||||
|
|
||||||
|
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||||
|
/* #undef size_t */
|
||||||
|
|
||||||
|
/* Define to `int' if <sys/types.h> does not define. */
|
||||||
|
/* #undef ssize_t */
|
||||||
|
|||||||
@@ -7,18 +7,14 @@
|
|||||||
reworked by Thomas Orgis - it was the entry point for eventually becoming maintainer...
|
reworked by Thomas Orgis - it was the entry point for eventually becoming maintainer...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#else
|
#else
|
||||||
#include <winsock.h>
|
#include <winsock.h>
|
||||||
#endif
|
#endif
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
@@ -164,9 +160,7 @@ int control_generic (struct frame *fr)
|
|||||||
generic_sendmsg("P 0");
|
generic_sendmsg("P 0");
|
||||||
}
|
}
|
||||||
if (init) {
|
if (init) {
|
||||||
static char tmp[1000];
|
print_remote_header(fr);
|
||||||
make_remote_header(fr, tmp);
|
|
||||||
generic_sendmsg(tmp);
|
|
||||||
init = 0;
|
init = 0;
|
||||||
}
|
}
|
||||||
if(!frame_before && (silent == 0))
|
if(!frame_before && (silent == 0))
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
initially written by Michael Hipp
|
initially written by Michael Hipp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
initially written by Michael Hipp
|
initially written by Michael Hipp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
absolutely not optimized for this operation
|
absolutely not optimized for this operation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
altivec optimization by tmkk
|
altivec optimization by tmkk
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
even for Intel processors.
|
even for Intel processors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,6 @@
|
|||||||
* (c) 1998 Fabrice Bellard
|
* (c) 1998 Fabrice Bellard
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "mpg123.h"
|
#include "mpg123.h"
|
||||||
|
|
||||||
#define FIR_SIZE 16
|
#define FIR_SIZE 16
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
initially written by Michael Hipp
|
initially written by Michael Hipp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|||||||
@@ -26,37 +26,26 @@
|
|||||||
Funny aspect there is that shoutcast servers do not do HTTP/1.1 chunked transfer but implement some different chunking themselves...
|
Funny aspect there is that shoutcast servers do not do HTTP/1.1 chunked transfer but implement some different chunking themselves...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include "mpg123.h"
|
||||||
|
|
||||||
/* That _is_ real now */
|
/* That _is_ real now */
|
||||||
#define ACCEPT_HEAD "Accept: audio/mpeg, audio/x-mpeg, audio/x-mpegurl, audio/x-scpls, application/pls, */*\r\n"
|
#define ACCEPT_HEAD "Accept: audio/mpeg, audio/x-mpeg, audio/x-mpegurl, audio/x-scpls, application/pls, */*\r\n"
|
||||||
char *proxyurl = NULL;
|
char *proxyurl = NULL;
|
||||||
|
|
||||||
#if !defined(WIN32) && !defined(GENERIC)
|
#if !defined(WIN32) && !defined(GENERIC)
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/* for SIZE_MAX */
|
|
||||||
#ifdef HAVE_STDINT_H
|
|
||||||
#include <stdint.h>
|
|
||||||
#endif
|
|
||||||
#ifndef SIZE_MAX
|
|
||||||
/* hm, is this portable across preprocessors? */
|
|
||||||
#define SIZE_MAX ((size_t)-1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define HTTP_MAX_RELOCATIONS 20
|
#define HTTP_MAX_RELOCATIONS 20
|
||||||
|
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "mpg123.h"
|
|
||||||
#include "stringbuf.h"
|
#include "stringbuf.h"
|
||||||
#include "icy.h"
|
#include "icy.h"
|
||||||
|
|
||||||
@@ -634,7 +623,7 @@ int http_open (char* url, char** content_type)
|
|||||||
if(purl_size < needed_length)
|
if(purl_size < needed_length)
|
||||||
{
|
{
|
||||||
purl_size = needed_length;
|
purl_size = needed_length;
|
||||||
purl = realloc(purl, purl_size);
|
purl = safe_realloc(purl, purl_size);
|
||||||
if(purl == NULL)
|
if(purl == NULL)
|
||||||
{
|
{
|
||||||
http_failure;
|
http_failure;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#include <stdlib.h>
|
|
||||||
#include "mpg123.h"
|
#include "mpg123.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "stringbuf.h"
|
#include "stringbuf.h"
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
The int-vs-pointer situation has to be cleaned up.
|
The int-vs-pointer situation has to be cleaned up.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include "mpg123.h"
|
#include "mpg123.h"
|
||||||
#include "huffman.h"
|
#include "huffman.h"
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#define ME "main"
|
#define ME "main"
|
||||||
#include "mpg123.h"
|
#include "mpg123.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -125,6 +124,13 @@ static int intflag = FALSE;
|
|||||||
|
|
||||||
int OutputDescriptor;
|
int OutputDescriptor;
|
||||||
|
|
||||||
|
/* A safe realloc also for very old systems where realloc(NULL, size) returns NULL. */
|
||||||
|
void *safe_realloc(void *ptr, size_t size)
|
||||||
|
{
|
||||||
|
if(ptr == NULL) return malloc(size);
|
||||||
|
else return realloc(ptr, size);
|
||||||
|
}
|
||||||
|
|
||||||
#if !defined(WIN32) && !defined(GENERIC)
|
#if !defined(WIN32) && !defined(GENERIC)
|
||||||
#ifndef NOXFERMEM
|
#ifndef NOXFERMEM
|
||||||
static void catch_child(void)
|
static void catch_child(void)
|
||||||
|
|||||||
27
src/mpg123.h
27
src/mpg123.h
@@ -9,13 +9,18 @@
|
|||||||
used source: musicout.h from mpegaudio package
|
used source: musicout.h from mpegaudio package
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef _MPG123_H_
|
||||||
|
#define _MPG123_H_
|
||||||
|
|
||||||
/* everyone needs it */
|
/* everyone needs it */
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <sys/signal.h>
|
#include <sys/signal.h>
|
||||||
@@ -23,17 +28,21 @@
|
|||||||
#endif
|
#endif
|
||||||
/* want to suport large files in future */
|
/* want to suport large files in future */
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
#ifndef off_t
|
|
||||||
#define off_t long
|
#ifdef HAVE_INTTYPES_H
|
||||||
|
#include <inttypes.h>
|
||||||
|
#endif
|
||||||
|
/* for SIZE_MAX */
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
|
#ifndef SIZE_MAX
|
||||||
|
/* hm, is this portable across preprocessors? */
|
||||||
#ifndef _AUDIO_H_
|
#define SIZE_MAX ((size_t)-1)
|
||||||
#define _AUDIO_H_
|
#endif
|
||||||
|
|
||||||
typedef unsigned char byte;
|
typedef unsigned char byte;
|
||||||
|
|
||||||
@@ -436,4 +445,6 @@ extern scale_t outscale;
|
|||||||
|
|
||||||
#include "optimize.h"
|
#include "optimize.h"
|
||||||
|
|
||||||
|
void *safe_realloc(void *ptr, size_t size);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -493,7 +493,7 @@ int add_to_playlist(char* new_entry, char freeit)
|
|||||||
{
|
{
|
||||||
struct listitem* tmp = NULL;
|
struct listitem* tmp = NULL;
|
||||||
/* enlarge the list */
|
/* enlarge the list */
|
||||||
tmp = (struct listitem*) realloc(pl.list, (pl.size + pl.alloc_step) * sizeof(struct listitem));
|
tmp = (struct listitem*) safe_realloc(pl.list, (pl.size + pl.alloc_step) * sizeof(struct listitem));
|
||||||
if(!tmp)
|
if(!tmp)
|
||||||
{
|
{
|
||||||
error("unable to allocate more memory for playlist");
|
error("unable to allocate more memory for playlist");
|
||||||
|
|||||||
@@ -6,13 +6,10 @@
|
|||||||
initially written by Michael Hipp
|
initially written by Michael Hipp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include "mpg123.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include "mpg123.h"
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "icy.h"
|
#include "icy.h"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
stringbuf: mimicking a bit of C++ to more safely handle strings
|
stringbuf: mimicking a bit of C++ to more safely handle strings
|
||||||
|
|
||||||
copyright 2006 by the mpg123 project - free software under the terms of the LGPL 2.1
|
copyright 2006-7 by the mpg123 project - free software under the terms of the LGPL 2.1
|
||||||
see COPYING and AUTHORS files in distribution or http://mpg123.org
|
see COPYING and AUTHORS files in distribution or http://mpg123.org
|
||||||
initially written by Thomas Orgis
|
initially written by Thomas Orgis
|
||||||
*/
|
*/
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "stringbuf.h"
|
#include "stringbuf.h"
|
||||||
#include <stdlib.h>
|
#include "mpg123.h" /* actually just for safe_realloc */
|
||||||
|
|
||||||
void init_stringbuf(struct stringbuf* sb)
|
void init_stringbuf(struct stringbuf* sb)
|
||||||
{
|
{
|
||||||
@@ -34,7 +34,7 @@ int resize_stringbuf(struct stringbuf* sb, size_t new)
|
|||||||
{
|
{
|
||||||
char* t;
|
char* t;
|
||||||
debug("really!");
|
debug("really!");
|
||||||
t = (char*) realloc(sb->p, new*sizeof(char));
|
t = (char*) safe_realloc(sb->p, new*sizeof(char));
|
||||||
debug1("realloc returned %p", (void*) t);
|
debug1("realloc returned %p", (void*) t);
|
||||||
if(t != NULL)
|
if(t != NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
./system < my_system_stream.mpg | mpg123 -
|
./system < my_system_stream.mpg | mpg123 -
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
initially written by Michael Hipp
|
initially written by Michael Hipp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "mpg123.h"
|
#include "mpg123.h"
|
||||||
|
|
||||||
static unsigned char *conv16to8_buf = NULL;
|
static unsigned char *conv16to8_buf = NULL;
|
||||||
|
|||||||
@@ -11,10 +11,8 @@
|
|||||||
#ifdef HAVE_TERMIOS
|
#ifdef HAVE_TERMIOS
|
||||||
|
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
|||||||
@@ -14,8 +14,6 @@
|
|||||||
It's not a very clean code ... Fix this!
|
It's not a very clean code ... Fix this!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "mpg123.h"
|
#include "mpg123.h"
|
||||||
|
|
||||||
#ifdef FLOATOUT
|
#ifdef FLOATOUT
|
||||||
|
|||||||
@@ -12,12 +12,9 @@
|
|||||||
|
|
||||||
#ifndef NOXFERMEM
|
#ifndef NOXFERMEM
|
||||||
|
|
||||||
#include <stdio.h>
|
#include "mpg123.h"
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
@@ -28,7 +25,6 @@
|
|||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "mpg123.h"
|
|
||||||
|
|
||||||
#ifndef HAVE_MMAP
|
#ifndef HAVE_MMAP
|
||||||
#include <sys/ipc.h>
|
#include <sys/ipc.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user