]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blobdiff - libavcodec/cscd.c
Fix segault
[frescor/ffmpeg.git] / libavcodec / cscd.c
index 55bf2ec1282421d32e10126e27d04429935d23a9..5fe097712d2d70897bc0b762cf52b09deabeebca 100644 (file)
@@ -135,7 +135,9 @@ static void add_frame_32(AVFrame *f, const uint8_t *src,
 #endif
 
 static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
-                        const uint8_t *buf, int buf_size) {
+                        AVPacket *avpkt) {
+    const uint8_t *buf = avpkt->data;
+    int buf_size = avpkt->size;
     CamStudioContext *c = avctx->priv_data;
     AVFrame *picture = data;
 
@@ -158,7 +160,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     switch ((buf[0] >> 1) & 7) {
         case 0: { // lzo compression
             int outlen = c->decomp_size, inlen = buf_size - 2;
-            if (lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen))
+            if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen))
                 av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
             break;
         }
@@ -232,7 +234,7 @@ static av_cold int decode_init(AVCodecContext *avctx) {
     c->linelen = avctx->width * avctx->bits_per_coded_sample / 8;
     c->height = avctx->height;
     c->decomp_size = c->height * c->linelen;
-    c->decomp_buf = av_malloc(c->decomp_size + LZO_OUTPUT_PADDING);
+    c->decomp_buf = av_malloc(c->decomp_size + AV_LZO_OUTPUT_PADDING);
     if (!c->decomp_buf) {
         av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
         return 1;