diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2007-03-11 16:44:14 +0000 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2007-03-11 16:44:14 +0000 |
commit | 2476139973aac278e591e4c0678d824e800fddbd (patch) | |
tree | 69e2aad385265925ae0d1891c01337a5fb7c2d39 /libavcodec/ac3.h | |
parent | c81ab015f8227e4a79358cfe0bde4985853e433e (diff) | |
download | ffmpeg-2476139973aac278e591e4c0678d824e800fddbd.tar.gz |
move AC-3 header parsing to ac3.c
Originally committed as revision 8323 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ac3.h')
-rw-r--r-- | libavcodec/ac3.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/libavcodec/ac3.h b/libavcodec/ac3.h index 28c7f03956..757f446572 100644 --- a/libavcodec/ac3.h +++ b/libavcodec/ac3.h @@ -45,6 +45,50 @@ typedef struct AC3BitAllocParameters { int cplfleak, cplsleak; } AC3BitAllocParameters; +/** + * @struct AC3HeaderInfo + * Coded AC-3 header values up to the lfeon element, plus derived values. + */ +typedef struct { + /** @defgroup coded Coded elements + * @{ + */ + uint16_t sync_word; + uint16_t crc1; + uint8_t fscod; + uint8_t frmsizecod; + uint8_t bsid; + uint8_t bsmod; + uint8_t acmod; + uint8_t cmixlev; + uint8_t surmixlev; + uint8_t dsurmod; + uint8_t lfeon; + /** @} */ + + /** @defgroup derived Derived values + * @{ + */ + uint8_t halfratecod; + uint16_t sample_rate; + uint32_t bit_rate; + uint8_t channels; + uint16_t frame_size; + /** @} */ +} AC3HeaderInfo; + +/** + * Parses AC-3 frame header. + * Parses the header up to the lfeon element, which is the first 52 or 54 bits + * depending on the audio coding mode. + * @param buf[in] Array containing the first 7 bytes of the frame. + * @param hdr[out] Pointer to struct where header info is written. + * @return Returns 0 on success, -1 if there is a sync word mismatch, + * -2 if the bsid (version) element is invalid, -3 if the fscod (sample rate) + * element is invalid, or -4 if the frmsizecod (bit rate) element is invalid. + */ +int ff_ac3_parse_header(const uint8_t buf[7], AC3HeaderInfo *hdr); + extern uint16_t ff_ac3_frame_sizes[38][3]; extern const uint8_t ff_ac3_channels[8]; extern const uint16_t ff_ac3_freqs[3]; |