xref: /third_party/ffmpeg/libavcodec/dca_exss.h (revision cabdff1a)
1/*
2 * Copyright (C) 2016 foo86
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef AVCODEC_DCA_EXSS_H
22#define AVCODEC_DCA_EXSS_H
23
24#include <stdint.h>
25
26#include "avcodec.h"
27#include "get_bits.h"
28
29typedef struct DCAExssAsset {
30    int     asset_offset;   ///< Offset to asset data from start of substream
31    int     asset_size;     ///< Size of encoded asset data
32    int     asset_index;    ///< Audio asset identifier
33
34    int     pcm_bit_res;                ///< PCM bit resolution
35    int     max_sample_rate;            ///< Maximum sample rate
36    int     nchannels_total;            ///< Total number of channels
37    int     one_to_one_map_ch_to_spkr;  ///< One to one channel to speaker mapping flag
38    int     embedded_stereo;            ///< Embedded stereo flag
39    int     embedded_6ch;               ///< Embedded 6 channels flag
40    int     spkr_mask_enabled;          ///< Speaker mask enabled flag
41    int     spkr_mask;                  ///< Loudspeaker activity mask
42    int     representation_type;        ///< Representation type
43
44    int     coding_mode;        ///< Coding mode for the asset
45    int     extension_mask;     ///< Coding components used in asset
46
47    int     core_offset;    ///< Offset to core component from start of substream
48    int     core_size;      ///< Size of core component in extension substream
49
50    int     xbr_offset;     ///< Offset to XBR extension from start of substream
51    int     xbr_size;       ///< Size of XBR extension in extension substream
52
53    int     xxch_offset;    ///< Offset to XXCH extension from start of substream
54    int     xxch_size;      ///< Size of XXCH extension in extension substream
55
56    int     x96_offset;     ///< Offset to X96 extension from start of substream
57    int     x96_size;       ///< Size of X96 extension in extension substream
58
59    int     lbr_offset;     ///< Offset to LBR component from start of substream
60    int     lbr_size;       ///< Size of LBR component in extension substream
61
62    int     xll_offset;         ///< Offset to XLL data from start of substream
63    int     xll_size;           ///< Size of XLL data in extension substream
64    int     xll_sync_present;   ///< XLL sync word present flag
65    int     xll_delay_nframes;  ///< Initial XLL decoding delay in frames
66    int     xll_sync_offset;    ///< Number of bytes offset to XLL sync
67
68    int     hd_stream_id;   ///< DTS-HD stream ID
69} DCAExssAsset;
70
71typedef struct DCAExssParser {
72    AVCodecContext  *avctx;
73    GetBitContext   gb;
74
75    int     exss_index;         ///< Extension substream index
76    int     exss_size_nbits;    ///< Number of bits for extension substream size
77    int     exss_size;          ///< Number of bytes of extension substream
78
79    int     static_fields_present;  ///< Per stream static fields presence flag
80    int     npresents;  ///< Number of defined audio presentations
81    int     nassets;    ///< Number of audio assets in extension substream
82
83    int     mix_metadata_enabled;   ///< Mixing metadata enable flag
84    int     nmixoutconfigs;         ///< Number of mixing configurations
85    int     nmixoutchs[4];          ///< Speaker layout mask for mixer output channels
86
87    DCAExssAsset   assets[1];    ///< Audio asset descriptors
88} DCAExssParser;
89
90int ff_dca_exss_parse(DCAExssParser *s, const uint8_t *data, int size);
91
92#endif
93