History

Split graph_load_from_dest() to have a version independent of avfilter_vf_graph Commited in SoC by Vitor Sessak on 2008-03-24 19:19:38

Originally committed as revision 12731 to svn://svn.ffmpeg.org/ffmpeg/trunk

Vitor Sessak committed 18 years ago

Commit 45a09311 parent b6be4ac2 files · +65 −2Browse files

Unified · Split

2 files
  1. libavfilter/avfiltergraph.c +60 −2
  2. libavfilter/avfiltergraph.h +5 −0
libavfilter/avfiltergraph.c+60−2
@@ -488,11 +488,10 @@ int avfilter_graph_config_formats(AVFilterContext *graphctx) · 487 unmodified lines
488488 return 0;
489489 }
490490
491−static int graph_load_from_desc(AVFilterContext *ctx, AVFilterGraphDesc *desc)
491+static int graph_load_from_desc2(AVFilterContext *ctx, AVFilterGraphDesc *desc)
492492 {
493493 AVFilterGraphDescFilter *curfilt;
494494 AVFilterGraphDescLink *curlink;
495− AVFilterGraphDescExport *curpad;
496495 AVFilterContext *filt, *filtb;
497496
498497 AVFilter *filterdef;
@@ -533,6 +532,22 @@ static int graph_load_from_desc(AVFilterContext *ctx, AVFilterGraphDesc *desc) · 34 unmodified lines
533532 }
534533 }
535534
535+ return 0;
536+
537+fail:
538+ uninit(ctx);
539+ return -1;
540+}
541+
542+static int graph_load_from_desc(AVFilterContext *ctx, AVFilterGraphDesc *desc)
543+{
544+ AVFilterGraphDescExport *curpad;
545+ char tmp[20];
546+ AVFilterContext *filt;
547+
548+ if (graph_load_from_desc2(ctx, desc) < 0)
549+ goto fail;
550+
536551 /* export all input pads */
537552 for(curpad = desc->inputs; curpad; curpad = curpad->next) {
538553 snprintf(tmp, 20, "%d", curpad->filter);
@@ -560,6 +575,49 @@ fail: · 21 unmodified lines
560575 return -1;
561576 }
562577
578+int graph_load_from_desc3(AVFilterContext *ctx, AVFilterGraphDesc *desc, AVFilterContext *in, int inpad, AVFilterContext *out, int outpad)
579+{
580+ AVFilterGraphDescExport *curpad;
581+ char tmp[20];
582+ AVFilterContext *filt;
583+
584+ if (graph_load_from_desc2(ctx, desc) < 0)
585+ goto fail;
586+
587+ /* export all input pads */
588+ for(curpad = desc->inputs; curpad; curpad = curpad->next) {
589+ snprintf(tmp, 20, "%d", curpad->filter);
590+ if(!(filt = avfilter_graph_get_filter(ctx, tmp))) {
591+ av_log(ctx, AV_LOG_ERROR, "filter owning exported pad does not exist\n");
592+ goto fail;
593+ }
594+ if(avfilter_link(in, inpad, filt, curpad->pad)) {
595+ av_log(ctx, AV_LOG_ERROR, "cannot create link between source and destination filters\n");
596+ goto fail;
597+ }
598+ }
599+
600+ /* export all output pads */
601+ for(curpad = desc->outputs; curpad; curpad = curpad->next) {
602+ snprintf(tmp, 20, "%d", curpad->filter);
603+ if(!(filt = avfilter_graph_get_filter(ctx, tmp))) {
604+ av_log(ctx, AV_LOG_ERROR, "filter owning exported pad does not exist\n");
605+ goto fail;
606+ }
607+
608+ if(avfilter_link(filt, curpad->pad, out, outpad)) {
609+ av_log(ctx, AV_LOG_ERROR, "cannot create link between source and destination filters\n");
610+ goto fail;
611+ }
612+ }
613+
614+ return 0;
615+
616+fail:
617+ uninit(ctx);
618+ return -1;
619+}
620+
563621 static int init(AVFilterContext *ctx, const char *args, void *opaque)
564622 {
565623 GraphContext *gctx = ctx->priv;
libavfilter/avfiltergraph.h+5−0
@@ -119,4 +119,9 @@ int avfilter_graph_config_formats(AVFilterContext *graphctx); · 118 unmodified lines
119119 */
120120 int avfilter_graph_config_links(AVFilterContext *graphctx);
121121
122+
123+int graph_load_from_desc3(AVFilterContext *ctx, AVFilterGraphDesc *desc,
124+ AVFilterContext *in, int inpad,
125+ AVFilterContext *out, int outpad);
126+
122127 #endif /* FFMPEG_AVFILTERGRAPH_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t