[FFmpeg-soc] [soc]: r4713 - in afilters: af_null.c dummy.c

kdub subversion at mplayerhq.hu
Mon Jul 13 20:36:14 CEST 2009


Author: kdub
Date: Mon Jul 13 20:36:13 2009
New Revision: 4713

Log:
get two sequential filters working

Modified:
   afilters/af_null.c
   afilters/dummy.c

Modified: afilters/af_null.c
==============================================================================
--- afilters/af_null.c	Mon Jul 13 19:59:09 2009	(r4712)
+++ afilters/af_null.c	Mon Jul 13 20:36:13 2009	(r4713)
@@ -48,6 +48,22 @@ AVFilter avfilter_af_null =
                                   { .name = NULL}},
 };
 
+AVFilter avfilter_af_null2 =
+{
+    .name      = "audio_null",
+
+    .priv_size = sizeof(af_null_priv_t),
+
+    .inputs    = (AVFilterPad[]) {{ .name            = "default",
+                                    .type            = CODEC_TYPE_AUDIO,
+                                    .filter_buffer    = filter },
+                                  { .name = NULL}},
+
+    .outputs   = (AVFilterPad[]) {{ .name            = "default",
+                                    .type            = CODEC_TYPE_AUDIO, },
+                                  { .name = NULL}},
+};
+
 
 static int filter(AVFilterLink *link, AVFilterBufferRef *sample_ref)
 {
@@ -59,10 +75,9 @@ static int filter(AVFilterLink *link, AV
     data = (int16_t*) sample_ref->buffer->data;
     for (i=0; i < num_samples; i++)
     {
+        printf("%i\n", data[i]);
         data[i]  = data[i] +1;
     }
 
     return 0;
 }
-
-

Modified: afilters/dummy.c
==============================================================================
--- afilters/dummy.c	Mon Jul 13 19:59:09 2009	(r4712)
+++ afilters/dummy.c	Mon Jul 13 20:36:13 2009	(r4713)
@@ -8,7 +8,7 @@
 #include "af_src.c"
 #include "af_null.c"
 
-#if 0
+#if 1
 int dump_avfiltlink(AVFilterLink *link)
 {
     if (!link)
@@ -99,28 +99,46 @@ int main()
     src_context = avfilter_open(src_filter, "filter_src");
     avfilter_register(src_filter);
 
-    /* set up actual filter */
+    /* set up the first filter */
     AVFilterContext * avfiltcont=NULL;
     AVFilter *avfilt;
     avfilt = &avfilter_af_null;
     avfiltcont = avfilter_open(avfilt, "filterID1234");
     avfilter_register(avfilt);
 
+    /* set up the first filter */
+    AVFilterContext * avfiltcont2=NULL;
+    AVFilter *avfilt2;
+    avfilt2 = &avfilter_af_null2;
+    memcpy(avfilt2, &avfilter_af_null, sizeof(AVFilter));
+    avfiltcont2 = avfilter_open(avfilt2, "filtery");
+    avfilter_register(avfilt2);
+
     /*init filters */
     avfilter_init_filter(avfiltcont, NULL, NULL);
+    avfilter_init_filter(avfiltcont2, NULL, NULL);
     avfilter_init_filter(src_context, NULL, NULL);
 
     /* link filters */
     avfilter_link(src_context, 0, avfiltcont, 0);
+    avfilter_link(avfiltcont, 0, avfiltcont2, 0);
     avfilter_config_links(src_context);
     avfilter_config_links(avfiltcont);
+    avfilter_config_links(avfiltcont2);
 
 
+    dump_avfiltcont(src_context);
+    dump_avfiltcont(avfiltcont);
+    dump_avfiltcont(avfiltcont2);
+
     /* load some samples in the source filter */
     av_asrc_buffer_add_samples(src_context, &sample_buf);
 
     /* run this link */
+    printf("running first link\n");
     avfilter_filter_buffer(src_context->outputs[0], &sample_buf);
+    printf("running second link\n");
+    avfilter_filter_buffer(avfiltcont->outputs[0], &sample_buf);
 
 }
 


More information about the FFmpeg-soc mailing list