]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/aasc.c
dirac: add Comments and references to the standard
[ffmpeg] / libavcodec / aasc.c
index 11ea5779b1a29d3fdbb1a5679d5f644f8d2ba6bc..f27f44dd51003eca922a77d9894ad3f7002811d1 100644 (file)
 
 typedef struct AascContext {
     AVCodecContext *avctx;
+    GetByteContext gb;
     AVFrame frame;
 } AascContext;
 
-#define FETCH_NEXT_STREAM_BYTE() \
-    if (stream_ptr >= buf_size) \
-    { \
-      av_log(s->avctx, AV_LOG_ERROR, " AASC: stream ptr just went out of bounds (fetch)\n"); \
-      break; \
-    } \
-    stream_byte = buf[stream_ptr++];
-
 static av_cold int aasc_decode_init(AVCodecContext *avctx)
 {
     AascContext *s = avctx->priv_data;
@@ -84,7 +77,8 @@ static int aasc_decode_frame(AVCodecContext *avctx,
         }
         break;
     case 1:
-        ff_msrle_decode(avctx, (AVPicture*)&s->frame, 8, buf - 4, buf_size + 4);
+        bytestream2_init(&s->gb, buf - 4, buf_size + 4);
+        ff_msrle_decode(avctx, (AVPicture*)&s->frame, 8, &s->gb);
         break;
     default:
         av_log(avctx, AV_LOG_ERROR, "Unknown compression type %d\n", compr);
@@ -112,11 +106,11 @@ static av_cold int aasc_decode_end(AVCodecContext *avctx)
 AVCodec ff_aasc_decoder = {
     .name           = "aasc",
     .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = CODEC_ID_AASC,
+    .id             = AV_CODEC_ID_AASC,
     .priv_data_size = sizeof(AascContext),
     .init           = aasc_decode_init,
     .close          = aasc_decode_end,
     .decode         = aasc_decode_frame,
     .capabilities   = CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Autodesk RLE"),
+    .long_name      = NULL_IF_CONFIG_SMALL("Autodesk RLE"),
 };