[FFmpeg-soc] [soc]: r2163 - in libavfilter: diffs/03_ffplay_filters.diff graphparser.c graphparser.h

vitor subversion at mplayerhq.hu
Wed Apr 23 22:40:49 CEST 2008


Author: vitor
Date: Wed Apr 23 22:40:49 2008
New Revision: 2163

Log:
Pass the inputs and outputs of avfilter_parse_graph() with a AVFilterInOut linked list

Modified:
   libavfilter/diffs/03_ffplay_filters.diff
   libavfilter/graphparser.c
   libavfilter/graphparser.h

Modified: libavfilter/diffs/03_ffplay_filters.diff
==============================================================================
--- libavfilter/diffs/03_ffplay_filters.diff	(original)
+++ libavfilter/diffs/03_ffplay_filters.diff	Wed Apr 23 22:40:49 2008
@@ -1,5 +1,5 @@
 --- ffplay.c.old	2008-04-22 17:33:42.000000000 +0200
-+++ ffplay.c	2008-04-22 17:34:41.000000000 +0200
++++ ffplay.c	2008-04-23 22:39:04.000000000 +0200
 @@ -27,6 +27,12 @@
  #include "swscale.h"
  #include "avstring.h"
@@ -323,7 +323,7 @@
  static int video_thread(void *arg)
  {
      VideoState *is = arg;
-@@ -1390,10 +1593,43 @@
+@@ -1390,10 +1593,55 @@
      double pts;
      int ret;
  
@@ -342,9 +342,21 @@
 +
 +
 +    if(vfilters) {
-+        if (avfilter_parse_graph(graph, vfilters,
-+                                 filt_src, 0,
-+                                 filt_out, 0, NULL) < 0) goto the_end;
++        AVFilterInOut *inouts = av_malloc(sizeof(AVFilterInOut));
++        inouts->name    = "in";
++        inouts->filter  = filt_src;
++        inouts->type    = LinkTypeOut;
++        inouts->pad_idx = 0;
++        inouts->next    = av_malloc(sizeof(AVFilterInOut));
++
++        inouts->next->name    = "out";
++        inouts->next->filter  = filt_out;
++        inouts->next->type    = LinkTypeIn;
++        inouts->next->pad_idx = 0;
++        inouts->next->next    = NULL;
++
++        if (avfilter_parse_graph(graph, vfilters, inouts, NULL) < 0)
++            goto the_end;
 +    } else {
 +        if(avfilter_link(filt_src, 0, filt_out, 0) < 0)          goto the_end;
 +    }
@@ -367,7 +379,7 @@
  
          if (ret < 0) goto the_end;
  
-@@ -1410,6 +1646,9 @@
+@@ -1410,6 +1658,9 @@
                  stream_pause(cur_stream);
      }
   the_end:
@@ -377,7 +389,7 @@
      av_free(frame);
      return 0;
  }
-@@ -2149,6 +2388,12 @@
+@@ -2149,6 +2400,12 @@
      /* free all pictures */
      for(i=0;i<VIDEO_PICTURE_QUEUE_SIZE; i++) {
          vp = &is->pictq[i];
@@ -390,7 +402,7 @@
          if (vp->bmp) {
              SDL_FreeYUVOverlay(vp->bmp);
              vp->bmp = NULL;
-@@ -2486,6 +2731,9 @@
+@@ -2486,6 +2743,9 @@
      { "ec", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&error_concealment}, "set error concealment options",  "bit_mask" },
      { "sync", HAS_ARG | OPT_EXPERT, {(void*)opt_sync}, "set audio-video sync. type (type=audio/video/ext)", "type" },
      { "threads", HAS_ARG | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" },

Modified: libavfilter/graphparser.c
==============================================================================
--- libavfilter/graphparser.c	(original)
+++ libavfilter/graphparser.c	Wed Apr 23 22:40:49 2008
@@ -23,6 +23,7 @@
 #include <ctype.h>
 #include <string.h>
 
+#include "graphparser.h"
 #include "avfilter.h"
 #include "avfiltergraph.h"
 
@@ -149,24 +150,6 @@ static void parse_link_name(const char *
     }
 }
 
-
-enum LinkType {
-    LinkTypeIn,
-    LinkTypeOut,
-};
-
-/**
- * A linked-list of the inputs/outputs of the filter chain.
- */
-typedef struct AVFilterInOut {
-    enum LinkType type;
-    const char *name;
-    AVFilterContext *filter;
-    int pad_idx;
-
-    struct AVFilterInOut *next;
-} AVFilterInOut;
-
 static void free_inout(AVFilterInOut *head)
 {
     while(head) {
@@ -363,28 +346,14 @@ static int parse_outputs(const char **bu
  * Parse a string describing a filter graph.
  */
 int avfilter_parse_graph(AVFilterGraph *graph, const char *filters,
-                         AVFilterContext *in, int inpad,
-                         AVFilterContext *out, int outpad,
-                         AVClass *log_ctx)
+                         AVFilterInOut *inouts, AVClass *log_ctx)
 {
     int index = 0;
     char chr = 0;
     int pad = 0;
 
     AVFilterInOut *currInputs = NULL;
-    AVFilterInOut *openLinks  = av_malloc(sizeof(AVFilterInOut));
-
-    openLinks->name    = "in";
-    openLinks->filter  = in;
-    openLinks->type    = LinkTypeOut;
-    openLinks->pad_idx = inpad;
-    openLinks->next    = av_malloc(sizeof(AVFilterInOut));
-
-    openLinks->next->name    = "out";
-    openLinks->next->filter  = out;
-    openLinks->next->type    = LinkTypeIn;
-    openLinks->next->pad_idx = outpad;
-    openLinks->next->next    = NULL;
+    AVFilterInOut *openLinks  = inouts;
 
     do {
         AVFilterContext *filter;

Modified: libavfilter/graphparser.h
==============================================================================
--- libavfilter/graphparser.h	(original)
+++ libavfilter/graphparser.h	Wed Apr 23 22:40:49 2008
@@ -25,6 +25,23 @@
 #include "avfilter.h"
 #include "avfiltergraph.h"
 
+enum LinkType {
+    LinkTypeIn,
+    LinkTypeOut,
+};
+
+/**
+ * A linked-list of the inputs/outputs of the filter chain.
+ */
+typedef struct AVFilterInOut {
+    enum LinkType type;
+    const char *name;
+    AVFilterContext *filter;
+    int pad_idx;
+
+    struct AVFilterInOut *next;
+} AVFilterInOut;
+
 /**
  * Add to a graph a graph described by a string.
  * @param graph   the filter graph where to link the parsed graph context
@@ -36,8 +53,6 @@
  * @return        zero on success, -1 on error
  */
 int avfilter_parse_graph(AVFilterGraph *graph, const char *filters,
-                         AVFilterContext *in, int inpad,
-                         AVFilterContext *out, int outpad,
-                         AVClass *log_ctx);
+                         AVFilterInOut *inouts, AVClass *log_ctx);
 
 #endif  /* FFMPEG_GRAPHPARSER_H */



More information about the FFmpeg-soc mailing list