if (cpr->silence_threshold != -1) {
#if CPR_VERSION_INT >= AV_VERSION_INT(0, 7, 0)
if (!chromaprint_set_option(cpr->ctx, "silence_threshold", cpr->silence_threshold)) {
- av_log(s, AV_LOG_ERROR, "Failed to set silence threshold.\n");
+ av_log(s, AV_LOG_ERROR, "Failed to set silence threshold. Setting silence_threshold requires -algorithm 3 option.\n");
goto fail;
}
#else
static int write_packet(AVFormatContext *s, AVPacket *pkt)
{
ChromaprintMuxContext *cpr = s->priv_data;
- return chromaprint_feed(cpr->ctx, pkt->data, pkt->size / 2) ? 0 : AVERROR(EINVAL);
+ return chromaprint_feed(cpr->ctx, (const int16_t *)pkt->data, pkt->size / 2) ? 0 : AVERROR(EINVAL);
}
static int write_trailer(AVFormatContext *s)
{
ChromaprintMuxContext *cpr = s->priv_data;
AVIOContext *pb = s->pb;
- void *fp = NULL, *enc_fp = NULL;
+ void *fp = NULL;
+ char *enc_fp = NULL;
int size, enc_size, ret = AVERROR(EINVAL);
if (!chromaprint_finish(cpr->ctx)) {
goto fail;
}
- if (!chromaprint_get_raw_fingerprint(cpr->ctx, &fp, &size)) {
+ if (!chromaprint_get_raw_fingerprint(cpr->ctx, (uint32_t **)&fp, &size)) {
av_log(s, AV_LOG_ERROR, "Failed to retrieve fingerprint\n");
goto fail;
}
switch (cpr->fp_format) {
case FINGERPRINT_RAW:
- avio_write(pb, fp, size);
+ avio_write(pb, fp, size * 4); //fp points to array of uint32_t
break;
case FINGERPRINT_COMPRESSED:
case FINGERPRINT_BASE64: