[FFmpeg-soc] [soc]: r4737 - in afilters: af_null.c af_src.c avfilter.c dummy.c

kdub subversion at mplayerhq.hu
Tue Jul 21 10:38:11 CEST 2009


Author: kdub
Date: Tue Jul 21 10:38:11 2009
New Revision: 4737

Log:
Add accepted pcm formats to my 3 filters

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

Modified: afilters/af_null.c
==============================================================================
--- afilters/af_null.c	Tue Jul 21 01:42:11 2009	(r4736)
+++ afilters/af_null.c	Tue Jul 21 10:38:11 2009	(r4737)
@@ -24,7 +24,10 @@
 
 #include <stdio.h>
 #include "avfilter.h"
+
 static int null_filter(AVFilterLink *link, AVFilterBufferRef *sample_ref);
+static int query_af_null_formats(AVFilterContext *ctx);
+static int init_af_null(AVFilterContext *ctx, const char *args, void *opaque);
 
 typedef struct
 {
@@ -32,6 +35,7 @@ typedef struct
 
 } af_null_priv_t;
 
+
 AVFilter avfilter_af_null =
 {
     .name      = "audio_null",
@@ -46,8 +50,38 @@ AVFilter avfilter_af_null =
     .outputs   = (AVFilterPad[]) {{ .name            = "default",
                                     .type            = CODEC_TYPE_AUDIO, },
                                   { .name = NULL}},
+
+    .init = init_af_null,
+    .query_formats = query_af_null_formats,
 };
 
+
+static int init_af_null(AVFilterContext *ctx, const char *args, void *opaque)
+{
+    printf("init afnull\n");
+    int i;
+    af_null_priv_t * p;
+    ctx->priv = av_mallocz(sizeof(af_null_priv_t));
+    p = (af_null_priv_t*) ctx->priv;
+    for (i=0; i<100; i++)
+       p->history[i] = i;
+
+    return 0;
+}
+
+static int query_af_null_formats(AVFilterContext *ctx)
+{
+    av_log(0,0, "query formats\n");
+
+    AVFilterFormats *formats;
+    formats = avfilter_make_format_list(3, CODEC_ID_PCM_S16LE,
+                                            CODEC_ID_PCM_S16BE,
+                                            CODEC_ID_PCM_F32LE);
+    avfilter_set_common_formats(ctx,formats);
+
+    return 0;
+}
+
 static int null_filter(AVFilterLink *link, AVFilterBufferRef *sample_ref)
 {
     av_log(0,0, "Filter buffer\n");

Modified: afilters/af_src.c
==============================================================================
--- afilters/af_src.c	Tue Jul 21 01:42:11 2009	(r4736)
+++ afilters/af_src.c	Tue Jul 21 10:38:11 2009	(r4737)
@@ -91,6 +91,13 @@ static int src_buf_init (AVFilterContext
 }
 
 
+static int query_af_src_formats(AVFilterContext *ctx)
+{
+    av_log(0,0, "query formats\n");
+    AVFilterFormats *formats1;
+    formats1 = avfilter_all_sampleformats();
+    avfilter_set_common_formats(ctx,formats1);
+}
 
 AVFilter avfilter_af_src =
 {
@@ -103,7 +110,8 @@ AVFilter avfilter_af_src =
     .outputs    = (AVFilterPad[]) { {.name = "default",
                                      .type = CODEC_TYPE_AUDIO,
                                      .filter_buffer = dump_next},
-                                    {.name = NULL}}
+                                    {.name = NULL}},
 
+    .query_formats = query_af_src_formats
 };
 

Modified: afilters/avfilter.c
==============================================================================
--- afilters/avfilter.c	Tue Jul 21 01:42:11 2009	(r4736)
+++ afilters/avfilter.c	Tue Jul 21 10:38:11 2009	(r4737)
@@ -262,10 +262,6 @@ void avfilter_filter_buffer(AVFilterLink
 
     int input_func = 1, output_func = 1;
 
-    /* convert, if necessary */
-//    if (link->av_conv)
-//        av_audio_convert();
-
     if (!(filter_output_buffer = dst->filter_buffer))
     {
         av_log(0,0,"LINK HAS NO OUTPUT?\n", 0);
@@ -284,9 +280,14 @@ void avfilter_filter_buffer(AVFilterLink
 
     link->cur_buf = sample_ref;
 
+    /* wrap up output filter's processes if necessary */
     if (output_func)
     filter_output_buffer(link, link->cur_buf);
 
+    /* convert pcm samples, if necessary */
+
+
+    /* do the input filter's processing*/
     if (input_func)
     filter_input_buffer(link, link->cur_buf);
 }

Modified: afilters/dummy.c
==============================================================================
--- afilters/dummy.c	Tue Jul 21 01:42:11 2009	(r4736)
+++ afilters/dummy.c	Tue Jul 21 10:38:11 2009	(r4737)
@@ -85,6 +85,8 @@ int main()
 #endif
     }   // sine wave, period 1024/100, range, 100 -> -100
 
+    /* set up formats */
+
     AVFilterBuffer samples;
     AVFilterBufferRef sample_buf;
     samples.n_samples = n_samples;
@@ -123,6 +125,16 @@ int main()
     avfilter_init_filter(avfiltcont2, NULL, NULL);
     avfilter_init_filter(src_context, NULL, NULL);
 
+    /* configure formats?  */
+
+
+
+    /* merge lists? */
+    AVFilterFormats * merge;
+
+//    merge = avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b)
+
+
     /* link filters */
     avfilter_link(src_context, 0, avfiltcont, 0);
     avfilter_link(avfiltcont, 0, avfiltcont2, 0);
@@ -131,6 +143,9 @@ int main()
     avfilter_config_links(avfiltcont2);
 
 
+
+
+
     /*dump_avfiltcont(src_context);
     dump_avfiltcont(avfiltcont);
     dump_avfiltcont(avfiltcont2);*/


More information about the FFmpeg-soc mailing list