Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZane van Iperen <zane@zanevaniperen.com>2020-09-05 10:24:17 +0300
committerZane van Iperen <zane@zanevaniperen.com>2020-09-14 07:23:54 +0300
commit442249ef2801c60fdbc6b16880617417bd6085ba (patch)
tree8bb61bb23a8f9c98ba27492c250873964bf3139d /libavformat/argo_asf.h
parent0476b6ee1eaa258c7b527de0f477f6b4c9838dab (diff)
avformat/argo_asf: split functionality into a header
For future use by the argo_brp demuxer. Adds: - void ff_argo_asf_parse_file_header(ArgoASFFileHeader *hdr, const uint8_t *buf); - int ff_argo_asf_validate_file_header(AVFormatContext *s, const ArgoASFFileHeader *hdr); - void ff_argo_asf_parse_chunk_header(ArgoASFChunkHeader *hdr, const uint8_t *buf); - int ff_argo_asf_fill_stream(AVStream *st, const ArgoASFChunkHeader *ckhdr); Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Diffstat (limited to 'libavformat/argo_asf.h')
-rw-r--r--libavformat/argo_asf.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/libavformat/argo_asf.h b/libavformat/argo_asf.h
new file mode 100644
index 0000000000..905769dafe
--- /dev/null
+++ b/libavformat/argo_asf.h
@@ -0,0 +1,67 @@
+/*
+ * Argonaut Games ASF (de)muxer
+ *
+ * Copyright (C) 2020 Zane van Iperen (zane@zanevaniperen.com)
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVFORMAT_ARGO_ASF_H
+#define AVFORMAT_ARGO_ASF_H
+
+#include <stdint.h>
+
+#define ASF_TAG MKTAG('A', 'S', 'F', '\0')
+#define ASF_FILE_HEADER_SIZE 24
+#define ASF_CHUNK_HEADER_SIZE 20
+#define ASF_SAMPLE_COUNT 32
+
+typedef struct ArgoASFFileHeader {
+ uint32_t magic; /*< Magic Number, {'A', 'S', 'F', '\0'} */
+ uint16_t version_major; /*< File Major Version. */
+ uint16_t version_minor; /*< File Minor Version. */
+ uint32_t num_chunks; /*< No. chunks in the file. */
+ uint32_t chunk_offset; /*< Offset to the first chunk from the start of the file. */
+ int8_t name[8]; /*< Name. */
+} ArgoASFFileHeader;
+
+typedef struct ArgoASFChunkHeader {
+ uint32_t num_blocks; /*< No. blocks in the chunk. */
+ uint32_t num_samples; /*< No. samples per channel in a block. Always 32. */
+ uint32_t unk1; /*< Unknown */
+ uint16_t sample_rate; /*< Sample rate. */
+ uint16_t unk2; /*< Unknown. */
+ uint32_t flags; /*< Stream flags. */
+} ArgoASFChunkHeader;
+
+enum {
+ ASF_CF_BITS_PER_SAMPLE = (1 << 0), /*< 16-bit if set, 8 otherwise. */
+ ASF_CF_STEREO = (1 << 1), /*< Stereo if set, mono otherwise. */
+ ASF_CF_ALWAYS1_1 = (1 << 2), /*< Unknown, always seems to be set. */
+ ASF_CF_ALWAYS1_2 = (1 << 3), /*< Unknown, always seems to be set. */
+
+ ASF_CF_ALWAYS1 = ASF_CF_ALWAYS1_1 | ASF_CF_ALWAYS1_2,
+ ASF_CF_ALWAYS0 = ~(ASF_CF_BITS_PER_SAMPLE | ASF_CF_STEREO | ASF_CF_ALWAYS1)
+};
+
+void ff_argo_asf_parse_file_header(ArgoASFFileHeader *hdr, const uint8_t *buf);
+int ff_argo_asf_validate_file_header(AVFormatContext *s, const ArgoASFFileHeader *hdr);
+void ff_argo_asf_parse_chunk_header(ArgoASFChunkHeader *hdr, const uint8_t *buf);
+int ff_argo_asf_fill_stream(AVStream *st, const ArgoASFFileHeader *fhdr,
+ const ArgoASFChunkHeader *ckhdr);
+
+#endif /* AVFORMAT_ARGO_ASF_H */