mirror of https://github.com/mpv-player/mpv
audio: mp_msg conversions
This commit is contained in:
parent
4abe6b862f
commit
1974c9b49d
|
@ -144,7 +144,7 @@ static int setup_format(struct dec_audio *da)
|
|||
// If not set, try container samplerate.
|
||||
// (Maybe this can't happen, and it's an artifact from the past.)
|
||||
da->decoded.rate = sh_audio->wf->nSamplesPerSec;
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_WARN, "ad_lavc: using container rate.\n");
|
||||
MP_WARN(da, "using container rate.\n");
|
||||
}
|
||||
|
||||
struct mp_chmap lavc_chmap;
|
||||
|
@ -198,8 +198,7 @@ static int init(struct dec_audio *da, const char *decoder)
|
|||
|
||||
lavc_codec = avcodec_find_decoder_by_name(decoder);
|
||||
if (!lavc_codec) {
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_ERR,
|
||||
"Cannot find codec '%s' in libavcodec...\n", decoder);
|
||||
MP_ERR(da, "Cannot find codec '%s' in libavcodec...\n", decoder);
|
||||
uninit(da);
|
||||
return 0;
|
||||
}
|
||||
|
@ -225,8 +224,7 @@ static int init(struct dec_audio *da, const char *decoder)
|
|||
|
||||
if (opts->avopt) {
|
||||
if (parse_avopts(lavc_context, opts->avopt) < 0) {
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_ERR,
|
||||
"ad_lavc: setting AVOptions '%s' failed.\n", opts->avopt);
|
||||
MP_ERR(da, "setting AVOptions '%s' failed.\n", opts->avopt);
|
||||
uninit(da);
|
||||
return 0;
|
||||
}
|
||||
|
@ -257,24 +255,22 @@ static int init(struct dec_audio *da, const char *decoder)
|
|||
|
||||
/* open it */
|
||||
if (avcodec_open2(lavc_context, lavc_codec, NULL) < 0) {
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_ERR, "Could not open codec.\n");
|
||||
MP_ERR(da, "Could not open codec.\n");
|
||||
uninit(da);
|
||||
return 0;
|
||||
}
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_V, "INFO: libavcodec \"%s\" init OK!\n",
|
||||
MP_VERBOSE(da, "INFO: libavcodec \"%s\" init OK!\n",
|
||||
lavc_codec->name);
|
||||
|
||||
// Decode at least 1 sample: (to get header filled)
|
||||
for (int tries = 1; ; tries++) {
|
||||
int x = decode_new_packet(da);
|
||||
if (x >= 0 && ctx->frame.samples > 0) {
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_V,
|
||||
"Initial decode succeeded after %d packets.\n", tries);
|
||||
MP_VERBOSE(da, "Initial decode succeeded after %d packets.\n", tries);
|
||||
break;
|
||||
}
|
||||
if (tries >= 50) {
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_ERR,
|
||||
"ad_lavc: initial decode failed\n");
|
||||
MP_ERR(da, "initial decode failed\n");
|
||||
uninit(da);
|
||||
return 0;
|
||||
}
|
||||
|
@ -296,7 +292,7 @@ static void uninit(struct dec_audio *da)
|
|||
|
||||
if (lavc_context) {
|
||||
if (avcodec_close(lavc_context) < 0)
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Could not close codec.\n");
|
||||
MP_ERR(da, "Could not close codec.\n");
|
||||
av_freep(&lavc_context->extradata);
|
||||
av_freep(&lavc_context);
|
||||
}
|
||||
|
@ -361,7 +357,7 @@ static int decode_new_packet(struct dec_audio *da)
|
|||
return 0;
|
||||
}
|
||||
if (ret < 0) {
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_V, "lavc_audio: error\n");
|
||||
MP_VERBOSE(da, "lavc_audio: error\n");
|
||||
return -1;
|
||||
}
|
||||
if (!got_frame)
|
||||
|
@ -381,7 +377,7 @@ static int decode_new_packet(struct dec_audio *da)
|
|||
da->pts_offset = 0;
|
||||
}
|
||||
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_DBG2, "Decoded %d -> %d samples\n", in_len,
|
||||
MP_DBG(da, "Decoded %d -> %d samples\n", in_len,
|
||||
priv->frame.samples);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -115,10 +115,10 @@ static int preinit(struct dec_audio *da)
|
|||
|
||||
bad_end:
|
||||
if (!con->handle)
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_ERR, "mpg123 preinit error: %s\n",
|
||||
MP_ERR(da, "mpg123 preinit error: %s\n",
|
||||
mpg123_plain_strerror(err));
|
||||
else
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_ERR, "mpg123 preinit error: %s\n",
|
||||
MP_ERR(da, "mpg123 preinit error: %s\n",
|
||||
mpg123_strerror(con->handle));
|
||||
|
||||
uninit(da);
|
||||
|
@ -156,8 +156,7 @@ static int set_format(struct dec_audio *da)
|
|||
int af = mpg123_format_to_af(encoding);
|
||||
if (!af) {
|
||||
/* This means we got a funny custom build of libmpg123 that only supports an unknown format. */
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_ERR,
|
||||
"Bad encoding from mpg123: %i.\n", encoding);
|
||||
MP_ERR(da, "Bad encoding from mpg123: %i.\n", encoding);
|
||||
return MPG123_ERR;
|
||||
}
|
||||
mp_audio_set_format(&da->decoded, af);
|
||||
|
@ -236,9 +235,9 @@ static int init(struct dec_audio *da, const char *decoder)
|
|||
|
||||
fail:
|
||||
if (ret == MPG123_NEED_MORE) {
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_ERR, "Could not find mp3 stream.\n");
|
||||
MP_ERR(da, "Could not find mp3 stream.\n");
|
||||
} else {
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_ERR, "mpg123 init error: %s\n",
|
||||
MP_ERR(da, "mpg123 init error: %s\n",
|
||||
mpg123_strerror(con->handle));
|
||||
}
|
||||
|
||||
|
@ -337,7 +336,7 @@ static int decode_audio(struct dec_audio *da, struct mp_audio *buffer, int maxle
|
|||
return 0;
|
||||
|
||||
mpg123_fail:
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_ERR, "mpg123 decoding error: %s\n",
|
||||
MP_ERR(da, "mpg123 decoding error: %s\n",
|
||||
mpg123_strerror(con->handle));
|
||||
return -1;
|
||||
}
|
||||
|
@ -351,8 +350,7 @@ static int control(struct dec_audio *da, int cmd, void *arg)
|
|||
mpg123_close(con->handle);
|
||||
|
||||
if (mpg123_open_feed(con->handle) != MPG123_OK) {
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_ERR,
|
||||
"mpg123 failed to reopen stream: %s\n",
|
||||
MP_ERR(da, "mpg123 failed to reopen stream: %s\n",
|
||||
mpg123_strerror(con->handle));
|
||||
return CONTROL_FALSE;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#define OUTBUF_SIZE 65536
|
||||
|
||||
struct spdifContext {
|
||||
struct mp_log *log;
|
||||
AVFormatContext *lavf_ctx;
|
||||
int iec61937_packet_size;
|
||||
int out_buffer_len;
|
||||
|
@ -48,7 +49,7 @@ static int write_packet(void *p, uint8_t *buf, int buf_size)
|
|||
|
||||
int buffer_left = ctx->out_buffer_size - ctx->out_buffer_len;
|
||||
if (buf_size > buffer_left) {
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_ERR, "spdif packet too large.\n");
|
||||
MP_ERR(ctx, "spdif packet too large.\n");
|
||||
buf_size = buffer_left;
|
||||
}
|
||||
|
||||
|
@ -76,6 +77,7 @@ static int init(struct dec_audio *da, const char *decoder)
|
|||
{
|
||||
struct spdifContext *spdif_ctx = talloc_zero(NULL, struct spdifContext);
|
||||
da->priv = spdif_ctx;
|
||||
spdif_ctx->log = da->log;
|
||||
|
||||
AVFormatContext *lavf_ctx = avformat_alloc_context();
|
||||
if (!lavf_ctx)
|
||||
|
@ -166,8 +168,7 @@ static int init(struct dec_audio *da, const char *decoder)
|
|||
da->decoded.rate = samplerate;
|
||||
|
||||
if (avformat_write_header(lavf_ctx, &format_opts) < 0) {
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_FATAL,
|
||||
"libavformat spdif initialization failed.\n");
|
||||
MP_FATAL(da, "libavformat spdif initialization failed.\n");
|
||||
av_dict_free(&format_opts);
|
||||
goto fail;
|
||||
}
|
||||
|
@ -204,7 +205,7 @@ static int decode_audio(struct dec_audio *da, struct mp_audio *buffer, int maxle
|
|||
AVPacket pkt;
|
||||
mp_set_av_packet(&pkt, mpkt, NULL);
|
||||
pkt.pts = pkt.dts = 0;
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_V, "spdif packet, size=%d\n", pkt.size);
|
||||
MP_VERBOSE(da, "spdif packet, size=%d\n", pkt.size);
|
||||
if (mpkt->pts != MP_NOPTS_VALUE) {
|
||||
da->pts = mpkt->pts;
|
||||
da->pts_offset = 0;
|
||||
|
|
|
@ -68,7 +68,7 @@ static const struct ad_functions * const ad_drivers[] = {
|
|||
static bool reinit_audio_buffer(struct dec_audio *da)
|
||||
{
|
||||
if (!mp_audio_config_valid(&da->decoded)) {
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_ERR, "Audio decoder did not specify audio "
|
||||
MP_ERR(da, "Audio decoder did not specify audio "
|
||||
"format, or requested an unsupported configuration!\n");
|
||||
return false;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ static bool reinit_audio_buffer(struct dec_audio *da)
|
|||
static void uninit_decoder(struct dec_audio *d_audio)
|
||||
{
|
||||
if (d_audio->ad_driver) {
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_V, "Uninit audio decoder.\n");
|
||||
MP_VERBOSE(d_audio, "Uninit audio decoder.\n");
|
||||
d_audio->ad_driver->uninit(d_audio);
|
||||
}
|
||||
d_audio->ad_driver = NULL;
|
||||
|
@ -91,7 +91,7 @@ static void uninit_decoder(struct dec_audio *d_audio)
|
|||
static int init_audio_codec(struct dec_audio *d_audio, const char *decoder)
|
||||
{
|
||||
if (!d_audio->ad_driver->init(d_audio, decoder)) {
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_V, "Audio decoder init failed.\n");
|
||||
MP_VERBOSE(d_audio, "Audio decoder init failed.\n");
|
||||
d_audio->ad_driver = NULL;
|
||||
uninit_decoder(d_audio);
|
||||
return 0;
|
||||
|
@ -148,14 +148,14 @@ int audio_init_best_codec(struct dec_audio *d_audio, char *audio_decoders)
|
|||
const struct ad_functions *driver = find_driver(sel->family);
|
||||
if (!driver)
|
||||
continue;
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_V, "Opening audio decoder %s:%s\n",
|
||||
sel->family, sel->decoder);
|
||||
MP_VERBOSE(d_audio, "Opening audio decoder %s:%s\n",
|
||||
sel->family, sel->decoder);
|
||||
d_audio->ad_driver = driver;
|
||||
if (init_audio_codec(d_audio, sel->decoder)) {
|
||||
decoder = sel;
|
||||
break;
|
||||
}
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_WARN, "Audio decoder init failed for "
|
||||
MP_WARN(d_audio, "Audio decoder init failed for "
|
||||
"%s:%s\n", sel->family, sel->decoder);
|
||||
}
|
||||
|
||||
|
@ -163,19 +163,16 @@ int audio_init_best_codec(struct dec_audio *d_audio, char *audio_decoders)
|
|||
d_audio->decoder_desc =
|
||||
talloc_asprintf(d_audio, "%s [%s:%s]", decoder->desc, decoder->family,
|
||||
decoder->decoder);
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_INFO, "Selected audio codec: %s\n",
|
||||
d_audio->decoder_desc);
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_V,
|
||||
"AUDIO: %d Hz, %d ch, %s\n",
|
||||
d_audio->decoded.rate, d_audio->decoded.channels.num,
|
||||
af_fmt_to_str(d_audio->decoded.format));
|
||||
mp_msg(MSGT_IDENTIFY, MSGL_INFO,
|
||||
"ID_AUDIO_BITRATE=%d\nID_AUDIO_RATE=%d\n" "ID_AUDIO_NCH=%d\n",
|
||||
d_audio->i_bps * 8, d_audio->decoded.rate,
|
||||
d_audio->decoded.channels.num);
|
||||
MP_INFO(d_audio, "Selected audio codec: %s\n",
|
||||
d_audio->decoder_desc);
|
||||
MP_VERBOSE(d_audio, "AUDIO: %d Hz, %d ch, %s\n",
|
||||
d_audio->decoded.rate, d_audio->decoded.channels.num,
|
||||
af_fmt_to_str(d_audio->decoded.format));
|
||||
MP_SMODE(d_audio, "ID_AUDIO_BITRATE=%d\nID_AUDIO_RATE=%d\n" "ID_AUDIO_NCH=%d\n",
|
||||
d_audio->i_bps * 8, d_audio->decoded.rate,
|
||||
d_audio->decoded.channels.num);
|
||||
} else {
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_ERR,
|
||||
"Failed to initialize an audio decoder for codec '%s'.\n",
|
||||
MP_ERR(d_audio, "Failed to initialize an audio decoder for codec '%s'.\n",
|
||||
d_audio->header->codec ? d_audio->header->codec : "<unknown>");
|
||||
}
|
||||
|
||||
|
@ -188,7 +185,7 @@ void audio_uninit(struct dec_audio *d_audio)
|
|||
if (!d_audio)
|
||||
return;
|
||||
if (d_audio->afilter) {
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_V, "Uninit audio filters...\n");
|
||||
MP_VERBOSE(d_audio, "Uninit audio filters...\n");
|
||||
af_destroy(d_audio->afilter);
|
||||
d_audio->afilter = NULL;
|
||||
}
|
||||
|
@ -203,7 +200,7 @@ int audio_init_filters(struct dec_audio *d_audio, int in_samplerate,
|
|||
int *out_format)
|
||||
{
|
||||
if (!d_audio->afilter)
|
||||
d_audio->afilter = af_new(d_audio->opts);
|
||||
d_audio->afilter = af_new(d_audio->global);
|
||||
struct af_stream *afs = d_audio->afilter;
|
||||
|
||||
// input format: same as codec's output format:
|
||||
|
@ -218,8 +215,7 @@ int audio_init_filters(struct dec_audio *d_audio, int in_samplerate,
|
|||
|
||||
char *s_from = mp_audio_config_to_str(&afs->input);
|
||||
char *s_to = mp_audio_config_to_str(&afs->output);
|
||||
mp_msg(MSGT_DECAUDIO, MSGL_V,
|
||||
"Building audio filter chain for %s -> %s...\n", s_from, s_to);
|
||||
MP_VERBOSE(d_audio, "Building audio filter chain for %s -> %s...\n", s_from, s_to);
|
||||
talloc_free(s_from);
|
||||
talloc_free(s_to);
|
||||
|
||||
|
|
|
@ -27,7 +27,9 @@ struct mp_audio_buffer;
|
|||
struct mp_decoder_list;
|
||||
|
||||
struct dec_audio {
|
||||
struct mp_log *log;
|
||||
struct MPOpts *opts;
|
||||
struct mpv_global *global;
|
||||
const struct ad_functions *ad_driver;
|
||||
struct sh_stream *header;
|
||||
struct mp_audio_buffer *decode_buffer;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include "common/common.h"
|
||||
#include "common/global.h"
|
||||
|
||||
#include "options/m_option.h"
|
||||
#include "options/m_config.h"
|
||||
|
@ -179,8 +180,7 @@ static struct af_instance *af_create(struct af_stream *s, char *name,
|
|||
{
|
||||
struct m_obj_desc desc;
|
||||
if (!m_obj_list_find(&desc, &af_obj_list, bstr0(name))) {
|
||||
mp_msg(MSGT_VFILTER, MSGL_ERR,
|
||||
"Couldn't find audio filter '%s'.\n", name);
|
||||
MP_ERR(s, "Couldn't find audio filter '%s'.\n", name);
|
||||
return NULL;
|
||||
}
|
||||
const struct af_info *info = desc.p;
|
||||
|
@ -189,20 +189,21 @@ static struct af_instance *af_create(struct af_stream *s, char *name,
|
|||
if (info->flags & AF_FLAGS_NOT_REENTRANT) {
|
||||
for (struct af_instance *cur = s->first; cur; cur = cur->next) {
|
||||
if (cur->info == info) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "[libaf] There can only be one "
|
||||
MP_ERR(s, "There can only be one "
|
||||
"instance of the filter '%s' in each stream\n", name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "[libaf] Adding filter %s \n", name);
|
||||
MP_VERBOSE(s, "Adding filter %s \n", name);
|
||||
|
||||
struct af_instance *af = talloc_zero(NULL, struct af_instance);
|
||||
*af = (struct af_instance) {
|
||||
.info = info,
|
||||
.mul = 1,
|
||||
.data = talloc_zero(af, struct mp_audio),
|
||||
.log = mp_log_new(af, s->log, name),
|
||||
};
|
||||
struct m_config *config = m_config_from_obj_desc(af, &desc);
|
||||
if (m_config_apply_defaults(config, name, s->opts->af_defs) < 0)
|
||||
|
@ -218,8 +219,7 @@ static struct af_instance *af_create(struct af_stream *s, char *name,
|
|||
return af;
|
||||
|
||||
error:
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR,
|
||||
"[libaf] Couldn't create or open audio filter '%s'\n", name);
|
||||
MP_ERR(s, "Couldn't create or open audio filter '%s'\n", name);
|
||||
talloc_free(af);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -280,8 +280,7 @@ static void af_remove(struct af_stream *s, struct af_instance *af)
|
|||
return;
|
||||
|
||||
// Print friendly message
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "[libaf] Removing filter %s \n",
|
||||
af->info->name);
|
||||
MP_VERBOSE(s, "Removing filter %s \n", af->info->name);
|
||||
|
||||
// Detach pointers
|
||||
af->prev->next = af->next;
|
||||
|
@ -306,26 +305,26 @@ repeat:
|
|||
static void af_print_filter_chain(struct af_stream *s, struct af_instance *at,
|
||||
int msg_level)
|
||||
{
|
||||
mp_msg(MSGT_AFILTER, msg_level, "Audio filter chain:\n");
|
||||
MP_MSG(s, msg_level, "Audio filter chain:\n");
|
||||
|
||||
struct af_instance *af = s->first;
|
||||
while (af) {
|
||||
mp_msg(MSGT_AFILTER, msg_level, " [%s] ", af->info->name);
|
||||
MP_MSG(s, msg_level, " [%s] ", af->info->name);
|
||||
if (af->data) {
|
||||
char *info = mp_audio_config_to_str(af->data);
|
||||
mp_msg(MSGT_AFILTER, msg_level, "%s", info);
|
||||
MP_MSG(s, msg_level, "%s", info);
|
||||
talloc_free(info);
|
||||
}
|
||||
if (af == at)
|
||||
mp_msg(MSGT_AFILTER, msg_level, " <-");
|
||||
mp_msg(MSGT_AFILTER, msg_level, "\n");
|
||||
MP_MSG(s, msg_level, " <-");
|
||||
MP_MSG(s, msg_level, "\n");
|
||||
|
||||
af = af->next;
|
||||
}
|
||||
|
||||
mp_msg(MSGT_AFILTER, msg_level, " [ao] ");
|
||||
MP_MSG(s, msg_level, " [ao] ");
|
||||
char *info = mp_audio_config_to_str(&s->output);
|
||||
mp_msg(MSGT_AFILTER, msg_level, "%s\n", info);
|
||||
MP_MSG(s, msg_level, "%s\n", info);
|
||||
talloc_free(info);
|
||||
}
|
||||
|
||||
|
@ -555,8 +554,8 @@ static int af_reinit(struct af_stream *s)
|
|||
break;
|
||||
}
|
||||
default:
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "[libaf] Reinitialization did not "
|
||||
"work, audio filter '%s' returned error code %i\n",
|
||||
MP_ERR(s, "Reinitialization did not work, "
|
||||
"audio filter '%s' returned error code %i\n",
|
||||
af->info->name, rv);
|
||||
af_print_filter_chain(s, af, MSGL_ERR);
|
||||
return AF_ERROR;
|
||||
|
@ -573,8 +572,7 @@ static int af_reinit(struct af_stream *s)
|
|||
return af_config_equals(&s->output, &s->filter_output) ? AF_OK : AF_ERROR;
|
||||
|
||||
negotiate_error:
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "[libaf] Unable to convert audio input "
|
||||
"format to output format.\n");
|
||||
MP_ERR(s, "Unable to convert audio input format to output format.\n");
|
||||
af_print_filter_chain(s, af, MSGL_ERR);
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
@ -586,7 +584,7 @@ void af_uninit(struct af_stream *s)
|
|||
af_remove(s, s->first->next);
|
||||
}
|
||||
|
||||
struct af_stream *af_new(struct MPOpts *opts)
|
||||
struct af_stream *af_new(struct mpv_global *global)
|
||||
{
|
||||
struct af_stream *s = talloc_zero(NULL, struct af_stream);
|
||||
static struct af_info in = { .name = "in" };
|
||||
|
@ -611,7 +609,8 @@ struct af_stream *af_new(struct MPOpts *opts)
|
|||
};
|
||||
s->first->next = s->last;
|
||||
s->last->prev = s->first;
|
||||
s->opts = opts;
|
||||
s->opts = global->opts;
|
||||
s->log = mp_log_new(s, global->log, "!af");
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -654,7 +653,7 @@ int af_init(struct af_stream *s)
|
|||
|
||||
if (af_reinit(s) != AF_OK) {
|
||||
// Something is stuffed audio out will not work
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "Could not create audio filter chain.\n");
|
||||
MP_ERR(s, "Could not create audio filter chain.\n");
|
||||
af_uninit(s);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "common/msg.h"
|
||||
|
||||
struct af_instance;
|
||||
struct mpv_global;
|
||||
|
||||
// Number of channels
|
||||
#define AF_NCH MP_NUM_CHANNELS
|
||||
|
@ -57,6 +58,7 @@ struct af_info {
|
|||
// Linked list of audio filters
|
||||
struct af_instance {
|
||||
const struct af_info *info;
|
||||
struct mp_log *log;
|
||||
int (*control)(struct af_instance *af, int cmd, void *arg);
|
||||
void (*uninit)(struct af_instance *af);
|
||||
/* flags is a bit mask of AF_FILTER_FLAG_* values
|
||||
|
@ -86,6 +88,7 @@ struct af_stream {
|
|||
struct mp_audio output;
|
||||
struct mp_audio filter_output;
|
||||
|
||||
struct mp_log *log;
|
||||
struct MPOpts *opts;
|
||||
};
|
||||
|
||||
|
@ -120,7 +123,7 @@ typedef struct af_control_ext_s {
|
|||
int ch; // Chanel number
|
||||
} af_control_ext_t;
|
||||
|
||||
struct af_stream *af_new(struct MPOpts *opts);
|
||||
struct af_stream *af_new(struct mpv_global *global);
|
||||
void af_destroy(struct af_stream *s);
|
||||
int af_init(struct af_stream *s);
|
||||
void af_uninit(struct af_stream *s);
|
||||
|
|
|
@ -142,13 +142,12 @@ static int control(struct af_instance *af, int cmd, void *arg)
|
|||
// bs2b have srate limits, try to resample if needed
|
||||
if (af->data->rate > BS2B_MAXSRATE || af->data->rate < BS2B_MINSRATE) {
|
||||
af->data->rate = BS2B_DEFAULT_SRATE;
|
||||
mp_msg(MSGT_AFILTER, MSGL_WARN,
|
||||
"[bs2b] Requested sample rate %d Hz is out of bounds [%d..%d] Hz.\n"
|
||||
MP_WARN(af, "[bs2b] Requested sample rate %d Hz is out of bounds [%d..%d] Hz.\n"
|
||||
"[bs2b] Trying to resample to %d Hz.\n",
|
||||
af->data->rate, BS2B_MINSRATE, BS2B_MAXSRATE, BS2B_DEFAULT_SRATE);
|
||||
}
|
||||
bs2b_set_srate(s->filter, (long)af->data->rate);
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "[bs2b] using format %s\n",
|
||||
MP_VERBOSE(af, "[bs2b] using format %s\n",
|
||||
af_fmt_to_str(af->data->format));
|
||||
|
||||
return af_test_output(af,(struct mp_audio*)arg);
|
||||
|
|
|
@ -41,7 +41,8 @@ typedef struct af_channels_s{
|
|||
}af_channels_t;
|
||||
|
||||
// Local function for copying data
|
||||
static void copy(void* in, void* out, int ins, int inos,int outs, int outos, int len, int bps)
|
||||
static void copy(struct af_instance *af, void* in, void* out,
|
||||
int ins, int inos,int outs, int outos, int len, int bps)
|
||||
{
|
||||
switch(bps){
|
||||
case 1:{
|
||||
|
@ -112,24 +113,25 @@ static void copy(void* in, void* out, int ins, int inos,int outs, int outos, int
|
|||
break;
|
||||
}
|
||||
default:
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "[channels] Unsupported number of bytes/sample: %i"
|
||||
MP_ERR(af, "Unsupported number of bytes/sample: %i"
|
||||
" please report this error on the MPlayer mailing list. \n",bps);
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure the routes are sane
|
||||
static int check_routes(af_channels_t* s, int nin, int nout)
|
||||
static int check_routes(struct af_instance *af, int nin, int nout)
|
||||
{
|
||||
af_channels_t* s = af->priv;
|
||||
int i;
|
||||
if((s->nr < 1) || (s->nr > AF_NCH)){
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "[channels] The number of routing pairs must be"
|
||||
MP_ERR(af, "[channels] The number of routing pairs must be"
|
||||
" between 1 and %i. Current value is %i\n",AF_NCH,s->nr);
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
||||
for(i=0;i<s->nr;i++){
|
||||
if((s->route[i][FR] >= nin) || (s->route[i][TO] >= nout)){
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "[channels] Invalid routing in pair nr. %i.\n", i);
|
||||
MP_ERR(af, "[channels] Invalid routing in pair nr. %i.\n", i);
|
||||
return AF_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -174,7 +176,7 @@ static int control(struct af_instance* af, int cmd, void* arg)
|
|||
af->data->rate = ((struct mp_audio*)arg)->rate;
|
||||
mp_audio_force_interleaved_format((struct mp_audio*)arg);
|
||||
mp_audio_set_format(af->data, ((struct mp_audio*)arg)->format);
|
||||
return check_routes(s,((struct mp_audio*)arg)->nch,af->data->nch);
|
||||
return check_routes(af,((struct mp_audio*)arg)->nch,af->data->nch);
|
||||
}
|
||||
return AF_UNKNOWN;
|
||||
}
|
||||
|
@ -192,9 +194,9 @@ static int filter(struct af_instance* af, struct mp_audio* data, int flags)
|
|||
// Reset unused channels
|
||||
memset(l->planes[0],0,mp_audio_psize(c) / c->nch * l->nch);
|
||||
|
||||
if(AF_OK == check_routes(s,c->nch,l->nch))
|
||||
if(AF_OK == check_routes(af,c->nch,l->nch))
|
||||
for(i=0;i<s->nr;i++)
|
||||
copy(c->planes[0],l->planes[0],c->nch,s->route[i][FR],
|
||||
copy(af, c->planes[0],l->planes[0],c->nch,s->route[i][FR],
|
||||
l->nch,s->route[i][TO],mp_audio_psize(c),c->bps);
|
||||
|
||||
// Set output data
|
||||
|
@ -218,12 +220,11 @@ static int af_open(struct af_instance* af){
|
|||
do {
|
||||
int n = 0;
|
||||
if (ch >= AF_NCH) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_FATAL,
|
||||
"[channels] Can't have more than %d routes.\n", AF_NCH);
|
||||
MP_FATAL(af, "[channels] Can't have more than %d routes.\n", AF_NCH);
|
||||
return AF_ERROR;
|
||||
}
|
||||
sscanf(cp, "%i-%i%n" ,&s->route[ch][FR], &s->route[ch][TO], &n);
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "[channels] Routing from channel %i to"
|
||||
MP_VERBOSE(af, "[channels] Routing from channel %i to"
|
||||
" channel %i\n",s->route[ch][FR],s->route[ch][TO]);
|
||||
cp = &cp[n];
|
||||
ch++;
|
||||
|
|
|
@ -54,7 +54,7 @@ static int control(struct af_instance* af, int cmd, void* arg)
|
|||
struct mp_audio *in = arg;
|
||||
|
||||
if (in->bps != 1 && in->bps != 2 && in->bps != 4) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_FATAL, "[delay] Sample format not supported\n");
|
||||
MP_FATAL(af, "[delay] Sample format not supported\n");
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
||||
|
@ -69,16 +69,16 @@ static int control(struct af_instance* af, int cmd, void* arg)
|
|||
for(i=0;i<af->data->nch;i++){
|
||||
s->q[i] = calloc(L,af->data->bps);
|
||||
if(NULL == s->q[i])
|
||||
mp_msg(MSGT_AFILTER, MSGL_FATAL, "[delay] Out of memory\n");
|
||||
MP_FATAL(af, "[delay] Out of memory\n");
|
||||
}
|
||||
|
||||
if(AF_OK != af_from_ms(AF_NCH, s->d, s->wi, af->data->rate, 0.0, 1000.0))
|
||||
return AF_ERROR;
|
||||
s->ri = 0;
|
||||
for(i=0;i<AF_NCH;i++){
|
||||
mp_msg(MSGT_AFILTER, MSGL_DBG2, "[delay] Channel %i delayed by %0.3fms\n",
|
||||
MP_DBG(af, "[delay] Channel %i delayed by %0.3fms\n",
|
||||
i,MPCLAMP(s->d[i],0.0,1000.0));
|
||||
mp_msg(MSGT_AFILTER, MSGL_DBG3, "[delay] Channel %i delayed by %i samples\n",
|
||||
MP_TRACE(af, "[delay] Channel %i delayed by %i samples\n",
|
||||
i,s->wi[i]);
|
||||
}
|
||||
return AF_OK;
|
||||
|
|
|
@ -33,7 +33,7 @@ static int control(struct af_instance* af, int cmd, void* arg)
|
|||
switch(cmd){
|
||||
case AF_CONTROL_REINIT: ;
|
||||
*af->data = *(struct mp_audio*)arg;
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "[dummy] Was reinitialized: %iHz/%ich/%s\n",
|
||||
MP_VERBOSE(af, "[dummy] Was reinitialized: %iHz/%ich/%s\n",
|
||||
af->data->rate,af->data->nch,af_fmt_to_str(af->data->format));
|
||||
return AF_OK;
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ static int control(struct af_instance* af, int cmd, void* arg)
|
|||
s->K--;
|
||||
|
||||
if(s->K != KM)
|
||||
mp_msg(MSGT_AFILTER, MSGL_INFO, "[equalizer] Limiting the number of filters to"
|
||||
MP_INFO(af, "[equalizer] Limiting the number of filters to"
|
||||
" %i due to low sample rate.\n",s->K);
|
||||
|
||||
// Generate filter taps
|
||||
|
|
|
@ -95,20 +95,20 @@ static int control(struct af_instance* af, int cmd, void* arg)
|
|||
// Allocate new buffers (as one continuous block)
|
||||
s->buf[0] = calloc(s->sz*af->data->nch, af->data->bps);
|
||||
if(NULL == s->buf[0])
|
||||
mp_msg(MSGT_AFILTER, MSGL_FATAL, "[export] Out of memory\n");
|
||||
MP_FATAL(af, "[export] Out of memory\n");
|
||||
for(i = 1; i < af->data->nch; i++)
|
||||
s->buf[i] = (uint8_t *)s->buf[0] + i*s->sz*af->data->bps;
|
||||
|
||||
if (!s->filename) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_FATAL, "[export] No filename set.\n");
|
||||
MP_FATAL(af, "[export] No filename set.\n");
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
||||
// Init memory mapping
|
||||
s->fd = open(s->filename, O_RDWR | O_CREAT | O_TRUNC | O_CLOEXEC, 0640);
|
||||
mp_msg(MSGT_AFILTER, MSGL_INFO, "[export] Exporting to file: %s\n", s->filename);
|
||||
MP_INFO(af, "[export] Exporting to file: %s\n", s->filename);
|
||||
if(s->fd < 0) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_FATAL, "[export] Could not open/create file: %s\n",
|
||||
MP_FATAL(af, "[export] Could not open/create file: %s\n",
|
||||
s->filename);
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
@ -125,8 +125,8 @@ static int control(struct af_instance* af, int cmd, void* arg)
|
|||
// mmap size
|
||||
s->mmap_area = mmap(0, mapsize, PROT_READ|PROT_WRITE,MAP_SHARED, s->fd, 0);
|
||||
if(s->mmap_area == NULL)
|
||||
mp_msg(MSGT_AFILTER, MSGL_FATAL, "[export] Could not mmap file %s\n", s->filename);
|
||||
mp_msg(MSGT_AFILTER, MSGL_INFO, "[export] Memory mapped to file: %s (%p)\n",
|
||||
MP_FATAL(af, "[export] Could not mmap file %s\n", s->filename);
|
||||
MP_INFO(af, "[export] Memory mapped to file: %s (%p)\n",
|
||||
s->filename, s->mmap_area);
|
||||
|
||||
// Initialize header
|
||||
|
|
|
@ -80,13 +80,12 @@ static int control(struct af_instance *af, int cmd, void *arg)
|
|||
force_out_params(af, out);
|
||||
|
||||
if (in->nch != out->nch || in->bps != out->bps) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR,
|
||||
"[af_format] Forced input/output formats are incompatible.\n");
|
||||
MP_ERR(af, "[af_format] Forced input/output formats are incompatible.\n");
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
||||
if (priv->fail) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "[af_format] Failing on purpose.\n");
|
||||
MP_ERR(af, "[af_format] Failing on purpose.\n");
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -296,8 +296,7 @@ static int control(struct af_instance *af, int cmd, void* arg)
|
|||
if(af->data->rate != 48000) {
|
||||
// automatic samplerate adjustment in the filter chain
|
||||
// is not yet supported.
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR,
|
||||
"[hrtf] ERROR: Sampling rate is not 48000 Hz (%d)!\n",
|
||||
MP_ERR(af, "[hrtf] ERROR: Sampling rate is not 48000 Hz (%d)!\n",
|
||||
af->data->rate);
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
@ -368,30 +367,25 @@ static int filter(struct af_instance *af, struct mp_audio *data, int flags)
|
|||
s->print_flag = 0;
|
||||
switch (s->decode_mode) {
|
||||
case HRTF_MIX_51:
|
||||
mp_msg(MSGT_AFILTER, MSGL_INFO,
|
||||
"[hrtf] Using HRTF to mix %s discrete surround into "
|
||||
MP_INFO(af, "[hrtf] Using HRTF to mix %s discrete surround into "
|
||||
"L, R channels\n", s->matrix_mode ? "5+1" : "5");
|
||||
break;
|
||||
case HRTF_MIX_STEREO:
|
||||
mp_msg(MSGT_AFILTER, MSGL_INFO,
|
||||
"[hrtf] Using HRTF to mix stereo into "
|
||||
MP_INFO(af, "[hrtf] Using HRTF to mix stereo into "
|
||||
"L, R channels\n");
|
||||
break;
|
||||
case HRTF_MIX_MATRIX2CH:
|
||||
mp_msg(MSGT_AFILTER, MSGL_INFO,
|
||||
"[hrtf] Using active matrix to decode 2 channel "
|
||||
MP_INFO(af, "[hrtf] Using active matrix to decode 2 channel "
|
||||
"input, HRTF to mix %s matrix surround into "
|
||||
"L, R channels\n", "3/2");
|
||||
break;
|
||||
default:
|
||||
mp_msg(MSGT_AFILTER, MSGL_WARN,
|
||||
"[hrtf] bogus decode_mode: %d\n", s->decode_mode);
|
||||
MP_WARN(af, "[hrtf] bogus decode_mode: %d\n", s->decode_mode);
|
||||
break;
|
||||
}
|
||||
|
||||
if(s->matrix_mode)
|
||||
mp_msg(MSGT_AFILTER, MSGL_INFO,
|
||||
"[hrtf] Using active matrix to decode rear center "
|
||||
MP_INFO(af, "[hrtf] Using active matrix to decode rear center "
|
||||
"channel\n");
|
||||
}
|
||||
|
||||
|
@ -601,7 +595,7 @@ static int af_open(struct af_instance* af)
|
|||
s->print_flag = 1;
|
||||
|
||||
if (allocate(s) != 0) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "[hrtf] Memory allocation error.\n");
|
||||
MP_ERR(af, "[hrtf] Memory allocation error.\n");
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
||||
|
@ -620,13 +614,13 @@ static int af_open(struct af_instance* af)
|
|||
s->cr_ir = cr_filt + (s->cr_o = pulse_detect(cr_filt));
|
||||
|
||||
if((s->ba_ir = malloc(s->basslen * sizeof(float))) == NULL) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "[hrtf] Memory allocation error.\n");
|
||||
MP_ERR(af, "[hrtf] Memory allocation error.\n");
|
||||
return AF_ERROR;
|
||||
}
|
||||
fc = 2.0 * BASSFILTFREQ / (float)af->data->rate;
|
||||
if(af_filter_design_fir(s->basslen, s->ba_ir, &fc, LP | KAISER, 4 * M_PI) ==
|
||||
-1) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "[hrtf] Unable to design low-pass "
|
||||
MP_ERR(af, "[hrtf] Unable to design low-pass "
|
||||
"filter.\n");
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
|
|
@ -137,7 +137,8 @@ struct af_info af_info_ladspa = {
|
|||
* configuration. Else, it returns AF_ERROR.
|
||||
*/
|
||||
|
||||
static int af_ladspa_parse_plugin(af_ladspa_t *setup) {
|
||||
static int af_ladspa_parse_plugin(struct af_instance *af) {
|
||||
af_ladspa_t *setup = af->priv;
|
||||
int p, i;
|
||||
const LADSPA_Descriptor *pdes = setup->plugin_descriptor;
|
||||
LADSPA_PortDescriptor d;
|
||||
|
@ -217,30 +218,30 @@ static int af_ladspa_parse_plugin(af_ladspa_t *setup) {
|
|||
}
|
||||
|
||||
if (setup->ninputs == 0) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_WARN, "%s: %s\n", setup->myname,
|
||||
MP_WARN(af, "%s: %s\n", setup->myname,
|
||||
_("WARNING! This LADSPA plugin has no audio inputs.\n The incoming audio signal will be lost."));
|
||||
} else if (setup->ninputs == 1) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "%s: this is a mono effect\n", setup->myname);
|
||||
MP_VERBOSE(af, "%s: this is a mono effect\n", setup->myname);
|
||||
} else if (setup->ninputs == 2) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "%s: this is a stereo effect\n", setup->myname);
|
||||
MP_VERBOSE(af, "%s: this is a stereo effect\n", setup->myname);
|
||||
} else {
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "%s: this is a %i-channel effect, "
|
||||
MP_VERBOSE(af, "%s: this is a %i-channel effect, "
|
||||
"support is experimental\n", setup->myname, setup->ninputs);
|
||||
}
|
||||
|
||||
if (setup->noutputs == 0) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
|
||||
MP_ERR(af, "%s: %s\n", setup->myname,
|
||||
_("This LADSPA plugin has no audio outputs."));
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
||||
if (setup->noutputs != setup->ninputs ) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
|
||||
MP_ERR(af, "%s: %s\n", setup->myname,
|
||||
_("The number of audio inputs and audio outputs of the LADSPA plugin differ."));
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "%s: this plugin has %d input control(s)\n",
|
||||
MP_VERBOSE(af, "%s: this plugin has %d input control(s)\n",
|
||||
setup->myname, setup->ninputcontrols);
|
||||
|
||||
/* Print list of controls and its range of values it accepts */
|
||||
|
@ -248,18 +249,18 @@ static int af_ladspa_parse_plugin(af_ladspa_t *setup) {
|
|||
for (i=0; i<setup->ninputcontrols; i++) {
|
||||
p = setup->inputcontrolsmap[i];
|
||||
hint = pdes->PortRangeHints[p];
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, " --- %d %s [", i, pdes->PortNames[p]);
|
||||
MP_VERBOSE(af, " --- %d %s [", i, pdes->PortNames[p]);
|
||||
|
||||
if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor)) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "%0.2f , ", hint.LowerBound);
|
||||
MP_VERBOSE(af, "%0.2f , ", hint.LowerBound);
|
||||
} else {
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "... , ");
|
||||
MP_VERBOSE(af, "... , ");
|
||||
}
|
||||
|
||||
if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor)) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "%0.2f]\n", hint.UpperBound);
|
||||
MP_VERBOSE(af, "%0.2f]\n", hint.UpperBound);
|
||||
} else {
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "...]\n");
|
||||
MP_VERBOSE(af, "...]\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -305,9 +306,9 @@ static void* mydlopen(const char *filename, int flag) {
|
|||
/* For Windows there's only absolute path support.
|
||||
* If you have a Windows machine, feel free to fix this.
|
||||
* (path separator, shared objects extension, et cetera). */
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "\ton windows, only absolute pathnames "
|
||||
MP_VERBOSE(af, "\ton windows, only absolute pathnames "
|
||||
"are supported\n");
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "\ttrying %s\n", filename);
|
||||
MP_VERBOSE(af, "\ttrying %s\n", filename);
|
||||
return dlopen(filename, flag);
|
||||
#endif
|
||||
|
||||
|
@ -348,7 +349,6 @@ static void* mydlopen(const char *filename, int flag) {
|
|||
}
|
||||
strcpy(buf+needslash+(end-start), filename);
|
||||
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "\ttrying %s\n", buf);
|
||||
result=dlopen(buf, flag);
|
||||
|
||||
free(buf);
|
||||
|
@ -362,7 +362,6 @@ static void* mydlopen(const char *filename, int flag) {
|
|||
} /* end if there's a ladspapath */
|
||||
|
||||
/* last resort, just open it again, so the dlerror() message is correct */
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "\ttrying %s\n", filename);
|
||||
return dlopen(filename,flag);
|
||||
}
|
||||
|
||||
|
@ -383,24 +382,25 @@ static void* mydlopen(const char *filename, int flag) {
|
|||
* \return Either AF_ERROR or AF_OK, depending on the success of the operation.
|
||||
*/
|
||||
|
||||
static int af_ladspa_load_plugin(af_ladspa_t *setup) {
|
||||
static int af_ladspa_load_plugin(struct af_instance *af) {
|
||||
af_ladspa_t *setup = af->priv;
|
||||
const LADSPA_Descriptor *ladspa_descriptor;
|
||||
LADSPA_Descriptor_Function descriptor_function;
|
||||
int i;
|
||||
|
||||
/* load library */
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "%s: loading ladspa plugin library %s\n",
|
||||
MP_VERBOSE(af, "%s: loading ladspa plugin library %s\n",
|
||||
setup->myname, setup->file);
|
||||
|
||||
setup->libhandle = mydlopen(setup->file, RTLD_NOW);
|
||||
|
||||
if (!setup->libhandle) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s %s\n\t%s\n", setup->myname,
|
||||
MP_ERR(af, "%s: %s %s\n\t%s\n", setup->myname,
|
||||
_("failed to load"), setup->file, dlerror() );
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "%s: library found.\n", setup->myname);
|
||||
MP_VERBOSE(af, "%s: library found.\n", setup->myname);
|
||||
|
||||
/* find descriptor function */
|
||||
dlerror();
|
||||
|
@ -408,7 +408,7 @@ static int af_ladspa_load_plugin(af_ladspa_t *setup) {
|
|||
"ladspa_descriptor");
|
||||
|
||||
if (!descriptor_function) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n\t%s\n", setup->myname,
|
||||
MP_ERR(af, "%s: %s\n\t%s\n", setup->myname,
|
||||
_("Couldn't find ladspa_descriptor() function in the specified library file."), dlerror());
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
@ -416,33 +416,33 @@ static int af_ladspa_load_plugin(af_ladspa_t *setup) {
|
|||
/* if label == help, list all labels in library and exit */
|
||||
|
||||
if (strcmp(setup->label, "help") == 0) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_INFO, "%s: %s %s:\n", setup->myname,
|
||||
MP_INFO(af, "%s: %s %s:\n", setup->myname,
|
||||
_("available labels in"), setup->file);
|
||||
for (i=0; ; i++) {
|
||||
ladspa_descriptor = descriptor_function(i);
|
||||
if (ladspa_descriptor == NULL) {
|
||||
return AF_ERROR;
|
||||
}
|
||||
mp_msg(MSGT_AFILTER, MSGL_INFO, " %-16s - %s (%lu)\n",
|
||||
MP_INFO(af, " %-16s - %s (%lu)\n",
|
||||
ladspa_descriptor->Label,
|
||||
ladspa_descriptor->Name,
|
||||
ladspa_descriptor->UniqueID);
|
||||
}
|
||||
}
|
||||
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "%s: looking for label\n", setup->myname);
|
||||
MP_VERBOSE(af, "%s: looking for label\n", setup->myname);
|
||||
|
||||
/* find label in library */
|
||||
for (i=0; ; i++) {
|
||||
ladspa_descriptor = descriptor_function(i);
|
||||
if (ladspa_descriptor == NULL) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
|
||||
MP_ERR(af, "%s: %s\n", setup->myname,
|
||||
_("Couldn't find label in plugin library."));
|
||||
return AF_ERROR;
|
||||
}
|
||||
if (strcmp(ladspa_descriptor->Label, setup->label) == 0) {
|
||||
setup->plugin_descriptor = ladspa_descriptor;
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "%s: %s found\n", setup->myname,
|
||||
MP_VERBOSE(af, "%s: %s found\n", setup->myname,
|
||||
setup->label);
|
||||
return AF_OK;
|
||||
}
|
||||
|
@ -463,7 +463,6 @@ static int af_ladspa_load_plugin(af_ladspa_t *setup) {
|
|||
*/
|
||||
|
||||
static int af_ladspa_malloc_failed(char *myname) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s", myname, "Memory allocation failed.\n");
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
||||
|
@ -489,7 +488,7 @@ static int control(struct af_instance *af, int cmd, void *arg) {
|
|||
|
||||
switch(cmd) {
|
||||
case AF_CONTROL_REINIT:
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "%s: (re)init\n", setup->myname);
|
||||
MP_VERBOSE(af, "%s: (re)init\n", setup->myname);
|
||||
|
||||
if (!arg) return AF_ERROR;
|
||||
|
||||
|
@ -520,7 +519,7 @@ static void uninit(struct af_instance *af) {
|
|||
const LADSPA_Descriptor *pdes = setup->plugin_descriptor;
|
||||
|
||||
if (setup->myname) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "%s: cleaning up\n", setup->myname);
|
||||
MP_VERBOSE(af, "%s: cleaning up\n", setup->myname);
|
||||
free(setup->myname);
|
||||
}
|
||||
|
||||
|
@ -589,7 +588,7 @@ static int filter(struct af_instance *af, struct mp_audio *data, int flags) {
|
|||
*/
|
||||
|
||||
if (setup->nch != 0) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_DBG3, "%s: bufsize change; free old buffer\n",
|
||||
MP_TRACE(af, "%s: bufsize change; free old buffer\n",
|
||||
setup->myname);
|
||||
|
||||
if(setup->inbufs) {
|
||||
|
@ -610,7 +609,7 @@ static int filter(struct af_instance *af, struct mp_audio *data, int flags) {
|
|||
setup->inbufs = calloc(nch, sizeof(float*));
|
||||
setup->outbufs = calloc(nch, sizeof(float*));
|
||||
|
||||
mp_msg(MSGT_AFILTER, MSGL_DBG3, "%s: bufsize = %d\n",
|
||||
MP_TRACE(af, "%s: bufsize = %d\n",
|
||||
setup->myname, setup->bufsize);
|
||||
|
||||
for(i=0; i<nch; i++) {
|
||||
|
@ -752,13 +751,13 @@ static int af_open(struct af_instance *af) {
|
|||
return af_ladspa_malloc_failed((char*)af_info_ladspa.name);
|
||||
|
||||
if (!setup->file || !setup->file[0]) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
|
||||
MP_ERR(af, "%s: %s\n", setup->myname,
|
||||
_("No library file specified."));
|
||||
uninit(af);
|
||||
return AF_ERROR;
|
||||
}
|
||||
if (!setup->label || !setup->label[0]) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
|
||||
MP_ERR(af, "%s: %s\n", setup->myname,
|
||||
_("No filter label specified."));
|
||||
uninit(af);
|
||||
return AF_ERROR;
|
||||
|
@ -773,11 +772,11 @@ static int af_open(struct af_instance *af) {
|
|||
|
||||
/* load plugin :) */
|
||||
|
||||
if ( af_ladspa_load_plugin(setup) != AF_OK )
|
||||
if ( af_ladspa_load_plugin(af) != AF_OK )
|
||||
return AF_ERROR;
|
||||
|
||||
/* see what inputs, outputs and controls this plugin has */
|
||||
if ( af_ladspa_parse_plugin(setup) != AF_OK )
|
||||
if ( af_ladspa_parse_plugin(af) != AF_OK )
|
||||
return AF_ERROR;
|
||||
|
||||
/* ninputcontrols is set by now, read control values from arg */
|
||||
|
@ -786,14 +785,14 @@ static int af_open(struct af_instance *af) {
|
|||
char *line = setup->controls;
|
||||
for (int i = 0; i < setup->ninputcontrols; i++) {
|
||||
if (!line || (i != 0 && *line != ',')) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
|
||||
MP_ERR(af, "%s: %s\n", setup->myname,
|
||||
_("Not enough controls specified on the command line."));
|
||||
return AF_ERROR;
|
||||
}
|
||||
if (i != 0)
|
||||
line++;
|
||||
if (sscanf(line, "%f", &val) != 1) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
|
||||
MP_ERR(af, "%s: %s\n", setup->myname,
|
||||
_("Not enough controls specified on the command line."));
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
@ -801,16 +800,16 @@ static int af_open(struct af_instance *af) {
|
|||
line = strchr(line, ',');
|
||||
}
|
||||
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "%s: input controls: ", setup->myname);
|
||||
MP_VERBOSE(af, "%s: input controls: ", setup->myname);
|
||||
for (int i = 0; i < setup->ninputcontrols; i++) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "%0.4f ",
|
||||
MP_VERBOSE(af, "%0.4f ",
|
||||
setup->inputcontrols[setup->inputcontrolsmap[i]]);
|
||||
}
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "\n");
|
||||
MP_VERBOSE(af, "\n");
|
||||
|
||||
/* check boundaries of inputcontrols */
|
||||
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "%s: checking boundaries of input controls\n",
|
||||
MP_VERBOSE(af, "%s: checking boundaries of input controls\n",
|
||||
setup->myname);
|
||||
for (int i = 0; i < setup->ninputcontrols; i++) {
|
||||
int p = setup->inputcontrolsmap[i];
|
||||
|
@ -820,18 +819,18 @@ static int af_open(struct af_instance *af) {
|
|||
|
||||
if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor) &&
|
||||
val < hint.LowerBound) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: Input control #%d is below lower boundary of %0.4f.\n",
|
||||
MP_ERR(af, "%s: Input control #%d is below lower boundary of %0.4f.\n",
|
||||
setup->myname, i, hint.LowerBound);
|
||||
return AF_ERROR;
|
||||
}
|
||||
if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor) &&
|
||||
val > hint.UpperBound) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: Input control #%d is above upper boundary of %0.4f.\n",
|
||||
MP_ERR(af, "%s: Input control #%d is above upper boundary of %0.4f.\n",
|
||||
setup->myname, i, hint.UpperBound);
|
||||
return AF_ERROR;
|
||||
}
|
||||
}
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "%s: all controls have sane values\n",
|
||||
MP_VERBOSE(af, "%s: all controls have sane values\n",
|
||||
setup->myname);
|
||||
|
||||
/* All is well! */
|
||||
|
|
|
@ -103,7 +103,7 @@ static int control(struct af_instance *af, int cmd, void *arg)
|
|||
|
||||
mp_audio_buffer_reinit(s->pending, in);
|
||||
|
||||
mp_msg(MSGT_AFILTER, MSGL_DBG2, "af_lavcac3enc reinit: %d, %d, %f, %d.\n",
|
||||
MP_DBG(af, "af_lavcac3enc reinit: %d, %d, %f, %d.\n",
|
||||
in->nch, in->rate, af->mul, s->in_samples);
|
||||
|
||||
int bit_rate = s->bit_rate ? s->bit_rate : default_bit_rate[in->nch];
|
||||
|
@ -121,12 +121,12 @@ static int control(struct af_instance *af, int cmd, void *arg)
|
|||
s->lavc_actx->bit_rate = bit_rate;
|
||||
|
||||
if (avcodec_open2(s->lavc_actx, s->lavc_acodec, NULL) < 0) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "Couldn't open codec %s, br=%d.\n", "ac3", bit_rate);
|
||||
MP_ERR(af, "Couldn't open codec %s, br=%d.\n", "ac3", bit_rate);
|
||||
return AF_ERROR;
|
||||
}
|
||||
}
|
||||
if (s->lavc_actx->frame_size != AC3_FRAME_SIZE) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "lavcac3enc: unexpected ac3 "
|
||||
MP_ERR(af, "lavcac3enc: unexpected ac3 "
|
||||
"encoder frame size %d\n", s->lavc_actx->frame_size);
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ static int filter(struct af_instance* af, struct mp_audio* audio, int flags)
|
|||
|
||||
AVFrame *frame = avcodec_alloc_frame();
|
||||
if (!frame) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_FATAL, "[libaf] Could not allocate memory \n");
|
||||
MP_FATAL(af, "[libaf] Could not allocate memory \n");
|
||||
return -1;
|
||||
}
|
||||
frame->nb_samples = s->in_samples;
|
||||
|
@ -201,7 +201,7 @@ static int filter(struct af_instance* af, struct mp_audio* audio, int flags)
|
|||
int ok;
|
||||
ret = avcodec_encode_audio2(s->lavc_actx, &s->pkt, frame, &ok);
|
||||
if (ret < 0 || !ok) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_FATAL, "[lavac3enc] Encode failed.\n");
|
||||
MP_FATAL(af, "[lavac3enc] Encode failed.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ static int filter(struct af_instance* af, struct mp_audio* audio, int flags)
|
|||
|
||||
mp_audio_buffer_skip(s->pending, consumed_pending);
|
||||
|
||||
mp_msg(MSGT_AFILTER, MSGL_DBG2, "avcodec_encode_audio got %d, pending %d.\n",
|
||||
MP_DBG(af, "avcodec_encode_audio got %d, pending %d.\n",
|
||||
s->pkt.size, mp_audio_buffer_samples(s->pending));
|
||||
|
||||
int frame_size = s->pkt.size;
|
||||
|
@ -257,13 +257,13 @@ static int af_open(struct af_instance* af){
|
|||
|
||||
s->lavc_acodec = avcodec_find_encoder_by_name("ac3");
|
||||
if (!s->lavc_acodec) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "Audio LAVC, couldn't find encoder for codec %s.\n", "ac3");
|
||||
MP_ERR(af, "Audio LAVC, couldn't find encoder for codec %s.\n", "ac3");
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
||||
s->lavc_actx = avcodec_alloc_context3(s->lavc_acodec);
|
||||
if (!s->lavc_actx) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "Audio LAVC, couldn't allocate context!\n");
|
||||
MP_ERR(af, "Audio LAVC, couldn't allocate context!\n");
|
||||
return AF_ERROR;
|
||||
}
|
||||
const enum AVSampleFormat *fmts = s->lavc_acodec->sample_fmts;
|
||||
|
@ -275,11 +275,11 @@ static int af_open(struct af_instance* af){
|
|||
}
|
||||
}
|
||||
if (!s->in_sampleformat) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "Audio LAVC, encoder doesn't "
|
||||
MP_ERR(af, "Audio LAVC, encoder doesn't "
|
||||
"support expected sample formats!\n");
|
||||
return AF_ERROR;
|
||||
}
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "[af_lavcac3enc]: in sample format: %s\n",
|
||||
MP_VERBOSE(af, "[af_lavcac3enc]: in sample format: %s\n",
|
||||
af_fmt_to_str(s->in_sampleformat));
|
||||
|
||||
av_init_packet(&s->pkt);
|
||||
|
@ -293,7 +293,7 @@ static int af_open(struct af_instance* af){
|
|||
break;
|
||||
}
|
||||
if (i >= 19) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_WARN, "af_lavcac3enc unable set unsupported "
|
||||
MP_WARN(af, "af_lavcac3enc unable set unsupported "
|
||||
"bitrate %d, use default bitrate (check manpage to see "
|
||||
"supported bitrates).\n", s->cfg_bit_rate);
|
||||
s->cfg_bit_rate = 0;
|
||||
|
|
|
@ -82,19 +82,19 @@ static bool recreate_graph(struct af_instance *af, struct mp_audio *config)
|
|||
int r;
|
||||
|
||||
if (bstr0(p->cfg_graph).len == 0) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_FATAL, "lavfi: no filter graph set\n");
|
||||
MP_FATAL(af, "lavfi: no filter graph set\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
destroy_graph(af);
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "lavfi: create graph: '%s'\n", p->cfg_graph);
|
||||
MP_VERBOSE(af, "lavfi: create graph: '%s'\n", p->cfg_graph);
|
||||
|
||||
AVFilterGraph *graph = avfilter_graph_alloc();
|
||||
if (!graph)
|
||||
goto error;
|
||||
|
||||
if (parse_avopts(graph, p->cfg_avopts) < 0) {
|
||||
mp_msg(MSGT_VFILTER, MSGL_FATAL, "lavfi: could not set opts: '%s'\n",
|
||||
MP_FATAL(af, "lavfi: could not set opts: '%s'\n",
|
||||
p->cfg_avopts);
|
||||
goto error;
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ static bool recreate_graph(struct af_instance *af, struct mp_audio *config)
|
|||
return true;
|
||||
|
||||
error:
|
||||
mp_msg(MSGT_AFILTER, MSGL_FATAL, "Can't configure libavfilter graph.\n");
|
||||
MP_FATAL(af, "Can't configure libavfilter graph.\n");
|
||||
avfilter_graph_free(&graph);
|
||||
talloc_free(tmp);
|
||||
return false;
|
||||
|
|
|
@ -168,8 +168,7 @@ static int configure_lavrr(struct af_instance *af, struct mp_audio *in,
|
|||
av_opt_set_double(s->avrctx, "cutoff", s->ctx.cutoff, 0);
|
||||
|
||||
if (parse_avopts(s->avrctx, s->avopts) < 0) {
|
||||
mp_msg(MSGT_VFILTER, MSGL_FATAL,
|
||||
"af_lavrresample: could not set opts: '%s'\n", s->avopts);
|
||||
MP_FATAL(af, "af_lavrresample: could not set opts: '%s'\n", s->avopts);
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
||||
|
@ -222,7 +221,7 @@ static int configure_lavrr(struct af_instance *af, struct mp_audio *in,
|
|||
if (avresample_open(s->avrctx) < 0 ||
|
||||
avresample_open(s->avrctx_out) < 0)
|
||||
{
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "[lavrresample] Cannot open "
|
||||
MP_ERR(af, "[lavrresample] Cannot open "
|
||||
"Libavresample Context. \n");
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
@ -398,7 +397,7 @@ static int af_open(struct af_instance *af)
|
|||
if (s->avrctx && s->avrctx_out) {
|
||||
return AF_OK;
|
||||
} else {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "[lavrresample] Cannot initialize "
|
||||
MP_ERR(af, "[lavrresample] Cannot initialize "
|
||||
"Libavresample Context. \n");
|
||||
uninit(af);
|
||||
return AF_ERROR;
|
||||
|
|
|
@ -80,7 +80,7 @@ static int control(struct af_instance* af, int cmd, void* arg)
|
|||
|
||||
// Sanity check
|
||||
if(((int*)arg)[0] <= 0 || ((int*)arg)[0] > AF_NCH){
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "[pan] The number of output channels must be"
|
||||
MP_ERR(af, "[pan] The number of output channels must be"
|
||||
" between 1 and %i. Current value is %i\n",AF_NCH,((int*)arg)[0]);
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ static int af_open(struct af_instance* af){
|
|||
j = 0; k = 0;
|
||||
while(k < AF_NCH){
|
||||
sscanf(cp, "%f%n" , &s->level[j][k], &n);
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "[pan] Pan level from channel %i to"
|
||||
MP_VERBOSE(af, "[pan] Pan level from channel %i to"
|
||||
" channel %i = %f\n",k,j,s->level[j][k]);
|
||||
cp =&cp[n];
|
||||
j++;
|
||||
|
|
|
@ -275,8 +275,7 @@ static int control(struct af_instance *af, int cmd, void *arg)
|
|||
int nch = data->nch;
|
||||
int use_int = 0;
|
||||
|
||||
mp_msg(MSGT_AFILTER, MSGL_V,
|
||||
"[scaletempo] %.3f speed * %.3f scale_nominal = %.3f\n",
|
||||
MP_VERBOSE(af, "[scaletempo] %.3f speed * %.3f scale_nominal = %.3f\n",
|
||||
s->speed, s->scale_nominal, s->scale);
|
||||
|
||||
mp_audio_force_interleaved_format(data);
|
||||
|
@ -318,7 +317,7 @@ static int control(struct af_instance *af, int cmd, void *arg)
|
|||
s->buf_overlap = realloc(s->buf_overlap, s->bytes_overlap);
|
||||
s->table_blend = realloc(s->table_blend, s->bytes_overlap * 4);
|
||||
if (!s->buf_overlap || !s->table_blend) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_FATAL, "[scaletempo] Out of memory\n");
|
||||
MP_FATAL(af, "[scaletempo] Out of memory\n");
|
||||
return AF_ERROR;
|
||||
}
|
||||
memset(s->buf_overlap, 0, s->bytes_overlap);
|
||||
|
@ -355,7 +354,7 @@ static int control(struct af_instance *af, int cmd, void *arg)
|
|||
s->table_window = realloc(s->table_window,
|
||||
s->bytes_overlap * 2 - nch * bps * 2);
|
||||
if (!s->buf_pre_corr || !s->table_window) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_FATAL, "[scaletempo] Out of memory\n");
|
||||
MP_FATAL(af, "[scaletempo] Out of memory\n");
|
||||
return AF_ERROR;
|
||||
}
|
||||
memset((char *)s->buf_pre_corr + s->bytes_overlap * 2, 0,
|
||||
|
@ -372,8 +371,7 @@ static int control(struct af_instance *af, int cmd, void *arg)
|
|||
s->table_window = realloc(s->table_window,
|
||||
s->bytes_overlap - nch * bps);
|
||||
if (!s->buf_pre_corr || !s->table_window) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_FATAL,
|
||||
"[scaletempo] Out of memory\n");
|
||||
MP_FATAL(af, "[scaletempo] Out of memory\n");
|
||||
return AF_ERROR;
|
||||
}
|
||||
float *pw = s->table_window;
|
||||
|
@ -393,14 +391,14 @@ static int control(struct af_instance *af, int cmd, void *arg)
|
|||
* bps * nch;
|
||||
s->buf_queue = realloc(s->buf_queue, s->bytes_queue + UNROLL_PADDING);
|
||||
if (!s->buf_queue) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_FATAL, "[scaletempo] Out of memory\n");
|
||||
MP_FATAL(af, "[scaletempo] Out of memory\n");
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
||||
s->bytes_queued = 0;
|
||||
s->bytes_to_slide = 0;
|
||||
|
||||
mp_msg(MSGT_AFILTER, MSGL_DBG2, "[scaletempo] "
|
||||
MP_DBG(af, "[scaletempo] "
|
||||
"%.2f stride_in, %i stride_out, %i standing, "
|
||||
"%i overlap, %i search, %i queue, %s mode\n",
|
||||
s->frames_stride_scaled,
|
||||
|
|
|
@ -99,7 +99,7 @@ static int play_s16(struct af_instance* af, struct mp_audio* data, int f)
|
|||
s->pos += 2 * M_PI * s->freq / data->rate;
|
||||
}
|
||||
|
||||
mp_msg(MSGT_AFILTER, MSGL_V, "[sinesuppress] f:%8.2f: amp:%8.2f\n", s->freq, sqrt(s->real*s->real + s->imag*s->imag) / s->ref);
|
||||
MP_VERBOSE(af, "[sinesuppress] f:%8.2f: amp:%8.2f\n", s->freq, sqrt(s->real*s->real + s->imag*s->imag) / s->ref);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ static int control(struct af_instance* af, int cmd, void* arg)
|
|||
struct mp_audio *in = arg;
|
||||
float fc;
|
||||
if (!mp_chmap_is_stereo(&in->channels)) {
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "[surround] Only stereo input is supported.\n");
|
||||
MP_ERR(af, "[surround] Only stereo input is supported.\n");
|
||||
return AF_DETACH;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ static int control(struct af_instance* af, int cmd, void* arg)
|
|||
// Surround filer coefficients
|
||||
fc = 2.0 * 7000.0/(float)af->data->rate;
|
||||
if (-1 == af_filter_design_fir(L, s->w, &fc, LP|HAMMING, 0)){
|
||||
mp_msg(MSGT_AFILTER, MSGL_ERR, "[surround] Unable to design low-pass filter.\n");
|
||||
MP_ERR(af, "[surround] Unable to design low-pass filter.\n");
|
||||
return AF_ERROR;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ static int control(struct af_instance* af, int cmd, void* arg)
|
|||
s->dl = calloc(LD,af->data->bps);
|
||||
s->dr = calloc(LD,af->data->bps);
|
||||
if((NULL == s->dl) || (NULL == s->dr))
|
||||
mp_msg(MSGT_AFILTER, MSGL_FATAL, "[delay] Out of memory\n");
|
||||
MP_FATAL(af, "[delay] Out of memory\n");
|
||||
|
||||
// Initialize delay queue index
|
||||
if(AF_OK != af_from_ms(1, &s->d, &s->wi, af->data->rate, 0.0, 1000.0))
|
||||
|
|
|
@ -114,6 +114,8 @@ void reinit_audio_chain(struct MPContext *mpctx)
|
|||
mpctx->initialized_flags |= INITIALIZED_ACODEC;
|
||||
assert(!mpctx->d_audio);
|
||||
mpctx->d_audio = talloc_zero(NULL, struct dec_audio);
|
||||
mpctx->d_audio->log = mp_log_new(mpctx->d_audio, mpctx->log, "!ad");
|
||||
mpctx->d_audio->global = mpctx->global;
|
||||
mpctx->d_audio->opts = opts;
|
||||
mpctx->d_audio->header = sh;
|
||||
if (!audio_init_best_codec(mpctx->d_audio, opts->audio_decoders))
|
||||
|
|
Loading…
Reference in New Issue