shithub: opus

Download patch

ref: 9f555bc4e7c04ce8c2119979e0138a1a7ae9c2c4
parent: 6696a1443bd6da8c8fbe26ddc5e12baa7eb2b75c
author: Jean-Marc Valin <[email protected]>
date: Mon Aug 22 22:56:12 EDT 2011

encode_size() moved out of opus_encoder.c

--- a/src/opus.c
+++ b/src/opus.c
@@ -30,10 +30,24 @@
 #endif
 
 #include "opus.h"
+#include "opus_private.h"
 
 #ifndef OPUS_VERSION
 #define OPUS_VERSION "unknown"
 #endif
+
+int encode_size(int size, unsigned char *data)
+{
+   if (size < 252)
+   {
+      data[0] = size;
+      return 1;
+   } else {
+      data[0] = 252+(size&0x3);
+      data[1] = (size-(int)data[0])>>2;
+      return 2;
+   }
+}
 
 const char *opus_strerror(int error)
 {
--- a/src/opus_private.h
+++ b/src/opus_private.h
@@ -29,6 +29,8 @@
 #ifndef OPUS_PRIVATE_H
 #define OPUS_PRIVATE_H
 
+int encode_size(int size, unsigned char *data);
+
 /* Make sure everything's aligned to 4 bytes (this may need to be increased
    on really weird architectures) */
 static inline int align(int i)
--- a/src/repacketizer.c
+++ b/src/repacketizer.c
@@ -42,18 +42,7 @@
    int framesize;
 };
 
-static int encode_size(int size, unsigned char *data)
-{
-   if (size < 252)
-   {
-      data[0] = size;
-      return 1;
-   } else {
-      data[0] = 252+(size&0x3);
-      data[1] = (size-(int)data[0])>>2;
-      return 2;
-   }
-}
+
 
 int opus_repacketizer_get_size(void)
 {