File indexing completed on 2025-01-05 04:01:13

0001 /*
0002  * SPDX-FileCopyrightText: 2019-2023 Mattia Basaglia <dev@dragon.best>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 #pragma once
0007 
0008 #include "riff.hpp"
0009 
0010 namespace glaxnimate::io::aep {
0011 
0012 class AepRiff : public RiffReader
0013 {
0014 public:
0015     static bool is_fake_list(const ChunkId& header)
0016     {
0017         return header == "tdsn" || header == "fnam" || header == "pdnm";
0018     }
0019 
0020 protected:
0021     void on_chunk(RiffChunk & chunk) override
0022     {
0023         if ( is_fake_list(chunk.header) )
0024         {
0025             chunk.children = read_chunks(chunk.reader);
0026         }
0027         else if ( chunk.header == "LIST" )
0028         {
0029             chunk.subheader = chunk.reader.read(4);
0030             if ( chunk.subheader != "btdk" )
0031                 chunk.children = read_chunks(chunk.reader);
0032             else
0033                 chunk.reader.defer();
0034         }
0035         else
0036         {
0037             chunk.reader.defer();
0038         }
0039     }
0040 };
0041 
0042 } // namespace glaxnimate::io::aep
0043