Merge lp:~noskcaj/ubuntu/vivid/banshee-community-extensions/merge into lp:ubuntu/vivid/banshee-community-extensions

Proposed by Jackson Doak
Status: Needs review
Proposed branch: lp:~noskcaj/ubuntu/vivid/banshee-community-extensions/merge
Merge into: lp:ubuntu/vivid/banshee-community-extensions
Diff against target: 2071 lines (+22/-1964)
11 files modified
.pc/LastfmFingerprint-Clean-up-caps-handling-and-make-su.patch/src/LastfmFingerprint/liblastfmfpbridge/gst-lastfmfpbridge.cpp (+0/-367)
.pc/Mirage-Clean-up-caps-handling-and-make-sure-to-wait-.patch/src/Mirage/libmirageaudio/gst-mirageaudio.c (+0/-513)
.pc/Port-LastfmFingerprint-plugin-to-GStreamer-1.0.patch/build/m4/extensions/lastfmfingerprint.m4 (+0/-44)
.pc/Port-LastfmFingerprint-plugin-to-GStreamer-1.0.patch/src/LastfmFingerprint/liblastfmfpbridge/gst-lastfmfpbridge.cpp (+0/-363)
.pc/Port-LastfmFingerprint-plugin-to-GStreamer-1.0.patch/src/LastfmFingerprint/liblastfmfpbridge/lastfmfpbridgetest.cpp (+0/-47)
.pc/Port-Mirage-plugin-to-GStreamer-1.0.patch/README (+0/-86)
.pc/Port-Mirage-plugin-to-GStreamer-1.0.patch/build/m4/extensions/mirage.m4 (+0/-38)
.pc/Port-Mirage-plugin-to-GStreamer-1.0.patch/src/Mirage/libmirageaudio/gst-mirageaudio.c (+0/-502)
.pc/applied-patches (+0/-4)
debian/changelog (+21/-0)
debian/control (+1/-0)
To merge this branch: bzr merge lp:~noskcaj/ubuntu/vivid/banshee-community-extensions/merge
Reviewer Review Type Date Requested Status
Daniel Holbach (community) Approve
Review via email: mp+243867@code.launchpad.net

Description of the change

Merge from debian, dropping dbus#2 change since our banshee is still on version 1.
Makes the package function again. Ignore lp:1268331

To post a comment you must log in.
Revision history for this message
Daniel Holbach (dholbach) wrote :

Thanks. Uploaded.

review: Approve

Unmerged revisions

33. By Jackson Doak

Use dbus#1 for the moment

32. By Jackson Doak

* Merge from Debian Unstable, remaining changes:
  + Enable AppIndicator extension
* [10ace16] Use DBus#2 API
* Rebuild against taglib-sharp 2.1
* [ef676d16] Add dependency against banshee 2.6.1-3 to sync taglib-sharp usage

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed directory '.pc/LastfmFingerprint-Clean-up-caps-handling-and-make-su.patch'
2=== removed directory '.pc/LastfmFingerprint-Clean-up-caps-handling-and-make-su.patch/src'
3=== removed directory '.pc/LastfmFingerprint-Clean-up-caps-handling-and-make-su.patch/src/LastfmFingerprint'
4=== removed directory '.pc/LastfmFingerprint-Clean-up-caps-handling-and-make-su.patch/src/LastfmFingerprint/liblastfmfpbridge'
5=== removed file '.pc/LastfmFingerprint-Clean-up-caps-handling-and-make-su.patch/src/LastfmFingerprint/liblastfmfpbridge/gst-lastfmfpbridge.cpp'
6--- .pc/LastfmFingerprint-Clean-up-caps-handling-and-make-su.patch/src/LastfmFingerprint/liblastfmfpbridge/gst-lastfmfpbridge.cpp 2013-06-03 23:00:22 +0000
7+++ .pc/LastfmFingerprint-Clean-up-caps-handling-and-make-su.patch/src/LastfmFingerprint/liblastfmfpbridge/gst-lastfmfpbridge.cpp 1970-01-01 00:00:00 +0000
8@@ -1,367 +0,0 @@
9-/*
10- * last.fm Fingerprint - Accoustic fingerprint lib to get puid of song
11- * inspired from mirage : http://hop.at/mirage
12- *
13- * Copyright (C) 2010 Olivier Dufour <olivier(dot)duff(at)gmail(dot)com
14- * Modified version of Dominik Schnitzer <dominik@schnitzer.at>
15- *
16- * This program is free software; you can redistribute it and/or
17- * modify it under the terms of the GNU General Public License
18- * as published by the Free Software Foundation; either version 2
19- * of the License, or (at your option) any later version.
20- *
21- * This program is distributed in the hope that it will be useful,
22- * but WITHOUT ANY WARRANTY; without even the implied warranty of
23- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24- * GNU General Public License for more details.
25- *
26- * You should have received a copy of the GNU General Public License
27- * along with this program; if not, write to the Free Software
28- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
29- * Boston, MA 02110-1301, USA.
30- */
31-
32-#include <time.h>
33-
34-#include <glib.h>
35-#include <gst/gst.h>
36-#include <gst/audio/audio.h>
37-
38-#include <stdlib.h>
39-
40-#include "gst-lastfmfpbridge.h"
41-
42-#include "FingerprintExtractor.h"
43-
44-struct LastfmfpAudio {
45-
46- // Cancel decoding mutex
47- GMutex *decoding_mutex;
48-
49- // Gstreamer
50- GstElement *pipeline;
51- GstElement *audio;
52-
53- gint filerate;
54- gint seconds;
55- gint nchannels;
56-
57- fingerprint::FingerprintExtractor *extractor;
58-
59- //input
60- short *data_in;
61- size_t num_samples;
62-
63- //output
64- const char* data_out;
65- size_t data_out_size;
66-
67- int fpid;
68-
69- gboolean quit;
70- gboolean invalidate;
71-};
72-
73-static void
74-Lastfmfp_cb_newpad(GstElement *decodebin, GstPad *pad, LastfmfpAudio *ma)
75-{
76- GstCaps *caps;
77- GstStructure *str;
78- GstPad *audiopad;
79-
80- // only link once
81- audiopad = gst_element_get_static_pad(ma->audio, "sink");
82- if (GST_PAD_IS_LINKED(audiopad)) {
83- g_object_unref(audiopad);
84- return;
85- }
86-
87- // check media type
88- caps = gst_pad_get_current_caps(pad);
89- str = gst_caps_get_structure(caps, 0);
90-
91- if (!g_strrstr(gst_structure_get_name(str), "audio")) {
92- gst_caps_unref(caps);
93- gst_object_unref(audiopad);
94- return;
95- }
96- gst_caps_unref(caps);
97-
98- // link
99- gst_pad_link(pad, audiopad);
100- gst_object_unref(audiopad);
101-}
102-
103-static void FingerprintFound(LastfmfpAudio *ma)
104-{
105- //we have the fingerprint
106-
107- std::pair<const char*, size_t> fpData = ma->extractor->getFingerprint();
108- ma->data_out = fpData.first;
109- ma->data_out_size = fpData.second;
110-}
111-
112-extern "C" unsigned int
113-Lastfmfp_getVersion (LastfmfpAudio *ma)
114-{
115- return ma->extractor->getVersion ();
116-}
117-
118-static void
119-Lastfmfp_cb_have_data(GstElement *element, GstBuffer *buffer, GstPad *pad, LastfmfpAudio *ma)
120-{
121- GstMapInfo map;
122-
123- // if data continues to flow/EOS is not yet processed
124- if (ma->quit)
125- return;
126-
127- // exit on empty buffer
128- if (gst_buffer_get_size(buffer) <= 0)
129- return;
130-
131- if (!gst_buffer_map (buffer, &map, GST_MAP_READ))
132- return;
133-
134- ma->data_in = (short*)map.data;
135- //ma->num_samples = (size_t)(GST_BUFFER_OFFSET_END (buffer) - GST_BUFFER_OFFSET (buffer));
136- ma->num_samples = (size_t)(map.size / sizeof(guint16));
137-
138- //printf("caps: %s\n", gst_caps_to_string(GST_BUFFER_CAPS(buffer)));
139- //printf(" offset : %llu size: %llu \n", (unsigned long long)GST_BUFFER_OFFSET (buffer), (unsigned long long)GST_BUFFER_OFFSET_END (buffer));
140- //GST_LOG ("caps are %" GST_PTR_FORMAT, GST_BUFFER_CAPS(buffer));
141- //extractor.process(const short* pPCM, size_t num_samples, bool end_of_stream = false);
142- //printf("data: %d %d %d %d %d %d %d %d %d %d %d %d \n", ma->data_in[0], ma->data_in[1], ma->data_in[2], ma->data_in[3], ma->data_in[4], ma->data_in[5], ma->data_in[6], ma->data_in[7], ma->data_in[8], ma->data_in[9], ma->data_in[10], ma->data_in[11]);
143- if (ma->extractor->process(ma->data_in, ma->num_samples, false))//TODO check parametters
144- {
145- //stop the gstreamer loop to free all and return fpid
146- GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(ma->pipeline));
147- GstMessage* eosmsg = gst_message_new_eos(GST_OBJECT(ma->pipeline));
148- gst_bus_post(bus, eosmsg);
149- g_print("libLastfmfp: EOS Message sent\n");
150- gst_object_unref(bus);
151- ma->quit = TRUE;
152- }
153-
154- gst_buffer_unmap (buffer, &map);
155-
156- return;
157-}
158-
159-extern "C" LastfmfpAudio*
160-Lastfmfp_initialize(gint seconds)
161-{
162- LastfmfpAudio *ma;
163-
164- ma = g_new0(LastfmfpAudio, 1);
165- ma->seconds = seconds;
166-
167- // cancel decoding mutex
168- ma->decoding_mutex = g_mutex_new();
169-
170- return ma;
171-}
172-
173-void
174-Lastfmfp_initgstreamer(LastfmfpAudio *ma, const gchar *file)
175-{
176- GstPad *audiopad;
177- GstCaps *filter_short;
178- GstElement *cfilt_short;
179- GstElement *dec;
180- GstElement *src;
181- GstElement *sink;
182- GstElement *audioconvert;
183-
184- // Gstreamer decoder setup
185- ma->pipeline = gst_pipeline_new("pipeline");
186-
187- // decoder
188- src = gst_element_factory_make("filesrc", "source");
189- g_object_set(G_OBJECT(src), "location", file, NULL);
190- dec = gst_element_factory_make("decodebin", "decoder");
191- g_signal_connect(dec, "pad-added", G_CALLBACK(Lastfmfp_cb_newpad), ma);
192- gst_bin_add_many(GST_BIN(ma->pipeline), src, dec, NULL);
193- gst_element_link(src, dec);
194-
195- // audio conversion
196- ma->audio = gst_bin_new("audio");
197-
198- audioconvert = gst_element_factory_make("audioconvert", "conv");
199- filter_short = gst_caps_new_simple("audio/x-raw",
200- "format", G_TYPE_STRING, GST_AUDIO_NE(S16),
201- NULL);
202- cfilt_short = gst_element_factory_make("capsfilter", "cfilt_short");
203- g_object_set(G_OBJECT(cfilt_short), "caps", filter_short, NULL);
204- gst_caps_unref(filter_short);
205-
206- sink = gst_element_factory_make("fakesink", "sink");
207- g_object_set(G_OBJECT(sink), "signal-handoffs", TRUE, NULL);
208- g_signal_connect(sink, "handoff", G_CALLBACK(Lastfmfp_cb_have_data), ma);
209-
210-
211- gst_bin_add_many(GST_BIN(ma->audio),
212- audioconvert, cfilt_short,
213- sink, NULL);
214- gst_element_link_many(audioconvert, cfilt_short,
215- sink, NULL);
216-
217- audiopad = gst_element_get_static_pad(audioconvert, "sink");
218- gst_element_add_pad(ma->audio,
219- gst_ghost_pad_new("sink", audiopad));
220- gst_object_unref(audiopad);
221-
222- gst_bin_add(GST_BIN(ma->pipeline), ma->audio);
223-
224- // Get sampling rate of audio file
225- GstClockTime max_wait = 1 * GST_SECOND;
226- if (gst_element_set_state(ma->pipeline, GST_STATE_READY) == GST_STATE_CHANGE_ASYNC) {
227- gst_element_get_state(ma->pipeline, NULL, NULL, max_wait);
228- }
229- if (gst_element_set_state(ma->pipeline, GST_STATE_PAUSED) == GST_STATE_CHANGE_ASYNC) {
230- gst_element_get_state(ma->pipeline, NULL, NULL, max_wait);
231- }
232-
233- GstPad *pad = gst_element_get_static_pad(sink, "sink");
234- GstCaps *caps = gst_pad_get_current_caps(pad);
235- if (GST_IS_CAPS(caps)) {
236- GstStructure *str = gst_caps_get_structure(caps, 0);
237- gst_structure_get_int(str, "rate", &ma->filerate);
238- gst_structure_get_int(str, "channels", &ma->nchannels);
239- } else {
240- ma->filerate = -1;
241- }
242- gst_caps_unref(caps);
243- gst_object_unref(pad);
244-}
245-
246-extern "C" const char*
247-Lastfmfp_decode(LastfmfpAudio *ma, const gchar *file, int* size, int* ret)
248-{
249- GstBus *bus;
250-
251- ma->quit = FALSE;
252-
253- g_mutex_lock(ma->decoding_mutex);
254- ma->invalidate = FALSE;
255- g_mutex_unlock(ma->decoding_mutex);
256-
257- // Gstreamer setup
258- Lastfmfp_initgstreamer(ma, file);
259- //lastfm setup
260- ma->extractor = new fingerprint::FingerprintExtractor();
261- ma->extractor->initForQuery(ma->filerate, ma->nchannels, ma->seconds);
262-
263- if (ma->filerate < 0) {
264- *size = 0;
265- *ret = -1;
266-
267- // Gstreamer cleanup
268- gst_element_set_state(ma->pipeline, GST_STATE_NULL);
269- gst_object_unref(GST_OBJECT(ma->pipeline));
270-
271- return NULL;
272- }
273-
274- // decode...
275- gst_element_set_state(ma->pipeline, GST_STATE_PLAYING);
276- g_print("libLastfmfp: decoding %s\n", file);
277-
278-
279- bus = gst_pipeline_get_bus(GST_PIPELINE(ma->pipeline));
280- gboolean decoding = TRUE;
281- *ret = 0;
282- while (decoding) {
283- GstMessage* message = gst_bus_timed_pop_filtered(bus, GST_MSECOND*100,
284- (GstMessageType) (GST_MESSAGE_ERROR | GST_MESSAGE_EOS));
285-
286- if (message == NULL)
287- continue;
288-
289- switch (GST_MESSAGE_TYPE(message)) {
290- case GST_MESSAGE_ERROR: {
291- GError *err;
292- gchar *debug;
293-
294- gst_message_parse_error(message, &err, &debug);
295- g_print("libLastfmfp: error: %s\n", err->message);
296- g_error_free(err);
297- g_free(debug);
298- decoding = FALSE;
299- *ret = -1;
300-
301- break;
302- }
303- case GST_MESSAGE_EOS: {
304- //ma->extractor->process(0, static_cast<size_t>(0), true);
305- FingerprintFound(ma);
306- g_print("libLastfmfp: EOS Message received\n");
307- decoding = FALSE;
308- break;
309- }
310- default:
311- break;
312- }
313- gst_message_unref(message);
314- }
315- gst_object_unref(bus);
316-
317-
318- g_mutex_lock(ma->decoding_mutex);
319-
320- // Gstreamer cleanup
321- gst_element_set_state(ma->pipeline, GST_STATE_NULL);
322- gst_object_unref(GST_OBJECT(ma->pipeline));
323-
324- if (ma->invalidate) {
325- //*size = 0;
326- *ret = -2;
327- } else {
328- //*size = ma->nchannels/2 + 1;
329- }
330-
331- *size = ma->data_out_size;
332-
333- g_mutex_unlock(ma->decoding_mutex);
334-
335- return ma->data_out;
336-}
337-
338-extern "C" LastfmfpAudio*
339-Lastfmfp_destroy(LastfmfpAudio *ma)
340-{
341- g_print("libLastfmfp: destroy.\n");
342-
343- g_mutex_free(ma->decoding_mutex);
344-
345- // common
346- free(ma);
347-
348- return NULL;
349-}
350-
351-extern "C" void
352-Lastfmfp_canceldecode(LastfmfpAudio *ma)
353-{
354- if (GST_IS_ELEMENT(ma->pipeline)) {
355-
356- GstState state;
357- gst_element_get_state(ma->pipeline, &state, NULL, 100*GST_MSECOND);
358-
359- if (state != GST_STATE_NULL) {
360- g_mutex_lock(ma->decoding_mutex);
361-
362- GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(ma->pipeline));
363- GstMessage* eosmsg = gst_message_new_eos(GST_OBJECT(ma->pipeline));
364- gst_bus_post(bus, eosmsg);
365- g_print("libLastfmfp: EOS Message sent\n");
366- gst_object_unref(bus);
367-
368- ma->invalidate = TRUE;
369-
370- g_mutex_unlock(ma->decoding_mutex);
371- }
372- }
373-}
374-
375-
376
377=== removed directory '.pc/Mirage-Clean-up-caps-handling-and-make-sure-to-wait-.patch'
378=== removed directory '.pc/Mirage-Clean-up-caps-handling-and-make-sure-to-wait-.patch/src'
379=== removed directory '.pc/Mirage-Clean-up-caps-handling-and-make-sure-to-wait-.patch/src/Mirage'
380=== removed directory '.pc/Mirage-Clean-up-caps-handling-and-make-sure-to-wait-.patch/src/Mirage/libmirageaudio'
381=== removed file '.pc/Mirage-Clean-up-caps-handling-and-make-sure-to-wait-.patch/src/Mirage/libmirageaudio/gst-mirageaudio.c'
382--- .pc/Mirage-Clean-up-caps-handling-and-make-sure-to-wait-.patch/src/Mirage/libmirageaudio/gst-mirageaudio.c 2013-06-03 23:00:22 +0000
383+++ .pc/Mirage-Clean-up-caps-handling-and-make-sure-to-wait-.patch/src/Mirage/libmirageaudio/gst-mirageaudio.c 1970-01-01 00:00:00 +0000
384@@ -1,513 +0,0 @@
385-/*
386- * Mirage - High Performance Music Similarity and Automatic Playlist Generator
387- * http://hop.at/mirage
388- *
389- * Copyright (C) 2007 Dominik Schnitzer <dominik@schnitzer.at>
390- *
391- * This program is free software; you can redistribute it and/or
392- * modify it under the terms of the GNU General Public License
393- * as published by the Free Software Foundation; either version 2
394- * of the License, or (at your option) any later version.
395- *
396- * This program is distributed in the hope that it will be useful,
397- * but WITHOUT ANY WARRANTY; without even the implied warranty of
398- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
399- * GNU General Public License for more details.
400- *
401- * You should have received a copy of the GNU General Public License
402- * along with this program; if not, write to the Free Software
403- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
404- * Boston, MA 02110-1301, USA.
405- */
406-
407-#include <math.h>
408-#include <string.h>
409-#include <time.h>
410-#include <stdlib.h>
411-
412-#include <glib.h>
413-#include <fftw3.h>
414-#include <gst/gst.h>
415-#include <gst/audio/audio.h>
416-#include <samplerate.h>
417-
418-#include "gst-mirageaudio.h"
419-
420-struct MirageAudio {
421-
422- // Cancel decoding mutex
423- GMutex *decoding_mutex;
424-
425- // Gstreamer
426- GstElement *pipeline;
427- GstElement *audio;
428-
429- gint rate;
430- gint filerate;
431- gint seconds;
432- gint winsize;
433- gint samples;
434-
435- // FFTW
436- float *fftw;
437- fftwf_plan fftwplan;
438- gint fftwsamples;
439- gint fftwsize;
440-
441- // libsamplerate
442- SRC_STATE *src_state;
443- SRC_DATA src_data;
444-
445- // Hann window
446- float *window;
447-
448- // Output buffer
449- float *out;
450- gint hops;
451- gint curhop;
452- gint cursample;
453-
454- gboolean quit;
455- gboolean invalidate;
456-};
457-
458-#define SRC_BUFFERLENGTH 4096
459-
460-clock_t start;
461-clock_t end;
462-
463-
464-void tic()
465-{
466- start = clock();
467-}
468-
469-void toc()
470-{
471- double ms;
472- end = clock();
473- ms = ((end - start)/(double)(CLOCKS_PER_SEC))*1000.0;
474- g_print("libmirageaudio: time = %f\n", ms);
475-}
476-
477-static void
478-mirageaudio_cb_newpad(GstElement *decodebin, GstPad *pad, MirageAudio *ma)
479-{
480- GstCaps *caps;
481- GstStructure *str;
482- GstPad *audiopad;
483-
484- // only link once
485- audiopad = gst_element_get_static_pad(ma->audio, "sink");
486- if (GST_PAD_IS_LINKED(audiopad)) {
487- g_object_unref(audiopad);
488- return;
489- }
490-
491- // check media type
492- caps = gst_pad_get_current_caps(pad);
493- str = gst_caps_get_structure(caps, 0);
494-
495- if (!g_strrstr(gst_structure_get_name(str), "audio")) {
496- gst_caps_unref(caps);
497- gst_object_unref(audiopad);
498- return;
499- }
500- gst_caps_unref(caps);
501-
502- // link
503- gst_pad_link(pad, audiopad);
504- gst_object_unref(audiopad);
505-}
506-
507-static void
508-mirageaudio_cb_have_data(GstElement *element, GstBuffer *buffer, GstPad *pad, MirageAudio *ma)
509-{
510- gint buffersamples;
511- gint bufferpos;
512- gint i;
513- gint j;
514- gint fill;
515- GstMapInfo map;
516-
517- // if data continues to flow/EOS is not yet processed
518- if (ma->quit)
519- return;
520-
521- // exit on empty buffer
522- if (gst_buffer_get_size (buffer) <= 0)
523- return;
524- if (!gst_buffer_map (buffer, &map, GST_MAP_READ))
525- return;
526-
527- ma->src_data.data_in = (float*)map.data;
528- ma->src_data.input_frames = map.size/sizeof(float);
529-
530- do {
531- // set end of input flag if necessary
532- ma->cursample += ma->src_data.input_frames;
533- if (ma->cursample >= ma->seconds * ma->filerate) {
534- ma->src_data.end_of_input = 1;
535- }
536-
537- // resampling
538- int err = src_process(ma->src_state, &ma->src_data);
539-
540- if (err != 0) {
541- g_print("libmirageaudio: SRC Error - %s\n", src_strerror(err));
542- }
543- // return if no output
544- if (ma->src_data.output_frames_gen == 0) {
545- gst_buffer_unmap (buffer, &map);
546- return;
547- }
548-
549- buffersamples = ma->src_data.output_frames_gen;
550- bufferpos = 0;
551-
552- // FFTW
553- // If buffer does not get filled
554- if (ma->fftwsamples + buffersamples < ma->winsize) {
555- memcpy(ma->fftw+ma->fftwsamples, ma->src_data.data_out, buffersamples*sizeof(float));
556- ma->fftwsamples += buffersamples;
557-
558- // If buffer gets filled.
559- } else {
560- do {
561- // prepare FFTW
562- fill = ma->winsize - ma->fftwsamples;
563-
564- if (fill <= 0)
565- g_print("libmirageaudio: Logic ERROR! fill <= 0\n");
566-
567- memcpy(ma->fftw+ma->fftwsamples, ma->src_data.data_out+bufferpos, fill*sizeof(float));
568- memset(ma->fftw+ma->winsize, 0, ma->winsize*sizeof(float));
569- for (i = 0; i < ma->winsize; i++) {
570- ma->fftw[i] = ma->fftw[i] * ma->window[i] * 32768.0f;
571- }
572-
573- // Execute FFTW
574- fftwf_execute(ma->fftwplan);
575-
576- // Powerspectrum
577- ma->out[ma->curhop] = powf(ma->fftw[0], 2);
578- for (j = 1; j < ma->winsize/2; j++) {
579- ma->out[j*ma->hops + ma->curhop] = powf(ma->fftw[j*2], 2) + powf(ma->fftw[ma->fftwsize-j*2], 2);
580- }
581- ma->out[(ma->winsize/2)*ma->hops + ma->curhop] = powf(ma->fftw[ma->winsize], 2);
582-
583- ma->fftwsamples = 0;
584- buffersamples -= fill;
585- bufferpos += fill;
586-
587- ma->curhop++;
588-
589- if (ma->curhop == ma->hops) {
590- GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(ma->pipeline));
591- GstMessage* eosmsg = gst_message_new_eos(GST_OBJECT(ma->pipeline));
592- gst_bus_post(bus, eosmsg);
593- g_print("libmirageaudio: EOS Message sent\n");
594- gst_object_unref(bus);
595- ma->quit = TRUE;
596- gst_buffer_unmap (buffer, &map);
597- return;
598- }
599-
600- } while (buffersamples >= ma->winsize);
601-
602- if (buffersamples > 0) {
603- memcpy(ma->fftw, ma->src_data.data_out+bufferpos, buffersamples*sizeof(float));
604- ma->fftwsamples = buffersamples;
605- }
606- }
607-
608- ma->src_data.data_in += ma->src_data.input_frames_used;
609- ma->src_data.input_frames -= ma->src_data.input_frames_used;
610-
611- } while (ma->src_data.input_frames > 0);
612-
613- gst_buffer_unmap (buffer, &map);
614-
615- return;
616-}
617-
618-MirageAudio*
619-mirageaudio_initialize(gint rate, gint seconds, gint winsize)
620-{
621- MirageAudio *ma;
622- gint i;
623-
624- ma = g_new0(MirageAudio, 1);
625- ma->rate = rate;
626- ma->seconds = seconds;
627- ma->hops = rate*seconds/winsize;
628- ma->out = malloc(ma->hops*((winsize/2)+1)*sizeof(float));
629-
630- // FFTW
631- ma->winsize = winsize;
632- ma->fftwsize = 2 * ma->winsize;
633- ma->fftw = (float*)fftwf_malloc(ma->fftwsize * sizeof(float));
634- ma->fftwplan = fftwf_plan_r2r_1d((2*ma->winsize), ma->fftw, ma->fftw, FFTW_R2HC,
635- FFTW_ESTIMATE | FFTW_DESTROY_INPUT);
636-
637- // Hann Window
638- ma->window = malloc(ma->winsize*sizeof(float));
639- for (i = 0; i < ma->winsize; i++) {
640- ma->window[i] = (float)(0.5 * (1.0 - cos((2.0*M_PI *(double)i)/(double)(ma->winsize-1))));
641- }
642-
643- // Samplingrate converter
644- int error;
645- ma->src_state = src_new(SRC_ZERO_ORDER_HOLD, 1, &error);
646- ma->src_data.data_out = malloc(SRC_BUFFERLENGTH*sizeof(float));
647- ma->src_data.output_frames = SRC_BUFFERLENGTH;
648-
649- // cancel decoding mutex
650- ma->decoding_mutex = g_mutex_new();
651-
652- return ma;
653-}
654-
655-void
656-mirageaudio_initgstreamer(MirageAudio *ma, const gchar *file)
657-{
658- GstPad *audiopad;
659- GstCaps *filter_float;
660- GstCaps *filter_resample;
661- GstElement *cfilt_float;
662- GstElement *cfilt_resample;
663- GstElement *dec;
664- GstElement *src;
665- GstElement *sink;
666- GstElement *audioresample;
667- GstElement *audioconvert;
668-
669- // Gstreamer decoder setup
670- ma->pipeline = gst_pipeline_new("pipeline");
671-
672- // decoder
673- src = gst_element_factory_make("filesrc", "source");
674- g_object_set(G_OBJECT(src), "location", file, NULL);
675- dec = gst_element_factory_make("decodebin", "decoder");
676- g_signal_connect(dec, "pad-added", G_CALLBACK(mirageaudio_cb_newpad), ma);
677- gst_bin_add_many(GST_BIN(ma->pipeline), src, dec, NULL);
678- gst_element_link(src, dec);
679-
680- // audio conversion
681- ma->audio = gst_bin_new("audio");
682-
683- audioconvert = gst_element_factory_make("audioconvert", "conv");
684- filter_float = gst_caps_new_simple("audio/x-raw",
685- "format", G_TYPE_STRING, GST_AUDIO_NE(F32),
686- NULL);
687- cfilt_float = gst_element_factory_make("capsfilter", "cfilt_float");
688- g_object_set(G_OBJECT(cfilt_float), "caps", filter_float, NULL);
689- gst_caps_unref(filter_float);
690-
691- audioresample = gst_element_factory_make("audioresample", "resample");
692-
693- filter_resample = gst_caps_new_simple("audio/x-raw",
694- "format", G_TYPE_STRING, GST_AUDIO_NE(F32),
695- "channels", G_TYPE_INT, 1,
696- NULL);
697- cfilt_resample = gst_element_factory_make("capsfilter", "cfilt_resample");
698- g_object_set(G_OBJECT(cfilt_resample), "caps", filter_resample, NULL);
699- gst_caps_unref(filter_resample);
700-
701- sink = gst_element_factory_make("fakesink", "sink");
702- g_object_set(G_OBJECT(sink), "signal-handoffs", TRUE, NULL);
703- g_signal_connect(sink, "handoff", G_CALLBACK(mirageaudio_cb_have_data), ma);
704-
705-
706- gst_bin_add_many(GST_BIN(ma->audio),
707- audioconvert, audioresample,
708- cfilt_resample, cfilt_float,
709- sink, NULL);
710- gst_element_link_many(audioconvert, cfilt_float,
711- audioresample, cfilt_resample,
712- sink, NULL);
713-
714- audiopad = gst_element_get_static_pad(audioconvert, "sink");
715- gst_element_add_pad(ma->audio,
716- gst_ghost_pad_new("sink", audiopad));
717- gst_object_unref(audiopad);
718-
719- gst_bin_add(GST_BIN(ma->pipeline), ma->audio);
720-
721- // Get sampling rate of audio file
722- GstClockTime max_wait = 1 * GST_SECOND;
723- if (gst_element_set_state(ma->pipeline, GST_STATE_READY) == GST_STATE_CHANGE_ASYNC) {
724- gst_element_get_state(ma->pipeline, NULL, NULL, max_wait);
725- }
726- if (gst_element_set_state(ma->pipeline, GST_STATE_PAUSED) == GST_STATE_CHANGE_ASYNC) {
727- gst_element_get_state(ma->pipeline, NULL, NULL, max_wait);
728- }
729-
730- GstPad *pad = gst_element_get_static_pad(sink, "sink");
731- GstCaps *caps = gst_pad_get_current_caps(pad);
732- if (GST_IS_CAPS(caps)) {
733- GstStructure *str = gst_caps_get_structure(caps, 0);
734- gst_structure_get_int(str, "rate", &ma->filerate);
735-
736- } else {
737- ma->filerate = -1;
738- }
739- gst_caps_unref(caps);
740- gst_object_unref(pad);
741-}
742-
743-float*
744-mirageaudio_decode(MirageAudio *ma, const gchar *file, int *frames, int* size, int* ret)
745-{
746- GstBus *bus;
747- tic();
748-
749- ma->fftwsamples = 0;
750- ma->curhop = 0;
751- ma->cursample = 0;
752- ma->quit = FALSE;
753-
754- g_mutex_lock(ma->decoding_mutex);
755- ma->invalidate = FALSE;
756- g_mutex_unlock(ma->decoding_mutex);
757-
758- // Gstreamer setup
759- mirageaudio_initgstreamer(ma, file);
760- if (ma->filerate < 0) {
761- *size = 0;
762- *frames = 0;
763- *ret = -1;
764-
765- // Gstreamer cleanup
766- gst_element_set_state(ma->pipeline, GST_STATE_NULL);
767- gst_object_unref(GST_OBJECT(ma->pipeline));
768-
769- return NULL;
770- }
771-
772- // libsamplerate initialization
773- ma->src_data.src_ratio = (double)ma->rate/(double)ma->filerate;
774- ma->src_data.input_frames = 0;
775- ma->src_data.end_of_input = 0;
776- src_reset(ma->src_state);
777- g_print("libmirageaudio: rate=%d, resampling=%f\n", ma->filerate, ma->src_data.src_ratio);
778-
779- // decode...
780- gst_element_set_state(ma->pipeline, GST_STATE_PLAYING);
781- g_print("libmirageaudio: decoding %s\n", file);
782-
783-
784- bus = gst_pipeline_get_bus(GST_PIPELINE(ma->pipeline));
785- gboolean decoding = TRUE;
786- *ret = 0;
787- while (decoding) {
788- GstMessage* message = gst_bus_timed_pop_filtered(bus, GST_MSECOND*100,
789- GST_MESSAGE_ERROR | GST_MESSAGE_EOS);
790-
791- if (message == NULL)
792- continue;
793-
794- switch (GST_MESSAGE_TYPE(message)) {
795- case GST_MESSAGE_ERROR: {
796- GError *err;
797- gchar *debug;
798-
799- gst_message_parse_error(message, &err, &debug);
800- g_print("libmirageaudio: error: %s\n", err->message);
801- g_error_free(err);
802- g_free(debug);
803- ma->curhop = 0;
804- decoding = FALSE;
805- *ret = -1;
806-
807- break;
808- }
809- case GST_MESSAGE_EOS: {
810- g_print("libmirageaudio: EOS Message received\n");
811- decoding = FALSE;
812- break;
813- }
814- default:
815- break;
816- }
817- gst_message_unref(message);
818- }
819- gst_object_unref(bus);
820-
821-
822- g_mutex_lock(ma->decoding_mutex);
823-
824- // Gstreamer cleanup
825- gst_element_set_state(ma->pipeline, GST_STATE_NULL);
826- gst_object_unref(GST_OBJECT(ma->pipeline));
827-
828- toc();
829-
830- if (ma->invalidate) {
831- *size = 0;
832- *frames = 0;
833- *ret = -2;
834- } else {
835- *size = ma->winsize/2 + 1;
836- *frames = ma->curhop;
837- }
838-
839- g_mutex_unlock(ma->decoding_mutex);
840-
841- g_print("libmirageaudio: frames=%d (maxhops=%d), size=%d\n", *frames, ma->hops, *size);
842- return ma->out;
843-}
844-
845-MirageAudio*
846-mirageaudio_destroy(MirageAudio *ma)
847-{
848- g_print("libmirageaudio: destroy.\n");
849- // FFTW cleanup
850- fftwf_destroy_plan(ma->fftwplan);
851- fftwf_free(ma->fftw);
852-
853- // Hann window clanup
854- free(ma->window);
855-
856- // libsamplerate
857- free(ma->src_data.data_out);
858- src_delete(ma->src_state);
859-
860- g_mutex_free(ma->decoding_mutex);
861-
862- // common
863- free(ma->out);
864- free(ma);
865-
866- return NULL;
867-}
868-
869-void
870-mirageaudio_initgst()
871-{
872- gst_init(NULL, NULL);
873-}
874-
875-void
876-mirageaudio_canceldecode(MirageAudio *ma)
877-{
878- if (GST_IS_ELEMENT(ma->pipeline)) {
879-
880- GstState state;
881- gst_element_get_state(ma->pipeline, &state, NULL, 100*GST_MSECOND);
882-
883- if (state != GST_STATE_NULL) {
884- g_mutex_lock(ma->decoding_mutex);
885-
886- GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(ma->pipeline));
887- GstMessage* eosmsg = gst_message_new_eos(GST_OBJECT(ma->pipeline));
888- gst_bus_post(bus, eosmsg);
889- g_print("libmirageaudio: EOS Message sent\n");
890- gst_object_unref(bus);
891-
892- ma->invalidate = TRUE;
893-
894- g_mutex_unlock(ma->decoding_mutex);
895- }
896- }
897-}
898
899=== removed directory '.pc/Port-LastfmFingerprint-plugin-to-GStreamer-1.0.patch'
900=== removed directory '.pc/Port-LastfmFingerprint-plugin-to-GStreamer-1.0.patch/build'
901=== removed directory '.pc/Port-LastfmFingerprint-plugin-to-GStreamer-1.0.patch/build/m4'
902=== removed directory '.pc/Port-LastfmFingerprint-plugin-to-GStreamer-1.0.patch/build/m4/extensions'
903=== removed file '.pc/Port-LastfmFingerprint-plugin-to-GStreamer-1.0.patch/build/m4/extensions/lastfmfingerprint.m4'
904--- .pc/Port-LastfmFingerprint-plugin-to-GStreamer-1.0.patch/build/m4/extensions/lastfmfingerprint.m4 2013-06-03 23:00:22 +0000
905+++ .pc/Port-LastfmFingerprint-plugin-to-GStreamer-1.0.patch/build/m4/extensions/lastfmfingerprint.m4 1970-01-01 00:00:00 +0000
906@@ -1,44 +0,0 @@
907-AC_DEFUN([BCE_LASTFMFINGERPRINT],
908-[
909- AC_REQUIRE([AC_PROG_CXX])
910- BCE_ARG_DISABLE([LastfmFingerprint], [try])
911-
912- BCE_CHECK_EXTENSION_DEP([LastfmFingerprint], [GLIB],
913- [glib-2.0],
914- [The glib library was not found. Please install it or disable the LastfmFingerprint extension by passing --disable-lastfmfingerprint])
915-
916- BCE_CHECK_EXTENSION_DEP([LastfmFingerprint], [FFTW3F],
917- [fftw3f],
918- [The fftw3f library was not found. Please install it or disable the LastfmFingerprint extension by passing --disable-lastfmfingerprint])
919-
920- BCE_CHECK_EXTENSION_DEP([LastfmFingerprint], [LIBSAMPLERATE],
921- [samplerate],
922- [The samplerate library was not found. Please install it or disable the LastfmFingerprint extension by passing --disable-lastfmfingerprint])
923-
924- BCE_CHECK_EXTENSION_DEP([LastfmFingerprint], [BANSHEE_LASTFM],
925- [banshee-lastfm],
926- [banshee-lastfm was not found. Please install it or disable the LastfmFingerprint extension by passing --disable-lastfmfingerprint])
927-
928- GSTREAMER_REQUIRED_VERSION=0.10.15
929- BCE_CHECK_EXTENSION_DEP([LastfmFingerprint], [GSTREAMER],
930- [gstreamer-0.10 >= $GSTREAMER_REQUIRED_VERSION
931- gstreamer-base-0.10 >= $GSTREAMER_REQUIRED_VERSION
932- gstreamer-plugins-base-0.10 >= $GSTREAMER_REQUIRED_VERSION],
933- [GStreamer >= $GSTREAMER_REQUIRED_VERSION not found. Please install it or disable the LastfmFingerprint extension by passing --disable-lastfmfingerprint])
934-
935- if test "x$enable_LastfmFingerprint" = "xtry" \
936- && test "x$have_GLIB" = "xyes" \
937- && test "x$have_FFTW3F" = "xyes" \
938- && test "x$have_LIBSAMPLERATE" = "xyes" \
939- && test "x$have_BANSHEE_LASTFM" = "xyes" \
940- && test "x$have_GSTREAMER" = "xyes"; then
941- enable_LastfmFingerprint=yes
942- fi
943-
944- if test "x$enable_LastfmFingerprint" = "xyes"; then
945- AM_CONDITIONAL(ENABLE_LASTFMFINGERPRINT, true)
946- else
947- enable_LastfmFingerprint=no
948- AM_CONDITIONAL(ENABLE_LASTFMFINGERPRINT, false)
949- fi
950-])
951
952=== removed directory '.pc/Port-LastfmFingerprint-plugin-to-GStreamer-1.0.patch/src'
953=== removed directory '.pc/Port-LastfmFingerprint-plugin-to-GStreamer-1.0.patch/src/LastfmFingerprint'
954=== removed directory '.pc/Port-LastfmFingerprint-plugin-to-GStreamer-1.0.patch/src/LastfmFingerprint/liblastfmfpbridge'
955=== removed file '.pc/Port-LastfmFingerprint-plugin-to-GStreamer-1.0.patch/src/LastfmFingerprint/liblastfmfpbridge/gst-lastfmfpbridge.cpp'
956--- .pc/Port-LastfmFingerprint-plugin-to-GStreamer-1.0.patch/src/LastfmFingerprint/liblastfmfpbridge/gst-lastfmfpbridge.cpp 2013-06-03 23:00:22 +0000
957+++ .pc/Port-LastfmFingerprint-plugin-to-GStreamer-1.0.patch/src/LastfmFingerprint/liblastfmfpbridge/gst-lastfmfpbridge.cpp 1970-01-01 00:00:00 +0000
958@@ -1,363 +0,0 @@
959-/*
960- * last.fm Fingerprint - Accoustic fingerprint lib to get puid of song
961- * inspired from mirage : http://hop.at/mirage
962- *
963- * Copyright (C) 2010 Olivier Dufour <olivier(dot)duff(at)gmail(dot)com
964- * Modified version of Dominik Schnitzer <dominik@schnitzer.at>
965- *
966- * This program is free software; you can redistribute it and/or
967- * modify it under the terms of the GNU General Public License
968- * as published by the Free Software Foundation; either version 2
969- * of the License, or (at your option) any later version.
970- *
971- * This program is distributed in the hope that it will be useful,
972- * but WITHOUT ANY WARRANTY; without even the implied warranty of
973- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
974- * GNU General Public License for more details.
975- *
976- * You should have received a copy of the GNU General Public License
977- * along with this program; if not, write to the Free Software
978- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
979- * Boston, MA 02110-1301, USA.
980- */
981-
982-#include <time.h>
983-
984-#include <glib.h>
985-#include <gst/gst.h>
986-
987-#include "gst-lastfmfpbridge.h"
988-
989-#include "FingerprintExtractor.h"
990-
991-struct LastfmfpAudio {
992-
993- // Cancel decoding mutex
994- GMutex *decoding_mutex;
995-
996- // Gstreamer
997- GstElement *pipeline;
998- GstElement *audio;
999-
1000- gint filerate;
1001- gint seconds;
1002- gint nchannels;
1003-
1004- fingerprint::FingerprintExtractor *extractor;
1005-
1006- //input
1007- short *data_in;
1008- size_t num_samples;
1009-
1010- //output
1011- const char* data_out;
1012- size_t data_out_size;
1013-
1014- int fpid;
1015-
1016- gboolean quit;
1017- gboolean invalidate;
1018-};
1019-
1020-static void
1021-Lastfmfp_cb_newpad(GstElement *decodebin, GstPad *pad, gboolean last, LastfmfpAudio *ma)
1022-{
1023- GstCaps *caps;
1024- GstStructure *str;
1025- GstPad *audiopad;
1026-
1027- // only link once
1028- audiopad = gst_element_get_pad(ma->audio, "sink");
1029- if (GST_PAD_IS_LINKED(audiopad)) {
1030- g_object_unref(audiopad);
1031- return;
1032- }
1033-
1034- // check media type
1035- caps = gst_pad_get_caps(pad);
1036- str = gst_caps_get_structure(caps, 0);
1037-
1038- if (!g_strrstr(gst_structure_get_name(str), "audio")) {
1039- gst_caps_unref(caps);
1040- gst_object_unref(audiopad);
1041- return;
1042- }
1043- gst_caps_unref(caps);
1044-
1045- // link
1046- gst_pad_link(pad, audiopad);
1047- gst_object_unref(audiopad);
1048-}
1049-
1050-static void FingerprintFound(LastfmfpAudio *ma)
1051-{
1052- //we have the fingerprint
1053-
1054- std::pair<const char*, size_t> fpData = ma->extractor->getFingerprint();
1055- ma->data_out = fpData.first;
1056- ma->data_out_size = fpData.second;
1057-}
1058-
1059-extern "C" unsigned int
1060-Lastfmfp_getVersion (LastfmfpAudio *ma)
1061-{
1062- return ma->extractor->getVersion ();
1063-}
1064-
1065-static void
1066-Lastfmfp_cb_have_data(GstElement *element, GstBuffer *buffer, GstPad *pad, LastfmfpAudio *ma)
1067-{
1068- // if data continues to flow/EOS is not yet processed
1069- if (ma->quit)
1070- return;
1071-
1072- // exit on empty buffer
1073- if (buffer->size <= 0)
1074- return;
1075-
1076- ma->data_in = (short*)GST_BUFFER_DATA(buffer);
1077- //ma->num_samples = (size_t)(GST_BUFFER_OFFSET_END (buffer) - GST_BUFFER_OFFSET (buffer));
1078- ma->num_samples = (size_t)(GST_BUFFER_SIZE (buffer) / sizeof(guint16));
1079-
1080- //printf("caps: %s\n", gst_caps_to_string(GST_BUFFER_CAPS(buffer)));
1081- //printf(" offset : %llu size: %llu \n", (unsigned long long)GST_BUFFER_OFFSET (buffer), (unsigned long long)GST_BUFFER_OFFSET_END (buffer));
1082- //GST_LOG ("caps are %" GST_PTR_FORMAT, GST_BUFFER_CAPS(buffer));
1083- //extractor.process(const short* pPCM, size_t num_samples, bool end_of_stream = false);
1084- //printf("data: %d %d %d %d %d %d %d %d %d %d %d %d \n", ma->data_in[0], ma->data_in[1], ma->data_in[2], ma->data_in[3], ma->data_in[4], ma->data_in[5], ma->data_in[6], ma->data_in[7], ma->data_in[8], ma->data_in[9], ma->data_in[10], ma->data_in[11]);
1085- if (ma->extractor->process(ma->data_in, ma->num_samples, false))//TODO check parametters
1086- {
1087- //stop the gstreamer loop to free all and return fpid
1088- GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(ma->pipeline));
1089- GstMessage* eosmsg = gst_message_new_eos(GST_OBJECT(ma->pipeline));
1090- gst_bus_post(bus, eosmsg);
1091- g_print("libLastfmfp: EOS Message sent\n");
1092- gst_object_unref(bus);
1093- ma->quit = TRUE;
1094- return;
1095-
1096- }
1097-
1098-
1099- return;
1100-}
1101-
1102-extern "C" LastfmfpAudio*
1103-Lastfmfp_initialize(gint seconds)
1104-{
1105- LastfmfpAudio *ma;
1106-
1107- ma = g_new0(LastfmfpAudio, 1);
1108- ma->seconds = seconds;
1109-
1110- // cancel decoding mutex
1111- ma->decoding_mutex = g_mutex_new();
1112-
1113- return ma;
1114-}
1115-
1116-void
1117-Lastfmfp_initgstreamer(LastfmfpAudio *ma, const gchar *file)
1118-{
1119- GstPad *audiopad;
1120- GstCaps *filter_short;
1121- GstElement *cfilt_short;
1122- GstElement *dec;
1123- GstElement *src;
1124- GstElement *sink;
1125- GstElement *audioconvert;
1126-
1127- // Gstreamer decoder setup
1128- ma->pipeline = gst_pipeline_new("pipeline");
1129-
1130- // decoder
1131- src = gst_element_factory_make("filesrc", "source");
1132- g_object_set(G_OBJECT(src), "location", file, NULL);
1133- dec = gst_element_factory_make("decodebin", "decoder");
1134- g_signal_connect(dec, "new-decoded-pad", G_CALLBACK(Lastfmfp_cb_newpad), ma);
1135- gst_bin_add_many(GST_BIN(ma->pipeline), src, dec, NULL);
1136- gst_element_link(src, dec);
1137-
1138- // audio conversion
1139- ma->audio = gst_bin_new("audio");
1140-
1141- audioconvert = gst_element_factory_make("audioconvert", "conv");
1142- filter_short = gst_caps_new_simple("audio/x-raw-int",
1143- "width", G_TYPE_INT, 16,
1144- "depth", G_TYPE_INT, 16,
1145- "endianness", G_TYPE_INT, 1234,//BYTE_ORDER, //1234,
1146- "signed", G_TYPE_BOOLEAN, TRUE,
1147- NULL);
1148- cfilt_short = gst_element_factory_make("capsfilter", "cfilt_short");
1149- g_object_set(G_OBJECT(cfilt_short), "caps", filter_short, NULL);
1150- gst_caps_unref(filter_short);
1151-
1152- sink = gst_element_factory_make("fakesink", "sink");
1153- g_object_set(G_OBJECT(sink), "signal-handoffs", TRUE, NULL);
1154- g_signal_connect(sink, "handoff", G_CALLBACK(Lastfmfp_cb_have_data), ma);
1155-
1156-
1157- gst_bin_add_many(GST_BIN(ma->audio),
1158- audioconvert, cfilt_short,
1159- sink, NULL);
1160- gst_element_link_many(audioconvert, cfilt_short,
1161- sink, NULL);
1162-
1163- audiopad = gst_element_get_pad(audioconvert, "sink");
1164- gst_element_add_pad(ma->audio,
1165- gst_ghost_pad_new("sink", audiopad));
1166- gst_object_unref(audiopad);
1167-
1168- gst_bin_add(GST_BIN(ma->pipeline), ma->audio);
1169-
1170- // Get sampling rate of audio file
1171- GstClockTime max_wait = 1 * GST_SECOND;
1172- if (gst_element_set_state(ma->pipeline, GST_STATE_READY) == GST_STATE_CHANGE_ASYNC) {
1173- gst_element_get_state(ma->pipeline, NULL, NULL, max_wait);
1174- }
1175- if (gst_element_set_state(ma->pipeline, GST_STATE_PAUSED) == GST_STATE_CHANGE_ASYNC) {
1176- gst_element_get_state(ma->pipeline, NULL, NULL, max_wait);
1177- }
1178-
1179- GstPad *pad = gst_element_get_pad(sink, "sink");
1180- GstCaps *caps = gst_pad_get_negotiated_caps(pad);
1181- if (GST_IS_CAPS(caps)) {
1182- GstStructure *str = gst_caps_get_structure(caps, 0);
1183- gst_structure_get_int(str, "rate", &ma->filerate);
1184- gst_structure_get_int(str, "channels", &ma->nchannels);
1185- } else {
1186- ma->filerate = -1;
1187- }
1188- gst_caps_unref(caps);
1189- gst_object_unref(pad);
1190-}
1191-
1192-extern "C" const char*
1193-Lastfmfp_decode(LastfmfpAudio *ma, const gchar *file, int* size, int* ret)
1194-{
1195- GstBus *bus;
1196-
1197- ma->quit = FALSE;
1198-
1199- g_mutex_lock(ma->decoding_mutex);
1200- ma->invalidate = FALSE;
1201- g_mutex_unlock(ma->decoding_mutex);
1202-
1203- // Gstreamer setup
1204- Lastfmfp_initgstreamer(ma, file);
1205- //lastfm setup
1206- ma->extractor = new fingerprint::FingerprintExtractor();
1207- ma->extractor->initForQuery(ma->filerate, ma->nchannels, ma->seconds);
1208-
1209- if (ma->filerate < 0) {
1210- *size = 0;
1211- *ret = -1;
1212-
1213- // Gstreamer cleanup
1214- gst_element_set_state(ma->pipeline, GST_STATE_NULL);
1215- gst_object_unref(GST_OBJECT(ma->pipeline));
1216-
1217- return NULL;
1218- }
1219-
1220- // decode...
1221- gst_element_set_state(ma->pipeline, GST_STATE_PLAYING);
1222- g_print("libLastfmfp: decoding %s\n", file);
1223-
1224-
1225- bus = gst_pipeline_get_bus(GST_PIPELINE(ma->pipeline));
1226- gboolean decoding = TRUE;
1227- *ret = 0;
1228- while (decoding) {
1229- GstMessage* message = gst_bus_timed_pop_filtered(bus, GST_MSECOND*100,
1230- (GstMessageType) (GST_MESSAGE_ERROR | GST_MESSAGE_EOS));
1231-
1232- if (message == NULL)
1233- continue;
1234-
1235- switch (GST_MESSAGE_TYPE(message)) {
1236- case GST_MESSAGE_ERROR: {
1237- GError *err;
1238- gchar *debug;
1239-
1240- gst_message_parse_error(message, &err, &debug);
1241- g_print("libLastfmfp: error: %s\n", err->message);
1242- g_error_free(err);
1243- g_free(debug);
1244- decoding = FALSE;
1245- *ret = -1;
1246-
1247- break;
1248- }
1249- case GST_MESSAGE_EOS: {
1250- //ma->extractor->process(0, static_cast<size_t>(0), true);
1251- FingerprintFound(ma);
1252- g_print("libLastfmfp: EOS Message received\n");
1253- decoding = FALSE;
1254- break;
1255- }
1256- default:
1257- break;
1258- }
1259- gst_message_unref(message);
1260- }
1261- gst_object_unref(bus);
1262-
1263-
1264- g_mutex_lock(ma->decoding_mutex);
1265-
1266- // Gstreamer cleanup
1267- gst_element_set_state(ma->pipeline, GST_STATE_NULL);
1268- gst_object_unref(GST_OBJECT(ma->pipeline));
1269-
1270- if (ma->invalidate) {
1271- //*size = 0;
1272- *ret = -2;
1273- } else {
1274- //*size = ma->nchannels/2 + 1;
1275- }
1276-
1277- *size = ma->data_out_size;
1278-
1279- g_mutex_unlock(ma->decoding_mutex);
1280-
1281- return ma->data_out;
1282-}
1283-
1284-extern "C" LastfmfpAudio*
1285-Lastfmfp_destroy(LastfmfpAudio *ma)
1286-{
1287- g_print("libLastfmfp: destroy.\n");
1288-
1289- g_mutex_free(ma->decoding_mutex);
1290-
1291- // common
1292- free(ma);
1293-
1294- return NULL;
1295-}
1296-
1297-extern "C" void
1298-Lastfmfp_canceldecode(LastfmfpAudio *ma)
1299-{
1300- if (GST_IS_ELEMENT(ma->pipeline)) {
1301-
1302- GstState state;
1303- gst_element_get_state(ma->pipeline, &state, NULL, 100*GST_MSECOND);
1304-
1305- if (state != GST_STATE_NULL) {
1306- g_mutex_lock(ma->decoding_mutex);
1307-
1308- GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(ma->pipeline));
1309- GstMessage* eosmsg = gst_message_new_eos(GST_OBJECT(ma->pipeline));
1310- gst_bus_post(bus, eosmsg);
1311- g_print("libLastfmfp: EOS Message sent\n");
1312- gst_object_unref(bus);
1313-
1314- ma->invalidate = TRUE;
1315-
1316- g_mutex_unlock(ma->decoding_mutex);
1317- }
1318- }
1319-}
1320-
1321-
1322
1323=== removed file '.pc/Port-LastfmFingerprint-plugin-to-GStreamer-1.0.patch/src/LastfmFingerprint/liblastfmfpbridge/lastfmfpbridgetest.cpp'
1324--- .pc/Port-LastfmFingerprint-plugin-to-GStreamer-1.0.patch/src/LastfmFingerprint/liblastfmfpbridge/lastfmfpbridgetest.cpp 2013-06-03 23:00:22 +0000
1325+++ .pc/Port-LastfmFingerprint-plugin-to-GStreamer-1.0.patch/src/LastfmFingerprint/liblastfmfpbridge/lastfmfpbridgetest.cpp 1970-01-01 00:00:00 +0000
1326@@ -1,47 +0,0 @@
1327-/*
1328- * Mirage - High Performance Music Similarity and Automatic Playlist Generator
1329- * http://hop.at/mirage
1330- *
1331- * Copyright (C) 2007 Dominik Schnitzer <dominik@schnitzer.at>
1332- *
1333- * This program is free software; you can redistribute it and/or
1334- * modify it under the terms of the GNU General Public License
1335- * as published by the Free Software Foundation; either version 2
1336- * of the License, or (at your option) any later version.
1337- *
1338- * This program is distributed in the hope that it will be useful,
1339- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1340- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1341- * GNU General Public License for more details.
1342- *
1343- * You should have received a copy of the GNU General Public License
1344- * along with this program; if not, write to the Free Software
1345- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
1346- * Boston, MA 02110-1301, USA.
1347- */
1348-
1349-#include <gst/gst.h>
1350-
1351-#include "gst-lastfmfpbridge.h"
1352-
1353-gint
1354-main (gint argc,
1355- gchar *argv[])
1356-{
1357- // init GStreamer
1358- gst_init (&argc, &argv);
1359-
1360- int size = 0;
1361- int ret = 0;
1362-
1363- //TODO parse argv for param of initialize
1364- LastfmfpAudio *ma = Lastfmfp_initialize(215);
1365-
1366- const char* fpid = Lastfmfp_decode(ma, argv[0], &size, &ret);
1367-
1368- printf("return fpid: %s ret: %d ", fpid, ret);
1369-
1370- ma = Lastfmfp_destroy(ma);
1371-
1372- return 0;
1373-}
1374
1375=== removed directory '.pc/Port-Mirage-plugin-to-GStreamer-1.0.patch'
1376=== removed file '.pc/Port-Mirage-plugin-to-GStreamer-1.0.patch/README'
1377--- .pc/Port-Mirage-plugin-to-GStreamer-1.0.patch/README 2013-06-03 23:00:22 +0000
1378+++ .pc/Port-Mirage-plugin-to-GStreamer-1.0.patch/README 1970-01-01 00:00:00 +0000
1379@@ -1,86 +0,0 @@
1380-Banshee Community Extensions is a repository and project for extensions to the
1381-Banshee media player that are community contributed and maintained.
1382-
1383-By bringing various third-party extensions into this one project, we can help
1384-each other maintain them and keep them up to date with the latest Banshee API.
1385-
1386-This is meant to be a low-barrier-to-entry way to start, develop, and publish
1387-a Banshee extension.
1388-
1389-=======================
1390-Points of Contact
1391-=======================
1392-
1393-* Website
1394- http://banshee-project.org/download/extensions/
1395- http://banshee-project.org/contribute/write-extensions/
1396-
1397-* File bugs
1398- https://bugzilla.gnome.org/enter_bug.cgi?product=banshee&component=Community%20Extensions
1399-
1400-* Mailing list/forum
1401- http://mail.gnome.org/mailman/listinfo/banshee-list
1402- http://banshee-project.org/support/forum/
1403-
1404- For BCE maintainers/developers:
1405- http://mail.gnome.org/mailman/listinfo/banshee-devel-list
1406-
1407-* IRC
1408- #banshee on irc.gnome.org
1409-
1410-=======================
1411-Dependencies
1412-=======================
1413-
1414-Banshee 2.1.0 and its devel packages are required. Some extensions have
1415-specific requirements.
1416-
1417-AppIndicator
1418- appindicator-sharp
1419- notify-sharp
1420-
1421-ClutterFlow
1422- clutter-sharp
1423- clutter-gtk-sharp
1424-
1425-LastfmFingerprint
1426- glib-2.0
1427- fftw3f
1428- samplerate
1429- gstreamer-0.10 >= 0.10.15
1430- gstreamer-base-0.10 >= 0.10.15
1431- gstreamer-plugins-base-0.10 >= 0.10.15
1432-
1433-LCD
1434- LCDProc
1435-
1436-Lirc
1437- LIRC
1438-
1439-Mirage:
1440- glib-2.0
1441- fftw3f
1442- samplerate
1443- gstreamer-0.10 >= 0.10.15
1444- gstreamer-base-0.10 >= 0.10.15
1445- gstreamer-plugins-base-0.10 >= 0.10.15
1446-
1447-Telepathy
1448- empathy >= 2.27.91
1449- telepathy-gabble >= 0.9
1450- telepathy-mission-control-5 >= 5.3.1
1451- see src/Telepathy/README for more details
1452-
1453-ZeitgeistDataprovider
1454- zeitgeist-sharp
1455-
1456-=======================
1457-Create a New Extension
1458-=======================
1459-
1460-Simply run:
1461-
1462-./create-extension Foo
1463-
1464-Where Foo is the name (with no spaces) of the extension. Read
1465-http://banshee-project.org/contribute/write-extensions/ for more information.
1466
1467=== removed directory '.pc/Port-Mirage-plugin-to-GStreamer-1.0.patch/build'
1468=== removed directory '.pc/Port-Mirage-plugin-to-GStreamer-1.0.patch/build/m4'
1469=== removed directory '.pc/Port-Mirage-plugin-to-GStreamer-1.0.patch/build/m4/extensions'
1470=== removed file '.pc/Port-Mirage-plugin-to-GStreamer-1.0.patch/build/m4/extensions/mirage.m4'
1471--- .pc/Port-Mirage-plugin-to-GStreamer-1.0.patch/build/m4/extensions/mirage.m4 2013-06-03 23:00:22 +0000
1472+++ .pc/Port-Mirage-plugin-to-GStreamer-1.0.patch/build/m4/extensions/mirage.m4 1970-01-01 00:00:00 +0000
1473@@ -1,38 +0,0 @@
1474-AC_DEFUN([BCE_MIRAGE],
1475-[
1476- BCE_ARG_DISABLE([Mirage], [try])
1477-
1478- BCE_CHECK_EXTENSION_DEP([Mirage], [GLIB],
1479- [glib-2.0],
1480- [The glib library was not found. Please install it or disable the Mirage extension by passing --disable-mirage])
1481-
1482- BCE_CHECK_EXTENSION_DEP([Mirage], [FFTW3F],
1483- [fftw3f],
1484- [The fftw3f library was not found. Please install it or disable the Mirage extension by passing --disable-mirage])
1485-
1486- BCE_CHECK_EXTENSION_DEP([Mirage], [LIBSAMPLERATE],
1487- [samplerate],
1488- [The samplerate library was not found. Please install it or disable the Mirage extension by passing --disable-mirage])
1489-
1490- GSTREAMER_REQUIRED_VERSION=0.10.15
1491- BCE_CHECK_EXTENSION_DEP([Mirage], [GSTREAMER],
1492- [gstreamer-0.10 >= $GSTREAMER_REQUIRED_VERSION
1493- gstreamer-base-0.10 >= $GSTREAMER_REQUIRED_VERSION
1494- gstreamer-plugins-base-0.10 >= $GSTREAMER_REQUIRED_VERSION],
1495- [GStreamer >= $GSTREAMER_REQUIRED_VERSION not found. Please install it or disable the Mirage extension by passing --disable-mirage])
1496-
1497- if test "x$enable_Mirage" = "xtry" \
1498- && test "x$have_GLIB" = "xyes" \
1499- && test "x$have_FFTW3F" = "xyes" \
1500- && test "x$have_LIBSAMPLERATE" = "xyes" \
1501- && test "x$have_GSTREAMER" = "xyes"; then
1502- enable_Mirage=yes
1503- fi
1504-
1505- if test "x$enable_Mirage" = "xyes"; then
1506- AM_CONDITIONAL(ENABLE_MIRAGE, true)
1507- else
1508- enable_Mirage=no
1509- AM_CONDITIONAL(ENABLE_MIRAGE, false)
1510- fi
1511-])
1512
1513=== removed directory '.pc/Port-Mirage-plugin-to-GStreamer-1.0.patch/src'
1514=== removed directory '.pc/Port-Mirage-plugin-to-GStreamer-1.0.patch/src/Mirage'
1515=== removed directory '.pc/Port-Mirage-plugin-to-GStreamer-1.0.patch/src/Mirage/libmirageaudio'
1516=== removed file '.pc/Port-Mirage-plugin-to-GStreamer-1.0.patch/src/Mirage/libmirageaudio/gst-mirageaudio.c'
1517--- .pc/Port-Mirage-plugin-to-GStreamer-1.0.patch/src/Mirage/libmirageaudio/gst-mirageaudio.c 2013-06-03 23:00:22 +0000
1518+++ .pc/Port-Mirage-plugin-to-GStreamer-1.0.patch/src/Mirage/libmirageaudio/gst-mirageaudio.c 1970-01-01 00:00:00 +0000
1519@@ -1,502 +0,0 @@
1520-/*
1521- * Mirage - High Performance Music Similarity and Automatic Playlist Generator
1522- * http://hop.at/mirage
1523- *
1524- * Copyright (C) 2007 Dominik Schnitzer <dominik@schnitzer.at>
1525- *
1526- * This program is free software; you can redistribute it and/or
1527- * modify it under the terms of the GNU General Public License
1528- * as published by the Free Software Foundation; either version 2
1529- * of the License, or (at your option) any later version.
1530- *
1531- * This program is distributed in the hope that it will be useful,
1532- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1533- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1534- * GNU General Public License for more details.
1535- *
1536- * You should have received a copy of the GNU General Public License
1537- * along with this program; if not, write to the Free Software
1538- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
1539- * Boston, MA 02110-1301, USA.
1540- */
1541-
1542-#include <math.h>
1543-#include <string.h>
1544-#include <time.h>
1545-
1546-#include <glib.h>
1547-#include <fftw3.h>
1548-#include <gst/gst.h>
1549-#include <samplerate.h>
1550-
1551-#include "gst-mirageaudio.h"
1552-
1553-struct MirageAudio {
1554-
1555- // Cancel decoding mutex
1556- GMutex *decoding_mutex;
1557-
1558- // Gstreamer
1559- GstElement *pipeline;
1560- GstElement *audio;
1561-
1562- gint rate;
1563- gint filerate;
1564- gint seconds;
1565- gint winsize;
1566- gint samples;
1567-
1568- // FFTW
1569- float *fftw;
1570- fftwf_plan fftwplan;
1571- gint fftwsamples;
1572- gint fftwsize;
1573-
1574- // libsamplerate
1575- SRC_STATE *src_state;
1576- SRC_DATA src_data;
1577-
1578- // Hann window
1579- float *window;
1580-
1581- // Output buffer
1582- float *out;
1583- gint hops;
1584- gint curhop;
1585- gint cursample;
1586-
1587- gboolean quit;
1588- gboolean invalidate;
1589-};
1590-
1591-#define SRC_BUFFERLENGTH 4096
1592-
1593-clock_t start;
1594-clock_t end;
1595-
1596-
1597-void tic()
1598-{
1599- start = clock();
1600-}
1601-
1602-void toc()
1603-{
1604- double ms;
1605- end = clock();
1606- ms = ((end - start)/(double)(CLOCKS_PER_SEC))*1000.0;
1607- g_print("libmirageaudio: time = %f\n", ms);
1608-}
1609-
1610-static void
1611-mirageaudio_cb_newpad(GstElement *decodebin, GstPad *pad, gboolean last, MirageAudio *ma)
1612-{
1613- GstCaps *caps;
1614- GstStructure *str;
1615- GstPad *audiopad;
1616-
1617- // only link once
1618- audiopad = gst_element_get_pad(ma->audio, "sink");
1619- if (GST_PAD_IS_LINKED(audiopad)) {
1620- g_object_unref(audiopad);
1621- return;
1622- }
1623-
1624- // check media type
1625- caps = gst_pad_get_caps(pad);
1626- str = gst_caps_get_structure(caps, 0);
1627-
1628- if (!g_strrstr(gst_structure_get_name(str), "audio")) {
1629- gst_caps_unref(caps);
1630- gst_object_unref(audiopad);
1631- return;
1632- }
1633- gst_caps_unref(caps);
1634-
1635- // link
1636- gst_pad_link(pad, audiopad);
1637- gst_object_unref(audiopad);
1638-}
1639-
1640-static void
1641-mirageaudio_cb_have_data(GstElement *element, GstBuffer *buffer, GstPad *pad, MirageAudio *ma)
1642-{
1643- gint buffersamples;
1644- gint bufferpos;
1645- gint i;
1646- gint j;
1647- gint fill;
1648-
1649- // if data continues to flow/EOS is not yet processed
1650- if (ma->quit)
1651- return;
1652-
1653- // exit on empty buffer
1654- if (buffer->size <= 0)
1655- return;
1656-
1657- ma->src_data.data_in = (float*)GST_BUFFER_DATA(buffer);
1658- ma->src_data.input_frames = GST_BUFFER_SIZE(buffer)/sizeof(float);
1659-
1660- do {
1661- // set end of input flag if necessary
1662- ma->cursample += ma->src_data.input_frames;
1663- if (ma->cursample >= ma->seconds * ma->filerate) {
1664- ma->src_data.end_of_input = 1;
1665- }
1666-
1667- // resampling
1668- int err = src_process(ma->src_state, &ma->src_data);
1669-
1670- if (err != 0) {
1671- g_print("libmirageaudio: SRC Error - %s\n", src_strerror(err));
1672- }
1673- // return if no output
1674- if (ma->src_data.output_frames_gen == 0)
1675- return;
1676-
1677- buffersamples = ma->src_data.output_frames_gen;
1678- bufferpos = 0;
1679-
1680- // FFTW
1681- // If buffer does not get filled
1682- if (ma->fftwsamples + buffersamples < ma->winsize) {
1683- memcpy(ma->fftw+ma->fftwsamples, ma->src_data.data_out, buffersamples*sizeof(float));
1684- ma->fftwsamples += buffersamples;
1685-
1686- // If buffer gets filled.
1687- } else {
1688- do {
1689- // prepare FFTW
1690- fill = ma->winsize - ma->fftwsamples;
1691-
1692- if (fill <= 0)
1693- g_print("libmirageaudio: Logic ERROR! fill <= 0\n");
1694-
1695- memcpy(ma->fftw+ma->fftwsamples, ma->src_data.data_out+bufferpos, fill*sizeof(float));
1696- memset(ma->fftw+ma->winsize, 0, ma->winsize*sizeof(float));
1697- for (i = 0; i < ma->winsize; i++) {
1698- ma->fftw[i] = ma->fftw[i] * ma->window[i] * 32768.0f;
1699- }
1700-
1701- // Execute FFTW
1702- fftwf_execute(ma->fftwplan);
1703-
1704- // Powerspectrum
1705- ma->out[ma->curhop] = powf(ma->fftw[0], 2);
1706- for (j = 1; j < ma->winsize/2; j++) {
1707- ma->out[j*ma->hops + ma->curhop] = powf(ma->fftw[j*2], 2) + powf(ma->fftw[ma->fftwsize-j*2], 2);
1708- }
1709- ma->out[(ma->winsize/2)*ma->hops + ma->curhop] = powf(ma->fftw[ma->winsize], 2);
1710-
1711- ma->fftwsamples = 0;
1712- buffersamples -= fill;
1713- bufferpos += fill;
1714-
1715- ma->curhop++;
1716-
1717- if (ma->curhop == ma->hops) {
1718- GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(ma->pipeline));
1719- GstMessage* eosmsg = gst_message_new_eos(GST_OBJECT(ma->pipeline));
1720- gst_bus_post(bus, eosmsg);
1721- g_print("libmirageaudio: EOS Message sent\n");
1722- gst_object_unref(bus);
1723- ma->quit = TRUE;
1724- return;
1725- }
1726-
1727- } while (buffersamples >= ma->winsize);
1728-
1729- if (buffersamples > 0) {
1730- memcpy(ma->fftw, ma->src_data.data_out+bufferpos, buffersamples*sizeof(float));
1731- ma->fftwsamples = buffersamples;
1732- }
1733- }
1734-
1735- ma->src_data.data_in += ma->src_data.input_frames_used;
1736- ma->src_data.input_frames -= ma->src_data.input_frames_used;
1737-
1738- } while (ma->src_data.input_frames > 0);
1739-
1740- return;
1741-}
1742-
1743-MirageAudio*
1744-mirageaudio_initialize(gint rate, gint seconds, gint winsize)
1745-{
1746- MirageAudio *ma;
1747- gint i;
1748-
1749- ma = g_new0(MirageAudio, 1);
1750- ma->rate = rate;
1751- ma->seconds = seconds;
1752- ma->hops = rate*seconds/winsize;
1753- ma->out = malloc(ma->hops*((winsize/2)+1)*sizeof(float));
1754-
1755- // FFTW
1756- ma->winsize = winsize;
1757- ma->fftwsize = 2 * ma->winsize;
1758- ma->fftw = (float*)fftwf_malloc(ma->fftwsize * sizeof(float));
1759- ma->fftwplan = fftwf_plan_r2r_1d((2*ma->winsize), ma->fftw, ma->fftw, FFTW_R2HC,
1760- FFTW_ESTIMATE | FFTW_DESTROY_INPUT);
1761-
1762- // Hann Window
1763- ma->window = malloc(ma->winsize*sizeof(float));
1764- for (i = 0; i < ma->winsize; i++) {
1765- ma->window[i] = (float)(0.5 * (1.0 - cos((2.0*M_PI *(double)i)/(double)(ma->winsize-1))));
1766- }
1767-
1768- // Samplingrate converter
1769- int error;
1770- ma->src_state = src_new(SRC_ZERO_ORDER_HOLD, 1, &error);
1771- ma->src_data.data_out = malloc(SRC_BUFFERLENGTH*sizeof(float));
1772- ma->src_data.output_frames = SRC_BUFFERLENGTH;
1773-
1774- // cancel decoding mutex
1775- ma->decoding_mutex = g_mutex_new();
1776-
1777- return ma;
1778-}
1779-
1780-void
1781-mirageaudio_initgstreamer(MirageAudio *ma, const gchar *file)
1782-{
1783- GstPad *audiopad;
1784- GstCaps *filter_float;
1785- GstCaps *filter_resample;
1786- GstElement *cfilt_float;
1787- GstElement *cfilt_resample;
1788- GstElement *dec;
1789- GstElement *src;
1790- GstElement *sink;
1791- GstElement *audioresample;
1792- GstElement *audioconvert;
1793-
1794- // Gstreamer decoder setup
1795- ma->pipeline = gst_pipeline_new("pipeline");
1796-
1797- // decoder
1798- src = gst_element_factory_make("filesrc", "source");
1799- g_object_set(G_OBJECT(src), "location", file, NULL);
1800- dec = gst_element_factory_make("decodebin", "decoder");
1801- g_signal_connect(dec, "new-decoded-pad", G_CALLBACK(mirageaudio_cb_newpad), ma);
1802- gst_bin_add_many(GST_BIN(ma->pipeline), src, dec, NULL);
1803- gst_element_link(src, dec);
1804-
1805- // audio conversion
1806- ma->audio = gst_bin_new("audio");
1807-
1808- audioconvert = gst_element_factory_make("audioconvert", "conv");
1809- filter_float = gst_caps_new_simple("audio/x-raw-float",
1810- "width", G_TYPE_INT, 32,
1811- NULL);
1812- cfilt_float = gst_element_factory_make("capsfilter", "cfilt_float");
1813- g_object_set(G_OBJECT(cfilt_float), "caps", filter_float, NULL);
1814- gst_caps_unref(filter_float);
1815-
1816- audioresample = gst_element_factory_make("audioresample", "resample");
1817-
1818- filter_resample = gst_caps_new_simple("audio/x-raw-float",
1819- "channels", G_TYPE_INT, 1,
1820- NULL);
1821- cfilt_resample = gst_element_factory_make("capsfilter", "cfilt_resample");
1822- g_object_set(G_OBJECT(cfilt_resample), "caps", filter_resample, NULL);
1823- gst_caps_unref(filter_resample);
1824-
1825- sink = gst_element_factory_make("fakesink", "sink");
1826- g_object_set(G_OBJECT(sink), "signal-handoffs", TRUE, NULL);
1827- g_signal_connect(sink, "handoff", G_CALLBACK(mirageaudio_cb_have_data), ma);
1828-
1829-
1830- gst_bin_add_many(GST_BIN(ma->audio),
1831- audioconvert, audioresample,
1832- cfilt_resample, cfilt_float,
1833- sink, NULL);
1834- gst_element_link_many(audioconvert, cfilt_float,
1835- audioresample, cfilt_resample,
1836- sink, NULL);
1837-
1838- audiopad = gst_element_get_pad(audioconvert, "sink");
1839- gst_element_add_pad(ma->audio,
1840- gst_ghost_pad_new("sink", audiopad));
1841- gst_object_unref(audiopad);
1842-
1843- gst_bin_add(GST_BIN(ma->pipeline), ma->audio);
1844-
1845- // Get sampling rate of audio file
1846- GstClockTime max_wait = 1 * GST_SECOND;
1847- if (gst_element_set_state(ma->pipeline, GST_STATE_READY) == GST_STATE_CHANGE_ASYNC) {
1848- gst_element_get_state(ma->pipeline, NULL, NULL, max_wait);
1849- }
1850- if (gst_element_set_state(ma->pipeline, GST_STATE_PAUSED) == GST_STATE_CHANGE_ASYNC) {
1851- gst_element_get_state(ma->pipeline, NULL, NULL, max_wait);
1852- }
1853-
1854- GstPad *pad = gst_element_get_pad(sink, "sink");
1855- GstCaps *caps = gst_pad_get_negotiated_caps(pad);
1856- if (GST_IS_CAPS(caps)) {
1857- GstStructure *str = gst_caps_get_structure(caps, 0);
1858- gst_structure_get_int(str, "rate", &ma->filerate);
1859-
1860- } else {
1861- ma->filerate = -1;
1862- }
1863- gst_caps_unref(caps);
1864- gst_object_unref(pad);
1865-}
1866-
1867-float*
1868-mirageaudio_decode(MirageAudio *ma, const gchar *file, int *frames, int* size, int* ret)
1869-{
1870- GstBus *bus;
1871- tic();
1872-
1873- ma->fftwsamples = 0;
1874- ma->curhop = 0;
1875- ma->cursample = 0;
1876- ma->quit = FALSE;
1877-
1878- g_mutex_lock(ma->decoding_mutex);
1879- ma->invalidate = FALSE;
1880- g_mutex_unlock(ma->decoding_mutex);
1881-
1882- // Gstreamer setup
1883- mirageaudio_initgstreamer(ma, file);
1884- if (ma->filerate < 0) {
1885- *size = 0;
1886- *frames = 0;
1887- *ret = -1;
1888-
1889- // Gstreamer cleanup
1890- gst_element_set_state(ma->pipeline, GST_STATE_NULL);
1891- gst_object_unref(GST_OBJECT(ma->pipeline));
1892-
1893- return NULL;
1894- }
1895-
1896- // libsamplerate initialization
1897- ma->src_data.src_ratio = (double)ma->rate/(double)ma->filerate;
1898- ma->src_data.input_frames = 0;
1899- ma->src_data.end_of_input = 0;
1900- src_reset(ma->src_state);
1901- g_print("libmirageaudio: rate=%d, resampling=%f\n", ma->filerate, ma->src_data.src_ratio);
1902-
1903- // decode...
1904- gst_element_set_state(ma->pipeline, GST_STATE_PLAYING);
1905- g_print("libmirageaudio: decoding %s\n", file);
1906-
1907-
1908- bus = gst_pipeline_get_bus(GST_PIPELINE(ma->pipeline));
1909- gboolean decoding = TRUE;
1910- *ret = 0;
1911- while (decoding) {
1912- GstMessage* message = gst_bus_timed_pop_filtered(bus, GST_MSECOND*100,
1913- GST_MESSAGE_ERROR | GST_MESSAGE_EOS);
1914-
1915- if (message == NULL)
1916- continue;
1917-
1918- switch (GST_MESSAGE_TYPE(message)) {
1919- case GST_MESSAGE_ERROR: {
1920- GError *err;
1921- gchar *debug;
1922-
1923- gst_message_parse_error(message, &err, &debug);
1924- g_print("libmirageaudio: error: %s\n", err->message);
1925- g_error_free(err);
1926- g_free(debug);
1927- ma->curhop = 0;
1928- decoding = FALSE;
1929- *ret = -1;
1930-
1931- break;
1932- }
1933- case GST_MESSAGE_EOS: {
1934- g_print("libmirageaudio: EOS Message received\n");
1935- decoding = FALSE;
1936- break;
1937- }
1938- default:
1939- break;
1940- }
1941- gst_message_unref(message);
1942- }
1943- gst_object_unref(bus);
1944-
1945-
1946- g_mutex_lock(ma->decoding_mutex);
1947-
1948- // Gstreamer cleanup
1949- gst_element_set_state(ma->pipeline, GST_STATE_NULL);
1950- gst_object_unref(GST_OBJECT(ma->pipeline));
1951-
1952- toc();
1953-
1954- if (ma->invalidate) {
1955- *size = 0;
1956- *frames = 0;
1957- *ret = -2;
1958- } else {
1959- *size = ma->winsize/2 + 1;
1960- *frames = ma->curhop;
1961- }
1962-
1963- g_mutex_unlock(ma->decoding_mutex);
1964-
1965- g_print("libmirageaudio: frames=%d (maxhops=%d), size=%d\n", *frames, ma->hops, *size);
1966- return ma->out;
1967-}
1968-
1969-MirageAudio*
1970-mirageaudio_destroy(MirageAudio *ma)
1971-{
1972- g_print("libmirageaudio: destroy.\n");
1973- // FFTW cleanup
1974- fftwf_destroy_plan(ma->fftwplan);
1975- fftwf_free(ma->fftw);
1976-
1977- // Hann window clanup
1978- free(ma->window);
1979-
1980- // libsamplerate
1981- free(ma->src_data.data_out);
1982- src_delete(ma->src_state);
1983-
1984- g_mutex_free(ma->decoding_mutex);
1985-
1986- // common
1987- free(ma->out);
1988- free(ma);
1989-
1990- return NULL;
1991-}
1992-
1993-void
1994-mirageaudio_initgst()
1995-{
1996- gst_init(NULL, NULL);
1997-}
1998-
1999-void
2000-mirageaudio_canceldecode(MirageAudio *ma)
2001-{
2002- if (GST_IS_ELEMENT(ma->pipeline)) {
2003-
2004- GstState state;
2005- gst_element_get_state(ma->pipeline, &state, NULL, 100*GST_MSECOND);
2006-
2007- if (state != GST_STATE_NULL) {
2008- g_mutex_lock(ma->decoding_mutex);
2009-
2010- GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(ma->pipeline));
2011- GstMessage* eosmsg = gst_message_new_eos(GST_OBJECT(ma->pipeline));
2012- gst_bus_post(bus, eosmsg);
2013- g_print("libmirageaudio: EOS Message sent\n");
2014- gst_object_unref(bus);
2015-
2016- ma->invalidate = TRUE;
2017-
2018- g_mutex_unlock(ma->decoding_mutex);
2019- }
2020- }
2021-}
2022
2023=== removed file '.pc/applied-patches'
2024--- .pc/applied-patches 2013-06-03 23:00:22 +0000
2025+++ .pc/applied-patches 1970-01-01 00:00:00 +0000
2026@@ -1,4 +0,0 @@
2027-Port-Mirage-plugin-to-GStreamer-1.0.patch
2028-Port-LastfmFingerprint-plugin-to-GStreamer-1.0.patch
2029-Mirage-Clean-up-caps-handling-and-make-sure-to-wait-.patch
2030-LastfmFingerprint-Clean-up-caps-handling-and-make-su.patch
2031
2032=== modified file 'debian/changelog'
2033--- debian/changelog 2013-06-03 23:00:22 +0000
2034+++ debian/changelog 2014-12-05 21:01:57 +0000
2035@@ -1,3 +1,24 @@
2036+banshee-community-extensions (2.4.0-4ubuntu1) vivid; urgency=medium
2037+
2038+ * Merge from Debian Unstable, remaining changes:
2039+ + Enable AppIndicator extension
2040+ * Use dbus#1 for the moment
2041+
2042+ -- Jackson Doak <noskcaj@ubuntu.com> Sat, 06 Dec 2014 07:14:01 +1100
2043+
2044+banshee-community-extensions (2.4.0-4) unstable; urgency=low
2045+
2046+ * [10ace16] Use DBus#2 API
2047+
2048+ -- Jo Shields <directhex@apebox.org> Thu, 09 Jan 2014 10:25:19 +0000
2049+
2050+banshee-community-extensions (2.4.0-3) unstable; urgency=low
2051+
2052+ * Rebuild against taglib-sharp 2.1
2053+ * [ef676d16] Add dependency against banshee 2.6.1-3 to sync taglib-sharp usage
2054+
2055+ -- Chow Loong Jin <hyperair@debian.org> Sat, 21 Sep 2013 15:49:06 +0800
2056+
2057 banshee-community-extensions (2.4.0-2ubuntu1) saucy; urgency=low
2058
2059 * [ff4badf] Merge from Debian Unstable, remaining changes:
2060
2061=== modified file 'debian/control'
2062--- debian/control 2013-06-03 23:00:22 +0000
2063+++ debian/control 2014-12-05 21:01:57 +0000
2064@@ -245,6 +245,7 @@
2065 Enhances: banshee
2066 Architecture: all
2067 Depends: banshee-extensions-common (= ${source:Version}),
2068+ banshee (>= 2.6.1-3),
2069 ${cli:Depends}, ${misc:Depends}
2070 Description: Lyrics extension for Banshee
2071 Banshee Lyrics Plugin is an extension which shows lyrics of songs played in

Subscribers

People subscribed via source and target branches

to all changes: