changeset 643:db8f45986cff libavutil

Add av_ prefix to LZO stuff and thus make it officially part of the public API. Keep lzo1x_decode until the next major version bump for binary compatibility.
author reimar
date Mon, 02 Feb 2009 20:16:00 +0000
parents 70bdd5501662
children 8bcaa41403bd
files lzo.c lzo.h
diffstat 2 files changed, 24 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/lzo.c	Sun Feb 01 02:00:19 2009 +0000
+++ b/lzo.c	Mon Feb 02 20:16:00 2009 +0000
@@ -41,7 +41,7 @@
 static inline int get_byte(LZOContext *c) {
     if (c->in < c->in_end)
         return *c->in++;
-    c->error |= LZO_INPUT_DEPLETED;
+    c->error |= AV_LZO_INPUT_DEPLETED;
     return 1;
 }
 
@@ -88,11 +88,11 @@
     register uint8_t *dst = c->out;
     if (cnt > c->in_end - src) {
         cnt = FFMAX(c->in_end - src, 0);
-        c->error |= LZO_INPUT_DEPLETED;
+        c->error |= AV_LZO_INPUT_DEPLETED;
     }
     if (cnt > c->out_end - dst) {
         cnt = FFMAX(c->out_end - dst, 0);
-        c->error |= LZO_OUTPUT_FULL;
+        c->error |= AV_LZO_OUTPUT_FULL;
     }
 #if defined(INBUF_PADDED) && defined(OUTBUF_PADDED)
     COPY4(dst, src);
@@ -120,12 +120,12 @@
     register const uint8_t *src = &c->out[-back];
     register uint8_t *dst = c->out;
     if (src < c->out_start || src > dst) {
-        c->error |= LZO_INVALID_BACKPTR;
+        c->error |= AV_LZO_INVALID_BACKPTR;
         return;
     }
     if (cnt > c->out_end - dst) {
         cnt = FFMAX(c->out_end - dst, 0);
-        c->error |= LZO_OUTPUT_FULL;
+        c->error |= AV_LZO_OUTPUT_FULL;
     }
     memcpy_backptr(dst, back, cnt);
     c->out = dst + cnt;
@@ -187,9 +187,9 @@
  * \return 0 on success, otherwise error flags, see lzo.h
  *
  * Make sure all buffers are appropriately padded, in must provide
- * LZO_INPUT_PADDING, out must provide LZO_OUTPUT_PADDING additional bytes.
+ * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes.
  */
-int lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) {
+int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) {
     int state= 0;
     int x;
     LZOContext c;
@@ -202,10 +202,10 @@
     if (x > 17) {
         copy(&c, x - 17);
         x = GETB(c);
-        if (x < 16) c.error |= LZO_ERROR;
+        if (x < 16) c.error |= AV_LZO_ERROR;
     }
     if (c.in > c.in_end)
-        c.error |= LZO_INPUT_DEPLETED;
+        c.error |= AV_LZO_INPUT_DEPLETED;
     while (!c.error) {
         int cnt, back;
         if (x > 15) {
@@ -223,7 +223,7 @@
                 back += (GETB(c) << 6) + (x >> 2);
                 if (back == (1 << 14)) {
                     if (cnt != 1)
-                        c.error |= LZO_ERROR;
+                        c.error |= AV_LZO_ERROR;
                     break;
                 }
             }
@@ -252,6 +252,12 @@
     return c.error;
 }
 
+#if LIBAVUTIL_VERSION_MAJOR < 50
+int lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) {
+    return av_lzo1x_decode(out, outlen, in, inlen);
+}
+#endif
+
 #ifdef TEST
 #include <stdio.h>
 #include <lzo/lzo1x.h>
@@ -277,7 +283,7 @@
 #elif defined(LIBLZO_UNSAFE)
         if (lzo1x_decompress(comp, inlen, decomp, &outlen, NULL))
 #else
-        if (lzo1x_decode(decomp, &outlen, comp, &inlen))
+        if (av_lzo1x_decode(decomp, &outlen, comp, &inlen))
 #endif
             av_log(NULL, AV_LOG_ERROR, "decompression error\n");
 STOP_TIMER("lzod")
--- a/lzo.h	Sun Feb 01 02:00:19 2009 +0000
+++ b/lzo.h	Mon Feb 02 20:16:00 2009 +0000
@@ -24,15 +24,15 @@
 
 #include <stdint.h>
 
-#define LZO_INPUT_DEPLETED 1
-#define LZO_OUTPUT_FULL 2
-#define LZO_INVALID_BACKPTR 4
-#define LZO_ERROR 8
+#define AV_LZO_INPUT_DEPLETED 1
+#define AV_LZO_OUTPUT_FULL 2
+#define AV_LZO_INVALID_BACKPTR 4
+#define AV_LZO_ERROR 8
 
-#define LZO_INPUT_PADDING 8
-#define LZO_OUTPUT_PADDING 12
+#define AV_LZO_INPUT_PADDING 8
+#define AV_LZO_OUTPUT_PADDING 12
 
-int lzo1x_decode(void *out, int *outlen, const void *in, int *inlen);
+int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen);
 
 void av_memcpy_backptr(uint8_t *dst, int back, int cnt);