]>
Commit | Line | Data |
---|---|---|
0492623a JR |
1 | --- chromaprint-0.7/examples/fpcalc.c.0000 2012-09-06 02:05:36.000000000 +0800 |
2 | +++ chromaprint-0.7/examples/fpcalc.c 2013-07-11 12:46:13.408154060 +0800 | |
3 | @@ -13,7 +13,7 @@ | |
4 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) | |
5 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) | |
6 | ||
7 | -#define BUFFER_SIZE (AVCODEC_MAX_AUDIO_FRAME_SIZE * 2) | |
8 | +#define BUFFER_SIZE (192000 * 2) | |
9 | ||
10 | #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52, 94, 1) | |
11 | #define AV_SAMPLE_FMT_S16 SAMPLE_FMT_S16 | |
12 | @@ -65,7 +65,10 @@ | |
13 | goto done; | |
14 | } | |
15 | ||
16 | - if (avcodec_open(codec_ctx, codec) < 0) { | |
17 | + /* request regular signed 16-bit packed format */ | |
18 | + codec_ctx->request_sample_fmt = AV_SAMPLE_FMT_S16; | |
19 | + | |
20 | + if (avcodec_open2(codec_ctx, codec, NULL) < 0) { | |
21 | fprintf(stderr, "ERROR: couldn't open the codec\n"); | |
22 | goto done; | |
23 | } | |
24 | @@ -146,6 +149,7 @@ | |
25 | int ostride[6] = { 2 }; | |
26 | int len = buffer_size / istride[0]; | |
27 | if (av_audio_convert(convert_ctx, obuf, ostride, ibuf, istride, len) < 0) { | |
28 | + fprintf(stderr, "WARNING: unable to convert %d samples\n", buffer_size); | |
29 | break; | |
30 | } | |
31 | buffer = buffer2; | |
d8aa2c16 JR |
32 | --- chromaprint-0.7/src/ext/ffmpeg_decoder.h~ 2013-08-29 17:59:01.185761084 +0200 |
33 | +++ chromaprint-0.7/src/ext/ffmpeg_decoder.h 2013-08-29 18:01:51.129329962 +0200 | |
34 | @@ -28,6 +28,10 @@ | |
35 | } | |
36 | #include "audio_consumer.h" | |
37 | ||
38 | +#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE | |
39 | +#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 | |
40 | +#endif | |
41 | + | |
42 | class Decoder | |
43 | { | |
44 | public: | |
45 | --- chromaprint-0.7/src/ext/ffmpeg_decoder.h~ 2013-08-29 18:01:51.129329962 +0200 | |
46 | +++ chromaprint-0.7/src/ext/ffmpeg_decoder.h 2013-08-29 18:06:34.402639744 +0200 | |
47 | @@ -128,7 +128,7 @@ | |
48 | return false; | |
49 | } | |
50 | ||
51 | - if (avcodec_open(m_codec_ctx, codec) < 0) { | |
52 | + if (avcodec_open2(m_codec_ctx, codec, NULL) < 0) { | |
53 | m_error = "Couldn't open the codec."; | |
54 | return false; | |
55 | } |