00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "libavutil/pixdesc.h"
00025 #include "libavutil/rational.h"
00026 #include "libavutil/audioconvert.h"
00027 #include "libavutil/imgutils.h"
00028 #include "avfilter.h"
00029 #include "internal.h"
00030
00031 unsigned avfilter_version(void) {
00032 return LIBAVFILTER_VERSION_INT;
00033 }
00034
00035 const char *avfilter_configuration(void)
00036 {
00037 return FFMPEG_CONFIGURATION;
00038 }
00039
00040 const char *avfilter_license(void)
00041 {
00042 #define LICENSE_PREFIX "libavfilter license: "
00043 return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
00044 }
00045
00046 AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
00047 {
00048 AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef));
00049 if (!ret)
00050 return NULL;
00051 *ret = *ref;
00052 if (ref->type == AVMEDIA_TYPE_VIDEO) {
00053 ret->video = av_malloc(sizeof(AVFilterBufferRefVideoProps));
00054 if (!ret->video) {
00055 av_free(ret);
00056 return NULL;
00057 }
00058 *ret->video = *ref->video;
00059 } else if (ref->type == AVMEDIA_TYPE_AUDIO) {
00060 ret->audio = av_malloc(sizeof(AVFilterBufferRefAudioProps));
00061 if (!ret->audio) {
00062 av_free(ret);
00063 return NULL;
00064 }
00065 *ret->audio = *ref->audio;
00066 }
00067 ret->perms &= pmask;
00068 ret->buf->refcount ++;
00069 return ret;
00070 }
00071
00072 void avfilter_unref_buffer(AVFilterBufferRef *ref)
00073 {
00074 if (!ref)
00075 return;
00076 if (!(--ref->buf->refcount))
00077 ref->buf->free(ref->buf);
00078 av_free(ref->video);
00079 av_free(ref->audio);
00080 av_free(ref);
00081 }
00082
00083 void avfilter_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,
00084 AVFilterPad **pads, AVFilterLink ***links,
00085 AVFilterPad *newpad)
00086 {
00087 unsigned i;
00088
00089 idx = FFMIN(idx, *count);
00090
00091 *pads = av_realloc(*pads, sizeof(AVFilterPad) * (*count + 1));
00092 *links = av_realloc(*links, sizeof(AVFilterLink*) * (*count + 1));
00093 memmove(*pads +idx+1, *pads +idx, sizeof(AVFilterPad) * (*count-idx));
00094 memmove(*links+idx+1, *links+idx, sizeof(AVFilterLink*) * (*count-idx));
00095 memcpy(*pads+idx, newpad, sizeof(AVFilterPad));
00096 (*links)[idx] = NULL;
00097
00098 (*count)++;
00099 for (i = idx+1; i < *count; i++)
00100 if (*links[i])
00101 (*(unsigned *)((uint8_t *) *links[i] + padidx_off))++;
00102 }
00103
00104 int avfilter_link(AVFilterContext *src, unsigned srcpad,
00105 AVFilterContext *dst, unsigned dstpad)
00106 {
00107 AVFilterLink *link;
00108
00109 if (src->output_count <= srcpad || dst->input_count <= dstpad ||
00110 src->outputs[srcpad] || dst->inputs[dstpad])
00111 return -1;
00112
00113 if (src->output_pads[srcpad].type != dst->input_pads[dstpad].type) {
00114 av_log(src, AV_LOG_ERROR,
00115 "Media type mismatch between the '%s' filter output pad %d and the '%s' filter input pad %d\n",
00116 src->name, srcpad, dst->name, dstpad);
00117 return AVERROR(EINVAL);
00118 }
00119
00120 src->outputs[srcpad] =
00121 dst-> inputs[dstpad] = link = av_mallocz(sizeof(AVFilterLink));
00122
00123 link->src = src;
00124 link->dst = dst;
00125 link->srcpad = &src->output_pads[srcpad];
00126 link->dstpad = &dst->input_pads[dstpad];
00127 link->type = src->output_pads[srcpad].type;
00128 assert(PIX_FMT_NONE == -1 && AV_SAMPLE_FMT_NONE == -1);
00129 link->format = -1;
00130
00131 return 0;
00132 }
00133
00134 int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt,
00135 unsigned filt_srcpad_idx, unsigned filt_dstpad_idx)
00136 {
00137 int ret;
00138 unsigned dstpad_idx = link->dstpad - link->dst->input_pads;
00139
00140 av_log(link->dst, AV_LOG_INFO, "auto-inserting filter '%s' "
00141 "between the filter '%s' and the filter '%s'\n",
00142 filt->name, link->src->name, link->dst->name);
00143
00144 link->dst->inputs[dstpad_idx] = NULL;
00145 if ((ret = avfilter_link(filt, filt_dstpad_idx, link->dst, dstpad_idx)) < 0) {
00146
00147 link->dst->inputs[dstpad_idx] = link;
00148 return ret;
00149 }
00150
00151
00152 link->dst = filt;
00153 link->dstpad = &filt->input_pads[filt_srcpad_idx];
00154 filt->inputs[filt_srcpad_idx] = link;
00155
00156
00157
00158 if (link->out_formats)
00159 avfilter_formats_changeref(&link->out_formats,
00160 &filt->outputs[filt_dstpad_idx]->out_formats);
00161
00162 return 0;
00163 }
00164
00165 int avfilter_config_links(AVFilterContext *filter)
00166 {
00167 int (*config_link)(AVFilterLink *);
00168 unsigned i;
00169 int ret;
00170
00171 for (i = 0; i < filter->input_count; i ++) {
00172 AVFilterLink *link = filter->inputs[i];
00173
00174 if (!link) continue;
00175
00176 switch (link->init_state) {
00177 case AVLINK_INIT:
00178 continue;
00179 case AVLINK_STARTINIT:
00180 av_log(filter, AV_LOG_INFO, "circular filter chain detected\n");
00181 return 0;
00182 case AVLINK_UNINIT:
00183 link->init_state = AVLINK_STARTINIT;
00184
00185 if ((ret = avfilter_config_links(link->src)) < 0)
00186 return ret;
00187
00188 if (!(config_link = link->srcpad->config_props))
00189 config_link = avfilter_default_config_output_link;
00190 if ((ret = config_link(link)) < 0)
00191 return ret;
00192
00193 if (link->time_base.num == 0 && link->time_base.den == 0)
00194 link->time_base = link->src && link->src->input_count ?
00195 link->src->inputs[0]->time_base : AV_TIME_BASE_Q;
00196
00197 if (link->sample_aspect_ratio.num == 0 && link->sample_aspect_ratio.den == 0)
00198 link->sample_aspect_ratio = link->src->input_count ?
00199 link->src->inputs[0]->sample_aspect_ratio : (AVRational){1,1};
00200
00201 if (link->sample_rate == 0 && link->src && link->src->input_count)
00202 link->sample_rate = link->src->inputs[0]->sample_rate;
00203
00204 if (link->channel_layout == 0 && link->src && link->src->input_count)
00205 link->channel_layout = link->src->inputs[0]->channel_layout;
00206
00207 if ((config_link = link->dstpad->config_props))
00208 if ((ret = config_link(link)) < 0)
00209 return ret;
00210
00211 link->init_state = AVLINK_INIT;
00212 }
00213 }
00214
00215 return 0;
00216 }
00217
00218 static char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms)
00219 {
00220 snprintf(buf, buf_size, "%s%s%s%s%s%s",
00221 perms & AV_PERM_READ ? "r" : "",
00222 perms & AV_PERM_WRITE ? "w" : "",
00223 perms & AV_PERM_PRESERVE ? "p" : "",
00224 perms & AV_PERM_REUSE ? "u" : "",
00225 perms & AV_PERM_REUSE2 ? "U" : "",
00226 perms & AV_PERM_NEG_LINESIZES ? "n" : "");
00227 return buf;
00228 }
00229
00230 static void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end)
00231 {
00232 av_unused char buf[16];
00233 av_dlog(ctx,
00234 "ref[%p buf:%p refcount:%d perms:%s data:%p linesize[%d, %d, %d, %d] pts:%"PRId64" pos:%"PRId64,
00235 ref, ref->buf, ref->buf->refcount, ff_get_ref_perms_string(buf, sizeof(buf), ref->perms), ref->data[0],
00236 ref->linesize[0], ref->linesize[1], ref->linesize[2], ref->linesize[3],
00237 ref->pts, ref->pos);
00238
00239 if (ref->video) {
00240 av_dlog(ctx, " a:%d/%d s:%dx%d i:%c",
00241 ref->video->pixel_aspect.num, ref->video->pixel_aspect.den,
00242 ref->video->w, ref->video->h,
00243 !ref->video->interlaced ? 'P' :
00244 ref->video->top_field_first ? 'T' : 'B');
00245 }
00246 if (ref->audio) {
00247 av_dlog(ctx, " cl:%"PRId64"d sn:%d s:%d sr:%d p:%d",
00248 ref->audio->channel_layout,
00249 ref->audio->nb_samples,
00250 ref->audio->size,
00251 ref->audio->sample_rate,
00252 ref->audio->planar);
00253 }
00254
00255 av_dlog(ctx, "]%s", end ? "\n" : "");
00256 }
00257
00258 static void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
00259 {
00260 if (link->type == AVMEDIA_TYPE_VIDEO) {
00261 av_dlog(ctx,
00262 "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s",
00263 link, link->w, link->h,
00264 av_pix_fmt_descriptors[link->format].name,
00265 link->src ? link->src->filter->name : "",
00266 link->dst ? link->dst->filter->name : "",
00267 end ? "\n" : "");
00268 } else {
00269 char buf[128];
00270 av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout);
00271
00272 av_dlog(ctx,
00273 "link[%p r:%"PRId64" cl:%s fmt:%-16s %-16s->%-16s]%s",
00274 link, link->sample_rate, buf,
00275 av_get_sample_fmt_name(link->format),
00276 link->src ? link->src->filter->name : "",
00277 link->dst ? link->dst->filter->name : "",
00278 end ? "\n" : "");
00279 }
00280 }
00281
00282 #define FF_DPRINTF_START(ctx, func) av_dlog(NULL, "%-16s: ", #func)
00283
00284 AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
00285 {
00286 AVFilterBufferRef *ret = NULL;
00287
00288 av_unused char buf[16];
00289 FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0);
00290 av_dlog(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h);
00291
00292 if (link->dstpad->get_video_buffer)
00293 ret = link->dstpad->get_video_buffer(link, perms, w, h);
00294
00295 if (!ret)
00296 ret = avfilter_default_get_video_buffer(link, perms, w, h);
00297
00298 if (ret)
00299 ret->type = AVMEDIA_TYPE_VIDEO;
00300
00301 FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " returning "); ff_dlog_ref(NULL, ret, 1);
00302
00303 return ret;
00304 }
00305
00306 AVFilterBufferRef *
00307 avfilter_get_video_buffer_ref_from_arrays(uint8_t *data[4], int linesize[4], int perms,
00308 int w, int h, enum PixelFormat format)
00309 {
00310 AVFilterBuffer *pic = av_mallocz(sizeof(AVFilterBuffer));
00311 AVFilterBufferRef *picref = av_mallocz(sizeof(AVFilterBufferRef));
00312
00313 if (!pic || !picref)
00314 goto fail;
00315
00316 picref->buf = pic;
00317 picref->buf->free = ff_avfilter_default_free_buffer;
00318 if (!(picref->video = av_mallocz(sizeof(AVFilterBufferRefVideoProps))))
00319 goto fail;
00320
00321 pic->w = picref->video->w = w;
00322 pic->h = picref->video->h = h;
00323
00324
00325 picref->perms = perms | AV_PERM_READ;
00326
00327 pic->refcount = 1;
00328 picref->type = AVMEDIA_TYPE_VIDEO;
00329 pic->format = picref->format = format;
00330
00331 memcpy(pic->data, data, sizeof(pic->data));
00332 memcpy(pic->linesize, linesize, sizeof(pic->linesize));
00333 memcpy(picref->data, pic->data, sizeof(picref->data));
00334 memcpy(picref->linesize, pic->linesize, sizeof(picref->linesize));
00335
00336 return picref;
00337
00338 fail:
00339 if (picref && picref->video)
00340 av_free(picref->video);
00341 av_free(picref);
00342 av_free(pic);
00343 return NULL;
00344 }
00345
00346 AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms,
00347 enum AVSampleFormat sample_fmt, int size,
00348 int64_t channel_layout, int planar)
00349 {
00350 AVFilterBufferRef *ret = NULL;
00351
00352 if (link->dstpad->get_audio_buffer)
00353 ret = link->dstpad->get_audio_buffer(link, perms, sample_fmt, size, channel_layout, planar);
00354
00355 if (!ret)
00356 ret = avfilter_default_get_audio_buffer(link, perms, sample_fmt, size, channel_layout, planar);
00357
00358 if (ret)
00359 ret->type = AVMEDIA_TYPE_AUDIO;
00360
00361 return ret;
00362 }
00363
00364 int avfilter_request_frame(AVFilterLink *link)
00365 {
00366 FF_DPRINTF_START(NULL, request_frame); ff_dlog_link(NULL, link, 1);
00367
00368 if (link->srcpad->request_frame)
00369 return link->srcpad->request_frame(link);
00370 else if (link->src->inputs[0])
00371 return avfilter_request_frame(link->src->inputs[0]);
00372 else return -1;
00373 }
00374
00375 int avfilter_poll_frame(AVFilterLink *link)
00376 {
00377 int i, min = INT_MAX;
00378
00379 if (link->srcpad->poll_frame)
00380 return link->srcpad->poll_frame(link);
00381
00382 for (i = 0; i < link->src->input_count; i++) {
00383 int val;
00384 if (!link->src->inputs[i])
00385 return -1;
00386 val = avfilter_poll_frame(link->src->inputs[i]);
00387 min = FFMIN(min, val);
00388 }
00389
00390 return min;
00391 }
00392
00393
00394
00395 void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
00396 {
00397 void (*start_frame)(AVFilterLink *, AVFilterBufferRef *);
00398 AVFilterPad *dst = link->dstpad;
00399 int perms = picref->perms;
00400
00401 FF_DPRINTF_START(NULL, start_frame); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " "); ff_dlog_ref(NULL, picref, 1);
00402
00403 if (!(start_frame = dst->start_frame))
00404 start_frame = avfilter_default_start_frame;
00405
00406 if (picref->linesize[0] < 0)
00407 perms |= AV_PERM_NEG_LINESIZES;
00408
00409 if ((dst->min_perms & perms) != dst->min_perms || dst->rej_perms & perms) {
00410 av_log(link->dst, AV_LOG_DEBUG,
00411 "frame copy needed (have perms %x, need %x, reject %x)\n",
00412 picref->perms,
00413 link->dstpad->min_perms, link->dstpad->rej_perms);
00414
00415 link->cur_buf = avfilter_get_video_buffer(link, dst->min_perms, link->w, link->h);
00416 link->src_buf = picref;
00417 avfilter_copy_buffer_ref_props(link->cur_buf, link->src_buf);
00418 }
00419 else
00420 link->cur_buf = picref;
00421
00422 start_frame(link, link->cur_buf);
00423 }
00424
00425 void avfilter_end_frame(AVFilterLink *link)
00426 {
00427 void (*end_frame)(AVFilterLink *);
00428
00429 if (!(end_frame = link->dstpad->end_frame))
00430 end_frame = avfilter_default_end_frame;
00431
00432 end_frame(link);
00433
00434
00435
00436 if (link->src_buf) {
00437 avfilter_unref_buffer(link->src_buf);
00438 link->src_buf = NULL;
00439 }
00440 }
00441
00442 void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
00443 {
00444 uint8_t *src[4], *dst[4];
00445 int i, j, vsub;
00446 void (*draw_slice)(AVFilterLink *, int, int, int);
00447
00448 FF_DPRINTF_START(NULL, draw_slice); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " y:%d h:%d dir:%d\n", y, h, slice_dir);
00449
00450
00451 if (link->src_buf) {
00452 vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;
00453
00454 for (i = 0; i < 4; i++) {
00455 if (link->src_buf->data[i]) {
00456 src[i] = link->src_buf-> data[i] +
00457 (y >> (i==1 || i==2 ? vsub : 0)) * link->src_buf-> linesize[i];
00458 dst[i] = link->cur_buf->data[i] +
00459 (y >> (i==1 || i==2 ? vsub : 0)) * link->cur_buf->linesize[i];
00460 } else
00461 src[i] = dst[i] = NULL;
00462 }
00463
00464 for (i = 0; i < 4; i++) {
00465 int planew =
00466 av_image_get_linesize(link->format, link->cur_buf->video->w, i);
00467
00468 if (!src[i]) continue;
00469
00470 for (j = 0; j < h >> (i==1 || i==2 ? vsub : 0); j++) {
00471 memcpy(dst[i], src[i], planew);
00472 src[i] += link->src_buf->linesize[i];
00473 dst[i] += link->cur_buf->linesize[i];
00474 }
00475 }
00476 }
00477
00478 if (!(draw_slice = link->dstpad->draw_slice))
00479 draw_slice = avfilter_default_draw_slice;
00480 draw_slice(link, y, h, slice_dir);
00481 }
00482
00483 void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
00484 {
00485 void (*filter_samples)(AVFilterLink *, AVFilterBufferRef *);
00486 AVFilterPad *dst = link->dstpad;
00487
00488 FF_DPRINTF_START(NULL, filter_samples); ff_dlog_link(NULL, link, 1);
00489
00490 if (!(filter_samples = dst->filter_samples))
00491 filter_samples = avfilter_default_filter_samples;
00492
00493
00494 if ((dst->min_perms & samplesref->perms) != dst->min_perms ||
00495 dst->rej_perms & samplesref->perms) {
00496
00497 av_log(link->dst, AV_LOG_DEBUG,
00498 "Copying audio data in avfilter (have perms %x, need %x, reject %x)\n",
00499 samplesref->perms, link->dstpad->min_perms, link->dstpad->rej_perms);
00500
00501 link->cur_buf = avfilter_default_get_audio_buffer(link, dst->min_perms,
00502 samplesref->format,
00503 samplesref->audio->size,
00504 samplesref->audio->channel_layout,
00505 samplesref->audio->planar);
00506 link->cur_buf->pts = samplesref->pts;
00507 link->cur_buf->audio->sample_rate = samplesref->audio->sample_rate;
00508
00509
00510 memcpy(link->cur_buf->data[0], samplesref->data[0], samplesref->audio->size);
00511
00512 avfilter_unref_buffer(samplesref);
00513 } else
00514 link->cur_buf = samplesref;
00515
00516 filter_samples(link, link->cur_buf);
00517 }
00518
00519 #define MAX_REGISTERED_AVFILTERS_NB 64
00520
00521 static AVFilter *registered_avfilters[MAX_REGISTERED_AVFILTERS_NB + 1];
00522
00523 static int next_registered_avfilter_idx = 0;
00524
00525 AVFilter *avfilter_get_by_name(const char *name)
00526 {
00527 int i;
00528
00529 for (i = 0; registered_avfilters[i]; i++)
00530 if (!strcmp(registered_avfilters[i]->name, name))
00531 return registered_avfilters[i];
00532
00533 return NULL;
00534 }
00535
00536 int avfilter_register(AVFilter *filter)
00537 {
00538 if (next_registered_avfilter_idx == MAX_REGISTERED_AVFILTERS_NB)
00539 return -1;
00540
00541 registered_avfilters[next_registered_avfilter_idx++] = filter;
00542 return 0;
00543 }
00544
00545 AVFilter **av_filter_next(AVFilter **filter)
00546 {
00547 return filter ? ++filter : ®istered_avfilters[0];
00548 }
00549
00550 void avfilter_uninit(void)
00551 {
00552 memset(registered_avfilters, 0, sizeof(registered_avfilters));
00553 next_registered_avfilter_idx = 0;
00554 }
00555
00556 static int pad_count(const AVFilterPad *pads)
00557 {
00558 int count;
00559
00560 for(count = 0; pads->name; count ++) pads ++;
00561 return count;
00562 }
00563
00564 static const char *filter_name(void *p)
00565 {
00566 AVFilterContext *filter = p;
00567 return filter->filter->name;
00568 }
00569
00570 static const AVClass avfilter_class = {
00571 "AVFilter",
00572 filter_name,
00573 NULL,
00574 LIBAVUTIL_VERSION_INT,
00575 };
00576
00577 int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name)
00578 {
00579 AVFilterContext *ret;
00580 *filter_ctx = NULL;
00581
00582 if (!filter)
00583 return AVERROR(EINVAL);
00584
00585 ret = av_mallocz(sizeof(AVFilterContext));
00586
00587 ret->av_class = &avfilter_class;
00588 ret->filter = filter;
00589 ret->name = inst_name ? av_strdup(inst_name) : NULL;
00590 ret->priv = av_mallocz(filter->priv_size);
00591
00592 ret->input_count = pad_count(filter->inputs);
00593 if (ret->input_count) {
00594 ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->input_count);
00595 memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->input_count);
00596 ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->input_count);
00597 }
00598
00599 ret->output_count = pad_count(filter->outputs);
00600 if (ret->output_count) {
00601 ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->output_count);
00602 memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->output_count);
00603 ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->output_count);
00604 }
00605
00606 *filter_ctx = ret;
00607 return 0;
00608 }
00609
00610 void avfilter_free(AVFilterContext *filter)
00611 {
00612 int i;
00613 AVFilterLink *link;
00614
00615 if (filter->filter->uninit)
00616 filter->filter->uninit(filter);
00617
00618 for (i = 0; i < filter->input_count; i++) {
00619 if ((link = filter->inputs[i])) {
00620 if (link->src)
00621 link->src->outputs[link->srcpad - link->src->output_pads] = NULL;
00622 avfilter_formats_unref(&link->in_formats);
00623 avfilter_formats_unref(&link->out_formats);
00624 }
00625 av_freep(&link);
00626 }
00627 for (i = 0; i < filter->output_count; i++) {
00628 if ((link = filter->outputs[i])) {
00629 if (link->dst)
00630 link->dst->inputs[link->dstpad - link->dst->input_pads] = NULL;
00631 avfilter_formats_unref(&link->in_formats);
00632 avfilter_formats_unref(&link->out_formats);
00633 }
00634 av_freep(&link);
00635 }
00636
00637 av_freep(&filter->name);
00638 av_freep(&filter->input_pads);
00639 av_freep(&filter->output_pads);
00640 av_freep(&filter->inputs);
00641 av_freep(&filter->outputs);
00642 av_freep(&filter->priv);
00643 av_free(filter);
00644 }
00645
00646 int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque)
00647 {
00648 int ret=0;
00649
00650 if (filter->filter->init)
00651 ret = filter->filter->init(filter, args, opaque);
00652 return ret;
00653 }
00654