Built SDL2_image and _mixer static
This commit is contained in:
56
libsdl2_mixer/external/mpg123-1.25.6/src/tests/noise.c
vendored
Normal file
56
libsdl2_mixer/external/mpg123-1.25.6/src/tests/noise.c
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
#include "config.h"
|
||||
#include "compat.h"
|
||||
#include "dither.h"
|
||||
#include "debug.h"
|
||||
|
||||
/* Directly include the code for testing, avoiding
|
||||
build of same object with and without libtool. */
|
||||
#include "../libmpg123/dither_impl.h"
|
||||
|
||||
const char *typenames[] = { "white", "tpdf", "highpass_tpdf" };
|
||||
enum mpg123_noise_type types[] = { mpg123_white_noise, mpg123_tpdf_noise, mpg123_highpass_tpdf_noise };
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
size_t i;
|
||||
size_t count = DITHERSIZE;
|
||||
float *table;
|
||||
enum mpg123_noise_type type = mpg123_highpass_tpdf_noise;
|
||||
|
||||
fprintf(stderr, "Note: You could give two optional arguments: noise type and table size (number count).\n");
|
||||
if(argc > 1)
|
||||
{
|
||||
const char *typename = argv[1];
|
||||
for(i=0; i<sizeof(typenames)/sizeof(char*); ++i)
|
||||
if(strcmp(typename, typenames[i]) == 0)
|
||||
{
|
||||
type = types[i];
|
||||
break;
|
||||
}
|
||||
|
||||
if(i == sizeof(typenames)/sizeof(char*))
|
||||
{
|
||||
error("Unknown noise type!");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if(argc > 2)
|
||||
{
|
||||
count = (size_t) atol(argv[2]);
|
||||
}
|
||||
|
||||
table = malloc(sizeof(float)*count);
|
||||
if(table == NULL)
|
||||
{
|
||||
error("Cannot allocate memory for noise table!");
|
||||
return -2;
|
||||
}
|
||||
|
||||
mpg123_noise(table, count, type);
|
||||
for(i=0; i<count; ++i)
|
||||
printf("%g\n", table[i]);
|
||||
|
||||
free(table);
|
||||
|
||||
return 0;
|
||||
}
|
||||
109
libsdl2_mixer/external/mpg123-1.25.6/src/tests/plain_id3.c
vendored
Normal file
109
libsdl2_mixer/external/mpg123-1.25.6/src/tests/plain_id3.c
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
/* Just printing out ID3 tags with plain data from libmpg123 and explicitly called conversion routine. */
|
||||
|
||||
#include "compat.h"
|
||||
#include <mpg123.h>
|
||||
#include "debug.h"
|
||||
|
||||
int test_whence(const char* path, int scan_before)
|
||||
{
|
||||
int err = MPG123_OK;
|
||||
mpg123_handle* mh = NULL;
|
||||
off_t length, pos;
|
||||
|
||||
mh = mpg123_new(NULL, &err );
|
||||
if(mh == NULL) return -1;
|
||||
|
||||
err = mpg123_open(mh, path );
|
||||
if(err != MPG123_OK) return -1;
|
||||
|
||||
if(scan_before) mpg123_scan(mh);
|
||||
|
||||
pos = mpg123_seek( mh, 0, SEEK_END);
|
||||
if(pos < 0){ error1("seek failed: %s", mpg123_strerror(mh)); return -1; }
|
||||
|
||||
pos = mpg123_tell(mh);
|
||||
length = mpg123_length(mh);
|
||||
|
||||
/* Later: Read samples and compare different whence values with identical seek positions. */
|
||||
|
||||
mpg123_close(mh);
|
||||
mpg123_delete(mh);
|
||||
|
||||
fprintf(stdout, "length %"OFF_P" vs. pos %"OFF_P"\n", length, pos);
|
||||
|
||||
return (pos == length) ? 0 : -1;
|
||||
}
|
||||
|
||||
void print_field(const char *name, mpg123_string *sb)
|
||||
{
|
||||
const unsigned char *sbp = (unsigned char*)sb->p;
|
||||
enum mpg123_text_encoding enc;
|
||||
mpg123_string printer;
|
||||
mpg123_init_string(&printer);
|
||||
printf("\n=== %s ===\n", name);
|
||||
if(sb->fill == 0)
|
||||
{
|
||||
printf("Oh, empty. Totally.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
enc = mpg123_enc_from_id3(sbp[0]);
|
||||
|
||||
printf("From encoding: %i (in ID3: %i)\n", enc, (int)sbp[0]) ;
|
||||
if(mpg123_store_utf8(&printer, enc, sbp+1, sb->fill-1))
|
||||
{
|
||||
/* Not caring for multiple strings separated via null bytes here. */
|
||||
printf("Value: %s\n", printer.p);
|
||||
}
|
||||
else error("Conversion failed!");
|
||||
mpg123_free_string(&printer);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int err;
|
||||
int ret = 0;
|
||||
mpg123_handle *mh;
|
||||
mpg123_id3v2 *id3;
|
||||
|
||||
if(argc < 2)
|
||||
{
|
||||
printf("Gimme a MPEG file name...\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
mpg123_init();
|
||||
mh = mpg123_new(NULL, &err);
|
||||
if(err != MPG123_OK) goto badend;
|
||||
|
||||
mpg123_param(mh, MPG123_ADD_FLAGS, MPG123_PLAIN_ID3TEXT, 0.);
|
||||
|
||||
err = mpg123_open(mh, argv[1]);
|
||||
if(err != MPG123_OK) goto badend;
|
||||
|
||||
err = mpg123_scan(mh);
|
||||
if(err != MPG123_OK) goto badend;
|
||||
|
||||
err = mpg123_id3(mh, NULL, &id3);
|
||||
if(err != MPG123_OK) goto badend;
|
||||
|
||||
if(id3 == NULL)
|
||||
{
|
||||
error("No ID3 data found.");
|
||||
goto badend;
|
||||
}
|
||||
|
||||
print_field("artist", id3->artist);
|
||||
print_field("title", id3->title);
|
||||
print_field("album", id3->album);
|
||||
print_field("comment", id3->comment);
|
||||
|
||||
goto end;
|
||||
badend:
|
||||
ret = -1;
|
||||
end:
|
||||
mpg123_delete(mh);
|
||||
mpg123_exit();
|
||||
return ret;
|
||||
}
|
||||
56
libsdl2_mixer/external/mpg123-1.25.6/src/tests/seek_whence.c
vendored
Normal file
56
libsdl2_mixer/external/mpg123-1.25.6/src/tests/seek_whence.c
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
#include "compat.h"
|
||||
#include <mpg123.h>
|
||||
#include "debug.h"
|
||||
|
||||
int test_whence(const char* path, int scan_before)
|
||||
{
|
||||
int err = MPG123_OK;
|
||||
mpg123_handle* mh = NULL;
|
||||
off_t length, pos;
|
||||
|
||||
mh = mpg123_new(NULL, &err );
|
||||
if(mh == NULL) return -1;
|
||||
|
||||
err = mpg123_open(mh, path );
|
||||
if(err != MPG123_OK) return -1;
|
||||
|
||||
if(scan_before) mpg123_scan(mh);
|
||||
|
||||
pos = mpg123_seek( mh, 0, SEEK_END);
|
||||
if(pos < 0){ error1("seek failed: %s", mpg123_strerror(mh)); return -1; }
|
||||
|
||||
pos = mpg123_tell(mh);
|
||||
length = mpg123_length(mh);
|
||||
|
||||
/* Later: Read samples and compare different whence values with identical seek positions. */
|
||||
|
||||
mpg123_close(mh);
|
||||
mpg123_delete(mh);
|
||||
|
||||
fprintf(stdout, "length %"OFF_P" vs. pos %"OFF_P"\n", length, pos);
|
||||
|
||||
return (pos == length) ? 0 : -1;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int err = 0, errsum = 0;
|
||||
if(argc < 2)
|
||||
{
|
||||
printf("Gimme a MPEG file name...\n");
|
||||
return 0;
|
||||
}
|
||||
mpg123_init();
|
||||
fprintf(stderr, "End seek without (explicit) scanning: ");
|
||||
err = test_whence(argv[1], 0);
|
||||
fprintf(stdout, "%s\n", err == 0 ? "PASS" : "FAIL");
|
||||
errsum += err;
|
||||
fprintf(stderr, "End seek with explicit scanning: ");
|
||||
err = test_whence(argv[1], 1);
|
||||
fprintf(stdout, "%s\n", err == 0 ? "PASS" : "FAIL");
|
||||
errsum += err;
|
||||
mpg123_exit();
|
||||
printf("%s\n", errsum ? "FAIL" : "PASS");
|
||||
return errsum;
|
||||
}
|
||||
34
libsdl2_mixer/external/mpg123-1.25.6/src/tests/testtext.h
vendored
Normal file
34
libsdl2_mixer/external/mpg123-1.25.6/src/tests/testtext.h
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
/* Test strings generated by testtext.sh, using data from test.txt */
|
||||
|
||||
const unsigned char latin1[] =
|
||||
{ 0x47, 0x72, 0x6f, 0xdf, 0x65, 0x72, 0x20, 0x4d, 0xe4, 0x7a, 0x65, 0x6e, 0x2c, 0x20, 0x7a, 0x65, 0x69, 0x67, 0x65, 0x20, 0x64, 0x65, 0x69, 0x6e, 0x65, 0x20, 0x46, 0x6c, 0xfc, 0x67, 0x65, 0x6c, 0x20, 0xf6, 0x66, 0x74, 0x65, 0x72, 0x20, 0x6d, 0x61, 0x6c, 0x21, 0x20, 0x46, 0x61, 0x6b, 0x74, 0x6f, 0x72, 0x20, 0xbc, 0x2c, 0x20, 0x62, 0x69, 0x74, 0x74, 0x65, 0x2e, 0x0a,
|
||||
0x00 };
|
||||
|
||||
const unsigned char cp1252[] =
|
||||
{ 0x47, 0x72, 0x6f, 0xdf, 0x65, 0x72, 0x20, 0x4d, 0xe4, 0x7a, 0x65, 0x6e, 0x2c, 0x20, 0x7a, 0x65, 0x69, 0x67, 0x65, 0x20, 0x64, 0x65, 0x69, 0x6e, 0x65, 0x20, 0x46, 0x6c, 0xfc, 0x67, 0x65, 0x6c, 0x20, 0xf6, 0x66, 0x74, 0x65, 0x72, 0x20, 0x6d, 0x61, 0x6c, 0x21, 0x20, 0x46, 0x61, 0x6b, 0x74, 0x6f, 0x72, 0x20, 0xbc, 0x2c, 0x20, 0x62, 0x69, 0x74, 0x74, 0x65, 0x2e, 0x0a,
|
||||
0x00 };
|
||||
|
||||
const unsigned char utf8[] =
|
||||
{ 0x47, 0x72, 0x6f, 0xc3, 0x9f, 0x65, 0x72, 0x20, 0x4d, 0xc3, 0xa4, 0x7a, 0x65, 0x6e, 0x2c, 0x20, 0x7a, 0x65, 0x69, 0x67, 0x65, 0x20, 0x64, 0x65, 0x69, 0x6e, 0x65, 0x20, 0x46, 0x6c, 0xc3, 0xbc, 0x67, 0x65, 0x6c, 0x20, 0xc3, 0xb6, 0x66, 0x74, 0x65, 0x72, 0x20, 0x6d, 0x61, 0x6c, 0x21, 0x20, 0x46, 0x61, 0x6b, 0x74, 0x6f, 0x72, 0x20, 0xc2, 0xbc, 0x2c, 0x20, 0x62, 0x69, 0x74, 0x74, 0x65, 0x2e, 0x0a,
|
||||
0x00 };
|
||||
|
||||
const unsigned char utf16[] =
|
||||
{ 0xff, 0xfe, 0x47, 0x00, 0x72, 0x00, 0x6f, 0x00, 0xdf, 0x00, 0x65, 0x00, 0x72, 0x00, 0x20, 0x00, 0x4d, 0x00, 0xe4, 0x00, 0x7a, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x2c, 0x00, 0x20, 0x00, 0x7a, 0x00, 0x65, 0x00, 0x69, 0x00, 0x67, 0x00, 0x65, 0x00, 0x20, 0x00, 0x64, 0x00, 0x65, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x65, 0x00, 0x20, 0x00, 0x46, 0x00, 0x6c, 0x00, 0xfc, 0x00, 0x67, 0x00, 0x65, 0x00, 0x6c, 0x00, 0x20, 0x00, 0xf6, 0x00, 0x66, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x20, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x21, 0x00, 0x20, 0x00, 0x46, 0x00, 0x61, 0x00, 0x6b, 0x00, 0x74, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x20, 0x00, 0xbc, 0x00, 0x2c, 0x00, 0x20, 0x00, 0x62, 0x00, 0x69, 0x00, 0x74, 0x00, 0x74, 0x00, 0x65, 0x00, 0x2e, 0x00, 0x0a, 0x00,
|
||||
0x00, 0x00 };
|
||||
|
||||
const unsigned char utf16bom_le[] =
|
||||
{ 0xff, 0xfe, 0x47, 0x00, 0x72, 0x00, 0x6f, 0x00, 0xdf, 0x00, 0x65, 0x00, 0x72, 0x00, 0x20, 0x00, 0x4d, 0x00, 0xe4, 0x00, 0x7a, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x2c, 0x00, 0x20, 0x00, 0x7a, 0x00, 0x65, 0x00, 0x69, 0x00, 0x67, 0x00, 0x65, 0x00, 0x20, 0x00, 0x64, 0x00, 0x65, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x65, 0x00, 0x20, 0x00, 0x46, 0x00, 0x6c, 0x00, 0xfc, 0x00, 0x67, 0x00, 0x65, 0x00, 0x6c, 0x00, 0x20, 0x00, 0xf6, 0x00, 0x66, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x20, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x21, 0x00, 0x20, 0x00, 0x46, 0x00, 0x61, 0x00, 0x6b, 0x00, 0x74, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x20, 0x00, 0xbc, 0x00, 0x2c, 0x00, 0x20, 0x00, 0x62, 0x00, 0x69, 0x00, 0x74, 0x00, 0x74, 0x00, 0x65, 0x00, 0x2e, 0x00, 0x0a, 0x00,
|
||||
0x00, 0x00 };
|
||||
|
||||
const unsigned char utf16le[] =
|
||||
{ 0x47, 0x00, 0x72, 0x00, 0x6f, 0x00, 0xdf, 0x00, 0x65, 0x00, 0x72, 0x00, 0x20, 0x00, 0x4d, 0x00, 0xe4, 0x00, 0x7a, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x2c, 0x00, 0x20, 0x00, 0x7a, 0x00, 0x65, 0x00, 0x69, 0x00, 0x67, 0x00, 0x65, 0x00, 0x20, 0x00, 0x64, 0x00, 0x65, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x65, 0x00, 0x20, 0x00, 0x46, 0x00, 0x6c, 0x00, 0xfc, 0x00, 0x67, 0x00, 0x65, 0x00, 0x6c, 0x00, 0x20, 0x00, 0xf6, 0x00, 0x66, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x20, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x21, 0x00, 0x20, 0x00, 0x46, 0x00, 0x61, 0x00, 0x6b, 0x00, 0x74, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x20, 0x00, 0xbc, 0x00, 0x2c, 0x00, 0x20, 0x00, 0x62, 0x00, 0x69, 0x00, 0x74, 0x00, 0x74, 0x00, 0x65, 0x00, 0x2e, 0x00, 0x0a, 0x00,
|
||||
0x00, 0x00 };
|
||||
|
||||
const unsigned char utf16bom_be[] =
|
||||
{ 0xfe, 0xff, 0x00, 0x47, 0x00, 0x72, 0x00, 0x6f, 0x00, 0xdf, 0x00, 0x65, 0x00, 0x72, 0x00, 0x20, 0x00, 0x4d, 0x00, 0xe4, 0x00, 0x7a, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x2c, 0x00, 0x20, 0x00, 0x7a, 0x00, 0x65, 0x00, 0x69, 0x00, 0x67, 0x00, 0x65, 0x00, 0x20, 0x00, 0x64, 0x00, 0x65, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x65, 0x00, 0x20, 0x00, 0x46, 0x00, 0x6c, 0x00, 0xfc, 0x00, 0x67, 0x00, 0x65, 0x00, 0x6c, 0x00, 0x20, 0x00, 0xf6, 0x00, 0x66, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x20, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x21, 0x00, 0x20, 0x00, 0x46, 0x00, 0x61, 0x00, 0x6b, 0x00, 0x74, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x20, 0x00, 0xbc, 0x00, 0x2c, 0x00, 0x20, 0x00, 0x62, 0x00, 0x69, 0x00, 0x74, 0x00, 0x74, 0x00, 0x65, 0x00, 0x2e, 0x00, 0x0a,
|
||||
0x00, 0x00 };
|
||||
|
||||
const unsigned char utf16be[] =
|
||||
{ 0x00, 0x47, 0x00, 0x72, 0x00, 0x6f, 0x00, 0xdf, 0x00, 0x65, 0x00, 0x72, 0x00, 0x20, 0x00, 0x4d, 0x00, 0xe4, 0x00, 0x7a, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x2c, 0x00, 0x20, 0x00, 0x7a, 0x00, 0x65, 0x00, 0x69, 0x00, 0x67, 0x00, 0x65, 0x00, 0x20, 0x00, 0x64, 0x00, 0x65, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x65, 0x00, 0x20, 0x00, 0x46, 0x00, 0x6c, 0x00, 0xfc, 0x00, 0x67, 0x00, 0x65, 0x00, 0x6c, 0x00, 0x20, 0x00, 0xf6, 0x00, 0x66, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x20, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x21, 0x00, 0x20, 0x00, 0x46, 0x00, 0x61, 0x00, 0x6b, 0x00, 0x74, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x20, 0x00, 0xbc, 0x00, 0x2c, 0x00, 0x20, 0x00, 0x62, 0x00, 0x69, 0x00, 0x74, 0x00, 0x74, 0x00, 0x65, 0x00, 0x2e, 0x00, 0x0a,
|
||||
0x00, 0x00 };
|
||||
|
||||
80
libsdl2_mixer/external/mpg123-1.25.6/src/tests/text.c
vendored
Normal file
80
libsdl2_mixer/external/mpg123-1.25.6/src/tests/text.c
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
text: Test text transformations in libmpg123 (conversion to UTF-8).
|
||||
|
||||
copyright 2009 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
|
||||
initially written by Thomas Orgis
|
||||
|
||||
arguments: decoder testfile.mpeg
|
||||
*/
|
||||
|
||||
#include <mpg123.h>
|
||||
#include <compat.h>
|
||||
|
||||
#include "testtext.h"
|
||||
|
||||
int string_good(mpg123_string *sb)
|
||||
{
|
||||
/* Let's accept additional null bytes... */
|
||||
if(sb->fill >= sizeof(utf8) && memcmp(utf8, sb->p, sizeof(utf8)) == 0
|
||||
&& (sb->fill <= sizeof(utf8) || sb->p[sizeof(utf8)] == 0) )
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int check_string(const char* name, enum mpg123_text_encoding enc, const unsigned char* source, size_t source_size)
|
||||
{
|
||||
int ret = 0;
|
||||
mpg123_string sb;
|
||||
mpg123_init_string(&sb);
|
||||
printf("Conversion of %s: ", name);
|
||||
if( mpg123_store_utf8(&sb, enc, source, source_size)
|
||||
&& string_good(&sb) )
|
||||
{
|
||||
printf("PASS\n");
|
||||
ret = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("FAIL (%"SIZE_P" vs. %"SIZE_P")\n", (size_p)sb.fill, (size_p)sizeof(utf8));
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
mpg123_free_string(&sb);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* We test: latin1, cp1252, utf8 and all of utf16be/le with and without BOM.
|
||||
Everything should succeed -- except utf16le without BOM. */
|
||||
int main()
|
||||
{
|
||||
int ret = 0;
|
||||
mpg123_string trans_utf16le;
|
||||
|
||||
mpg123_init_string(&trans_utf16le);
|
||||
|
||||
/* First, all conversions that should work. */
|
||||
ret += check_string("latin1", mpg123_text_latin1, latin1, sizeof(latin1));
|
||||
ret += check_string("cp1252", mpg123_text_cp1252, cp1252, sizeof(cp1252));
|
||||
ret += check_string("utf8", mpg123_text_utf8, utf8, sizeof(utf8));
|
||||
ret += check_string("utf16bom_be", mpg123_text_utf16bom, utf16bom_be, sizeof(utf16bom_be));
|
||||
ret += check_string("utf16bom_le", mpg123_text_utf16, utf16bom_le, sizeof(utf16bom_le));
|
||||
ret += check_string("utf16be", mpg123_text_utf16be, utf16be, sizeof(utf16be));
|
||||
|
||||
/* Now test the non-supported string. */
|
||||
printf("Let's see what happens with a non-BOM little endian UTF-16 string: ");
|
||||
mpg123_store_utf8(&trans_utf16le, mpg123_text_utf16, utf16le, sizeof(utf16le));
|
||||
if(string_good(&trans_utf16le))
|
||||
{
|
||||
++ret;
|
||||
printf("FAIL\n");
|
||||
}
|
||||
else printf("PASS\n");
|
||||
|
||||
mpg123_free_string(&trans_utf16le);
|
||||
|
||||
printf("\n%s\n", ret == 0 ? "PASS" : "FAIL");
|
||||
|
||||
return ret;
|
||||
}
|
||||
Reference in New Issue
Block a user