audiod: Make default filters work also for udp streams.
authorAndre Noll <maan@systemlinux.org>
Fri, 5 Mar 2010 07:42:13 +0000 (08:42 +0100)
committerAndre Noll <maan@systemlinux.org>
Fri, 5 Mar 2010 07:42:13 +0000 (08:42 +0100)
Currently one has to use --no_default_filters and must specify fecdec as the
first filter for UDP streams, a fact that is not documented anywhere. Make decoding
of udp streams work if no filters were given by changing init_default_filters() to
add fecdec automatically if the udp receiver is used.

NEWS
audiod.c

diff --git a/NEWS b/NEWS
index d99605a..7f370eb 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,9 @@ NEWS
          for the new buffer tree API.
        - Fix audible buffer underruns for wma streams.
        - The alsa writer no longer prints meaningless underrun durations.
+       - audiod: Defaults work also for udp streams. If no filter is
+         given for an audio format that is received via upd, fecdec is
+         automatically added as the first filter (along with the decoder).
 
 ---------------------------------------
 0.4.1 (2009-12-22) "concurrent horizon"
index dd60228..1663dad 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -873,6 +873,17 @@ static int init_default_filters(void)
 
                if (a->num_filters)
                        continue; /* no default -- nothing to to */
+               /*
+                * If udp is used to receive this audiod format, add fecdec as
+                * the first filter.
+                */
+               if (strcmp(afi[i].receiver->name, "udp") == 0) {
+                       tmp = para_strdup("fecdec");
+                       add_filter(i, tmp);
+                       free(tmp);
+                       if (ret < 0)
+                               goto out;
+               }
                /* add "dec" to audio format name */
                tmp = make_message("%sdec", audio_formats[i]);
                for (j = 0; filters[j].name; j++)
@@ -898,7 +909,7 @@ static int parse_filter_args(void)
 {
        int i, ret, nf;
 
-       nf = PARA_MAX(1U, conf.filter_given);
+       nf = PARA_MAX(2U, conf.filter_given);
        PARA_INFO_LOG("maximal number of filters: %d\n", nf);
        FOR_EACH_AUDIO_FORMAT(i) {
                afi[i].filter_conf = para_malloc(nf * sizeof(void *));