Mercurial > mplayer.hg
comparison libaf/af.c @ 25302:701de923a20d
Fix missing command line bug by making the input parameter constant.
author | ulion |
---|---|
date | Mon, 10 Dec 2007 01:43:33 +0000 |
parents | 5a0da5dcadd3 |
children | 192b1d7dcfb0 |
comparison
equal
deleted
inserted
replaced
25301:456207bc0bd2 | 25302:701de923a20d |
---|---|
100 return NULL; | 100 return NULL; |
101 } | 101 } |
102 | 102 |
103 /*/ Function for creating a new filter of type name. The name may | 103 /*/ Function for creating a new filter of type name. The name may |
104 contain the commandline parameters for the filter */ | 104 contain the commandline parameters for the filter */ |
105 static af_instance_t* af_create(af_stream_t* s, char* name) | 105 static af_instance_t* af_create(af_stream_t* s, const char* name_with_cmd) |
106 { | 106 { |
107 char* name = strdup(name_with_cmd); | |
107 char* cmdline = name; | 108 char* cmdline = name; |
108 | 109 |
109 // Allocate space for the new filter and reset all pointers | 110 // Allocate space for the new filter and reset all pointers |
110 af_instance_t* new=malloc(sizeof(af_instance_t)); | 111 af_instance_t* new=malloc(sizeof(af_instance_t)); |
111 if(!new){ | 112 if (!name || !new) { |
112 af_msg(AF_MSG_ERROR,"[libaf] Could not allocate memory\n"); | 113 af_msg(AF_MSG_ERROR,"[libaf] Could not allocate memory\n"); |
113 goto err_out; | 114 goto err_out; |
114 } | 115 } |
115 memset(new,0,sizeof(af_instance_t)); | 116 memset(new,0,sizeof(af_instance_t)); |
116 | 117 |
135 | 136 |
136 // Initialize the new filter | 137 // Initialize the new filter |
137 if(AF_OK == new->info->open(new) && | 138 if(AF_OK == new->info->open(new) && |
138 AF_ERROR < new->control(new,AF_CONTROL_POST_CREATE,&s->cfg)){ | 139 AF_ERROR < new->control(new,AF_CONTROL_POST_CREATE,&s->cfg)){ |
139 if(cmdline){ | 140 if(cmdline){ |
140 if(AF_ERROR<new->control(new,AF_CONTROL_COMMAND_LINE,cmdline)) | 141 if(!AF_ERROR<new->control(new,AF_CONTROL_COMMAND_LINE,cmdline)) |
141 return new; | 142 goto err_out; |
142 } | 143 } |
143 else | 144 free(name); |
144 return new; | 145 return new; |
145 } | 146 } |
146 | 147 |
147 err_out: | 148 err_out: |
148 free(new); | 149 free(new); |
149 af_msg(AF_MSG_ERROR,"[libaf] Couldn't create or open audio filter '%s'\n", | 150 af_msg(AF_MSG_ERROR,"[libaf] Couldn't create or open audio filter '%s'\n", |
150 name); | 151 name); |
152 free(name); | |
151 return NULL; | 153 return NULL; |
152 } | 154 } |
153 | 155 |
154 /* Create and insert a new filter of type name before the filter in the | 156 /* Create and insert a new filter of type name before the filter in the |
155 argument. This function can be called during runtime, the return | 157 argument. This function can be called during runtime, the return |