FFmpeg
libavformat
argo_asf.h
Go to the documentation of this file.
1
/*
2
* Argonaut Games ASF (de)muxer
3
*
4
* Copyright (C) 2020 Zane van Iperen (zane@zanevaniperen.com)
5
*
6
* This file is part of FFmpeg.
7
*
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.
12
*
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.
17
*
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
21
*/
22
23
#ifndef AVFORMAT_ARGO_ASF_H
24
#define AVFORMAT_ARGO_ASF_H
25
26
#include <stdint.h>
27
#include "
libavutil/macros.h
"
28
29
#include "
avformat.h
"
30
31
#define ASF_TAG MKTAG('A', 'S', 'F', '\0')
32
#define ASF_FILE_HEADER_SIZE 24
33
#define ASF_CHUNK_HEADER_SIZE 20
34
#define ASF_SAMPLE_COUNT 32
35
#define ASF_MIN_BUFFER_SIZE FFMAX(ASF_FILE_HEADER_SIZE, ASF_CHUNK_HEADER_SIZE)
36
#define ASF_NAME_SIZE 8
37
38
typedef
struct
ArgoASFFileHeader
{
39
uint32_t
magic
;
/*< Magic Number, {'A', 'S', 'F', '\0'} */
40
uint16_t
version_major
;
/*< File Major Version. */
41
uint16_t
version_minor
;
/*< File Minor Version. */
42
uint32_t
num_chunks
;
/*< No. chunks in the file. */
43
uint32_t
chunk_offset
;
/*< Offset to the first chunk from the start of the file. */
44
char
name
[
ASF_NAME_SIZE
+ 1];
/*< Name, +1 for NULL-terminator. */
45
}
ArgoASFFileHeader
;
46
47
typedef
struct
ArgoASFChunkHeader
{
48
uint32_t
num_blocks
;
/*< No. blocks in the chunk. */
49
uint32_t
num_samples
;
/*< No. samples per channel in a block. Always 32. */
50
uint32_t
unk1
;
/*< Unknown */
51
uint16_t
sample_rate
;
/*< Sample rate. */
52
uint16_t
unk2
;
/*< Unknown. */
53
uint32_t
flags
;
/*< Stream flags. */
54
}
ArgoASFChunkHeader
;
55
56
enum
{
57
ASF_CF_BITS_PER_SAMPLE
= (1 << 0),
/*< 16-bit if set, 8 otherwise. */
58
ASF_CF_STEREO
= (1 << 1),
/*< Stereo if set, mono otherwise. */
59
ASF_CF_ALWAYS1_1
= (1 << 2),
/*< Unknown, always seems to be set. */
60
ASF_CF_ALWAYS1_2
= (1 << 3),
/*< Unknown, always seems to be set. */
61
62
ASF_CF_ALWAYS1
=
ASF_CF_ALWAYS1_1
|
ASF_CF_ALWAYS1_2
,
63
ASF_CF_ALWAYS0
= ~(
ASF_CF_BITS_PER_SAMPLE
|
ASF_CF_STEREO
|
ASF_CF_ALWAYS1
)
64
};
65
66
void
ff_argo_asf_parse_file_header
(
ArgoASFFileHeader
*hdr,
const
uint8_t *buf);
67
int
ff_argo_asf_validate_file_header
(
AVFormatContext
*
s
,
const
ArgoASFFileHeader
*hdr);
68
void
ff_argo_asf_parse_chunk_header
(
ArgoASFChunkHeader
*hdr,
const
uint8_t *buf);
69
int
ff_argo_asf_fill_stream
(
AVFormatContext
*
s
,
AVStream
*st,
const
ArgoASFFileHeader
*fhdr,
70
const
ArgoASFChunkHeader
*ckhdr);
71
72
#endif
/* AVFORMAT_ARGO_ASF_H */
ArgoASFChunkHeader::sample_rate
uint16_t sample_rate
Definition:
argo_asf.h:51
ArgoASFChunkHeader::num_samples
uint32_t num_samples
Definition:
argo_asf.h:49
ArgoASFChunkHeader::flags
uint32_t flags
Definition:
argo_asf.h:53
ArgoASFChunkHeader::unk2
uint16_t unk2
Definition:
argo_asf.h:52
ArgoASFFileHeader::name
char name[ASF_NAME_SIZE+1]
Definition:
argo_asf.h:44
ASF_CF_ALWAYS1
@ ASF_CF_ALWAYS1
Definition:
argo_asf.h:62
ASF_CF_BITS_PER_SAMPLE
@ ASF_CF_BITS_PER_SAMPLE
Definition:
argo_asf.h:57
ArgoASFFileHeader::version_minor
uint16_t version_minor
Definition:
argo_asf.h:41
macros.h
ArgoASFChunkHeader
Definition:
argo_asf.h:47
ff_argo_asf_validate_file_header
int ff_argo_asf_validate_file_header(AVFormatContext *s, const ArgoASFFileHeader *hdr)
Definition:
argo_asf.c:64
s
#define s(width, name)
Definition:
cbs_vp9.c:198
ArgoASFFileHeader::num_chunks
uint32_t num_chunks
Definition:
argo_asf.h:42
ff_argo_asf_parse_chunk_header
void ff_argo_asf_parse_chunk_header(ArgoASFChunkHeader *hdr, const uint8_t *buf)
Definition:
argo_asf.c:75
AVFormatContext
Format I/O context.
Definition:
avformat.h:1300
ASF_CF_STEREO
@ ASF_CF_STEREO
Definition:
argo_asf.h:58
ff_argo_asf_fill_stream
int ff_argo_asf_fill_stream(AVFormatContext *s, AVStream *st, const ArgoASFFileHeader *fhdr, const ArgoASFChunkHeader *ckhdr)
Definition:
argo_asf.c:85
ArgoASFFileHeader::version_major
uint16_t version_major
Definition:
argo_asf.h:40
ASF_NAME_SIZE
#define ASF_NAME_SIZE
Definition:
argo_asf.h:36
ArgoASFFileHeader::chunk_offset
uint32_t chunk_offset
Definition:
argo_asf.h:43
ASF_CF_ALWAYS0
@ ASF_CF_ALWAYS0
Definition:
argo_asf.h:63
ff_argo_asf_parse_file_header
void ff_argo_asf_parse_file_header(ArgoASFFileHeader *hdr, const uint8_t *buf)
Definition:
argo_asf.c:53
AVStream
Stream structure.
Definition:
avformat.h:748
ArgoASFChunkHeader::num_blocks
uint32_t num_blocks
Definition:
argo_asf.h:48
avformat.h
ArgoASFFileHeader
Definition:
argo_asf.h:38
ArgoASFChunkHeader::unk1
uint32_t unk1
Definition:
argo_asf.h:50
ASF_CF_ALWAYS1_1
@ ASF_CF_ALWAYS1_1
Definition:
argo_asf.h:59
ASF_CF_ALWAYS1_2
@ ASF_CF_ALWAYS1_2
Definition:
argo_asf.h:60
ArgoASFFileHeader::magic
uint32_t magic
Definition:
argo_asf.h:39
Generated on Tue Nov 12 2024 19:22:33 for FFmpeg by
1.8.17