summaryrefslogtreecommitdiffstats
path: root/libaf
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2012-01-18 04:21:58 +0100
committerwm4 <wm4@mplayer2.org>2012-01-18 04:21:58 +0100
commit6e41497d5be1f107c18b2143fa45b3c46d6e95d3 (patch)
treeba18bcab5e209d3c48658bac046fa48a9c5f053a /libaf
parent064f8c2fb656462db9662c67bdbc6716958a4de4 (diff)
parentf7c2ecebccc4b3c5d6299aee5b8f4d382fa78987 (diff)
downloadmpv-6e41497d5be1f107c18b2143fa45b3c46d6e95d3.tar.bz2
mpv-6e41497d5be1f107c18b2143fa45b3c46d6e95d3.tar.xz
Merge branch 'softvol' into my_master
Diffstat (limited to 'libaf')
-rw-r--r--libaf/af.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/libaf/af.c b/libaf/af.c
index 80f9871bfb..e4015727ac 100644
--- a/libaf/af.c
+++ b/libaf/af.c
@@ -246,6 +246,43 @@ void af_remove(af_stream_t* s, af_instance_t* af)
free(af);
}
+static void print_fmt(af_data_t *d)
+{
+ if (d) {
+ mp_msg(MSGT_AFILTER, MSGL_V, "%dHz/%dch/%s", d->rate, d->nch,
+ af_fmt2str_short(d->format));
+ } else {
+ mp_msg(MSGT_AFILTER, MSGL_V, "(?)");
+ }
+}
+
+static void af_print_filter_chain(af_stream_t* s)
+{
+ mp_msg(MSGT_AFILTER, MSGL_V, "Audio filter chain:\n");
+
+ mp_msg(MSGT_AFILTER, MSGL_V, " [in] ");
+ print_fmt(&s->input);
+ mp_msg(MSGT_AFILTER, MSGL_V, "\n");
+
+ af_instance_t *af = s->first;
+ while (af) {
+ mp_msg(MSGT_AFILTER, MSGL_V, " [%s] ", af->info->name);
+ print_fmt(af->data);
+ mp_msg(MSGT_AFILTER, MSGL_V, "\n");
+
+ af = af->next;
+ }
+
+ mp_msg(MSGT_AFILTER, MSGL_V, " [out] ");
+ print_fmt(&s->output);
+ mp_msg(MSGT_AFILTER, MSGL_V, "\n");
+}
+
+// Warning:
+// A failed af_reinit() leaves the audio chain behind in a useless, broken
+// state (for example, format filters that were tentatively inserted stay
+// inserted).
+// In that case, you should always rebuild the filter chain, or abort.
int af_reinit(af_stream_t* s, af_instance_t* af)
{
do{
@@ -343,6 +380,9 @@ int af_reinit(af_stream_t* s, af_instance_t* af)
return AF_ERROR;
}
}while(af);
+
+ af_print_filter_chain(s);
+
return AF_OK;
}
@@ -552,7 +592,9 @@ af_instance_t* af_add(af_stream_t* s, char* name){
// Reinitalize the filter list
if(AF_OK != af_reinit(s, s->first) ||
AF_OK != fixup_output_format(s)){
- free(new);
+ while (s->first)
+ af_remove(s, s->first);
+ af_init(s);
return NULL;
}
return new;