summaryrefslogtreecommitdiffstats
path: root/media-plugins/xmms-wma/files/xmms-wma-ds-ffmpeg.patch
diff options
context:
space:
mode:
Diffstat (limited to 'media-plugins/xmms-wma/files/xmms-wma-ds-ffmpeg.patch')
-rw-r--r--media-plugins/xmms-wma/files/xmms-wma-ds-ffmpeg.patch193
1 files changed, 193 insertions, 0 deletions
diff --git a/media-plugins/xmms-wma/files/xmms-wma-ds-ffmpeg.patch b/media-plugins/xmms-wma/files/xmms-wma-ds-ffmpeg.patch
new file mode 100644
index 0000000..3ad7ced
--- /dev/null
+++ b/media-plugins/xmms-wma/files/xmms-wma-ds-ffmpeg.patch
@@ -0,0 +1,193 @@
+diff -dPNur xmms-wma-1.0.5/Makefile xmms-wma-1.0.5-new/Makefile
+--- xmms-wma-1.0.5/Makefile 2004-03-03 15:47:58.000000000 +0100
++++ xmms-wma-1.0.5-new/Makefile 2007-04-21 22:51:51.000000000 +0200
+@@ -11,7 +11,7 @@
+ export DEPS := $(SOURCES:%.c=$(DEPDIR)/%.d)
+
+ all:
+- @cd ffmpeg-strip-wma; make; cd ..
++ #@cd ffmpeg-strip-wma; make; cd ..
+ @$(MAKE) --no-print-directory -f Makefile.inc
+ @strip $(PLUGIN_FILE)
+ @echo "The plug-in has been compiled. Run one of the following:"
+@@ -40,5 +40,5 @@
+ @echo "The plug-in has been uninstalled."
+
+ clean:
+- cd ffmpeg-strip-wma; make clean; cd ..
++ #cd ffmpeg-strip-wma; make clean; cd ..
+ rm -f $(OBJECTS) $(DEPS)
+diff -dPNur xmms-wma-1.0.5/Makefile.inc xmms-wma-1.0.5-new/Makefile.inc
+--- xmms-wma-1.0.5/Makefile.inc 2005-09-05 14:48:20.000000000 +0200
++++ xmms-wma-1.0.5-new/Makefile.inc 2007-04-21 22:51:51.000000000 +0200
+@@ -1,16 +1,18 @@
+ CC := gcc
+-CFLAGS := -O2 -ffast-math -fomit-frame-pointer -fPIC
+-#CFLAGS := -Wall -g -O3
+-CFLAGS += -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
+-CFLAGS += -I ffmpeg-strip-wma
+-CFLAGS += `xmms-config --cflags`
+-LIBS := `xmms-config --libs` -L ffmpeg-strip-wma -lffwma
++MYCFLAGS := $(CFLAGS) -fPIC
++#MYCFLAGS := -Wall -g -O3
++MYCFLAGS += -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -fPIC
++#MYCFLAGS += -I ffmpeg-strip-wma
++MYCFLAGS += `xmms-config --cflags`
++MYCFLAGS += -I/usr/include/ffmpeg
++#LIBS := `xmms-config --libs` -L ffmpeg-strip-wma -lffwma
++LIBS := `xmms-config --libs` -lavcodec -lavformat
+
+ $(PLUGIN_FILE): $(OBJECTS)
+ $(CC) -o $@ $^ $(LIBS) -shared
+
+ $(OBJDIR)/%.o: %.c
+- $(CC) -c -o $@ $(CFLAGS) $<
++ $(CC) -c -o $@ $(MYCFLAGS) $<
+
+ $(DEPDIR)/%.d: %.c
+ $(CC) -MM $(CFLAGS) $< | sed "s/^$*\.o:/$(OBJDIR)\/$*\.o $(DEPDIR)\/$*\.d:/" > $@
+diff -dPNur xmms-wma-1.0.5/xmms-wma.c xmms-wma-1.0.5-new/xmms-wma.c
+--- xmms-wma-1.0.5/xmms-wma.c 2005-09-05 22:19:00.000000000 +0200
++++ xmms-wma-1.0.5-new/xmms-wma.c 2007-04-22 00:47:20.000000000 +0200
+@@ -42,8 +42,9 @@
+ #undef HAVE_AV_CONFIG_H
+ #endif
+
+-#include "avcodec.h"
+-#include "avformat.h"
++#include "ffmpeg/avcodec.h"
++#include "ffmpeg/avformat.h"
++#include "ffmpeg/fifo.h"
+ #include "iir.h"
+
+ #define ABOUT_TXT "Copyright (C) 2004,2005 Mokrushin I.V. aka McMCC (mcmcc@mail.ru).\n \
+@@ -190,8 +191,6 @@
+
+ static void wma_init(void)
+ {
+- avcodec_init();
+- avcodec_register_all();
+ av_register_all();
+ init_iir();
+ }
+@@ -200,9 +199,14 @@
+ {
+ gchar *ext;
+ ext = strrchr(filename, '.');
+- if(ext)
++ if(ext) {
+ if(!strcasecmp(ext, ".wma"))
+ return 1;
++ if(!strcasecmp(ext, ".m4a"))
++ return 1;
++ if(!strcasecmp(ext, ".aac"))
++ return 1;
++ }
+ return 0;
+ }
+
+@@ -337,20 +341,21 @@
+ return;
+ #endif
+
+- av_find_stream_info(in);
+- (*len_real) = get_song_time(in);
+- (*title_real) = get_song_title(in, filename);
++ if (!av_find_stream_info(in)) {
++ (*len_real) = get_song_time(in);
++ (*title_real) = get_song_title(in, filename);
++ }
+ av_close_input_file(in);
+ }
+
+ static void wma_playbuff(int out_size)
+ {
+- FifoBuffer f;
++ AVFifoBuffer f;
+ int sst_buff;
+
+- fifo_init(&f, out_size*2);
+- fifo_write(&f, wma_outbuf, out_size, &f.wptr);
+- while(!fifo_read(&f, wma_s_outbuf, wma_st_buff, &f.rptr) && wma_decode)
++ av_fifo_init(&f, out_size*2);
++ av_fifo_write(&f, wma_outbuf, out_size);
++ while(!av_fifo_read(&f, wma_s_outbuf, wma_st_buff) && wma_decode)
+ {
+ if(wma_eq_on)
+ sst_buff = iir((gpointer)&wma_s_outbuf, wma_st_buff);
+@@ -364,7 +369,7 @@
+ wma_ip.output->write_audio((short *)wma_s_outbuf, sst_buff);
+ memset(wma_s_outbuf, 0, sst_buff);
+ }
+- fifo_free(&f);
++ av_fifo_free(&f);
+ return;
+ }
+
+@@ -373,18 +378,29 @@
+ uint8_t *inbuf_ptr;
+ int out_size, size, len;
+ AVPacket pkt;
++ int64_t seek_target;
+
+ pthread_mutex_lock(&wma_mutex);
+ while(wma_decode){
+-
+ if(wma_seekpos != -1)
+ {
+- av_seek_frame(ic, wma_idx, wma_seekpos * 1000000LL);
++ if (wma_idx>=0) {
++ seek_target = av_rescale_q(wma_seekpos * 1000000LL, AV_TIME_BASE_Q, ic->streams[wma_idx]->time_base);
++ } else {
++ seek_target = wma_seekpos * 1000000LL;
++ }
++ av_seek_frame(ic, wma_idx, seek_target, AVSEEK_FLAG_BACKWARD);
+ wma_ip.output->flush(wma_seekpos * 1000);
+ wma_seekpos = -1;
+ }
+
+- if(av_read_frame(ic, &pkt) < 0) break;
++ if(av_read_frame(ic, &pkt) < 0) {
++ /*if (url_ferror(&ic->pb) == 0) {
++ usleep(100000);
++ continue;
++ }*/
++ break;
++ }
+
+ size = pkt.size;
+ inbuf_ptr = pkt.data;
+@@ -427,10 +443,13 @@
+ #endif
+
+ for(wma_idx = 0; wma_idx < ic->nb_streams; wma_idx++) {
+- c = &ic->streams[wma_idx]->codec;
++ c = ic->streams[wma_idx]->codec;
+ if(c->codec_type == CODEC_TYPE_AUDIO) break;
+ }
+
++ if(!c || c->codec_type != CODEC_TYPE_AUDIO)
++ return;
++
+ av_find_stream_info(ic);
+
+ codec = avcodec_find_decoder(c->codec_id);
+@@ -459,7 +478,8 @@
+ {
+ wma_decode = 0;
+ if(wma_pause) wma_do_pause(0);
+- pthread_join(wma_decode_thread, NULL);
++ if(wma_decode_thread)
++ pthread_join(wma_decode_thread, NULL);
+ wma_ip.output->close_audio();
+ }
+
+@@ -482,7 +502,7 @@
+ #endif
+
+ for(i = 0; i < in->nb_streams; i++) {
+- s = &in->streams[i]->codec;
++ s = in->streams[i]->codec;
+ if(s->codec_type == CODEC_TYPE_AUDIO) break;
+ }
+