~ubuntu-branches/ubuntu/trusty/jreen/trusty

« back to all changes in this revision

Viewing changes to src/experimental/jingleaudiocontent.h

  • Committer: Package Import Robot
  • Author(s): Prasad Murthy
  • Date: 2013-03-08 00:00:33 UTC
  • Revision ID: package-import@ubuntu.com-20130308000033-x8thp6syo1kkh63s
Tags: upstream-1.1.1
Import upstream version 1.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Jreen
 
4
**
 
5
** Copyright © 2012 Ruslan Nigmatullin <euroelessar@yandex.ru>
 
6
**
 
7
*****************************************************************************
 
8
**
 
9
** $JREEN_BEGIN_LICENSE$
 
10
** This program is free software: you can redistribute it and/or modify
 
11
** it under the terms of the GNU General Public License as published by
 
12
** the Free Software Foundation, either version 2 of the License, or
 
13
** (at your option) any later version.
 
14
**
 
15
** This program is distributed in the hope that it will be useful,
 
16
** but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
18
** See the GNU General Public License for more details.
 
19
**
 
20
** You should have received a copy of the GNU General Public License
 
21
** along with this program.  If not, see http://www.gnu.org/licenses/.
 
22
** $JREEN_END_LICENSE$
 
23
**
 
24
****************************************************************************/
 
25
 
 
26
#ifndef JINGLEAUDIOCONTENT_H
 
27
#define JINGLEAUDIOCONTENT_H
 
28
 
 
29
#include "jinglecontent.h"
 
30
#include "jingleaudiopayload.h"
 
31
 
 
32
namespace Jreen
 
33
{
 
34
 
 
35
class JingleAudioContentPrivate;
 
36
class JingleAudioCodecFactory;
 
37
 
 
38
class JREEN_EXPORT JingleAudioContent : public JingleContent
 
39
{
 
40
        Q_OBJECT
 
41
        Q_DECLARE_PRIVATE(JingleAudioContent)
 
42
public:
 
43
    JingleAudioContent(JingleSession *session);
 
44
        ~JingleAudioContent();
 
45
        
 
46
        JingleAudioPayload currentPayload() const;
 
47
        int currentPayloadFrameSize() const;
 
48
        QIODevice *audioDevice() const;
 
49
        
 
50
        virtual JingleDescription::Ptr defaultDescription();
 
51
        virtual JingleDescription::Ptr handleDescription(const JingleDescription::Ptr &description);
 
52
        
 
53
        static void registerCodec(JingleAudioCodecFactory *factory);
 
54
        
 
55
protected:
 
56
        virtual void receive(int component, const QByteArray &data);
 
57
        
 
58
signals:
 
59
        void payloadChoosed(const Jreen::JingleAudioPayload &payload);
 
60
};
 
61
 
 
62
class JREEN_EXPORT JingleAudioCodec
 
63
{
 
64
public:
 
65
        virtual ~JingleAudioCodec() {}
 
66
 
 
67
        virtual int frameSize() const = 0;
 
68
        virtual QByteArray encodeFrame(const char *data, int size) = 0;
 
69
        virtual QByteArray decodeFrame(const char *data, int size) = 0;
 
70
};
 
71
 
 
72
class JREEN_EXPORT JingleAudioCodecFactory
 
73
{
 
74
public:
 
75
        virtual ~JingleAudioCodecFactory() {}
 
76
        virtual QList<JingleAudioPayload> supportedPayloads() = 0;
 
77
        virtual bool supportsPayload(const JingleAudioPayload &payload) = 0;
 
78
        virtual JingleAudioCodec *createCodec(const JingleAudioPayload &payload) = 0;
 
79
};
 
80
 
 
81
}
 
82
 
 
83
Q_DECLARE_INTERFACE(Jreen::JingleAudioCodecFactory, "org.qutim.Jreen.Jingle.AudioCodecFactory")
 
84
 
 
85
#endif // JINGLEAUDIOCONTENT_H