summaryrefslogtreecommitdiffstats
path: root/libaf/af.c
diff options
context:
space:
mode:
authoranders <anders@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-10-16 01:49:40 +0000
committeranders <anders@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-10-16 01:49:40 +0000
commit4d6e54d22d40d50f50d2095773f24b5c5913d9b9 (patch)
treedd9b825c6b794f80d96a946ce9264ecaed3c12c3 /libaf/af.c
parentdd84f32ef0620de9570953c22791a0da7ff179ea (diff)
downloadmpv-4d6e54d22d40d50f50d2095773f24b5c5913d9b9.tar.bz2
mpv-4d6e54d22d40d50f50d2095773f24b5c5913d9b9.tar.xz
Adding volume control and moving control() call parameters to a seperate file
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7746 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libaf/af.c')
-rw-r--r--libaf/af.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/libaf/af.c b/libaf/af.c
index 14b06624cd..fae93452a1 100644
--- a/libaf/af.c
+++ b/libaf/af.c
@@ -80,9 +80,10 @@ af_instance_t* af_create(af_stream_t* s, char* name)
}
// Initialize the new filter
- if(AF_OK==new->info->open(new))
+ if(AF_OK == new->info->open(new) &&
+ AF_ERROR < new->control(new,AF_CONTROL_POST_CREATE,&s->cfg))
return new;
-
+
free(new);
mp_msg(MSGT_AFILTER,MSGL_ERR,"Couldn't create audio filter '%s'\n",name);
return NULL;
@@ -141,6 +142,9 @@ void af_remove(af_stream_t* s, af_instance_t* af)
{
if(!af) return;
+ // Notify filter before changing anything
+ af->control(af,AF_CONTROL_PRE_DESTROY,0);
+
// Detach pointers
if(af->prev)
af->prev->next=af->next;
@@ -255,7 +259,6 @@ void af_uninit(af_stream_t* s)
-1 if failure */
int af_init(af_stream_t* s)
{
- int cfg=SLOW; // configuration type
int i=0;
// Sanity check
@@ -266,13 +269,11 @@ int af_init(af_stream_t* s)
s->input.len = s->output.len = 0;
// Figure out how fast the machine is
- if(s->cfg.force)
- cfg=s->cfg.force;
- else{
+ if(AF_INIT_AUTO == (AF_INIT_TYPE_MASK & s->cfg.force)){
# if defined(HAVE_SSE) || defined(HAVE_3DNOWEX)
- cfg=FAST;
+ s->cfg.force = (s->cfg.force & ~AF_INIT_TYPE_MASK) | AF_INIT_FAST;
# else
- cfg=SLOW;
+ s->cfg.force = (s->cfg.force & ~AF_INIT_TYPE_MASK) | AF_INIT_SLOW;
# endif
}
@@ -296,12 +297,12 @@ int af_init(af_stream_t* s)
return -1;
// Check output format
- if(cfg!=FORCE){
+ if((AF_INIT_TYPE_MASK & s->cfg.force) != AF_INIT_FORCE){
af_instance_t* af = NULL; // New filter
// Check output frequency if not OK fix with resample
if(s->last->data->rate!=s->output.rate){
if(NULL==(af=af_get(s,"resample"))){
- if(cfg==SLOW){
+ if((AF_INIT_TYPE_MASK & s->cfg.force) == AF_INIT_SLOW){
if(!strcmp(s->first->info->name,"format"))
af = af_append(s,s->first,"resample");
else