Package: splay / 0.9.5.2-14

0.9.5.2-13 Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
Description: Initial quilt patch
 Patch for accumulated changes from splay-0.9.5.2
 .
   * Switch to dpkg-source 3.0 (quilt) format
   * Removes autoconf chaff prior to build
Author: John Hedges <john@drystone.co.uk>

--- splay-0.9.5.2.orig/configure.in
+++ splay-0.9.5.2/configure.in
@@ -11,8 +11,18 @@ AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PROG_RANLIB
 
+AC_LANG(C++)
+
 dnl Checks for libraries.
-AC_CHECK_LIB(id3, ID3Tag_New)
+AC_CHECK_LIB([tag], [main], [AC_CHECK_HEADERS([taglib/tag.h],
+    [AC_DEFINE([TAGLIB], [1], [Define to 1 for taglib])]
+    [LIBTAG=1]
+	[LIBS="$LIBS -ltag"]
+    )])
+
+if test ! "$LIBTAG" = 1; then
+    AC_CHECK_LIB([id3], [ID3Tag_New])
+fi
 AC_CHECK_LIB(m, cos)
 AC_CHECK_LIB(pthread,main,INCLUDEPTHREAD=1)
 AC_CHECK_LIB(qt, main,XSPLAY=xsplay)
--- splay-0.9.5.2.orig/libs/fileplayer.cc
+++ splay-0.9.5.2/libs/fileplayer.cc
@@ -9,8 +9,7 @@
 #include "config.h"
 #endif
 
-#include <string.h>
-#include <iostream.h>
+#include <iostream>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -18,6 +17,8 @@
 
 #include "mpegsound.h"
 
+using namespace std;
+
 // File player superclass
 Fileplayer::Fileplayer()
 {
@@ -43,7 +44,7 @@ Mpegfileplayer::~Mpegfileplayer()
   if(server)delete server;
 }
 
-bool Mpegfileplayer::openfile(char *filename,char *device)
+bool Mpegfileplayer::openfile(char *filename,const char *device)
 {
 // Player
   if(device==NULL){
@@ -126,9 +127,7 @@ bool Mpegfileplayer::playing(int verbose
   }
 
   // Playing
-  int err;
-  while( err)  { 
-    err = server->run(100);
+  while (server->run(100)) { 
     if(frameinfo) {
       int currframe=server-> getcurrentframe();
       double currtime=1.0*currframe*pcmperframe/frequency;
@@ -166,9 +165,7 @@ bool Mpegfileplayer::playingwiththread(i
   }
 
   // Playing
-  int err;
-  while( err)  { 
-    err = server->run(100);
+  while (server->run(100)) {
     if(frameinfo) {
       int currframe=server-> getcurrentframe();
       double currtime=1.0*currframe*pcmperframe/frequency;
@@ -188,7 +185,7 @@ bool Mpegfileplayer::playingwiththread(i
 
 void Mpegfileplayer::showverbose(int )
 {
-  static char *modestring[4]={"stereo","joint stereo","dual channel","mono"};
+  static const char *modestring[4]={"stereo","joint stereo","dual channel","mono"};
 
   fprintf(stderr,"\tMPEG-%d Layer %d, %s,\n\t%dHz%s, %dkbit/s, ",
 	  server->getversion()+1,
--- splay-0.9.5.2.orig/libs/rawplayer.cc
+++ splay-0.9.5.2/libs/rawplayer.cc
@@ -24,7 +24,7 @@
 #define IOCTL(a,b,c)		(c = ioctl(a,b,c) )
 #endif
 
-char *Rawplayer::defaultdevice="/dev/dsp";
+const char *Rawplayer::defaultdevice="/dev/dsp";
 
 /* Volume */
 int Rawplayer::setvolume(int volume)
@@ -57,7 +57,7 @@ Rawplayer::~Rawplayer()
   close(audiohandle);
 }
 
-bool Rawplayer::initialize(char *filename)
+bool Rawplayer::initialize(const char *filename)
 {
   int flag;
 
--- splay-0.9.5.2.orig/libs/mpegtoraw.cc
+++ splay-0.9.5.2/libs/mpegtoraw.cc
@@ -15,6 +15,7 @@
 
 #include <math.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 
 #include "mpegsound.h"
@@ -22,6 +23,8 @@
 
 #define MY_PI 3.14159265358979323846
 
+#include <iostream>
+
 Mpegtoraw::Mpegtoraw(Soundinputstream *loader,Soundplayer *player)
 {
   __errorcode=SOUND_ERROR_OK;
@@ -359,7 +362,7 @@ bool Mpegtoraw::loadheader(void)
 
   c=((loader->getbytedirect()))>>1;
   padding=(c&1);             c>>=1;
-  frequency=(_frequency)(c&2); c>>=2;
+  frequency=(_frequency)(c&3); c>>=2;
   bitrateindex=(int)c;
   if(bitrateindex==15)return seterrorcode(SOUND_ERROR_BAD);
 
@@ -380,8 +383,10 @@ bool Mpegtoraw::loadheader(void)
 
   channelbitrate=bitrateindex;
   if(inputstereo)
+  {
     if(channelbitrate==4)channelbitrate=1;
     else channelbitrate-=4;
+  }
 
   if(channelbitrate==1 || channelbitrate==2)tableindex=0; else tableindex=1;
 
@@ -551,8 +556,6 @@ int  Mpegtoraw::getframesaved(void)
 
 #endif
 
-
-#include <iostream.h>
 // Convert mpeg to raw
 bool Mpegtoraw::run(int frames)
 {
--- splay-0.9.5.2.orig/libs/rawtofile.cc
+++ splay-0.9.5.2/libs/rawtofile.cc
@@ -20,7 +20,7 @@ Rawtofile::~Rawtofile()
   close(filehandle);
 }
 
-bool Rawtofile::initialize(char *filename)
+bool Rawtofile::initialize(const char *filename)
 {
   if(filename==NULL)filehandle=1;
   else if((filehandle=creat(filename,0644))==-1)
--- splay-0.9.5.2.orig/libs/mpegsound.h
+++ splay-0.9.5.2/libs/mpegsound.h
@@ -11,7 +11,6 @@
 /************************************/
 #include <stdio.h>
 #include <sys/types.h>
-#include <string.h>
 
 #ifdef PTHREADEDMPEG
 #ifdef HAVE_PTHREAD_H
@@ -230,7 +229,7 @@ public:
   Soundplayer() {__errorcode=SOUND_ERROR_OK;};
   virtual ~Soundplayer();
 
-  virtual bool initialize(char *filename)                       =0;
+  virtual bool initialize(const char *filename)                       =0;
   virtual void abort(void);
   virtual int  getprocessed(void);
 
@@ -255,7 +254,7 @@ class Rawtofile : public Soundplayer
 public:
   ~Rawtofile();
 
-  bool initialize(char *filename);
+  bool initialize(const char *filename);
   bool setsoundtype(int stereo,int samplesize,int speed);
   bool putblock(void *buffer,int size);
 
@@ -270,7 +269,7 @@ class Rawplayer : public Soundplayer
 public:
   ~Rawplayer();
 
-  bool initialize(char *filename);
+  bool initialize(const char *filename);
   void abort(void);
   int  getprocessed(void);
 
@@ -284,7 +283,7 @@ public:
   void setquota(int q){quota=q;};
   int  getquota(void) {return quota;};
 
-  static char *defaultdevice;
+  static const char *defaultdevice;
   static int  setvolume(int volume);
 
 private:
@@ -573,7 +572,7 @@ public:
 
   int geterrorcode(void)        {return __errorcode;};
 
-  virtual bool openfile(char *filename,char *device)=0;
+  virtual bool openfile(char *filename,const char *device)=0;
   virtual void setforcetomono(bool flag)            =0;
   virtual bool playing(int verbose,bool frameinfo, int startframe)                 =0;
 
@@ -593,7 +592,7 @@ public:
   Mpegfileplayer();
   ~Mpegfileplayer();
 
-  bool openfile(char *filename,char *device);
+  bool openfile(char *filename,const char *device);
   void setforcetomono(bool flag);
   void setdownfrequency(int value);
   bool playing(int verbose, bool frameinfo, int startframe);
--- splay-0.9.5.2.orig/apps/Makefile.am
+++ splay-0.9.5.2/apps/Makefile.am
@@ -15,7 +15,7 @@ noinst_HEADERS		= multipleselect.h files
 LDADD= ../libs/libmpeg.a
 
 INCLUDES = -I../libs  -I/usr/include/qt
-xsplay_LDADD=-lqt $(LDADD)
+xsplay_LDADD=-lqt -lz $(LDADD)
 
 man_MANS = splay.1 xsplay.1
 EXTRA_DIST = $(man_MANS)
--- splay-0.9.5.2.orig/apps/splay.1
+++ splay-0.9.5.2/apps/splay.1
@@ -8,16 +8,11 @@ splay \- MPEG-1,2 Audio layer 1,2,3 file
 [-2VMfmrsv] [-k num] [-d dev] [-l list] [-t num]
 .I filenames...
 
-.B xsplay
-[-2Vemrsv] [-d dev] [-l list] [-t num]
-.I filenames...
-
 .SH DESCRIPTION
 .I Splay
 is the sound file player such as MPEG-1,2 Audio files.  And you can
 play these files using list file.  With pthread, it can play sound
-files smoother. And it has X-interface with libqt. Splay with qt may
-make you splay easily.
+files smoother.
 
 .SH OPTIONS
 .I Splay
@@ -29,35 +24,32 @@ If you use this option, you may play MPE
 CPU very much.
 .PD 0
 .TP
-.BI \-e
-exit when play is done. (xsplay)
-.TP
 .BI \-f
 display info on played and remaining frames and time.
 .TP
 .BI \-m
 force to mono.\fR
 .PD 0 
-Play with mono even if file have stereo quality.
+Play with mono even if file is in stereo.
 .PD 0
 .TP
 .BI \-r
-Repeat forever. (Not X-interface)
-If you \-r with \-s, list files would be shuffled everytime.
+Repeat forever.
+If you \-r with \-s, list files are shuffled every time.
 .PD 0
 .TP
 .BI \-s
 Shuffle play. If you give list file or a number of files,
-Splay will makes them rearranged randomly. And with \-r
-Everytime the order of files would be changed.
+Splay will rearrange them randomly. And with \-r
+every time the order of files is changed.
 .PD 0
 .TP
-.BI \-v
+.BI \-v[v[v]]
 Verbose, Very verbose, Very very verbose.
 .PD 0
 .TP
 .BI \-M
-Play MPEG file as standard input.
+Play MPEG file from standard input.
 .PD 0
 .TP
 .BI \-V
@@ -68,7 +60,7 @@ Show version number.
 .I num
 of frames were saved during playing. When CPU is so busy and prevents
 splay from decoding, splay will play back using saved frames. This feature
-makes you do other job freely with listing MPEG music.
+lets you do other job freely while listening to MPEG music.
 .PD 0
 .TP
 .B \-k " num"
--- splay-0.9.5.2.orig/apps/functions.cc
+++ splay-0.9.5.2/apps/functions.cc
@@ -10,6 +10,7 @@
 #endif
 
 #include <stdio.h>
+#include <string>
 
 #include "xsplay.h"
 
--- splay-0.9.5.2.orig/apps/common.cc
+++ splay-0.9.5.2/apps/common.cc
@@ -20,7 +20,7 @@
 int  splay_verbose=0;
 int splay_startframe=0;
 char *splay_progname;
-char *splay_devicename=NULL;
+const char *splay_devicename=NULL;
 
 char *splay_list[MAXLISTSIZE];
 int  splay_listsize=0;
@@ -34,7 +34,7 @@ bool splay_shuffleflag=false,
 int splay_threadnum=50;
 #endif
 
-char *splay_Sounderrors[SOUND_ERROR_UNKNOWN]=
+const char *splay_Sounderrors[SOUND_ERROR_UNKNOWN]=
 { "Failed to open sound device.",
   "Sound device is busy.",
   "Buffersize of sound device is wrong.",
@@ -186,7 +186,9 @@ void shufflelist(void)
 
   for(i=splay_listsize-1;i>0;i--)
   {
-    p=random()%i;
+    p=random()%(i+1);
+
+    if(p==i)continue;
 
     tmp=splay_list[p];
     splay_list[p]=splay_list[i];
--- splay-0.9.5.2.orig/apps/splay.h
+++ splay-0.9.5.2/apps/splay.h
@@ -10,7 +10,7 @@
 extern int  splay_verbose;
 extern int splay_startframe;
 extern char *splay_progname;
-extern char *splay_devicename;
+extern const char *splay_devicename;
 
 extern char *splay_list[MAXLISTSIZE];
 extern int  splay_listsize;
@@ -20,7 +20,7 @@ extern bool splay_shuffleflag,
             splay_forcetomonoflag,
             splay_frameinfo;
 
-extern char *splay_Sounderrors[];
+extern const char *splay_Sounderrors[];
 
 #ifdef PTHREADEDMPEG
 extern int  splay_threadnum;
--- splay-0.9.5.2.orig/apps/splay.cc
+++ splay-0.9.5.2/apps/splay.cc
@@ -16,20 +16,27 @@
 
 #include <sys/types.h>
 #include <sys/wait.h>
-#include <iostream.h>
+#include <iostream>
+
+#ifdef TAGLIB
+#include <taglib/tag.h>
+#include <taglib/mpegfile.h>
+#endif
 
 #ifdef HAVE_LIBID3
 #include <id3/tag.h>
 #include <id3/misc_support.h>
 #endif /* HAVE_LIBID3 */
 
-#include <iomanip.h>
+#include <iomanip>
 
 #include "mpegsound.h"
 
 #include "splay.h"
 
-static char *help=
+using namespace std;
+
+static const char *help=
 "\t-2 : playing with half frequency.\n"
 "\t-e : exit when playing is done. (only XSPLAY)\n"
 "\t-f : display frame and time info (played and remaining).\n"
@@ -87,66 +94,25 @@ inline const char * nn(const char* str)
   return str?str:"";
 }
 
-#ifdef HAVE_LIBID3
+#ifdef TAGLIB
+std::ostream& operator<<(std::ostream& s, const TagLib::Tag& tag )
+{
+  s.setf(std::ios::left);
+  s << "Title : " << tag.title() << std::endl
+    << "Artist: " << std::setw(30) << tag.artist()
+    << "Album: " << tag.album() << std::endl
+    << "Genre : " << std::setw(18) << tag.genre()
+    << "Track: " << std::setw(5) << tag.track()
+    << "Year: " <<  std::setw(6) << tag.year()
+    << std::endl << std::flush; 
+  return s;
+}
+#endif /* TAGLIB */
 
-//List of ID3 genre names, copied from xmms.org
-const char *ID3_gen_list[255] =
-  {
-    //0-24
-    "Blues", "Classic Rock", "Country", "Dance", "Disco", 
-    "Funk", "Grunge", "Hip-Hop", "Jazz", "Metal",
-    "New Age", "Oldies", "Other", "Pop", "R&B",
-    "Rap", "Reggae", "Rock", "Techno", "Industrial",
-    "Alternative", "Ska", "Death Metal", "Pranks", "Soundtrack",
-    //25-49
-    "Euro-Techno", "Ambient", "Trip-Hop", "Vocal", "Jazz+Funk",
-    "Fusion", "Trance", "Classical", "Instrumental", "Acid",
-    "House", "Game", "Sound Clip", "Gospel", "Noise",
-    "Alt", "Bass", "Soul", "Punk", "Space",
-    "Meditative", "Instrumental Pop", "Instrumental Rock", "Ethnic", "Gothic",
-    //50-74
-    "Darkwave", "Techno-Industrial", "Electronic", "Pop-Folk", "Eurodance",
-    "Dream", "Southern Rock", "Comedy", "Cult", "Gangsta Rap",
-    "Top 40", "Christian Rap", "Pop/Funk", "Jungle", "Native American",
-    "Cabaret", "New Wave", "Psychedelic", "Rave", "Showtunes",
-    "Trailer", "Lo-Fi", "Tribal", "Acid Punk", "Acid Jazz",
-    //75-99
-    "Polka", "Retro", "Musical", "Rock & Roll", "Hard Rock",
-    "Folk", "Folk/Rock", "National Folk", "Swing", "Fast-Fusion",
-    "Bebob", "Latin", "Revival", "Celtic", "Bluegrass",
-    "Avantgarde", "Gothic Rock", "Progressive Rock", "Psychedelic Rock", "Symphonic Rock",
-    "Slow Rock", "Big Band", "Chorus", "Easy Listening", "Acoustic",
-    //100-124
-    "Humour", "Speech", "Chanson", "Opera", "Chamber Music",
-    "Sonata", "Symphony", "Booty Bass", "Primus", "Porn Groove",
-    "Satire", "Slow Jam", "Club", "Tango", "Samba",
-    "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul", "Freestyle",
-    "Duet", "Punk Rock", "Drum Solo", "A Cappella", "Euro-House",
-    //125-149
-    "Dance Hall", "Goa", "Drum & Bass", "Club-House", "Hardcore",
-    "Terror", "Indie", "BritPop", "Negerpunk", "Polsk Punk",
-    "Beat", "Christian Gangsta Rap", "Heavy Metal", "Black Metal", "Crossover",
-    "Contemporary Christian", "Christian Rock", "Merengue", "Salsa", "Thrash Metal",
-    "Anime", "JPop", "Synthpop"
-};
+#ifdef HAVE_LIBID3
 
 ostream& operator<<(ostream& s, const ID3_Tag* tag )
 {
-  /* this gets all frames, but the info is rather difficult to get,
-     just assume all is ID3FN_TEXT here and hope we get the most...
-  */
-  /*
-  size_t max = tag->NumFrames();
-  // s << "frames: " << max << endl;
-  for ( size_t n=0; n<max ; n++){
-    if ( ID3_Frame* frame = (*tag)[n] ){
-      s << "@@@" << frame->GetDescription() << " " <<
-	ID3_GetString(frame,ID3FN_TEXT) << endl;
-    }
-  }
-  */
-
-
   // Print just what we want...
   s.setf(ios::left);  // The filled fields get the text to the left
   s << 
@@ -156,40 +122,49 @@ ostream& operator<<(ostream& s, const ID
     "Album: " << nn(ID3_GetAlbum(tag)) << 
     endl ; 
   
+
   s << 
-    "Genre : " << setw(18) << nn(ID3_gen_list[ID3_GetGenreNum(tag)]) << 
+    "Genre : " << setw(18) << nn(ID3_GetGenre(tag)) << 
     "Track: " << setw(5) << ID3_GetTrackNum(tag) << 
     "Year: " <<  setw(6) << nn(ID3_GetYear(tag)); 
-//   if ( ID3_GetComment(tag) ){
-//     s << endl << "Comment:" << nn(ID3_GetComment(tag)) <<
-//       nn(ID3_GetLyricist(tag)) << nn(ID3_GetLyrics(tag));
-//   } 
 
   return s;
 }
+
 #endif /* HAVE_LIBID3 */
 
 static void play(char *filename)
 {
   if( splay_verbose-- )
     cout << filename << ":" << endl;
-  if( splay_verbose>0 )
+
+#ifdef TAGLIB
+  if( splay_verbose > 0) // cant do ID3 stuff on stdin
+  {
+    std::cout << *TagLib::MPEG::File(filename).tag();
+  }
+#endif /* TAGLIB */        
+  
+#ifdef HAVE_LIBID3
+
+  if( splay_verbose>0)
     {
       //    cerr << getpid() << endl;
-#ifdef HAVE_LIBID3
       try {
 	const ID3_Tag*  mytag = new ID3_Tag(filename);
 	if ( mytag->HasV1Tag() || mytag->HasV2Tag()  )
 	  cout << mytag << endl;
 	delete mytag;
-	
       }
-      catch(ID3_Error &err){
-	cout << err.GetErrorFile() << " (" << err.GetErrorLine() << "): "
-	     << err.GetErrorType() << ": " << err.GetErrorDesc() << endl;
+//      catch(ID3_Error &err){
+      catch(...){
+	cout << "Error found (GetError functions disabled)" << endl;
+//	cout << err.GetErrorFile() << " (" << err.GetErrorLine() << "): "
+//	     << err.GetErrorType() << ": " << err.GetErrorDesc() << endl;
       }
-#endif /* HAVE_LIBID3 */        
     }
+
+#endif /* HAVE_LIBID3 */        
   
   Mpegfileplayer *player;
   
--- splay-0.9.5.2.orig/apps/xsplay.cc
+++ splay-0.9.5.2/apps/xsplay.cc
@@ -27,10 +27,10 @@
 #endif /* HAVE_LIBID3 */
 
 #include <fcntl.h>
-#include <string.h>
+#include <string>
 #include <unistd.h>
-#include <iostream.h>
-#include <iomanip.h>
+#include <iostream>
+#include <iomanip>
 
 #include "mpegsound.h"
 #include "xsplay.h"
@@ -213,8 +213,9 @@ static void xplaympeg(char *filename,Sou
 	}
       }
       catch(ID3_Error &err){
-	cout << err.GetErrorFile() << " (" << err.GetErrorLine() << "): "
-	     << err.GetErrorType() << ": " << err.GetErrorDesc() << endl;
+	cout << "Error found (GetError functions disabled)" << endl;
+//	cout << err.GetErrorFile() << " (" << err.GetErrorLine() << "): "
+//	     << err.GetErrorType() << ": " << err.GetErrorDesc() << endl;
       }
 #endif /* HAVE_LIBID3 */