OLD | NEW |
1 /* | 1 /* |
2 * Deluxe Paint Animation demuxer | 2 * Deluxe Paint Animation demuxer |
3 * Copyright (c) 2009 Peter Ross | 3 * Copyright (c) 2009 Peter Ross |
4 * | 4 * |
5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
6 * | 6 * |
7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
(...skipping 21 matching lines...) Expand all Loading... |
32 unsigned int nb_records; | 32 unsigned int nb_records; |
33 int size; | 33 int size; |
34 } Page; | 34 } Page; |
35 | 35 |
36 typedef struct { | 36 typedef struct { |
37 unsigned int nb_pages; /** total pages in file */ | 37 unsigned int nb_pages; /** total pages in file */ |
38 unsigned int nb_records; /** total records in file */ | 38 unsigned int nb_records; /** total records in file */ |
39 int page_table_offset; | 39 int page_table_offset; |
40 #define MAX_PAGES 256 /** Deluxe Paint hardcoded value */ | 40 #define MAX_PAGES 256 /** Deluxe Paint hardcoded value */ |
41 Page pt[MAX_PAGES]; /** page table */ | 41 Page pt[MAX_PAGES]; /** page table */ |
42 int page; /** current page */ | 42 int page; /** current page (or AVERROR_xxx code) */ |
43 int record; /** current record (with in page) */ | 43 int record; /** current record (with in page) */ |
44 } AnmDemuxContext; | 44 } AnmDemuxContext; |
45 | 45 |
46 #define LPF_TAG MKTAG('L','P','F',' ') | 46 #define LPF_TAG MKTAG('L','P','F',' ') |
47 #define ANIM_TAG MKTAG('A','N','I','M') | 47 #define ANIM_TAG MKTAG('A','N','I','M') |
48 | 48 |
49 static int probe(AVProbeData *p) | 49 static int probe(AVProbeData *p) |
50 { | 50 { |
51 /* verify tags and video dimensions */ | 51 /* verify tags and video dimensions */ |
52 if (AV_RL32(&p->buf[0]) == LPF_TAG && | 52 if (AV_RL32(&p->buf[0]) == LPF_TAG && |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 { | 178 { |
179 AnmDemuxContext *anm = s->priv_data; | 179 AnmDemuxContext *anm = s->priv_data; |
180 ByteIOContext *pb = s->pb; | 180 ByteIOContext *pb = s->pb; |
181 Page *p; | 181 Page *p; |
182 int tmp, record_size; | 182 int tmp, record_size; |
183 | 183 |
184 if (url_feof(s->pb)) | 184 if (url_feof(s->pb)) |
185 return AVERROR(EIO); | 185 return AVERROR(EIO); |
186 | 186 |
187 if (anm->page < 0) | 187 if (anm->page < 0) |
188 return 0; | 188 return anm->page; |
189 | 189 |
190 repeat: | 190 repeat: |
191 p = &anm->pt[anm->page]; | 191 p = &anm->pt[anm->page]; |
192 | 192 |
193 /* parse page header */ | 193 /* parse page header */ |
194 if (anm->record < 0) { | 194 if (anm->record < 0) { |
195 url_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16), SE
EK_SET); | 195 url_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16), SE
EK_SET); |
196 url_fskip(pb, 8 + 2*p->nb_records); | 196 url_fskip(pb, 8 + 2*p->nb_records); |
197 anm->record = 0; | 197 anm->record = 0; |
198 } | 198 } |
(...skipping 27 matching lines...) Expand all Loading... |
226 } | 226 } |
227 | 227 |
228 AVInputFormat anm_demuxer = { | 228 AVInputFormat anm_demuxer = { |
229 "anm", | 229 "anm", |
230 NULL_IF_CONFIG_SMALL("Deluxe Paint Animation"), | 230 NULL_IF_CONFIG_SMALL("Deluxe Paint Animation"), |
231 sizeof(AnmDemuxContext), | 231 sizeof(AnmDemuxContext), |
232 probe, | 232 probe, |
233 read_header, | 233 read_header, |
234 read_packet, | 234 read_packet, |
235 }; | 235 }; |
OLD | NEW |