]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix name
authorBrian West <brian@freeswitch.org>
Wed, 30 Aug 2006 16:31:35 +0000 (16:31 +0000)
committerBrian West <brian@freeswitch.org>
Wed, 30 Aug 2006 16:31:35 +0000 (16:31 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2453 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/codecs/mod_g723/mod_g723_1.c [moved from src/mod/codecs/mod_g723/mod_g723.c with 99% similarity]
src/mod/codecs/mod_g726/mod_g726.c

similarity index 99%
rename from src/mod/codecs/mod_g723/mod_g723.c
rename to src/mod/codecs/mod_g723/mod_g723_1.c
index ef5a6fd5b24dad97383401181e7f593fe48f4e0a..08595e0bce22e5a4b52d15dfa48685b7371d576a 100644 (file)
@@ -46,7 +46,7 @@ Flag UseVx = True;
 
 enum Crate WrkRate = Rate63;
 
-static const char modname[] = "mod_g723";
+static const char modname[] = "mod_g723_1";
 
 struct g723_context {
        struct cod_state encoder_object;
index a4139df09021873c2c93101bab745fa0f2b912f7..42d46f441b9058e56128e7e462e3a2b7528d3119 100644 (file)
@@ -43,6 +43,7 @@ typedef struct {
        uint8_t bits_per_frame;
        uint8_t bits;
        uint8_t bbits;
+       uint8_t ecount;
        uint8_t d_bits;
        uint8_t d_bbits;
        uint8_t dcount;
@@ -131,12 +132,15 @@ static switch_status_t switch_g726_encode(switch_codec_t *codec,
 
                for (x = 0; x < loops && new_len < *encoded_data_len; x++) {
                        int edata = encoder(*ddp, AUDIO_ENCODING_LINEAR, context);
-
+                       
+                       
+                       handle->ecount++;
                        if (!handle->bbits) {
                                *handle->ptr = edata;
                        } else if ((handle->bbits + handle->bits_per_frame) <= BITS_IN_A_BYTE) {
-                               *handle->ptr <<= handle->bits_per_frame;
-                               *handle->ptr |= edata;
+                               printf ("WTF %d\n", BITS_IN_A_BYTE - (handle->bits_per_frame * handle->ecount));
+                               *handle->ptr += (edata << (BITS_IN_A_BYTE - (handle->bits_per_frame * handle->ecount)));
+                               handle->ecount = 0;
                        } else {
                                int remain, next, rdata, ndata;
 
@@ -145,16 +149,11 @@ static switch_status_t switch_g726_encode(switch_codec_t *codec,
                                rdata = edata;
                                ndata = edata;
 
-                               rdata >>= remain;
-                               *handle->ptr <<= remain;
-                               *handle->ptr |= rdata;
-
-                               handle->ptr++;
-                               
-                               ndata &= (1 << next) - 1;
+                               *handle->ptr += (edata << remain);
                                *handle->ptr = ndata;
 
                                handle->bbits = 0;
+                               handle->ecount = 0;
                        }
                        handle->bits += handle->bits_per_frame;
                        handle->bbits += handle->bits_per_frame;