Mercurial > libavcodec.hg
annotate aasc.c @ 3006:4007989367bc libavcodec
TrueSpeech compatible audio decoder by Konstantin Shishkov
author | diego |
---|---|
date | Tue, 03 Jan 2006 02:30:38 +0000 |
parents | b6b618986f80 |
children | 0b546eab515d |
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 * |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
5 * This library is free software; you can redistribute it and/or |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
6 * 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
|
7 * License as published by the Free Software Foundation; either |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
8 * version 2 of the License, or (at your option) any later version. |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
9 * |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
10 * This library is distributed in the hope that it will be useful, |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
13 * Lesser General Public License for more details. |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
14 * |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
15 * You should have received a copy of the GNU Lesser General Public |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
16 * License along with this library; if not, write to the Free Software |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
18 */ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
19 |
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 * @file aasc.c |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
22 * Autodesc RLE Video Decoder by Konstantin Shishkov |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
23 */ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
24 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
25 #include <stdio.h> |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
26 #include <stdlib.h> |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
27 #include <string.h> |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
28 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
29 #include "common.h" |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
30 #include "avcodec.h" |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
31 #include "dsputil.h" |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
32 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
33 typedef struct AascContext { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
34 AVCodecContext *avctx; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
35 AVFrame frame; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
36 } AascContext; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
37 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
38 #define FETCH_NEXT_STREAM_BYTE() \ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
39 if (stream_ptr >= buf_size) \ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
40 { \ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
41 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
|
42 break; \ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
43 } \ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
44 stream_byte = buf[stream_ptr++]; |
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 static int aasc_decode_init(AVCodecContext *avctx) |
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 AascContext *s = (AascContext *)avctx->priv_data; |
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 s->avctx = avctx; |
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 avctx->pix_fmt = PIX_FMT_BGR24; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
53 avctx->has_b_frames = 0; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
54 s->frame.data[0] = NULL; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
55 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
56 return 0; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
57 } |
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 static int aasc_decode_frame(AVCodecContext *avctx, |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
60 void *data, int *data_size, |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
61 uint8_t *buf, int buf_size) |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
62 { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
63 AascContext *s = (AascContext *)avctx->priv_data; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
64 int stream_ptr = 4; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
65 unsigned char rle_code; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
66 unsigned char stream_byte; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
67 int pixel_ptr = 0; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
68 int row_dec, row_ptr; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
69 int frame_size; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
70 int i; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
71 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
72 s->frame.reference = 1; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
73 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
|
74 if (avctx->reget_buffer(avctx, &s->frame)) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
75 av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
76 return -1; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
77 } |
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 row_dec = s->frame.linesize[0]; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
80 row_ptr = (s->avctx->height - 1) * row_dec; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
81 frame_size = row_dec * s->avctx->height; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
82 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
83 while (row_ptr >= 0) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
84 FETCH_NEXT_STREAM_BYTE(); |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
85 rle_code = stream_byte; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
86 if (rle_code == 0) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
87 /* 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
|
88 FETCH_NEXT_STREAM_BYTE(); |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
89 if (stream_byte == 0) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
90 /* line is done, goto the next one */ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
91 row_ptr -= row_dec; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
92 pixel_ptr = 0; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
93 } else if (stream_byte == 1) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
94 /* decode is done */ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
95 break; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
96 } else if (stream_byte == 2) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
97 /* reposition frame decode coordinates */ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
98 FETCH_NEXT_STREAM_BYTE(); |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
99 pixel_ptr += stream_byte; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
100 FETCH_NEXT_STREAM_BYTE(); |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
101 row_ptr -= stream_byte * row_dec; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
102 } else { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
103 /* copy pixels from encoded stream */ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
104 if ((pixel_ptr + stream_byte > avctx->width * 3) || |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
105 (row_ptr < 0)) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
106 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
|
107 break; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
108 } |
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 rle_code = stream_byte; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
111 if (stream_ptr + rle_code > buf_size) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
112 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
|
113 break; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
114 } |
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 for (i = 0; i < rle_code; i++) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
117 FETCH_NEXT_STREAM_BYTE(); |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
118 s->frame.data[0][row_ptr + pixel_ptr] = stream_byte; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
119 pixel_ptr++; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
120 } |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
121 if (rle_code & 1) |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
122 stream_ptr++; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
123 } |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
124 } else { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
125 /* decode a run of data */ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
126 if ((pixel_ptr + rle_code > avctx->width * 3) || |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
127 (row_ptr < 0)) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
128 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
|
129 break; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
130 } |
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 FETCH_NEXT_STREAM_BYTE(); |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
133 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
134 while(rle_code--) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
135 s->frame.data[0][row_ptr + pixel_ptr] = stream_byte; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
136 pixel_ptr++; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
137 } |
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 /* one last sanity check on the way out */ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
142 if (stream_ptr < buf_size) |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
143 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
|
144 stream_ptr, buf_size); |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
145 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
146 *data_size = sizeof(AVFrame); |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
147 *(AVFrame*)data = s->frame; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
148 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
149 /* report that the buffer was completely consumed */ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
150 return buf_size; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
151 } |
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 static int aasc_decode_end(AVCodecContext *avctx) |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
154 { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
155 AascContext *s = (AascContext *)avctx->priv_data; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
156 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
157 /* release the last frame */ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
158 if (s->frame.data[0]) |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
159 avctx->release_buffer(avctx, &s->frame); |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
160 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
161 return 0; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
162 } |
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 AVCodec aasc_decoder = { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
165 "aasc", |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
166 CODEC_TYPE_VIDEO, |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
167 CODEC_ID_AASC, |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
168 sizeof(AascContext), |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
169 aasc_decode_init, |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
170 NULL, |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
171 aasc_decode_end, |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
172 aasc_decode_frame, |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
173 CODEC_CAP_DR1, |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
174 }; |