]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/bitstream.c
lavc: add MMAL hardware decoder wrapper
[ffmpeg] / libavcodec / bitstream.c
index e7c476ba4bc75473ce246f14d5b8a59e7d6e5933..f36997ea40177d372d6b7907f22f86ac586e014a 100644 (file)
@@ -106,12 +106,17 @@ static int alloc_table(VLC *vlc, int size, int use_static)
 
     vlc->table_size += size;
     if (vlc->table_size > vlc->table_allocated) {
+        int err;
         if (use_static)
             return AVERROR_BUG;
         vlc->table_allocated += (1 << vlc->bits);
-        vlc->table = av_realloc(vlc->table, sizeof(VLC_TYPE) * 2 * vlc->table_allocated);
-        if (!vlc->table)
-            return AVERROR(ENOMEM);
+        if ((err = av_reallocp(&vlc->table,
+                               sizeof(VLC_TYPE) * 2 *
+                               vlc->table_allocated)) < 0) {
+            vlc->table_allocated = 0;
+            vlc->table_size = 0;
+            return err;
+        }
     }
     return index;
 }
@@ -124,7 +129,7 @@ static av_always_inline uint32_t bitswap_32(uint32_t x)
            (uint32_t)ff_reverse[ x >> 24];
 }
 
-typedef struct {
+typedef struct VLCcode {
     uint8_t bits;
     uint16_t symbol;
     /** codeword, with the first bit-to-be-read in the msb