Built SDL2_image and _mixer static

This commit is contained in:
2022-09-30 15:49:16 -04:00
parent e2605bf6c1
commit 1dec4347e0
4473 changed files with 1964551 additions and 9 deletions

View File

@ -0,0 +1,64 @@
#!/usr/bin/perl
#
# benchmark-cpu.pl: benchmark CPU optimizations of mpg123
#
# initially written by Nicholas J Humfrey <njh@aelius.com>, placed in the public domain
#
use strict;
#use Time::HiRes qw/time/;
my $MPG123_CMD = shift @ARGV;
my @TEST_FILES = @ARGV;
die "Please specify full path to mpg123 >= 1.7.0 and a test MP3 file to decode" if (scalar(@ARGV) < 1);
die "mpg123 command does not exist" unless (-e $MPG123_CMD);
die "mpg123 command is not executable" unless (-x $MPG123_CMD);
for(@TEST_FILES)
{
die "test MP3 file does not exist" unless (-e $_);
}
# Force unbuffed output on STDOUT
#$|=1; # why?
# Check the CPUs available
my $cpulist = `$MPG123_CMD --test-cpu`;
chomp( $cpulist );
die "Failed to get list of available CPU optimizations" unless ($cpulist =~ s/^Supported decoders: //);
my @cpus = split( / /, $cpulist );
my @encs = qw(s16 f32);
printf STDERR ("Found %d CPU optimizations to test...\n\n", scalar(@cpus) );
print "#mpg123 benchmark (user CPU time in seconds for decoding)\n";
print "#decoder";
for(@encs){ print " t_$_/s"; }
print "\n";
my $allret = 0;
foreach my $cpu (@cpus)
{
print "$cpu";
foreach my $e (@encs)
{
# using user CPU time
my @start_time = times();
my $ret = system($MPG123_CMD, '-q', '--cpu', $cpu, '-e', $e, '-t', @TEST_FILES );
my @end_time = times();
my $runtime = $end_time[2] - $start_time[2];
if($ret)
{
print STDERR "Execution of $MPG123_CMD failed with code $ret!\n";
$runtime = 0;
$allret = 1;
}
# third entry is child user time
printf(" %4.2f", $runtime);
}
print("\n");
}
exit($allret);

View File

@ -0,0 +1,133 @@
#!/usr/bin/env perl
# Hacked by Thomas Orgis, use at your leisure.
use strict;
use locale;
use File::Basename qw(basename dirname);
my @mpg123_command = qw(mpg123 --continue -Cv --rva-album);
my $listfile = "conplay.m3u";
my $glob = '*.mp[123]';
my $dir = shift;
unless(defined $dir)
{
print STDERR "\nThis little wrapper runs $mpg123_command[0] on a given directory (hand in '.' for the current one), playing all $glob files therein in terminal control mode. The extra trick is that a playlist file ($listfile by default) is read and updated (created) with the position you left playback at (via 'q' key), to return on next invokation.\n";
print STDERR "\nIf you give an existing file instead of a directory, or some non-existing path, as first and only paramter, it is used as playlist name and the directory part is used as the base directory for playback.\n";
print STDERR "\nThe name stands for CONtinued PLAYback. What did you think?;-)\n\n";
exit;
}
if(-f $dir or (not -e $dir))
{
$listfile = basename($dir);
$dir = dirname($dir);
}
chdir($dir) or die "Cannot enter $dir ($!)!\n";
print STDERR "Playing things in: $dir\n";
my @files;
my $entry = 1;
my $frame = 0;
if(-e $listfile)
{
open(LIST, '<', $listfile) or die "Cannot read playlist ($!)!\n";
while(<LIST>)
{
chomp;
unless(/^#/)
{
push(@files, $_);
}
elsif(/^#\s*current entry:\s*(\d+)$/)
{
$entry = $1;
}
elsif(/^#\s*current frame:\s*(\d+)$/)
{
$frame = $1;
}
}
close(LIST);
}
else
{
@files = get_files($glob);
write_list();
}
unless(@files)
{
print STDERR "There are no files to play.\n";
exit;
}
if($entry < 0 or $entry > @files or $frame < 0)
{
die "You got bad data in your playlist file (mismatch between current entry and total count, bad frame index). Clean that up.\n";
}
push(@mpg123_command, '-k', $frame, '--listentry', $entry, '-@', $listfile);
print STDERR "running player:\n\t@mpg123_command\n\n";
open(MPG123, '-|', @mpg123_command) or die "Cannot run mpg123!";
while(<MPG123>)
{
print STDOUT $_;
if(/^\[CONTINUE\]\s+track\s+(\d+)\s+frame\s+(\d+)/)
{
$entry = $1;
$frame = $2;
}
if(/^\[BOOKMARK\]\s+track\s+(\d+)\s+frame\s+(\d+)/)
{
print STDERR "\nGot bookmark at track $1, frame $2; not yet doing anything with that, besides storing.\n";
$entry = $1;
$frame = $2;
}
}
close(MPG123);
if($entry > @files)
{
$entry = 0;
$frame = 0;
}
print STDERR "Continue point is in track $entry, frame $frame.\n";
write_list();
sub write_list
{
unless(@files)
{
print STDERR "Refusing to write empty playlist.\n";
return;
}
open(LIST, '>', $listfile) or die "Cannot write Playlist";
print LIST "#M3U\n";
print LIST "#current entry: $entry\n";
print LIST "#current frame: $frame\n";
for my $f (@files)
{
print LIST "$f\n";
}
close(LIST);
}
sub get_files
{
my $glob = shift;
my @files;
open(FIND, '-|', 'find', '.', '-type', 'f', '-name', $glob) or die "Cannot exec find to find files: ($!)\n";
@files = <FIND>;
close(FIND);
chomp(@files);
return sort @files;
}

View File

@ -0,0 +1,71 @@
#!/bin/bash
if test $# -eq 0; then
echo "Give me some MPEG 1.0/2.0/2.5 layer 1/2/3 audio file name(s) and I give you meta info about it in an easily-parseable format:
name=value
for simple value association and
name.=value
to add another line to existing value (multiline comments)."
fi
for i in "$@"
do
echo lp "$i"
echo tag
echo scan
echo format
echo sample
done |
mpg123 -t -R |
perl -e '
while(<STDIN>)
{
if(/\@T \{/)
{
print "# meta info for: ".(shift @ARGV)."\n";
$field = undef;
%count = ();
%linecount = ();
}
elsif(/\@T ID3:(.*)$/)
{
$field = undef;
print "ID3v1.title=".substr($1, 0, 30)."\n";
print "ID3v1.artist=".substr($1, 30, 30)."\n";
print "ID3v1.album=".substr($1, 60, 30)."\n";
print "ID3v1.year=".substr($1, 90, 4)."\n";
print "ID3v1.comment=".substr($1, 94, 30)."\n";
print "ID3v1.genre=".substr($1, 124)."\n";
}
elsif(/\@T ID3\.([^:]+):(.*)$/)
{
$field = undef;
print "ID3.$1=$2\n";
}
elsif(/\@T (ID3v2\.\S{4})(|\s+lang\(([^\(\)]*)\)\s+desc\(([^\(\)]*)\)):/)
{
$class = $1;
$field = ++$count{$class} > 1 ? "$class$count{$class}" : $class;
print "$field.lang=$3\n" if(defined $3);
print "$field.desc=$4\n" if(defined $4);
}
elsif(/\@T =(.*)$/)
{
next unless defined $field;
print "$field".(++$linecount{$field} > 1 ? ".=" : "=").$1."\n";
}
elsif(/\@FORMAT\s+(\d+)\s+(\d+)/)
{
print "format.rate=$1\n";
print "format.channels=$2\n";
}
elsif(/\@SAMPLE\s+(\d+)\s+(\d+)/)
{
print "samples=$2\n";
}
}
' "$@"

View File

@ -0,0 +1,76 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# needs mutagen
# grabbed from: http://code.activestate.com/recipes/577138-embed-lyrics-into-mp3-files-using-mutagen-uslt-tag/
# simplified to only work on one file and get lyrics from stdin
# I suspect this is public domain code. Just a usage example of the mutagen lib.
import os
import sys
import codecs
from mutagen.mp3 import MP3
from mutagen.id3 import ID3NoHeaderError
from mutagen.id3 import ID3, USLT
TEXT_ENCODING = 'utf8'
TEXT_LANG = 'XXX'
TEXT_DESC = ''
# get workdir from first arg or use current dir
if (len(sys.argv) > 1):
fname = sys.argv[1]
print "fname=" + fname
else:
print 'Give me at least a file name to work on, plus the lyrics from stdin'
print 'Optionally, you can provide the language (3 lowercase letters) of the lyrics and a description'
sys.exit()
if (len(sys.argv) > 2):
TEXT_LANG = sys.argv[2]
if (len(sys.argv) > 3):
TEXT_DESC = sys.argv[3]
print "reading lyrics from standard input ..."
lyrics = sys.stdin.read().strip()
# try to find the right encoding
for enc in ('utf8','iso-8859-1','iso-8859-15','cp1252','cp1251','latin1'):
try:
lyrics = lyrics.decode(enc)
TEXT_DESC = TEXT_DESC.decode(enc)
print enc,
break
except:
pass
print "Adding lyrics to " + fname
print "Language: " + TEXT_LANG
print "Description: " + TEXT_DESC
# create ID3 tag if not exists
try:
tags = ID3(fname)
except ID3NoHeaderError:
print "Adding ID3 header;",
tags = ID3()
# remove old unsychronized lyrics
if len(tags.getall(u"USLT::'"+TEXT_LANG+"'")) != 0:
print "Removing Lyrics."
tags.delall(u"USLT::'"+TEXT_LANG+"'")
#tags.save(fname) # hm, why?
#tags.add(USLT(encoding=3, lang=u'eng', desc=u'desc', text=lyrics))
# apparently the description is important when more than one
# USLT frames are present
#tags[u"USLT::'eng'"] = (USLT(encoding=3, lang=u'eng', desc=u'desc', text=lyrics))
tags[u"USLT::'"+TEXT_LANG+"'"] = (USLT(encoding=3, lang=TEXT_LANG, desc=TEXT_DESC, text=lyrics))
print 'Added USLT frame to', fname
tags.save(fname)
print 'Done'