[FFmpeg-soc] [soc]: r2051 - in libavfilter: avfiltergraph.c avfiltergraph.h diffs/04_ffmpeg_filters.diff

vitor subversion at mplayerhq.hu
Wed Mar 26 21:51:24 CET 2008


Author: vitor
Date: Wed Mar 26 21:51:24 2008
New Revision: 2051

Log:
Remove usage of AVFilterGraphDesc outside avfiltergraph.c

Modified:
   libavfilter/avfiltergraph.c
   libavfilter/avfiltergraph.h
   libavfilter/diffs/04_ffmpeg_filters.diff

Modified: libavfilter/avfiltergraph.c
==============================================================================
--- libavfilter/avfiltergraph.c	(original)
+++ libavfilter/avfiltergraph.c	Wed Mar 26 21:51:24 2008
@@ -554,16 +554,25 @@ static AVFilterGraphDesc *parse_chain(co
 /**
  * Parse a string describing a filter graph.
  */
-AVFilterGraphDesc *avfilter_graph_parse_chain(const char *filters)
+int avfilter_graph_parse_chain(AVFilterGraph *graph, const char *filters, AVFilterContext *in, int inpad, AVFilterContext *out, int outpad)
 {
-    AVFilterGraphDesc *ret;
+    AVFilterGraphDesc *desc;
 
     /* Try first to parse supposing there is no (in) element */
-    if ((ret = parse_chain(filters, 0)))
-        return ret;
+    if (!(desc = parse_chain(filters, 0))) {
+        /* If it didn't work, parse supposing there is an (in) element */
+        desc = parse_chain(filters, 1);
+    }
+    if (!desc)
+        return -1;
 
-    /* Parse supposing there is an (in) element */
-    return parse_chain(filters, 1);
+    if (graph_load_from_desc3(graph, desc, in, inpad, out, outpad) < 0) {
+        avfilter_graph_free_desc(desc);
+        return -1;
+    }
+
+    avfilter_graph_free_desc(desc);
+    return 0;
 }
 
 /**

Modified: libavfilter/avfiltergraph.h
==============================================================================
--- libavfilter/avfiltergraph.h	(original)
+++ libavfilter/avfiltergraph.h	Wed Mar 26 21:51:24 2008
@@ -72,12 +72,16 @@ typedef struct AVFilterGraph {
 } AVFilterGraph;
 
 /**
- * Parse a graph composed of a simple chain of filters which is described by
- * a single string.
- * @param filters String listing filters and their arguments.
- * @return        The parsed graph description.
+ * Add to a graph a graph described by a string.
+ * @param graph   the filter graph where to link the parsed graph context
+ * @param filters string to be parsed
+ * @param in      input to the graph to be parsed (TODO: allow several)
+ * @param inpad   pad index of the input
+ * @param in      output to the graph to be parsed (TODO: allow several)
+ * @param inpad   pad index of the output
+ * @return        zero on success, -1 on error
  */
-AVFilterGraphDesc *avfilter_graph_parse_chain(const char *filters);
+int avfilter_graph_parse_chain(AVFilterGraph *graph, const char *filters, AVFilterContext *in, int inpad, AVFilterContext *out, int outpad);
 
 /**
  * Free a filter graph description.

Modified: libavfilter/diffs/04_ffmpeg_filters.diff
==============================================================================
--- libavfilter/diffs/04_ffmpeg_filters.diff	(original)
+++ libavfilter/diffs/04_ffmpeg_filters.diff	Wed Mar 26 21:51:24 2008
@@ -38,7 +38,7 @@ Index: ffmpeg.c
  } AVInputStream;
  
  typedef struct AVInputFile {
-@@ -288,6 +303,254 @@
+@@ -288,6 +303,253 @@
  static struct termios oldtty;
  #endif
  
@@ -269,8 +269,7 @@ Index: ffmpeg.c
 +    }
 +
 +    if(vfilters) {
-+        graph_load_from_desc3(filt_graph_all,
-+                              avfilter_graph_parse_chain(vfilters),
++        avfilter_graph_parse_chain(filt_graph_all, vfilters,
 +                              curr_filter, 0, ist->out_video_filter, 0);
 +    } else {
 +        if(avfilter_link(curr_filter, 0, ist->out_video_filter, 0) < 0)
@@ -293,7 +292,7 @@ Index: ffmpeg.c
  static void term_exit(void)
  {
  #ifdef HAVE_TERMIOS_H
-@@ -754,6 +1017,9 @@
+@@ -754,6 +1016,9 @@
      if (nb_frames <= 0)
          return;
  
@@ -303,7 +302,7 @@ Index: ffmpeg.c
      if (ost->video_crop) {
          if (av_picture_crop((AVPicture *)&picture_crop_temp, (AVPicture *)in_picture, dec->pix_fmt, ost->topBand, ost->leftBand) < 0) {
              av_log(NULL, AV_LOG_ERROR, "error cropping picture\n");
-@@ -763,6 +1029,7 @@
+@@ -763,6 +1028,7 @@
      } else {
          formatted_picture = in_picture;
      }
@@ -311,7 +310,7 @@ Index: ffmpeg.c
  
      final_picture = formatted_picture;
      padding_src = formatted_picture;
-@@ -778,12 +1045,14 @@
+@@ -778,12 +1044,14 @@
          }
      }
  
@@ -326,7 +325,7 @@ Index: ffmpeg.c
  
      if (ost->video_pad) {
          av_picture_pad((AVPicture*)final_picture, (AVPicture *)padding_src,
-@@ -1165,6 +1434,17 @@
+@@ -1165,6 +1433,17 @@
                                      &buffer_to_free);
          }
  
@@ -344,7 +343,7 @@ Index: ffmpeg.c
          // preprocess audio (volume)
          if (ist->st->codec->codec_type == CODEC_TYPE_AUDIO) {
              if (audio_volume != 256) {
-@@ -1227,10 +1507,23 @@
+@@ -1227,10 +1506,23 @@
                              do_audio_out(os, ost, ist, data_buf, data_size);
                              break;
                          case CODEC_TYPE_VIDEO:
@@ -368,7 +367,7 @@ Index: ffmpeg.c
                              break;
                          case CODEC_TYPE_SUBTITLE:
                              do_subtitle_out(os, ost, ist, &subtitle,
-@@ -1693,10 +1986,21 @@
+@@ -1693,10 +1985,21 @@
                          fprintf(stderr, "Cannot get resampling context\n");
                          exit(1);
                      }
@@ -390,7 +389,7 @@ Index: ffmpeg.c
                  break;
              case CODEC_TYPE_SUBTITLE:
                  ost->encoding_needed = 1;
-@@ -3804,6 +4108,9 @@
+@@ -3804,6 +4107,9 @@
  #ifdef CONFIG_VHOOK
      { "vhook", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)add_frame_hooker}, "insert video processing module", "module" },
  #endif



More information about the FFmpeg-soc mailing list