shithub: opus

Download patch

ref: a0d096f18f13b94ca1d804dfd9e21b42b6bcd702
parent: b271dae70cca6b6434f717e4a24c97b0d3735084
author: Gregory Maxwell <[email protected]>
date: Sat Jun 29 16:33:32 EDT 2013

Braces go on the next line.

--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -937,7 +937,8 @@
    case OPUS_GET_BANDWIDTH_REQUEST:
    {
       opus_int32 *value = va_arg(ap, opus_int32*);
-      if (!value) {
+      if (!value)
+      {
          goto bad_arg;
       }
       *value = st->bandwidth;
@@ -946,7 +947,8 @@
    case OPUS_GET_FINAL_RANGE_REQUEST:
    {
       opus_uint32 *value = va_arg(ap, opus_uint32*);
-      if (!value) {
+      if (!value)
+      {
          goto bad_arg;
       }
       *value = st->rangeFinal;
@@ -967,7 +969,8 @@
    case OPUS_GET_SAMPLE_RATE_REQUEST:
    {
       opus_int32 *value = va_arg(ap, opus_int32*);
-      if (!value) {
+      if (!value)
+      {
          goto bad_arg;
       }
       *value = st->Fs;
@@ -976,7 +979,8 @@
    case OPUS_GET_PITCH_REQUEST:
    {
       opus_int32 *value = va_arg(ap, opus_int32*);
-      if (!value) {
+      if (!value)
+      {
          goto bad_arg;
       }
       if (st->prev_mode == MODE_CELT_ONLY)
@@ -988,7 +992,8 @@
    case OPUS_GET_GAIN_REQUEST:
    {
       opus_int32 *value = va_arg(ap, opus_int32*);
-      if (!value) {
+      if (!value)
+      {
          goto bad_arg;
       }
       *value = st->decode_gain;
@@ -997,7 +1002,8 @@
    case OPUS_SET_GAIN_REQUEST:
    {
        opus_int32 value = va_arg(ap, opus_int32);
-       if (value<-32768 || value>32767) {
+       if (value<-32768 || value>32767)
+       {
           goto bad_arg;
        }
        st->decode_gain = value;
@@ -1006,7 +1012,8 @@
    case OPUS_GET_LAST_PACKET_DURATION_REQUEST:
    {
       opus_uint32 *value = va_arg(ap, opus_uint32*);
-      if (!value) {
+      if (!value)
+      {
          goto bad_arg;
       }
       *value = st->last_packet_duration;
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -1966,7 +1966,8 @@
         case OPUS_GET_APPLICATION_REQUEST:
         {
             opus_int32 *value = va_arg(ap, opus_int32*);
-            if (!value) {
+            if (!value)
+            {
                goto bad_arg;
             }
             *value = st->application;
@@ -1990,7 +1991,8 @@
         case OPUS_GET_BITRATE_REQUEST:
         {
             opus_int32 *value = va_arg(ap, opus_int32*);
-            if (!value) {
+            if (!value)
+            {
                goto bad_arg;
             }
             *value = user_bitrate_to_bitrate(st, st->prev_framesize, 1276);
@@ -1999,7 +2001,8 @@
         case OPUS_SET_FORCE_CHANNELS_REQUEST:
         {
             opus_int32 value = va_arg(ap, opus_int32);
-            if((value<1 || value>st->channels) && value != OPUS_AUTO) {
+            if((value<1 || value>st->channels) && value != OPUS_AUTO)
+            {
                goto bad_arg;
             }
             st->force_channels = value;
@@ -2008,7 +2011,8 @@
         case OPUS_GET_FORCE_CHANNELS_REQUEST:
         {
             opus_int32 *value = va_arg(ap, opus_int32*);
-            if (!value) {
+            if (!value)
+            {
                goto bad_arg;
             }
             *value = st->force_channels;
@@ -2017,7 +2021,8 @@
         case OPUS_SET_MAX_BANDWIDTH_REQUEST:
         {
             opus_int32 value = va_arg(ap, opus_int32);
-            if (value < OPUS_BANDWIDTH_NARROWBAND || value > OPUS_BANDWIDTH_FULLBAND) {
+            if (value < OPUS_BANDWIDTH_NARROWBAND || value > OPUS_BANDWIDTH_FULLBAND) 
+            {
                goto bad_arg;
             }
             st->max_bandwidth = value;
@@ -2033,7 +2038,8 @@
         case OPUS_GET_MAX_BANDWIDTH_REQUEST:
         {
             opus_int32 *value = va_arg(ap, opus_int32*);
-            if (!value) {
+            if (!value)
+            {
                goto bad_arg;
             }
             *value = st->max_bandwidth;
@@ -2042,7 +2048,8 @@
         case OPUS_SET_BANDWIDTH_REQUEST:
         {
             opus_int32 value = va_arg(ap, opus_int32);
-            if ((value < OPUS_BANDWIDTH_NARROWBAND || value > OPUS_BANDWIDTH_FULLBAND) && value != OPUS_AUTO) {
+            if ((value < OPUS_BANDWIDTH_NARROWBAND || value > OPUS_BANDWIDTH_FULLBAND) && value != OPUS_AUTO)
+            {
                goto bad_arg;
             }
             st->user_bandwidth = value;
@@ -2058,7 +2065,8 @@
         case OPUS_GET_BANDWIDTH_REQUEST:
         {
             opus_int32 *value = va_arg(ap, opus_int32*);
-            if (!value) {
+            if (!value)
+            {
                goto bad_arg;
             }
             *value = st->bandwidth;
@@ -2067,7 +2075,8 @@
         case OPUS_SET_DTX_REQUEST:
         {
             opus_int32 value = va_arg(ap, opus_int32);
-            if(value<0 || value>1) {
+            if(value<0 || value>1)
+            {
                goto bad_arg;
             }
             st->silk_mode.useDTX = value;
@@ -2076,7 +2085,8 @@
         case OPUS_GET_DTX_REQUEST:
         {
             opus_int32 *value = va_arg(ap, opus_int32*);
-            if (!value) {
+            if (!value)
+            {
                goto bad_arg;
             }
             *value = st->silk_mode.useDTX;
@@ -2085,7 +2095,8 @@
         case OPUS_SET_COMPLEXITY_REQUEST:
         {
             opus_int32 value = va_arg(ap, opus_int32);
-            if(value<0 || value>10) {
+            if(value<0 || value>10)
+            {
                goto bad_arg;
             }
             st->silk_mode.complexity = value;
@@ -2095,7 +2106,8 @@
         case OPUS_GET_COMPLEXITY_REQUEST:
         {
             opus_int32 *value = va_arg(ap, opus_int32*);
-            if (!value) {
+            if (!value)
+            {
                goto bad_arg;
             }
             *value = st->silk_mode.complexity;
@@ -2104,7 +2116,8 @@
         case OPUS_SET_INBAND_FEC_REQUEST:
         {
             opus_int32 value = va_arg(ap, opus_int32);
-            if(value<0 || value>1) {
+            if(value<0 || value>1)
+            {
                goto bad_arg;
             }
             st->silk_mode.useInBandFEC = value;
@@ -2113,7 +2126,8 @@
         case OPUS_GET_INBAND_FEC_REQUEST:
         {
             opus_int32 *value = va_arg(ap, opus_int32*);
-            if (!value) {
+            if (!value)
+            {
                goto bad_arg;
             }
             *value = st->silk_mode.useInBandFEC;
@@ -2122,7 +2136,8 @@
         case OPUS_SET_PACKET_LOSS_PERC_REQUEST:
         {
             opus_int32 value = va_arg(ap, opus_int32);
-            if (value < 0 || value > 100) {
+            if (value < 0 || value > 100)
+            {
                goto bad_arg;
             }
             st->silk_mode.packetLossPercentage = value;
@@ -2132,7 +2147,8 @@
         case OPUS_GET_PACKET_LOSS_PERC_REQUEST:
         {
             opus_int32 *value = va_arg(ap, opus_int32*);
-            if (!value) {
+            if (!value)
+            {
                goto bad_arg;
             }
             *value = st->silk_mode.packetLossPercentage;
@@ -2141,7 +2157,8 @@
         case OPUS_SET_VBR_REQUEST:
         {
             opus_int32 value = va_arg(ap, opus_int32);
-            if(value<0 || value>1) {
+            if(value<0 || value>1)
+            {
                goto bad_arg;
             }
             st->use_vbr = value;
@@ -2151,7 +2168,8 @@
         case OPUS_GET_VBR_REQUEST:
         {
             opus_int32 *value = va_arg(ap, opus_int32*);
-            if (!value) {
+            if (!value)
+            {
                goto bad_arg;
             }
             *value = st->use_vbr;
@@ -2160,7 +2178,8 @@
         case OPUS_SET_VOICE_RATIO_REQUEST:
         {
             opus_int32 value = va_arg(ap, opus_int32);
-            if (value<-1 || value>100) {
+            if (value<-1 || value>100)
+            {
                goto bad_arg;
             }
             st->voice_ratio = value;
@@ -2169,7 +2188,8 @@
         case OPUS_GET_VOICE_RATIO_REQUEST:
         {
             opus_int32 *value = va_arg(ap, opus_int32*);
-            if (!value) {
+            if (!value)
+            {
                goto bad_arg;
             }
             *value = st->voice_ratio;
@@ -2178,7 +2198,8 @@
         case OPUS_SET_VBR_CONSTRAINT_REQUEST:
         {
             opus_int32 value = va_arg(ap, opus_int32);
-            if(value<0 || value>1) {
+            if(value<0 || value>1)
+            {
                goto bad_arg;
             }
             st->vbr_constraint = value;
@@ -2187,7 +2208,8 @@
         case OPUS_GET_VBR_CONSTRAINT_REQUEST:
         {
             opus_int32 *value = va_arg(ap, opus_int32*);
-            if (!value) {
+            if (!value)
+            {
                goto bad_arg;
             }
             *value = st->vbr_constraint;
@@ -2196,7 +2218,8 @@
         case OPUS_SET_SIGNAL_REQUEST:
         {
             opus_int32 value = va_arg(ap, opus_int32);
-            if(value!=OPUS_AUTO && value!=OPUS_SIGNAL_VOICE && value!=OPUS_SIGNAL_MUSIC) {
+            if(value!=OPUS_AUTO && value!=OPUS_SIGNAL_VOICE && value!=OPUS_SIGNAL_MUSIC)
+            {
                goto bad_arg;
             }
             st->signal_type = value;
@@ -2205,7 +2228,8 @@
         case OPUS_GET_SIGNAL_REQUEST:
         {
             opus_int32 *value = va_arg(ap, opus_int32*);
-            if (!value) {
+            if (!value)
+            {
                goto bad_arg;
             }
             *value = st->signal_type;
@@ -2214,7 +2238,8 @@
         case OPUS_GET_LOOKAHEAD_REQUEST:
         {
             opus_int32 *value = va_arg(ap, opus_int32*);
-            if (!value) {
+            if (!value)
+            {
                goto bad_arg;
             }
             *value = st->Fs/400;
@@ -2225,7 +2250,8 @@
         case OPUS_GET_SAMPLE_RATE_REQUEST:
         {
             opus_int32 *value = va_arg(ap, opus_int32*);
-            if (!value) {
+            if (!value)
+            {
                goto bad_arg;
             }
             *value = st->Fs;
@@ -2234,7 +2260,8 @@
         case OPUS_GET_FINAL_RANGE_REQUEST:
         {
             opus_uint32 *value = va_arg(ap, opus_uint32*);
-            if (!value) {
+            if (!value)
+            {
                goto bad_arg;
             }
             *value = st->rangeFinal;
@@ -2243,7 +2270,8 @@
         case OPUS_SET_LSB_DEPTH_REQUEST:
         {
             opus_int32 value = va_arg(ap, opus_int32);
-            if (value<8 || value>24) {
+            if (value<8 || value>24)
+            {
                goto bad_arg;
             }
             st->lsb_depth=value;
@@ -2252,7 +2280,8 @@
         case OPUS_GET_LSB_DEPTH_REQUEST:
         {
             opus_int32 *value = va_arg(ap, opus_int32*);
-            if (!value) {
+            if (!value)
+            {
                goto bad_arg;
             }
             *value = st->lsb_depth;
@@ -2264,8 +2293,9 @@
             if (value != OPUS_FRAMESIZE_ARG   && value != OPUS_FRAMESIZE_2_5_MS &&
                 value != OPUS_FRAMESIZE_5_MS  && value != OPUS_FRAMESIZE_10_MS  &&
                 value != OPUS_FRAMESIZE_20_MS && value != OPUS_FRAMESIZE_40_MS  &&
-                value != OPUS_FRAMESIZE_60_MS && value != OPUS_FRAMESIZE_VARIABLE) {
-              goto bad_arg;
+                value != OPUS_FRAMESIZE_60_MS && value != OPUS_FRAMESIZE_VARIABLE)
+            {
+               goto bad_arg;
             }
             st->variable_duration = value;
             celt_encoder_ctl(celt_enc, OPUS_SET_EXPERT_FRAME_DURATION(value));
@@ -2274,7 +2304,8 @@
         case OPUS_GET_EXPERT_FRAME_DURATION_REQUEST:
         {
             opus_int32 *value = va_arg(ap, opus_int32*);
-            if (!value) {
+            if (!value)
+            {
                goto bad_arg;
             }
             *value = st->variable_duration;
@@ -2304,7 +2335,8 @@
         case OPUS_SET_FORCE_MODE_REQUEST:
         {
             opus_int32 value = va_arg(ap, opus_int32);
-            if ((value < MODE_SILK_ONLY || value > MODE_CELT_ONLY) && value != OPUS_AUTO) {
+            if ((value < MODE_SILK_ONLY || value > MODE_CELT_ONLY) && value != OPUS_AUTO)
+            {
                goto bad_arg;
             }
             st->user_forced_mode = value;
@@ -2320,7 +2352,8 @@
         case OPUS_SET_ENERGY_SAVE_REQUEST:
         {
             opus_val16 *value = va_arg(ap, opus_val16*);
-            if (!value) {
+            if (!value)
+            {
                goto bad_arg;
             }
             ret = celt_encoder_ctl(celt_enc, OPUS_SET_ENERGY_SAVE(value));
@@ -2337,7 +2370,8 @@
         case CELT_GET_MODE_REQUEST:
         {
            const CELTMode ** value = va_arg(ap, const CELTMode**);
-           if (!value) {
+           if (!value)
+           {
               goto bad_arg;
            }
            ret = celt_encoder_ctl(celt_enc, CELT_GET_MODE(value));
--- a/src/opus_multistream_decoder.c
+++ b/src/opus_multistream_decoder.c
@@ -400,7 +400,8 @@
           int s;
           opus_uint32 *value = va_arg(ap, opus_uint32*);
           opus_uint32 tmp;
-          if (!value) {
+          if (!value)
+          {
              goto bad_arg;
           }
           *value = 0;
@@ -445,7 +446,8 @@
           if (stream_id<0 || stream_id >= st->layout.nb_streams)
              ret = OPUS_BAD_ARG;
           value = va_arg(ap, OpusDecoder**);
-          if (!value) {
+          if (!value)
+          {
              goto bad_arg;
           }
           for (s=0;s<stream_id;s++)
--- a/src/opus_multistream_encoder.c
+++ b/src/opus_multistream_encoder.c
@@ -852,7 +852,8 @@
    case OPUS_SET_BITRATE_REQUEST:
    {
       opus_int32 value = va_arg(ap, opus_int32);
-      if (value<0 && value!=OPUS_AUTO && value!=OPUS_BITRATE_MAX) {
+      if (value<0 && value!=OPUS_AUTO && value!=OPUS_BITRATE_MAX)
+      {
          goto bad_arg;
       }
       st->bitrate_bps = value;
@@ -862,7 +863,8 @@
    {
       int s;
       opus_int32 *value = va_arg(ap, opus_int32*);
-      if (!value) {
+      if (!value)
+      {
          goto bad_arg;
       }
       *value = 0;
@@ -907,7 +909,8 @@
       int s;
       opus_uint32 *value = va_arg(ap, opus_uint32*);
       opus_uint32 tmp;
-      if (!value) {
+      if (!value)
+      {
          goto bad_arg;
       }
       *value=0;
@@ -965,7 +968,8 @@
       if (stream_id<0 || stream_id >= st->layout.nb_streams)
          ret = OPUS_BAD_ARG;
       value = va_arg(ap, OpusEncoder**);
-      if (!value) {
+      if (!value)
+      {
          goto bad_arg;
       }
       for (s=0;s<stream_id;s++)
@@ -987,7 +991,8 @@
    case OPUS_GET_EXPERT_FRAME_DURATION_REQUEST:
    {
        opus_int32 *value = va_arg(ap, opus_int32*);
-       if (!value) {
+       if (!value)
+       {
           goto bad_arg;
        }
        *value = st->variable_duration;