comparison ac3.h @ 4648:5683b496ffbc libavcodec

move AC-3 header parsing to ac3.c
author jbr
date Sun, 11 Mar 2007 16:44:14 +0000
parents 056127e5df89
children acdd4b24f5c5
comparison
equal deleted inserted replaced
4647:255affa5bae7 4648:5683b496ffbc
43 int halfratecod; 43 int halfratecod;
44 int sgain, sdecay, fdecay, dbknee, floor; 44 int sgain, sdecay, fdecay, dbknee, floor;
45 int cplfleak, cplsleak; 45 int cplfleak, cplsleak;
46 } AC3BitAllocParameters; 46 } AC3BitAllocParameters;
47 47
48 /**
49 * @struct AC3HeaderInfo
50 * Coded AC-3 header values up to the lfeon element, plus derived values.
51 */
52 typedef struct {
53 /** @defgroup coded Coded elements
54 * @{
55 */
56 uint16_t sync_word;
57 uint16_t crc1;
58 uint8_t fscod;
59 uint8_t frmsizecod;
60 uint8_t bsid;
61 uint8_t bsmod;
62 uint8_t acmod;
63 uint8_t cmixlev;
64 uint8_t surmixlev;
65 uint8_t dsurmod;
66 uint8_t lfeon;
67 /** @} */
68
69 /** @defgroup derived Derived values
70 * @{
71 */
72 uint8_t halfratecod;
73 uint16_t sample_rate;
74 uint32_t bit_rate;
75 uint8_t channels;
76 uint16_t frame_size;
77 /** @} */
78 } AC3HeaderInfo;
79
80 /**
81 * Parses AC-3 frame header.
82 * Parses the header up to the lfeon element, which is the first 52 or 54 bits
83 * depending on the audio coding mode.
84 * @param buf[in] Array containing the first 7 bytes of the frame.
85 * @param hdr[out] Pointer to struct where header info is written.
86 * @return Returns 0 on success, -1 if there is a sync word mismatch,
87 * -2 if the bsid (version) element is invalid, -3 if the fscod (sample rate)
88 * element is invalid, or -4 if the frmsizecod (bit rate) element is invalid.
89 */
90 int ff_ac3_parse_header(const uint8_t buf[7], AC3HeaderInfo *hdr);
91
48 extern uint16_t ff_ac3_frame_sizes[38][3]; 92 extern uint16_t ff_ac3_frame_sizes[38][3];
49 extern const uint8_t ff_ac3_channels[8]; 93 extern const uint8_t ff_ac3_channels[8];
50 extern const uint16_t ff_ac3_freqs[3]; 94 extern const uint16_t ff_ac3_freqs[3];
51 extern const uint16_t ff_ac3_bitratetab[19]; 95 extern const uint16_t ff_ac3_bitratetab[19];
52 extern const int16_t ff_ac3_window[256]; 96 extern const int16_t ff_ac3_window[256];