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:
authorNachiket Tarate <nachiket.programmer@gmail.com>2021-09-21 21:40:58 +0300
committerSteven Liu <lq@chinaffmpeg.org>2021-10-13 06:23:37 +0300
commit343c03c61cdf311f5eebb43731a3e5fd116200dc (patch)
tree799e12f7ceb97dfb4c99dbc5097b7a87c9fb13d1 /libavcodec/adts_header.h
parent1902a60ddab82b0c8e8e52c6d2c329eb4628a7d9 (diff)
libavcodec/adts_header: add frame_length field and avpriv function to parse AAC ADTS header
These will be used by HLS demuxer in case of sample decryption. Signed-off-by: Nachiket Tarate <nachiket.programmer@gmail.com> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Diffstat (limited to 'libavcodec/adts_header.h')
-rw-r--r--libavcodec/adts_header.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/libavcodec/adts_header.h b/libavcodec/adts_header.h
index f615f6a9f9..354d07e1f8 100644
--- a/libavcodec/adts_header.h
+++ b/libavcodec/adts_header.h
@@ -34,6 +34,7 @@ typedef struct AACADTSHeaderInfo {
uint8_t sampling_index;
uint8_t chan_config;
uint8_t num_aac_frames;
+ uint32_t frame_length;
} AACADTSHeaderInfo;
/**
@@ -47,4 +48,18 @@ typedef struct AACADTSHeaderInfo {
*/
int ff_adts_header_parse(GetBitContext *gbc, AACADTSHeaderInfo *hdr);
+/**
+ * Parse the ADTS frame header contained in the buffer, which is
+ * the first 54 bits.
+ * @param[in] buf Pointer to buffer containing the first 54 bits of the frame.
+ * @param[in] size Size of buffer containing the first 54 bits of the frame.
+ * @param[out] phdr Pointer to pointer to struct AACADTSHeaderInfo for which
+ * memory is allocated and header info is written into it. After using the header
+ * information, the allocated memory must be freed by using av_free.
+ * @return Returns 0 on success, -1 if there is a sync word mismatch,
+ * -2 if the version element is invalid, -3 if the sample rate
+ * element is invalid, or -4 if the bit rate element is invalid.
+ */
+int avpriv_adts_header_parse(AACADTSHeaderInfo **phdr, const uint8_t *buf, size_t size);
+
#endif /* AVCODEC_ADTS_HEADER_H */