aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/dolby_e.h
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-01-26 15:46:15 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-01-30 05:14:45 +0100
commit8cbff41583409210abef0f57a1afbf8bb1f1f351 (patch)
tree99719a940ef79f262e4fd1c4195c6510be1ecb0d /libavcodec/dolby_e.h
parentfa3ab43fecb49d544861a42a03e7432aa829de56 (diff)
downloadffmpeg-8cbff41583409210abef0f57a1afbf8bb1f1f351.tar.gz
avcodec/dolby_e_parse: Merge ff_dolby_e_parse_init/header
These two functions are always called after another; after all, what ff_dolby_e_parse_init does is obviously part of parsing the frame header. Also move the DolbyEHeaderInfo into DBEContext so that parsing the frame header only needs one struct (both users used a DBEContext immediately followed by a separate DolbyEHeaderInfo). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/dolby_e.h')
-rw-r--r--libavcodec/dolby_e.h54
1 files changed, 24 insertions, 30 deletions
diff --git a/libavcodec/dolby_e.h b/libavcodec/dolby_e.h
index d7fac94fd9..0838a1d3ea 100644
--- a/libavcodec/dolby_e.h
+++ b/libavcodec/dolby_e.h
@@ -31,24 +31,6 @@
#define MAX_CHANNELS 8
/**
- * @struct DBEContext
- * Dolby E reading context used by decoder and parser.
- */
-typedef struct DBEContext {
- void *avctx;
- GetBitContext gb;
-
- const uint8_t *input;
- int input_size;
-
- int word_bits;
- int word_bytes;
- int key_present;
-
- uint8_t buffer[1024 * 3 + AV_INPUT_BUFFER_PADDING_SIZE];
-} DBEContext;
-
-/**
* @struct DolbyEHeaderInfo
* Coded Dolby E header values up to end_gain element, plus derived values.
*/
@@ -79,26 +61,38 @@ typedef struct DolbyEHeaderInfo {
/** @} */
} DolbyEHeaderInfo;
+/**
+ * @struct DBEContext
+ * Dolby E reading context used by decoder and parser.
+ */
+typedef struct DBEContext {
+ void *avctx;
+ GetBitContext gb;
+
+ const uint8_t *input;
+ int input_size;
+
+ int word_bits;
+ int word_bytes;
+ int key_present;
+
+ DolbyEHeaderInfo metadata;
+
+ uint8_t buffer[1024 * 3 + AV_INPUT_BUFFER_PADDING_SIZE];
+} DBEContext;
+
static const uint16_t sample_rate_tab[16] = {
0, 42965, 43008, 44800, 53706, 53760
};
/**
- * Initialize DBEContext.
- * Set word_bits/word_bytes, input, input_size, key_present.
+ * Initialize DBEContext and parse Dolby E metadata.
+ * Set word_bits/word_bytes, input, input_size, key_present
+ * and parse the header up to the end_gain element.
* @param[out] s DBEContext.
* @param[in] buf raw input buffer.
* @param[in] buf_size must be 3 bytes at least.
* @return Returns 0 on success, AVERROR_INVALIDDATA on error
*/
-int ff_dolby_e_parse_init(DBEContext *s, const uint8_t *buf, int buf_size);
-
-/**
- * Parse Dolby E metadata.
- * Parse the header up to the end_gain element.
- * @param[in] s DBEContext .
- * @param[out] hdr Pointer to struct where header info is written.
- * @return Returns 0 on success, AVERROR_INVALIDDATA on error
- */
-int ff_dolby_e_parse_header(DBEContext *s, DolbyEHeaderInfo *hdr);
+int ff_dolby_e_parse_header(DBEContext *s, const uint8_t *buf, int buf_size);
#endif