diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-11-17 13:49:03 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-11-17 13:49:03 +0100 |
commit | c619de03546ac1d5b562350891302e7e010407a8 (patch) | |
tree | 54c7f2040d99d6d4ee889f7fbc7eb81f351bfbef /faad_decoder.h | |
parent | 90e2e9e59dd38d075c6f95629f1087e24954a327 (diff) | |
download | etisnoop-c619de03546ac1d5b562350891302e7e010407a8.tar.gz etisnoop-c619de03546ac1d5b562350891302e7e010407a8.tar.bz2 etisnoop-c619de03546ac1d5b562350891302e7e010407a8.zip |
ETISnoop correctly decode audio and write aac and wav files
Diffstat (limited to 'faad_decoder.h')
-rw-r--r-- | faad_decoder.h | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/faad_decoder.h b/faad_decoder.h index 10e9717..36e7594 100644 --- a/faad_decoder.h +++ b/faad_decoder.h @@ -54,22 +54,55 @@ struct adts_variable_header { unsigned int no_raw_data_blocks :2; }; +class FaadHandle +{ + public: + FaadHandle() + { + decoder = NeAACDecOpen(); + } + + FaadHandle(const FaadHandle& other) + { + this->decoder = NeAACDecOpen(); + } + + FaadHandle& operator=(const FaadHandle& other) + { + this->decoder = NeAACDecOpen(); + return *this; + } + + ~FaadHandle() + { + NeAACDecClose(decoder); + decoder = NULL; + } + + NeAACDecHandle decoder; +}; + class FaadDecoder { public: FaadDecoder(); - FaadDecoder(std::string filename, bool ps_flag, bool aac_channel_mode, + void open(std::string filename, bool ps_flag, bool aac_channel_mode, bool dac_rate, bool sbr_flag, int mpeg_surround_config); - size_t Decode(std::vector<std::vector<uint8_t> > aus); + void close(void); - ~FaadDecoder(void); + bool decode(std::vector<std::vector<uint8_t> > aus); + bool is_initialised(void) { return m_initialised; } private: + void update_header(void); + size_t m_data_len; + std::string m_filename; FILE* m_fd; + FILE* m_aac; /* Data needed for FAAD */ bool m_ps_flag; @@ -78,8 +111,11 @@ class FaadDecoder bool m_sbr_flag; int m_mpeg_surround_config; + int m_channels; + int m_sample_rate; + bool m_initialised; - NeAACDecHandle m_decoder; + FaadHandle m_faad_handle; }; #endif |