PDA

View Full Version : Audio:Scan 0.44 Trouble with MP3 CBR Files



punkdog
2009-10-20, 09:44
I have installed 7.4 from tarball on my Synology CS407 box. (ARM-Marvell based)
So far I managed to crosscompile all needed perl CPAN modules via the Synology toolchain for my box. Server is up and running stable except of one problem.

The Audio:Scan module ver 0.44 is not able to get the correct playtime for all of my CBR MP3 files. Playtime for VBR files is allways correct but CBR files have allways a playtime of 0.

To find the error I added some debug output to the Slim/Formats/Mp3.pm file and can see that for cbr files the returned song_lenght_ms is a negative value.

I'm not sure is this problem is related to my own crosscompilation or if this is a general problem with the Audio::Scan module on Linux.
Any ideas?

andyg
2009-10-20, 09:51
On Oct 20, 2009, at 12:44 PM, punkdog wrote:

>
> I have installed 7.4 from tarball on my Synology CS407 box. (ARM-
> Marvell
> based)
> So far I managed to crosscompile all needed perl CPAN modules via the
> Synology toolchain for my box. Server is up and running stable
> except of
> one problem.
>
> The Audio:Scan module ver 0.44 is not able to get the correct playtime
> for all of my CBR MP3 files. Playtime for VBR files is allways correct
> but CBR files have allways a playtime of 0.
>
> To find the error I added some debug output to the Slim/Formats/Mp3.pm
> file and can see that for cbr files the returned song_lenght_ms is a
> negative value.

I have tons of CBR files in the test suite and also my own library and
never ran into this problem. You should make sure your compile passes
all the Audio::Scan tests.

BTW, 7.4.1 now includes official ARM modules that may run on your box.

punkdog
2009-10-20, 10:05
Thanks Andy,

the problem seems to come from the APE Tags added by the mp3gain tool.
If I remove those Tags from the CBR files I can get correct Playtime.

andyg
2009-10-20, 10:11
Can you please file a bug for me and attach a file that has this
problem?

On Oct 20, 2009, at 1:05 PM, punkdog wrote:

>
> Thanks Andy,
>
> the problem seems to come from the APE Tags added by the mp3gain tool.
> If I remove those Tags from the CBR files I can get correct Playtime.

punkdog
2009-10-21, 06:30
Hi Andy,

I have to correct my previous post. The CBR file I have tested with has a
Lame header and did work allways. The evil was the PerlIO_tell function,
which allways says filesize=0. Calculation of playtime, when no lame header is available, is done by filesize - audiooffset and samplerate in "mp3.c". So if filesize is 0 the result will allways be negative.

Adding -DUSE_STDIO to the compile options in the Makefile did the trick.

p.s. I have tested your new arm modules, but they did not work for me (Segment fault)
Here the perl -V of my Synology machine

Summary of my perl5 (revision 5 version 8 subversion 3) configuration:
Platform:
osname=linux, osvers=2.6.15, archname=MARVELL_88F5281
uname='linux 2.6.15'
config_args=''
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=unde
f
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='/usr/local/arm-marvell-linux-gnu/bin/arm-marvell-linux-gnu-gcc', ccflags
='-I/usr/local/arm-marvell-linux-gnu/include -DSYNO_MARVELL_88F5281 -g -DSYNO_P
LATFORM=MARVELL_88F5281 -fno-strict-aliasing -fexpensive-optimizations -fomit-fr
ame-pointer -g ',
optimize='-O2',
cppflags='-fno-strict-aliasing'
ccversion='', gccversion='2.95.3 20010125 (prerelease)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize
=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='/usr/local/arm-marvell-linux-gnu/bin/arm-marvell-linux-gnu-ld', ldflags
=''
libpth=/usr/local/arm-marvell-linux-gnu/lib /usr/syno/lib
libs=-lnsl -ldl -lm -lcrypt -lc -lutil -lc -L/usr/local/arm-marvell-linux-gn
u/lib/gcc/arm-marvell-linux-gnu/3.4.3 -lgcc_s -L/source/perl-5.8.6 -lperl
perllibs=-lnsl -ldl -lm -lcrypt -lc -lutil -L/usr/local/arm-marvell-linux-gn
u/lib/gcc/arm-marvell-linux-gnu/3.4.3 -lgcc_s
libc=/usr/local/arm-marvell-linux-gnu/lib/libc-2.3.2.so, so=so, useshrplib=t
rue, libperl=libperl.so
gnulibc_version='2.2.2'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-I/usr/local/arm-m
arvell-linux-gnu/include -DSYNO_MARVELL_88F5281 -g -DSYNO_PLATFORM=MARVELL_88F52
81 -fno-strict-aliasing -fexpensive-optimizations -fomit-frame-pointer -g '
cccdlflags='-I/usr/local/arm-marvell-linux-gnu/include -DSYNO_MARVELL_88F528
1 -g -DSYNO_PLATFORM=MARVELL_88F5281 -fno-strict-aliasing -fexpensive-optimizati
ons -fomit-frame-pointer -g ', lddlflags='-shared -L/usr/local/arm-marvell-linux
-gnu/lib/gcc/arm-marvell-linux-gnu/3.4.3 -L/source/perl-5.8.6 -lperl -lgcc_s -L/
usr/syno/lib'

Characteristics of this binary (from libperl):
Compile-time options: USE_LARGE_FILES
Built under linux
Compiled at Apr 22 2009 04:56:25
@INC:
/usr/lib/perl5/5.8.6/MARVELL_88F5281
/usr/lib/perl5/5.8.6
/usr/lib/perl5/site_perl/5.8.6/MARVELL_88F5281
/usr/lib/perl5/site_perl/5.8.6
/usr/lib/perl5/site_perl

andyg
2009-10-21, 07:17
On Oct 21, 2009, at 9:30 AM, punkdog wrote:

>
> Hi Andy,
>
> I have to correct my previous post. The CBR file I have tested with
> has
> a
> Lame header and did work allways. The evil was the PerlIO_tell
> function,
> which allways says filesize=0. Calculation of playtime, when no lame
> header is available, is done by filesize - audiooffset and
> samplerate in
> "mp3.c". So if filesize is 0 the result will allways negative.
>
> Adding -DUSE_STDIO to the compile options in the Makefile did the
> trick.

Thanks for tracking that down. I should probably be using stat()
instead of tell() anyway for finding the file size. I'd like to be
able to test this though, do you have any info on how to reproduce?
Maybe it's related to the stdio settings your Perl was compiled with.
Can you paste your perl -V output?

punkdog
2009-10-21, 07:35
The perl -V is allready in my previous post, but I have added it by editing the post.


Hi Andy,

I have to correct my previous post. The CBR file I have tested with has a
Lame header and did work allways. The evil was the PerlIO_tell function,
which allways says filesize=0. Calculation of playtime, when no lame header is available, is done by filesize - audiooffset and samplerate in "mp3.c". So if filesize is 0 the result will allways be negative.

Adding -DUSE_STDIO to the compile options in the Makefile did the trick.

p.s. I have tested your new arm modules, but they did not work for me (Segment fault)
Here the perl -V of my Synology machine

Summary of my perl5 (revision 5 version 8 subversion 3) configuration:
Platform:
osname=linux, osvers=2.6.15, archname=MARVELL_88F5281
uname='linux 2.6.15'
config_args=''
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=unde
f
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='/usr/local/arm-marvell-linux-gnu/bin/arm-marvell-linux-gnu-gcc', ccflags
='-I/usr/local/arm-marvell-linux-gnu/include -DSYNO_MARVELL_88F5281 -g -DSYNO_P
LATFORM=MARVELL_88F5281 -fno-strict-aliasing -fexpensive-optimizations -fomit-fr
ame-pointer -g ',
optimize='-O2',
cppflags='-fno-strict-aliasing'
ccversion='', gccversion='2.95.3 20010125 (prerelease)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize
=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='/usr/local/arm-marvell-linux-gnu/bin/arm-marvell-linux-gnu-ld', ldflags
=''
libpth=/usr/local/arm-marvell-linux-gnu/lib /usr/syno/lib
libs=-lnsl -ldl -lm -lcrypt -lc -lutil -lc -L/usr/local/arm-marvell-linux-gn
u/lib/gcc/arm-marvell-linux-gnu/3.4.3 -lgcc_s -L/source/perl-5.8.6 -lperl
perllibs=-lnsl -ldl -lm -lcrypt -lc -lutil -L/usr/local/arm-marvell-linux-gn
u/lib/gcc/arm-marvell-linux-gnu/3.4.3 -lgcc_s
libc=/usr/local/arm-marvell-linux-gnu/lib/libc-2.3.2.so, so=so, useshrplib=t
rue, libperl=libperl.so
gnulibc_version='2.2.2'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-I/usr/local/arm-m
arvell-linux-gnu/include -DSYNO_MARVELL_88F5281 -g -DSYNO_PLATFORM=MARVELL_88F52
81 -fno-strict-aliasing -fexpensive-optimizations -fomit-frame-pointer -g '
cccdlflags='-I/usr/local/arm-marvell-linux-gnu/include -DSYNO_MARVELL_88F528
1 -g -DSYNO_PLATFORM=MARVELL_88F5281 -fno-strict-aliasing -fexpensive-optimizati
ons -fomit-frame-pointer -g ', lddlflags='-shared -L/usr/local/arm-marvell-linux
-gnu/lib/gcc/arm-marvell-linux-gnu/3.4.3 -L/source/perl-5.8.6 -lperl -lgcc_s -L/
usr/syno/lib'

Characteristics of this binary (from libperl):
Compile-time options: USE_LARGE_FILES
Built under linux
Compiled at Apr 22 2009 04:56:25
@INC:
/usr/lib/perl5/5.8.6/MARVELL_88F5281
/usr/lib/perl5/5.8.6
/usr/lib/perl5/site_perl/5.8.6/MARVELL_88F5281
/usr/lib/perl5/site_perl/5.8.6
/usr/lib/perl5/site_perl

andyg
2009-10-21, 08:00
OK, thanks, I'll see about switching to stat().

punkdog
2009-10-23, 03:51
Here my final solution for the crosscompile of Audio::Scan for my Synlogy box.

Compiling with -DUSE_STDIO makes the scan work but results in Segmentation Faults when playing an Internetradio station.

Finnaly it seems that the PerlIO_seek function fails on Synologies Perl implementation. To fix this I compiled it with -DUSE_PERLIO and added the following #define to include/common.h

#define PerlIO_seek(a, b, c) fseek(PerlIO_findFILE(a), b, c)

This solution works fine for Scan and Internetradio.