mpg123-1.32.0
This commit is contained in:
@@ -1,13 +1,20 @@
|
||||
# Module for non-recursive mpg123 build system.
|
||||
|
||||
if BUILD_LIBMPG123
|
||||
if BUILD_PROGRAMS
|
||||
if HAVE_LFS_WRAP
|
||||
TESTS += \
|
||||
src/tests/decode_fixed.sh
|
||||
endif
|
||||
endif
|
||||
TESTS += \
|
||||
src/tests/decode_fixed.sh \
|
||||
src/tests/seek_whence.sh \
|
||||
src/tests/seek_accuracy.sh \
|
||||
src/tests/resample_total \
|
||||
src/tests/text \
|
||||
src/tests/textprint \
|
||||
src/tests/plain_id3.sh
|
||||
endif
|
||||
|
||||
if !HAVE_SYNTH16
|
||||
XFAIL_TESTS += src/tests/decode_fixed.sh
|
||||
@@ -29,6 +36,7 @@ EXTRA_DIST += \
|
||||
src/tests/plain_id3.txt \
|
||||
src/tests/sweep.mp3
|
||||
|
||||
if BUILD_LIBMPG123
|
||||
check_PROGRAMS += \
|
||||
src/tests/decode_fixed \
|
||||
src/tests/seek_whence \
|
||||
@@ -45,6 +53,7 @@ EXTRA_PROGRAMS += \
|
||||
src/tests/seek_accuracy \
|
||||
src/tests/noise \
|
||||
src/tests/sweeper
|
||||
endif
|
||||
|
||||
src_tests_volume_SOURCES = \
|
||||
src/tests/volume.c
|
||||
|
||||
@@ -25,7 +25,7 @@ int work(mpg123_handle *mh, int ch, int enc)
|
||||
continue;
|
||||
fprintf(stderr, "Got first sample %d and last sample %d out of %zu\n"
|
||||
, buffer[0], buffer[done/sizeof(*buffer)-1], done/sizeof(*buffer) );
|
||||
unintr_write(STDOUT_FILENO, buffer, done);
|
||||
INT123_unintr_write(STDOUT_FILENO, buffer, done);
|
||||
}
|
||||
if(ret != MPG123_DONE)
|
||||
{
|
||||
|
||||
@@ -2,26 +2,44 @@
|
||||
// this, the native wrapper is used, hopefully matching off_t.
|
||||
//#define _FILE_OFFSET_BITS 64
|
||||
//#define _FILE_OFFSET_BITS 32
|
||||
#define SYN123_PORTABLE_API
|
||||
#include <syn123.h>
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#ifdef SYN123_PORTABLE_API
|
||||
typedef int64_t synoff;
|
||||
typedef int64_t synprint;
|
||||
#define SYNPRINT PRIi64
|
||||
#else
|
||||
typedef off_t synoff;
|
||||
typedef intmax_t synprint;
|
||||
#define SYNPRINT PRIiMAX
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
const long arate = 8000;
|
||||
const long brate = 48000;
|
||||
const off_t ins = 12637;
|
||||
const off_t outs = 75822;
|
||||
const synoff ins = 12637;
|
||||
const synoff outs = 75822;
|
||||
|
||||
int main()
|
||||
{
|
||||
off_t outs2 = syn123_resample_total(arate,brate,ins);
|
||||
off_t ins2 = syn123_resample_intotal(arate,brate,outs);
|
||||
#ifdef SYN123_PORTABLE_API
|
||||
synoff outs2 = syn123_resample_total64(arate,brate,ins);
|
||||
synoff ins2 = syn123_resample_intotal64(arate,brate,outs);
|
||||
#else
|
||||
synoff outs2 = syn123_resample_total(arate,brate,ins);
|
||||
synoff ins2 = syn123_resample_intotal(arate,brate,outs);
|
||||
#endif
|
||||
int err = 0;
|
||||
if(outs2 != outs && ++err)
|
||||
fprintf(stderr, "total mismatch: %ld != %ld\n"
|
||||
, (long)outs2, (long)outs );
|
||||
fprintf(stderr, "total mismatch: %" SYNPRINT " != %" SYNPRINT "\n"
|
||||
, (synprint)outs2, (synprint)outs );
|
||||
if(ins2 != ins && ++err)
|
||||
fprintf(stderr, "intotal mismatch: %ld != %ld\n"
|
||||
, (long)ins2, (long)ins );
|
||||
fprintf(stderr, "intotal mismatch: %" SYNPRINT " != %" SYNPRINT "\n"
|
||||
, (synprint)ins2, (synprint)ins );
|
||||
printf("%s\n", err ? "FAIL" : "PASS");
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#define SYN123_PORTABLE_API
|
||||
#include <syn123.h>
|
||||
#include <out123.h>
|
||||
|
||||
@@ -73,7 +74,10 @@ int main(int argc, char **argv)
|
||||
float *outbuf = malloc(sizeof(float)*maxoutblock);
|
||||
float *inbuf = malloc(sizeof(float)*maxinblock);
|
||||
if(!outbuf || !inbuf)
|
||||
{
|
||||
fprintf(stderr, "D'OOM!\n");
|
||||
return -13;
|
||||
}
|
||||
|
||||
off_t intotal = 0;
|
||||
off_t outtotal = 0;
|
||||
@@ -87,18 +91,19 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
}
|
||||
// Determine how many input samples to feed to get block output samples.
|
||||
ssize_t inblock = syn123_resample_inexpect(syn, block);
|
||||
if(inblock <= 0 || inblock > maxinblock)
|
||||
int err;
|
||||
size_t inblock = syn123_resample_in(syn, block, &err);
|
||||
if(err || inblock <= 0 || inblock > maxinblock)
|
||||
{
|
||||
fprintf(stderr, "bad inblock: %zd\n", inblock);
|
||||
fprintf(stderr, "bad inblock: %zu (%i)\n", inblock, err);
|
||||
ret = -15;
|
||||
break;
|
||||
}
|
||||
ssize_t outblock = syn123_resample_expect(syn, inblock);
|
||||
size_t outblock = syn123_resample_out(syn, inblock, &err);
|
||||
fprintf(stderr, "in %zu out %zu\n", inblock, outblock);
|
||||
if(outblock <= 0 || outblock > maxoutblock || outblock < block)
|
||||
if(err || outblock <= 0 || outblock > maxoutblock || outblock < block)
|
||||
{
|
||||
fprintf(stderr, "bad outblock: %zd\n", outblock);
|
||||
fprintf(stderr, "bad outblock: %zu (%d)\n", outblock, err);
|
||||
ret = -16;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,21 @@ int string_good(mpg123_string *sb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int chomp_check(const char *in, const char *out)
|
||||
{
|
||||
int ret = 1;
|
||||
mpg123_string work;
|
||||
mpg123_init_string(&work);
|
||||
if( mpg123_set_string(&work, in) && mpg123_chomp_string(&work)
|
||||
&& mpg123_strlen(&work, 0) == strlen(out)
|
||||
&& !strcmp(work.p, out) )
|
||||
{
|
||||
ret = 0;
|
||||
}
|
||||
mpg123_free_string(&work);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int check_string(const char* name, enum mpg123_text_encoding enc, const unsigned char* source, size_t source_size)
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -74,6 +89,16 @@ int main()
|
||||
|
||||
mpg123_free_string(&trans_utf16le);
|
||||
|
||||
printf("Now some basic usage of chomp and strlen.\n");
|
||||
ret += chomp_check(
|
||||
"This is the longest text evaah \n\n\r"
|
||||
, "This is the longest text evaah "
|
||||
);
|
||||
ret += chomp_check(
|
||||
"Foo."
|
||||
, "Foo."
|
||||
);
|
||||
|
||||
printf("\n%s\n", ret == 0 ? "PASS" : "FAIL");
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user