Classified ads
audioencoder.h
Go to the documentation of this file.
1 /* -*-C++-*- -*-coding: utf-8-unix;-*-
2  Classified Ads is Copyright (c) Antti Järvinen 2015.
3 
4  This file is part of Classified Ads.
5 
6  Classified Ads is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) any later version.
10 
11  Classified Ads is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with Classified Ads; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 
21 #ifndef AUDIO_ENCODER_H
22 #define AUDIO_ENCODER_H
23 
24 #include <QObject>
25 #include <opus/opus.h> // for data types
26 #include "../util/hash.h"
27 
35 class AudioEncoder : public QObject {
36  Q_OBJECT
37 
38 public:
42  AudioEncoder(quint32 aSampleRate = 8000,
43  quint32 aNumChannels = 1 ) ;
44  ~AudioEncoder() ;
45 
46 signals:
60 void frameEncoded(quint32 aCallId,
61  quint32 aSeqNo,
62  const QByteArray& aEncodedData,
63  Hash aForNode ) ;
64 public slots:
76 void frameReady(quint32 aCallId,
77  quint32 aSeqNo,
78  const QByteArray& aAudioData,
79  Hash aForNode ) ;
80 private: // members
81  OpusEncoder *iEncoder ;
82  unsigned char *iEncodedData ;
83  const quint32 iNumChannels ;
84 } ;
85 #endif
AudioEncoder(quint32 aSampleRate=8000, quint32 aNumChannels=1)
void frameEncoded(quint32 aCallId, quint32 aSeqNo, const QByteArray &aEncodedData, Hash aForNode)
class for compressing audio to be sent over network
Definition: audioencoder.h:35
Hash is class that carries 160-bit digest.
Definition: hash.h:38
OpusEncoder * iEncoder
Definition: audioencoder.h:81
void frameReady(quint32 aCallId, quint32 aSeqNo, const QByteArray &aAudioData, Hash aForNode)
unsigned char * iEncodedData
Definition: audioencoder.h:82
const quint32 iNumChannels
Definition: audioencoder.h:83