summaryrefslogtreecommitdiffstats
path: root/media-plugins/xmms-wma/files/xmms-wma-ds-ffmpeg20081014.patch
diff options
context:
space:
mode:
Diffstat (limited to 'media-plugins/xmms-wma/files/xmms-wma-ds-ffmpeg20081014.patch')
-rw-r--r--media-plugins/xmms-wma/files/xmms-wma-ds-ffmpeg20081014.patch209
1 files changed, 209 insertions, 0 deletions
diff --git a/media-plugins/xmms-wma/files/xmms-wma-ds-ffmpeg20081014.patch b/media-plugins/xmms-wma/files/xmms-wma-ds-ffmpeg20081014.patch
new file mode 100644
index 0000000..23c0b1a
--- /dev/null
+++ b/media-plugins/xmms-wma/files/xmms-wma-ds-ffmpeg20081014.patch
@@ -0,0 +1,209 @@
+diff -dPNur xmms-wma-1.0.5/Makefile xmms-wma-1.0.5-ds/Makefile
+--- xmms-wma-1.0.5/Makefile 2004-03-03 15:47:58.000000000 +0100
++++ xmms-wma-1.0.5-ds/Makefile 2008-11-27 01:33:03.000000000 +0100
+@@ -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-ds/Makefile.inc
+--- xmms-wma-1.0.5/Makefile.inc 2005-09-05 14:48:20.000000000 +0200
++++ xmms-wma-1.0.5-ds/Makefile.inc 2008-11-27 01:35:01.000000000 +0100
+@@ -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-ds/xmms-wma.c
+--- xmms-wma-1.0.5/xmms-wma.c 2008-11-27 02:58:02.000000000 +0100
++++ xmms-wma-1.0.5-ds/xmms-wma.c 2008-11-27 02:54:38.000000000 +0100
+@@ -43,8 +43,9 @@
+ #undef HAVE_AV_CONFIG_H
+ #endif
+
+-#include "avcodec.h"
+-#include "avformat.h"
++#include "libavcodec/avcodec.h"
++#include "libavformat/avformat.h"
++#include "libavutil/fifo.h"
+ #include "iir.h"
+
+ #define ABOUT_TXT "Copyright (C) 2004,2005 Mokrushin I.V. aka McMCC (mcmcc@mail.ru).\n \
+@@ -191,8 +192,6 @@
+
+ static void wma_init(void)
+ {
+- avcodec_init();
+- avcodec_register_all();
+ av_register_all();
+ init_iir();
+ }
+@@ -201,9 +200,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;
+ }
+
+@@ -338,21 +342,23 @@
+ 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_generic_write(&f, wma_outbuf, out_size, NULL);
++
++ while ((av_fifo_size(&f) > 0) && wma_decode) {
++ if (av_fifo_read(&f, wma_s_outbuf, wma_st_buff)) break;
++
+ if(wma_eq_on)
+ sst_buff = iir((gpointer)&wma_s_outbuf, wma_st_buff);
+ else
+@@ -365,7 +371,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;
+ }
+
+@@ -374,18 +380,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;
+@@ -393,7 +410,9 @@
+ if(size == 0) break;
+
+ while(size > 0){
+- len = avcodec_decode_audio(c, (short *)wma_outbuf, &out_size,
++ out_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
++
++ len = avcodec_decode_audio2(c, (short *)wma_outbuf, &out_size,
+ inbuf_ptr, size);
+ if(len < 0) break;
+
+@@ -428,10 +447,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);
+@@ -460,7 +482,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();
+ }
+
+@@ -484,7 +507,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;
+ }
+