Mercurial > libavcodec.hg
annotate aasc.c @ 4497:3975e734e07e libavcodec
doxygenize
author | michael |
---|---|
date | Wed, 07 Feb 2007 14:53:25 +0000 |
parents | c8c591fe26f8 |
children | 59f4fb490fa7 |
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 avctx->has_b_frames = 0; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
56 s->frame.data[0] = NULL; |
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 return 0; |
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 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
61 static int aasc_decode_frame(AVCodecContext *avctx, |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
62 void *data, int *data_size, |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
63 uint8_t *buf, int buf_size) |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
64 { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
65 AascContext *s = (AascContext *)avctx->priv_data; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
66 int stream_ptr = 4; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
67 unsigned char rle_code; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
68 unsigned char stream_byte; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
69 int pixel_ptr = 0; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
70 int row_dec, row_ptr; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
71 int frame_size; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
72 int i; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
73 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
74 s->frame.reference = 1; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
75 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
|
76 if (avctx->reget_buffer(avctx, &s->frame)) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
77 av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
78 return -1; |
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 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
81 row_dec = s->frame.linesize[0]; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
82 row_ptr = (s->avctx->height - 1) * row_dec; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
83 frame_size = row_dec * s->avctx->height; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
84 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
85 while (row_ptr >= 0) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
86 FETCH_NEXT_STREAM_BYTE(); |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
87 rle_code = stream_byte; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
88 if (rle_code == 0) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
89 /* 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
|
90 FETCH_NEXT_STREAM_BYTE(); |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
91 if (stream_byte == 0) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
92 /* line is done, goto the next one */ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
93 row_ptr -= row_dec; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
94 pixel_ptr = 0; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
95 } else if (stream_byte == 1) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
96 /* decode is done */ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
97 break; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
98 } else if (stream_byte == 2) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
99 /* reposition frame decode coordinates */ |
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 pixel_ptr += stream_byte; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
102 FETCH_NEXT_STREAM_BYTE(); |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
103 row_ptr -= stream_byte * row_dec; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
104 } else { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
105 /* copy pixels from encoded stream */ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
106 if ((pixel_ptr + stream_byte > avctx->width * 3) || |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
107 (row_ptr < 0)) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
108 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
|
109 break; |
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 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
112 rle_code = stream_byte; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
113 if (stream_ptr + rle_code > buf_size) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
114 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
|
115 break; |
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 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
118 for (i = 0; i < rle_code; i++) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
119 FETCH_NEXT_STREAM_BYTE(); |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
120 s->frame.data[0][row_ptr + pixel_ptr] = stream_byte; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
121 pixel_ptr++; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
122 } |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
123 if (rle_code & 1) |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
124 stream_ptr++; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
125 } |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
126 } else { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
127 /* decode a run of data */ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
128 if ((pixel_ptr + rle_code > avctx->width * 3) || |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
129 (row_ptr < 0)) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
130 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
|
131 break; |
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 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
134 FETCH_NEXT_STREAM_BYTE(); |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
135 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
136 while(rle_code--) { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
137 s->frame.data[0][row_ptr + pixel_ptr] = stream_byte; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
138 pixel_ptr++; |
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 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
143 /* one last sanity check on the way out */ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
144 if (stream_ptr < buf_size) |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
145 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
|
146 stream_ptr, buf_size); |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
147 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
148 *data_size = sizeof(AVFrame); |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
149 *(AVFrame*)data = s->frame; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
150 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
151 /* report that the buffer was completely consumed */ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
152 return buf_size; |
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 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
155 static int aasc_decode_end(AVCodecContext *avctx) |
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 AascContext *s = (AascContext *)avctx->priv_data; |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
158 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
159 /* release the last frame */ |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
160 if (s->frame.data[0]) |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
161 avctx->release_buffer(avctx, &s->frame); |
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 return 0; |
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 |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
166 AVCodec aasc_decoder = { |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
167 "aasc", |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
168 CODEC_TYPE_VIDEO, |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
169 CODEC_ID_AASC, |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
170 sizeof(AascContext), |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
171 aasc_decode_init, |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
172 NULL, |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
173 aasc_decode_end, |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
174 aasc_decode_frame, |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
175 CODEC_CAP_DR1, |
b6b618986f80
Autodesk Animator Studio Codec (AASC) video decoder, courtesy of
melanson
parents:
diff
changeset
|
176 }; |