0

In my project is undesirable use Phonon. It was therefore decided to use QAudioOutput and decoder Lame. The data obtained from the network through QNetworkReply and try to decode blocks of 4096 bytes, but I get an error. I understand that my actions are not correct because I can not find an explanation how to do it. I guess I need to skip ID3 tags and work with clean data

#include <QtNetwork>
#include <QObject>
#include <lame/lame.h>

class Decoder:public QObject
{
  Q_OBJECT
public:
  QNetworkReply* _reply;
  explicit Decoder(QNetworkReply *reply,QObject *parent=0):
    QObject(parent),
    _reply(reply)
  {
    QObject::connect(reply,SIGNAL(downloadProgress(qint64,qint64)),SLOT(readData(qint64,qint64));
  }
public slots:
  void readData(qint64 ready,qint64 total )
  {
    if ((_reply->size() > 4096) || (ready == total))
      {
        QByteArray data = _reply->read(4096);
        qint16 l_buf[4096*100];
        qint16 r_buf[4096*100];
        hip_t decoder = hip_decode_init();
        qint32 decoded = hip_decode(decoder,(unsigned char*)data.data(),data.size(),l_buf,r_buf);
      }
  }
DrEvil35
  • 127
  • 1
  • 8
  • You need to show us your code. – greg-449 Nov 21 '13 at 09:37
  • I studied the structure of MP3 and concluded that I need to look for headlines FFFB, consider the length of the sample and accumulate them. I think this is the right way. – DrEvil35 Nov 21 '13 at 13:21

0 Answers0