summaryrefslogtreecommitdiffstats
path: root/media-sound/mpg123/files/mpg123-ds-rcc.patch
diff options
context:
space:
mode:
Diffstat (limited to 'media-sound/mpg123/files/mpg123-ds-rcc.patch')
-rw-r--r--media-sound/mpg123/files/mpg123-ds-rcc.patch150
1 files changed, 150 insertions, 0 deletions
diff --git a/media-sound/mpg123/files/mpg123-ds-rcc.patch b/media-sound/mpg123/files/mpg123-ds-rcc.patch
new file mode 100644
index 0000000..620457b
--- /dev/null
+++ b/media-sound/mpg123/files/mpg123-ds-rcc.patch
@@ -0,0 +1,150 @@
+diff -dPNur mpg123/Makefile mpg123-new/Makefile
+--- mpg123/Makefile 2005-07-26 05:50:35.000000000 +0000
++++ mpg123-new/Makefile 2005-07-26 05:52:38.000000000 +0000
+@@ -789,12 +789,12 @@
+ mpg123-make:
+ @ $(MAKE) CFLAGS='$(CFLAGS)' BINNAME=mpg123 mpg123
+
+-mpg123: mpg123.o common.o $(OBJECTS) decode_2to1.o decode_4to1.o \
++mpg123: mpg123.o common.o rccpatch.o $(OBJECTS) decode_2to1.o decode_4to1.o \
+ tabinit.o audio.o layer1.o layer2.o layer3.o buffer.o \
+ getlopt.o httpget.o xfermem.o equalizer.o \
+ decode_ntom.o Makefile wav.o readers.o \
+ control_generic.o vbrhead.o playlist.o getbits.o
+- $(CC) $(CFLAGS) $(LDFLAGS) mpg123.o tabinit.o common.o layer1.o \
++ $(CC) $(CFLAGS) $(LDFLAGS) -lrcc rccpatch.o mpg123.o tabinit.o common.o layer1.o \
+ layer2.o layer3.o audio.o buffer.o decode_2to1.o equalizer.o \
+ decode_4to1.o getlopt.o httpget.o xfermem.o decode_ntom.o \
+ wav.o readers.o control_generic.o vbrhead.o playlist.o getbits.o \
+diff -dPNur mpg123/common.c mpg123-new/common.c
+--- mpg123/common.c 2005-07-26 05:50:37.000000000 +0000
++++ mpg123-new/common.c 2005-07-26 05:54:32.000000000 +0000
+@@ -22,6 +22,7 @@
+ #endif
+ #endif
+
++#include "rccpatch.h"
+ #include "mpg123.h"
+ #include "genre.h"
+ #include "common.h"
+@@ -666,6 +667,8 @@
+ char comment[31]={0,};
+ char genre[31]={0,};
+
++ char *ctitle, *cartist, *calbum, *ccomment;
++
+ if(param.quiet)
+ return;
+
+@@ -675,15 +678,25 @@
+ strncpy(year,tag->year,4);
+ strncpy(comment,tag->comment,30);
+
++ ctitle = rccPatchRecode(title);
++ cartist = rccPatchRecode(artist);
++ calbum = rccPatchRecode(album);
++ ccomment = rccPatchRecode(comment);
++
+ if ( tag->genre < sizeof(genre_table)/sizeof(*genre_table) ) {
+ strncpy(genre, genre_table[tag->genre], 30);
+ } else {
+ strncpy(genre,"Unknown",30);
+ }
+-
+- fprintf(stderr,"Title : %-30s Artist: %s\n",title,artist);
+- fprintf(stderr,"Album : %-30s Year : %4s\n",album,year);
+- fprintf(stderr,"Comment: %-30s Genre : %s\n",comment,genre);
++
++ fprintf(stderr,"Title : %-30s Artist: %s\n",ctitle?ctitle:title,cartist?cartist:artist);
++ fprintf(stderr,"Album : %-30s Year : %4s\n",calbum?calbum:album,year);
++ fprintf(stderr,"Comment: %-30s Genre : %s\n",ccomment?ccomment:comment,genre);
++
++ if (ctitle) free(ctitle);
++ if (cartist) free(cartist);
++ if (calbum) free(calbum);
++ if (ccomment) free(ccomment);
+ }
+
+ #if 0
+diff -dPNur mpg123/mpg123.c mpg123-new/mpg123.c
+--- mpg123/mpg123.c 2001-01-18 14:00:35.000000000 +0000
++++ mpg123-new/mpg123.c 2005-07-26 05:51:08.000000000 +0000
+@@ -33,6 +33,8 @@
+ #include "term.h"
+ #include "playlist.h"
+
++#include "rccpatch.h"
++
+ #include "version.h"
+
+ static void usage(char *dummy);
+@@ -890,6 +892,8 @@
+ term_init();
+ }
+ #endif
++
++ rccPatchInit();
+
+ leftFrames = numframes;
+ for(frameNum=0;read_frame(rd,fr) && leftFrames && !intflag;frameNum++) {
+@@ -1006,6 +1010,8 @@
+ }
+ }
+ }
++ rccPatchFree();
++
+ #ifndef NOXFERMEM
+ if (buffermem && param.usebuffer) {
+ buffer_end();
+diff -dPNur mpg123/rccpatch.c mpg123-new/rccpatch.c
+--- mpg123/rccpatch.c 1970-01-01 00:00:00.000000000 +0000
++++ mpg123-new/rccpatch.c 2005-07-26 05:51:08.000000000 +0000
+@@ -0,0 +1,40 @@
++#include <librcc.h>
++
++#define ID3_CLASS 0
++#define OUT_CLASS 1
++static rcc_class classes[] = {
++ { "id3", RCC_CLASS_STANDARD, NULL, NULL, "ID3 Encoding", 0 },
++ { "out", RCC_CLASS_STANDARD, NULL, NULL, "Output Encoding", 0 },
++ { NULL }
++};
++
++static int rcc_initialized = 0;
++
++void rccPatchFree() {
++ if (rcc_initialized) {
++ rccFree();
++ rcc_initialized = 0;
++ }
++}
++
++void rccPatchInit() {
++ if (rcc_initialized) return;
++ rccInit();
++ rccInitDefaultContext(NULL, 0, 0, classes, 0);
++ rccLoad(NULL, "xmms");
++ rccInitDb4(NULL, NULL, 0);
++ rcc_initialized = 1;
++}
++
++static void rccPatchTryInit() {
++ if (!rcc_initialized) {
++ rccPatchInit();
++ if (rcc_initialized) atexit(rccPatchFree);
++ }
++}
++
++char *rccPatchRecode(const char *str) {
++ char *res;
++ rccPatchTryInit();
++ return rccRecode(NULL, ID3_CLASS, OUT_CLASS, str);
++}
+diff -dPNur mpg123/rccpatch.h mpg123-new/rccpatch.h
+--- mpg123/rccpatch.h 1970-01-01 00:00:00.000000000 +0000
++++ mpg123-new/rccpatch.h 2005-07-26 05:51:08.000000000 +0000
+@@ -0,0 +1,4 @@
++void rccPatchFree();
++void rccPatchInit();
++char *rccPatchRecode(const char *str);
++