2 * Argonaut Games ASF (de)muxer
4 * Copyright (C) 2020 Zane van Iperen (zane@zanevaniperen.com)
6 * This file is part of FFmpeg.
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 #ifndef AVFORMAT_ARGO_ASF_H
24 #define AVFORMAT_ARGO_ASF_H
28 #define ASF_TAG MKTAG('A', 'S', 'F', '\0')
29 #define ASF_FILE_HEADER_SIZE 24
30 #define ASF_CHUNK_HEADER_SIZE 20
31 #define ASF_SAMPLE_COUNT 32
33 typedef struct ArgoASFFileHeader {
34 uint32_t magic; /*< Magic Number, {'A', 'S', 'F', '\0'} */
35 uint16_t version_major; /*< File Major Version. */
36 uint16_t version_minor; /*< File Minor Version. */
37 uint32_t num_chunks; /*< No. chunks in the file. */
38 uint32_t chunk_offset; /*< Offset to the first chunk from the start of the file. */
39 int8_t name[8]; /*< Name. */
42 typedef struct ArgoASFChunkHeader {
43 uint32_t num_blocks; /*< No. blocks in the chunk. */
44 uint32_t num_samples; /*< No. samples per channel in a block. Always 32. */
45 uint32_t unk1; /*< Unknown */
46 uint16_t sample_rate; /*< Sample rate. */
47 uint16_t unk2; /*< Unknown. */
48 uint32_t flags; /*< Stream flags. */
52 ASF_CF_BITS_PER_SAMPLE = (1 << 0), /*< 16-bit if set, 8 otherwise. */
53 ASF_CF_STEREO = (1 << 1), /*< Stereo if set, mono otherwise. */
54 ASF_CF_ALWAYS1_1 = (1 << 2), /*< Unknown, always seems to be set. */
55 ASF_CF_ALWAYS1_2 = (1 << 3), /*< Unknown, always seems to be set. */
57 ASF_CF_ALWAYS1 = ASF_CF_ALWAYS1_1 | ASF_CF_ALWAYS1_2,
58 ASF_CF_ALWAYS0 = ~(ASF_CF_BITS_PER_SAMPLE | ASF_CF_STEREO | ASF_CF_ALWAYS1)
61 void ff_argo_asf_parse_file_header(ArgoASFFileHeader *hdr, const uint8_t *buf);
62 int ff_argo_asf_validate_file_header(AVFormatContext *s, const ArgoASFFileHeader *hdr);
63 void ff_argo_asf_parse_chunk_header(ArgoASFChunkHeader *hdr, const uint8_t *buf);
64 int ff_argo_asf_fill_stream(AVStream *st, const ArgoASFFileHeader *fhdr,
65 const ArgoASFChunkHeader *ckhdr);
67 #endif /* AVFORMAT_ARGO_ASF_H */