[gupnp] [PATCH] typos in allowed frequencies



Hi,

the new code to guess DLNA profiles has some typos in the list of
allowed frequencies. Attaches are two patches to correct this.


Sven


>From 0c478adaf480a9e38031ca457b5cc833bf4ad128 Mon Sep 17 00:00:00 2001
From: Sven Neumann <s neumann phase-zero de>
Date: Wed, 22 Apr 2009 15:27:43 +0200
Subject: [PATCH] Fix typos in allowed frequencies

The list of allowed frequencies for MP3 and AAC profiles
contained 41kHz instead of 44.1kHz. Fix this and also declare
all these arrays as const.
---
 libgupnp-av/gupnp-dlna.c |   76 +++++++++++++++++++++++-----------------------
 1 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/libgupnp-av/gupnp-dlna.c b/libgupnp-av/gupnp-dlna.c
index d4bbb85..b73bc24 100644
--- a/libgupnp-av/gupnp-dlna.c
+++ b/libgupnp-av/gupnp-dlna.c
@@ -69,11 +69,11 @@ guess_png_profile (GUPnPDIDLLiteResource *resource)
 static void
 check_int_allowed (int         value,
                    const char *value_name,
-                   int        *allowed_values,
+                   const int  *allowed_values,
                    const char *profile)
 {
         if (value > 0) {
-                int     *allowed_value;
+                const int *allowed_value;
                 gboolean not_allowed = TRUE;
 
             for (allowed_value = allowed_values;
@@ -96,7 +96,7 @@ check_int_allowed (int         value,
 
 static void
 check_frequency (GUPnPDIDLLiteResource *resource,
-                 int                   *allowed_freq,
+                 const int             *allowed_freq,
                  const char            *profile)
 {
         check_int_allowed (resource->sample_freq,
@@ -107,7 +107,7 @@ check_frequency (GUPnPDIDLLiteResource *resource,
 
 static void
 check_bitrate (GUPnPDIDLLiteResource *resource,
-               int                   *allowed_bitrates,
+               const int             *allowed_bitrates,
                const char            *profile)
 {
         check_int_allowed (resource->bitrate,
@@ -118,7 +118,7 @@ check_bitrate (GUPnPDIDLLiteResource *resource,
 
 static void
 check_sample_size (GUPnPDIDLLiteResource *resource,
-                   int                   *allowed_sample_size,
+                   const int             *allowed_sample_size,
                    const char            *profile)
 {
         check_int_allowed (resource->bits_per_sample,
@@ -129,7 +129,7 @@ check_sample_size (GUPnPDIDLLiteResource *resource,
 
 static void
 check_num_channels (GUPnPDIDLLiteResource *resource,
-                    int                   *allowed_num_channels,
+                    const int             *allowed_num_channels,
                     const char            *profile)
 {
         check_int_allowed (resource->n_audio_channels,
@@ -141,7 +141,7 @@ check_num_channels (GUPnPDIDLLiteResource *resource,
 static const char *
 guess_ac3_profile (GUPnPDIDLLiteResource *resource)
 {
-        int allowed_freq[] = { 32000, 41000, 4800, -1 };
+        const int allowed_freq[] = { 32000, 41000, 4800, -1 };
 
         check_frequency (resource, allowed_freq, "AC3");
 
@@ -151,9 +151,9 @@ guess_ac3_profile (GUPnPDIDLLiteResource *resource)
 static const char *
 guess_lpcm_profile (GUPnPDIDLLiteResource *resource)
 {
-        int allowed_freq[] = { 41000, 4800, -1 };
-        int allowed_num_channels[] = { 1, 2, -1 };
-        int allowed_sample_size [] = { 16, -1 };
+        const int allowed_freq[] = { 41000, 4800, -1 };
+        const int allowed_num_channels[] = { 1, 2, -1 };
+        const int allowed_sample_size [] = { 16, -1 };
 
         check_frequency (resource, allowed_freq, "LPCM");
         check_num_channels (resource, allowed_num_channels, "LPCM");
@@ -165,23 +165,23 @@ guess_lpcm_profile (GUPnPDIDLLiteResource *resource)
 static const char *
 guess_mp3_profile (GUPnPDIDLLiteResource *resource)
 {
-        int allowed_freq[] = { 32000, 41000, 48000, -1 };
-        int allowed_num_channels[] = { 1, 2, -1 };
-        int allowed_bitrates[] = { 32000,
-                                   40000,
-                                   48000,
-                                   56000,
-                                   64000,
-                                   80000,
-                                   96000,
-                                   112000,
-                                   128000,
-                                   160000,
-                                   192000,
-                                   224000,
-                                   256000,
-                                   320000,
-                                   -1 };
+        const int allowed_freq[] = { 32000, 44100, 48000, -1 };
+        const int allowed_num_channels[] = { 1, 2, -1 };
+        const int allowed_bitrates[] = { 32000,
+                                         40000,
+                                         48000,
+                                         56000,
+                                         64000,
+                                         80000,
+                                         96000,
+                                         112000,
+                                         128000,
+                                         160000,
+                                         192000,
+                                         224000,
+                                         256000,
+                                         320000,
+                                         -1 };
 
         check_frequency (resource, allowed_freq, "MP3");
         check_num_channels (resource, allowed_num_channels, "MP3");
@@ -193,17 +193,17 @@ guess_mp3_profile (GUPnPDIDLLiteResource *resource)
 static const char *
 guess_aac_profile (GUPnPDIDLLiteResource *resource)
 {
-        int allowed_freq[] = { 8000,
-                               11025,
-                               12000,
-                               16000,
-                               22050,
-                               24000,
-                               32000,
-                               41000,
-                               48000,
-                               -1 };
-        int allowed_num_channels[] = { 1, 2, -1 };
+        const int allowed_freq[] = { 8000,
+                                     11025,
+                                     12000,
+                                     16000,
+                                     22050,
+                                     24000,
+                                     32000,
+                                     44100,
+                                     48000,
+                                     -1 };
+        const int allowed_num_channels[] = { 1, 2, -1 };
 
         check_frequency (resource, allowed_freq, "AAC_ISO");
         check_num_channels (resource, allowed_num_channels, "AAC_ISO");
-- 
1.5.6.3

>From 91e319c63c64020a2836c223e1eb07a9d9656d60 Mon Sep 17 00:00:00 2001
From: Sven Neumann <s neumann phase-zero de>
Date: Wed, 22 Apr 2009 15:32:17 +0200
Subject: [PATCH] Fix allowed frequencies in AC-3 and LPCM profiles

---
 libgupnp-av/gupnp-dlna.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libgupnp-av/gupnp-dlna.c b/libgupnp-av/gupnp-dlna.c
index b73bc24..f461ad0 100644
--- a/libgupnp-av/gupnp-dlna.c
+++ b/libgupnp-av/gupnp-dlna.c
@@ -141,7 +141,7 @@ check_num_channels (GUPnPDIDLLiteResource *resource,
 static const char *
 guess_ac3_profile (GUPnPDIDLLiteResource *resource)
 {
-        const int allowed_freq[] = { 32000, 41000, 4800, -1 };
+        const int allowed_freq[] = { 32000, 44100, 48000, -1 };
 
         check_frequency (resource, allowed_freq, "AC3");
 
@@ -151,7 +151,7 @@ guess_ac3_profile (GUPnPDIDLLiteResource *resource)
 static const char *
 guess_lpcm_profile (GUPnPDIDLLiteResource *resource)
 {
-        const int allowed_freq[] = { 41000, 4800, -1 };
+        const int allowed_freq[] = { 44100, 48000, -1 };
         const int allowed_num_channels[] = { 1, 2, -1 };
         const int allowed_sample_size [] = { 16, -1 };
 
-- 
1.5.6.3



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]