diff options
| author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-09-05 13:41:19 +0200 | 
|---|---|---|
| committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-09-05 13:41:19 +0200 | 
| commit | 9d5ad6c746643431b4cb340f799b9330a7e84a74 (patch) | |
| tree | a0bc474c8b69c81d18879196a862007f30eba7a3 /src | |
| parent | 239378a7fce009c902ced567f545f1251e3c80e9 (diff) | |
| download | ODR-SourceCompanion-9d5ad6c746643431b4cb340f799b9330a7e84a74.tar.gz ODR-SourceCompanion-9d5ad6c746643431b4cb340f799b9330a7e84a74.tar.bz2 ODR-SourceCompanion-9d5ad6c746643431b4cb340f799b9330a7e84a74.zip | |
Fix compilation warnings
Diffstat (limited to 'src')
| -rw-r--r-- | src/AACDecoder.cpp | 4 | ||||
| -rw-r--r-- | src/AVTEDIInput.cpp | 60 | ||||
| -rw-r--r-- | src/AVTEDIInput.h | 43 | 
3 files changed, 55 insertions, 52 deletions
| diff --git a/src/AACDecoder.cpp b/src/AACDecoder.cpp index 3f34ca0..17fd96d 100644 --- a/src/AACDecoder.cpp +++ b/src/AACDecoder.cpp @@ -45,7 +45,7 @@ void AACDecoder::decode_frame(uint8_t *data, size_t len)      const bool sbr_flag             = data[2] & 0x20;      const bool aac_channel_mode     = data[2] & 0x10;      const bool ps_flag              = data[2] & 0x08; -    const uint8_t mpeg_surround_config = data[2] & 0x07; +    //const uint8_t mpeg_surround_config = data[2] & 0x07;      const int core_sr_index = dac_rate ?          (sbr_flag ? 6 : 3) : (sbr_flag ? 8 : 5);   // 24/48/16/32 kHz @@ -171,7 +171,7 @@ void AACDecoder::decode_au(uint8_t *data, size_t len)                  std::to_string(result));      } -    for (int i = 0; i < m_output_frame.size(); i+=4) { +    for (size_t i = 0; i < m_output_frame.size(); i+=4) {          const uint8_t *input_buf = m_output_frame.data();          int16_t l = input_buf[i] | (input_buf[i+1] << 8);          int16_t r = input_buf[i+2] | (input_buf[i+3] << 8); diff --git a/src/AVTEDIInput.cpp b/src/AVTEDIInput.cpp index 72c4f09..f8a9e60 100644 --- a/src/AVTEDIInput.cpp +++ b/src/AVTEDIInput.cpp @@ -50,8 +50,6 @@ static int hideFirstPFTErrors = 30; /* Hide the errors that can occurs on  #define TAG_NAME_EST		(('e'<<24)|('s'<<16)|('t'<<8))  /* ------------------------------------------------------------------ - * - */  static void _dump(const uint8_t* buf, int size)  {      for( int i = 0 ; i < size ; i ++) @@ -61,6 +59,7 @@ static void _dump(const uint8_t* buf, int size)      }      if( size % 16 != 0 ) PRINTF("\n");  } +*/  /* ------------------------------------------------------------------   * @@ -199,22 +198,22 @@ bool AVTEDIInput::_pushPFTFrag(uint8_t* buf, size_t length)                  pft = NULL;              }              it = _pft.find(frag->Pseq()); -        }         +        }          if (pft) {              // Add frag to PFT              pft->pushPFTFrag(frag); -             +              // If the PFT is complete, extract the AF              if (pft->complete()) {                  std::vector<uint8_t> af;                  bool ok = pft->extractAF(af); -                 +                  if (ok) {                      _pushAF(af.data(), af.size(), ok);                  } else {                      ERROR("AF Frame Corrupted, Size=%zu\n", af.size()); -                    //_dump(af.data(), 10);                                         +                    //_dump(af.data(), 10);                  }                  _pft.erase(it); @@ -235,15 +234,15 @@ bool AVTEDIInput::_pushPFTFrag(uint8_t* buf, size_t length)          if (pft) {              const auto creation = pft->creation();              const auto diff = now - creation; -            if (diff > timeout_duration) {                 +            if (diff > timeout_duration) {                  //DEBUG("PFT timeout\n");                  std::vector<uint8_t> af; -                bool ok = pft->extractAF(af);                 +                bool ok = pft->extractAF(af);                  if (ok) {                      _pushAF(af.data(), af.size(), ok);                  } else {                      //ERROR("AF Frame CorruptedSize=%zu\n", af.size()); -                    //_dump(af.data(), 10);                                         +                    //_dump(af.data(), 10);                  }                  it = _pft.erase(it); @@ -278,7 +277,7 @@ bool AVTEDIInput::_pushAF(uint8_t* buf, size_t length, bool checked)      index += 2;      uint32_t LEN = unpack4(buf+index); index += 4;      ok = (LEN == length-12); -    uint32_t SEQ = unpack2(buf+index); index += 2; +    //uint32_t SEQ = unpack2(buf+index); index += 2;      if (ok) {          uint32_t CF = unpack1bit(buf[index], 0); @@ -302,7 +301,7 @@ bool AVTEDIInput::_pushAF(uint8_t* buf, size_t length, bool checked)          int est0Index = 0;          size_t est0Length = 0;          // Iterate through tags -        while (tagIndex < length - 2/*CRC*/ - 8/*Min tag length*/ && (!frameCountFound || est0Index==0) ) +        while (tagIndex < (ssize_t)length - 2/*CRC*/ - 8/*Min tag length*/ && (!frameCountFound || est0Index==0) )          {              uint32_t tagName = unpack4(buf+tagIndex); tagIndex += 4;              uint32_t tagLen = unpack4(buf+tagIndex); tagIndex += 4; @@ -451,7 +450,7 @@ PFT::~PFT()  {  //    DEBUG("- PFT %d\n", --nbPFT);      if (_frags) { -        for (int i=0 ; i<_Fcount ; i++) { +        for (size_t i = 0 ; i < _Fcount ; i++) {              delete _frags[i];          }          delete [] _frags; @@ -593,11 +592,10 @@ bool PFT::extractAF(std::vector<uint8_t>& afdata)          if (_cmax > 0)      // FEC present.          { -            int j, k;              uint8_t* p_data_w;              uint8_t* p_data_r;              size_t data_len = 0; -             +              // Re-assemble RS block              uint8_t rs_block[_Plen*_Fcount];              int eras_pos[_cmax][/*48*/255]; /* 48 theoritically but ... */ @@ -605,14 +603,14 @@ bool PFT::extractAF(std::vector<uint8_t>& afdata)              memset(no_eras, 0, sizeof(no_eras));              p_data_w = rs_block; -            for (j = 0; j < _Fcount; ++j) { +            for (size_t j = 0; j < _Fcount; ++j) {                  if (!_frags[j]) // fill with zeros if fragment is missing                  { -                    for (int k = 0; k < _Plen; k++) { -                        int pos = k * _Fcount; +                    for (size_t k = 0; k < _Plen; k++) { +                        size_t pos = k * _Fcount;                          p_data_w[pos] = 0x00; -                        int chunk = pos / (_RSk+48); -                        int chunkpos = (pos) % (_RSk+48); +                        size_t chunk = pos / (_RSk+48); +                        size_t chunkpos = (pos) % (_RSk+48);                          if (chunkpos > _RSk) {                              chunkpos += (207-_RSk);                          } @@ -621,9 +619,9 @@ bool PFT::extractAF(std::vector<uint8_t>& afdata)                      }                  } else {                      uint8_t* p_data_r = _frags[j]->payload(); -                    for (k = 0; k < _frags[j]->Plen(); k++) +                    for (size_t k = 0; k < _frags[j]->Plen(); k++)                          p_data_w[k * _Fcount] = *p_data_r++; -                    for (k = _frags[j]->Plen(); k < _Plen; k++) +                    for (size_t k = _frags[j]->Plen(); k < _Plen; k++)                          p_data_w[k * _Fcount] = 0x00;                  }                  p_data_w++; @@ -634,11 +632,11 @@ bool PFT::extractAF(std::vector<uint8_t>& afdata)              uint8_t rs_chunks[255 * _cmax];              _initRSDecoder();              if (_rs_handler) { -                k = _RSk; +                size_t k = _RSk;                  memset(rs_chunks, 0, sizeof(rs_chunks));                  p_data_w = rs_chunks;                  p_data_r = rs_block; -                for (j = 0; j < _cmax; j++) { +                for (size_t j = 0; j < _cmax; j++) {                      memcpy(p_data_w, p_data_r, k);                      p_data_w += k;                      p_data_r += k; @@ -651,18 +649,18 @@ bool PFT::extractAF(std::vector<uint8_t>& afdata)                  }                  p_data_r = rs_chunks; -                for (j = 0 ; j < _cmax && totCorrectedErr != -1 ; j++) { +                for (size_t j = 0 ; j < _cmax && totCorrectedErr != -1 ; j++) {  #if RS_TEST1 || RS_TEST2                      if (no_eras[j]>0) {                          DEBUG("RS Chuck %d: %d errors\n", j, no_eras[j]); -                    }                         -#endif                                            +                    } +#endif                      int nbErr = decode_rs_char(_rs_handler, p_data_r, eras_pos[j], no_eras[j]);  //                    int nbErr = decode_rs_char(_rs_handler, p_data_r, NULL, 0);                      if (nbErr >= 0) {  #if RS_TEST1 || RS_TEST2                          if (nbErr > 0) DEBUG("RS Chuck %d: %d corrections\n", j, nbErr); -#endif                        +#endif                          totCorrectedErr += nbErr;                      } else {  #if RS_TEST1 || RS_TEST2 @@ -683,9 +681,9 @@ bool PFT::extractAF(std::vector<uint8_t>& afdata)              /* --- re-assemble packet from Reed-Solomon block ----------- */              afdata.resize(_Plen*_Fcount);              p_data_w = afdata.data(); -#if RS_DECODE            +#if RS_DECODE              p_data_r = rs_chunks; -            for (j = 0; j < _cmax; j++) { +            for (size_t j = 0; j < _cmax; j++) {                  memcpy(p_data_w, p_data_r, _RSk);                  p_data_w += _RSk;                  p_data_r += 255; @@ -693,7 +691,7 @@ bool PFT::extractAF(std::vector<uint8_t>& afdata)              }  #else              p_data_r = rs_block; -            for (j = 0; j < _cmax; j++) { +            for (size_t j = 0; j < _cmax; j++) {                  memcpy(p_data_w, p_data_r, _RSk);                  p_data_w += _RSk;                  p_data_r += _RSk + 48; @@ -704,7 +702,7 @@ bool PFT::extractAF(std::vector<uint8_t>& afdata)              afdata.resize(data_len);          } else {            // No Fec Just assemble packets              afdata.resize(0); -            for (int j = 0; j < _Fcount; ++j) { +            for (size_t j = 0; j < _Fcount; ++j) {                  if (_frags[j])                  {                      afdata.insert(afdata.end(), diff --git a/src/AVTEDIInput.h b/src/AVTEDIInput.h index 4ec6086..a882278 100644 --- a/src/AVTEDIInput.h +++ b/src/AVTEDIInput.h @@ -15,8 +15,8 @@   * and limitations under the License.   * -------------------------------------------------------------------   */ -  -  + +  /*! \section AVT Input   *   * Extract audio frame from EDI frames produced by AVT encoder. @@ -56,13 +56,15 @@ class AVTEDIInput      public:          /*\param fragmentTimeoutMs How long to wait for all fragment before applying FEC or dropping old frames*/          AVTEDIInput(uint32_t fragmentTimeoutMs = 120); +        AVTEDIInput(const AVTEDIInput&) = delete; +        AVTEDIInput& operator=(const AVTEDIInput&) = delete;          ~AVTEDIInput();          /*! Push new data to edi decoder           * \return false is data is not EDI           */          bool pushData(uint8_t* buf, size_t length); -         +          /*! Give next available audio frame from EDI           * \return The size of the buffer. 0 if not data available           */ @@ -70,10 +72,10 @@ class AVTEDIInput      private:          uint32_t _fragmentTimeoutMs; -        std::map<int, PFT*>  _pft; +        std::map<int, PFT*> _pft;          typedef std::map<int, PFT*>::iterator PFTIterator; -         -        OrderedQueue*   _subChannelQueue; + +        OrderedQueue *_subChannelQueue;          bool _pushPFTFrag(uint8_t* buf, size_t length);          bool _pushAF(uint8_t* buf, size_t length, bool checked); @@ -87,7 +89,9 @@ class PFTFrag      public:          PFTFrag(uint8_t* buf, size_t length);          ~PFTFrag(); -         +        PFTFrag(const PFTFrag&) = delete; +        PFTFrag& operator=(const PFTFrag&) = delete; +          inline bool isValid() { return _valid; }          inline uint32_t Pseq() { return _Pseq; }          inline uint32_t Findex() { return _Findex; } @@ -98,7 +102,7 @@ class PFTFrag          inline uint32_t RSz() { return _RSz; }          inline uint8_t* payload() { return _payload.data(); }          inline const std::vector<uint8_t>& payloadVector() -            { return _payload; } +        { return _payload; }      private:          std::vector<uint8_t> _payload; @@ -114,8 +118,8 @@ class PFTFrag          uint32_t _Source;          uint32_t _Dest;          bool _valid; -         -        bool _parse(uint8_t* buf, size_t length);        + +        bool _parse(uint8_t* buf, size_t length);  };  /* ------------------------------------------------------------------ @@ -126,6 +130,8 @@ class PFT      public:          PFT(uint32_t Pseq, uint32_t Fcount);          ~PFT(); +        PFT(const PFT&) = delete; +        PFT& operator=(const PFT&) = delete;          /*! the given frag belongs to the PFT class,           *! it will be deleted by the class */ @@ -133,15 +139,15 @@ class PFT          /* \return true if all framgnements are received*/          bool complete(); -         +          /*! try to build the AF with received fragments.           *! Apply error correction if necessary (missing packets/CRC errors)           * \return true if the AF is completed           */ -        bool extractAF(std::vector<uint8_t>& afdata);   -         +        bool extractAF(std::vector<uint8_t>& afdata); +          inline std::chrono::steady_clock::time_point creation() -            { return _creation; } +        { return _creation; }      private:          PFTFrag** _frags; @@ -154,10 +160,10 @@ class PFT          uint32_t _cmax;          uint32_t _rxmin; -        std::chrono::steady_clock::time_point _creation;   -         +        std::chrono::steady_clock::time_point _creation; +          bool _canAttemptToDecode(); -         +          static void* _rs_handler;          static void _initRSDecoder();  }; @@ -168,12 +174,11 @@ class PFT  class EDISubCh {      public:          EDISubCh(uint8_t* buf, size_t length); -        ~EDISubCh();          inline uint32_t frameCount() { return _frameCount; }          inline uint8_t* payload() { return _payload.data(); }          inline const std::vector<uint8_t>& payloadVector() -            { return _payload; } +        { return _payload; }      private:          uint32_t _frameCount; | 
