summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/libmad/libmadplugin.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.cpp b/core/multimedia/opieplayer/libmad/libmadplugin.cpp
index b06cdaa..0adb503 100644
--- a/core/multimedia/opieplayer/libmad/libmadplugin.cpp
+++ b/core/multimedia/opieplayer/libmad/libmadplugin.cpp
@@ -15,49 +15,48 @@
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20// largly modified by Maximilian Reiss <max.reiss@gmx.de> 20// largly modified by Maximilian Reiss <max.reiss@gmx.de>
21 21
22#include <stdio.h> 22#include <stdio.h>
23#include <stdarg.h> 23#include <stdarg.h>
24#include <stdlib.h> 24#include <stdlib.h>
25#include <sys/types.h> 25#include <sys/types.h>
26#include <sys/stat.h> 26#include <sys/stat.h>
27#include <fcntl.h> 27#include <fcntl.h>
28#include <unistd.h> 28#include <unistd.h>
29#include <string.h> 29#include <string.h>
30#include <ctype.h> 30#include <ctype.h>
31#include <errno.h> 31#include <errno.h>
32#include <time.h> 32#include <time.h>
33#include <locale.h> 33#include <locale.h>
34#include <math.h> 34#include <math.h>
35#include <assert.h> 35#include <assert.h>
36 36
37#include <qapplication.h> 37#include <qapplication.h>
38#include <qmessagebox.h> 38#include <qmessagebox.h>
39#include <qregexp.h>
40 39
41#include <qpe/config.h> 40#include <qpe/config.h>
42 41
43// for network handling 42// for network handling
44#include <netinet/in.h> 43#include <netinet/in.h>
45#include <netdb.h> 44#include <netdb.h>
46#include <sys/socket.h> 45#include <sys/socket.h>
47#include <arpa/inet.h> 46#include <arpa/inet.h>
48#include <unistd.h> 47#include <unistd.h>
49 48
50 49
51//#define HAVE_MMAP 50//#define HAVE_MMAP
52 51
53#if defined(HAVE_MMAP) 52#if defined(HAVE_MMAP)
54# include <sys/mman.h> 53# include <sys/mman.h>
55#endif 54#endif
56#include "libmadplugin.h" 55#include "libmadplugin.h"
57 56
58 57
59extern "C" { 58extern "C" {
60#include "mad.h" 59#include "mad.h"
61} 60}
62 61
63 62
@@ -800,40 +799,42 @@ void LibMadPlugin::printID3Tags() {
800 if ( ::lseek( d->input.fd, -128, SEEK_END ) == -1 ) { 799 if ( ::lseek( d->input.fd, -128, SEEK_END ) == -1 ) {
801 qDebug( "error seeking to id3 tags" ); 800 qDebug( "error seeking to id3 tags" );
802 return; 801 return;
803 } 802 }
804 803
805 if ( ::read( d->input.fd, id3v1, 128 ) != 128 ) { 804 if ( ::read( d->input.fd, id3v1, 128 ) != 128 ) {
806 qDebug( "error reading in id3 tags" ); 805 qDebug( "error reading in id3 tags" );
807 return; 806 return;
808 } 807 }
809 808
810 if ( ::strncmp( (const char *)id3v1, "TAG", 3 ) != 0 ) { 809 if ( ::strncmp( (const char *)id3v1, "TAG", 3 ) != 0 ) {
811 debugMsg( "sorry, no id3 tags" ); 810 debugMsg( "sorry, no id3 tags" );
812 } else { 811 } else {
813 int len[5] = { 30, 30, 30, 4, 30 }; 812 int len[5] = { 30, 30, 30, 4, 30 };
814 QString label[5] = { tr( "Title" ), tr( "Artist" ), tr( "Album" ), tr( "Year" ), tr( "Comment" ) }; 813 QString label[5] = { tr( "Title" ), tr( "Artist" ), tr( "Album" ), tr( "Year" ), tr( "Comment" ) };
815 char *ptr = id3v1 + 3, *ptr2 = ptr + len[0]; 814 char *ptr = id3v1 + 3, *ptr2 = ptr + len[0];
816 qDebug( "ID3 tags in file:" ); 815 qDebug( "ID3 tags in file:" );
817 info = ""; 816 info = "";
818 for ( int i = 0; i < 5; ptr += len[i], i++, ptr2 += len[i] ) { 817 for ( int i = 0; i < 5; ptr += len[i], i++, ptr2 += len[i] ) {
819 char push = *ptr2; 818 char push = *ptr2;
820 *ptr2 = '\0'; 819 *ptr2 = '\0';
821 char *ptr3 = ptr2; 820 char *ptr3 = ptr2;
822 while ( ptr3-1 >= ptr && isspace(ptr3[-1]) ) ptr3--; 821 while ( ptr3-1 >= ptr && isspace(ptr3[-1]) ) ptr3--;
823 char push2 = *ptr3; *ptr3 = '\0'; 822 char push2 = *ptr3; *ptr3 = '\0';
824 if ( strcmp( ptr, "" ) ) 823 if ( strcmp( ptr, "" ) ) {
824 if( ((QString)ptr).find(" ") == -1) // don't add anything that has blanks
825 info += ( i != 0 ? ", " : "" ) + label[i] + ": " + ptr; 825 info += ( i != 0 ? ", " : "" ) + label[i] + ": " + ptr;
826 //qDebug( info.latin1() ); 826 }
827// qDebug( info.latin1() );
827 *ptr3 = push2; 828 *ptr3 = push2;
828 *ptr2 = push; 829 *ptr2 = push;
829 } 830 }
830 if (id3v1[126] == 0 && id3v1[127] != 0) 831 if (id3v1[126] == 0 && id3v1[127] != 0)
831 info += tr( ", Track: " ) + id3v1[127]; 832 info += tr( ", Track: " ) + id3v1[127];
832 } 833 }
833 834
834 if ( ::lseek(d->input.fd, 0, SEEK_SET) == -1 ) { 835 if ( ::lseek(d->input.fd, 0, SEEK_SET) == -1 ) {
835 qDebug( "error seeking back to beginning" ); 836 qDebug( "error seeking back to beginning" );
836 return; 837 return;
837 } 838 }
838} 839}
839 840