Mercurial > libavcodec.hg
annotate aasc.c @ 5821:51918cb97f6f libavcodec
add support for VP6 with huffman encoded blocks
closes issue 104
author | aurel |
---|---|
date | Sun, 14 Oct 2007 22:30:59 +0000 |
parents | f99e40a7155b |
children | b42a510e0939 |
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 "avcodec.h" |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
32 #include "dsputil.h" |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
33 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
34 typedef struct AascContext { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
35 AVCodecContext *avctx; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
36 AVFrame frame; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
37 } AascContext; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
38 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
39 #define FETCH_NEXT_STREAM_BYTE() \ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
40 if (stream_ptr >= buf_size) \ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
41 { \ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
42 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
|
43 break; \ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
44 } \ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
45 stream_byte = buf[stream_ptr++]; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
46 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
47 static int aasc_decode_init(AVCodecContext *avctx) |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
48 { |
4827 | 49 AascContext *s = avctx->priv_data; |
2588
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
50 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
51 s->avctx = avctx; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
52 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
53 avctx->pix_fmt = PIX_FMT_BGR24; |
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 { |
4827 | 63 AascContext *s = avctx->priv_data; |
2588
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 { |
4827 | 155 AascContext *s = avctx->priv_data; |
2588
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 }; |