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
|
http://bugs.gentoo.org/498194
http://bitbucket.org/acoustid/chromaprint/commits/90822f6eee64da2941c9cbd9cd41a9664fead1d4
From 90822f6eee64da2941c9cbd9cd41a9664fead1d4 Mon Sep 17 00:00:00 2001
From: Urs Fleisch <ufleisch@users.sourceforge.net>
Date: Sat, 28 Dec 2013 09:47:31 +0100
Subject: [PATCH] Build fpcalc if neither HAVE_SWRESAMPLE nor HAVE_AVRESAMPLE
defined, issue #11.
---
examples/fpcalc.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/examples/fpcalc.c b/examples/fpcalc.c
index a4b0ff9..e73e358 100644
--- a/examples/fpcalc.c
+++ b/examples/fpcalc.c
@@ -33,6 +33,8 @@ int decode_audio_file(ChromaprintContext *chromaprint_ctx, const char *file_name
SwrContext *convert_ctx = NULL;
#elif defined(HAVE_AVRESAMPLE)
AVAudioResampleContext *convert_ctx = NULL;
+#else
+ void *convert_ctx = NULL;
#endif
int max_dst_nb_samples = 0, dst_linsize = 0;
uint8_t *dst_data[1] = { NULL };
@@ -75,6 +77,7 @@ int decode_audio_file(ChromaprintContext *chromaprint_ctx, const char *file_name
goto done;
}
+#if defined(HAVE_SWRESAMPLE) || defined(HAVE_AVRESAMPLE)
if (codec_ctx->sample_fmt != AV_SAMPLE_FMT_S16) {
int64_t channel_layout = codec_ctx->channel_layout;
if (!channel_layout) {
@@ -111,6 +114,7 @@ int decode_audio_file(ChromaprintContext *chromaprint_ctx, const char *file_name
}
#endif
}
+#endif
if (stream->duration != AV_NOPTS_VALUE) {
*duration = stream->time_base.num * stream->duration / stream->time_base.den;
@@ -155,10 +159,11 @@ int decode_audio_file(ChromaprintContext *chromaprint_ctx, const char *file_name
max_dst_nb_samples = frame->nb_samples;
}
#if defined(HAVE_SWRESAMPLE)
- if (swr_convert(convert_ctx, dst_data, frame->nb_samples, (const uint8_t **)frame->data, frame->nb_samples) < 0) {
+ if (swr_convert(convert_ctx, dst_data, frame->nb_samples, (const uint8_t **)frame->data, frame->nb_samples) < 0)
#elif defined(HAVE_AVRESAMPLE)
- if (avresample_convert(convert_ctx, dst_data, 0, frame->nb_samples, (uint8_t **)frame->data, 0, frame->nb_samples) < 0) {
+ if (avresample_convert(convert_ctx, dst_data, 0, frame->nb_samples, (uint8_t **)frame->data, 0, frame->nb_samples) < 0)
#endif
+ {
fprintf(stderr, "ERROR: couldn't convert the audio\n");
goto done;
}
--
1.9.rc2.211.gd198f5d
|