annotate aasc.c @ 4761:4effe3bde31b libavcodec

support for the THP game format by Marco Gerards, mgerards xs4all nl
author diego
date Sun, 01 Apr 2007 14:28:48 +0000
parents 59f4fb490fa7
children b3ee9a1526b0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2588
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
1 /*
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
2 * Autodesc RLE Decoder
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
3 * Copyright (C) 2005 the ffmpeg project
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
4 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
5 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
6 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
2588
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
2588
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
11 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
2588
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
15 * Lesser General Public License for more details.
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
16 *
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
3036
0b546eab515d Update licensing information: The FSF changed postal address.
diego
parents: 2588
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2588
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
20 */
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
21
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
22 /**
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
23 * @file aasc.c
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
24 * Autodesc RLE Video Decoder by Konstantin Shishkov
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
25 */
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
26
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
27 #include <stdio.h>
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
28 #include <stdlib.h>
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
29 #include <string.h>
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
30
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
31 #include "common.h"
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
32 #include "avcodec.h"
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
33 #include "dsputil.h"
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
34
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
35 typedef struct AascContext {
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
36 AVCodecContext *avctx;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
37 AVFrame frame;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
38 } AascContext;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
39
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
40 #define FETCH_NEXT_STREAM_BYTE() \
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
41 if (stream_ptr >= buf_size) \
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
42 { \
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
43 av_log(s->avctx, AV_LOG_ERROR, " AASC: stream ptr just went out of bounds (fetch)\n"); \
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
44 break; \
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
45 } \
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
46 stream_byte = buf[stream_ptr++];
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
47
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
48 static int aasc_decode_init(AVCodecContext *avctx)
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
49 {
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
50 AascContext *s = (AascContext *)avctx->priv_data;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
51
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
52 s->avctx = avctx;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
53
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
54 avctx->pix_fmt = PIX_FMT_BGR24;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
55 s->frame.data[0] = NULL;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
56
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
57 return 0;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
58 }
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
59
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
60 static int aasc_decode_frame(AVCodecContext *avctx,
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
61 void *data, int *data_size,
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
62 uint8_t *buf, int buf_size)
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
63 {
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
64 AascContext *s = (AascContext *)avctx->priv_data;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
65 int stream_ptr = 4;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
66 unsigned char rle_code;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
67 unsigned char stream_byte;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
68 int pixel_ptr = 0;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
69 int row_dec, row_ptr;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
70 int frame_size;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
71 int i;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
72
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
73 s->frame.reference = 1;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
74 s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
75 if (avctx->reget_buffer(avctx, &s->frame)) {
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
76 av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
77 return -1;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
78 }
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
79
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
80 row_dec = s->frame.linesize[0];
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
81 row_ptr = (s->avctx->height - 1) * row_dec;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
82 frame_size = row_dec * s->avctx->height;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
83
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
84 while (row_ptr >= 0) {
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
85 FETCH_NEXT_STREAM_BYTE();
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
86 rle_code = stream_byte;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
87 if (rle_code == 0) {
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
88 /* fetch the next byte to see how to handle escape code */
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
89 FETCH_NEXT_STREAM_BYTE();
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
90 if (stream_byte == 0) {
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
91 /* line is done, goto the next one */
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
92 row_ptr -= row_dec;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
93 pixel_ptr = 0;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
94 } else if (stream_byte == 1) {
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
95 /* decode is done */
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
96 break;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
97 } else if (stream_byte == 2) {
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
98 /* reposition frame decode coordinates */
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
99 FETCH_NEXT_STREAM_BYTE();
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
100 pixel_ptr += stream_byte;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
101 FETCH_NEXT_STREAM_BYTE();
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
102 row_ptr -= stream_byte * row_dec;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
103 } else {
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
104 /* copy pixels from encoded stream */
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
105 if ((pixel_ptr + stream_byte > avctx->width * 3) ||
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
106 (row_ptr < 0)) {
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
107 av_log(s->avctx, AV_LOG_ERROR, " AASC: frame ptr just went out of bounds (copy1)\n");
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
108 break;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
109 }
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
110
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
111 rle_code = stream_byte;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
112 if (stream_ptr + rle_code > buf_size) {
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
113 av_log(s->avctx, AV_LOG_ERROR, " AASC: stream ptr just went out of bounds (copy2)\n");
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
114 break;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
115 }
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
116
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
117 for (i = 0; i < rle_code; i++) {
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
118 FETCH_NEXT_STREAM_BYTE();
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
119 s->frame.data[0][row_ptr + pixel_ptr] = stream_byte;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
120 pixel_ptr++;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
121 }
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
122 if (rle_code & 1)
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
123 stream_ptr++;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
124 }
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
125 } else {
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
126 /* decode a run of data */
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
127 if ((pixel_ptr + rle_code > avctx->width * 3) ||
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
128 (row_ptr < 0)) {
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
129 av_log(s->avctx, AV_LOG_ERROR, " AASC: frame ptr just went out of bounds (run1)\n");
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
130 break;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
131 }
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
132
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
133 FETCH_NEXT_STREAM_BYTE();
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
134
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
135 while(rle_code--) {
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
136 s->frame.data[0][row_ptr + pixel_ptr] = stream_byte;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
137 pixel_ptr++;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
138 }
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
139 }
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
140 }
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
141
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
142 /* one last sanity check on the way out */
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
143 if (stream_ptr < buf_size)
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
144 av_log(s->avctx, AV_LOG_ERROR, " AASC: ended frame decode with bytes left over (%d < %d)\n",
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
145 stream_ptr, buf_size);
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
146
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
147 *data_size = sizeof(AVFrame);
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
148 *(AVFrame*)data = s->frame;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
149
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
150 /* report that the buffer was completely consumed */
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
151 return buf_size;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
152 }
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
153
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
154 static int aasc_decode_end(AVCodecContext *avctx)
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
155 {
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
156 AascContext *s = (AascContext *)avctx->priv_data;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
157
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
158 /* release the last frame */
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
159 if (s->frame.data[0])
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
160 avctx->release_buffer(avctx, &s->frame);
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
161
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
162 return 0;
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
163 }
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
164
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
165 AVCodec aasc_decoder = {
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
166 "aasc",
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
167 CODEC_TYPE_VIDEO,
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
168 CODEC_ID_AASC,
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
169 sizeof(AascContext),
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
170 aasc_decode_init,
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
171 NULL,
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
172 aasc_decode_end,
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
173 aasc_decode_frame,
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
174 CODEC_CAP_DR1,
b6b618986f80 Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff changeset
175 };