1 /* Webcamoid, webcam capture application.
2  * Copyright (C) 2016  Gonzalo Exequiel Pedone
3  *
4  * Webcamoid is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * Webcamoid is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Webcamoid. If not, see <http://www.gnu.org/licenses/>.
16  *
17  * Web-Site: http://webcamoid.github.io/
18  */
19 
20 #ifndef MULTISRCELEMENT_H
21 #define MULTISRCELEMENT_H
22 
23 #include <akmultimediasourceelement.h>
24 
25 class MultiSrcElementPrivate;
26 
27 class MultiSrcElement: public AkMultimediaSourceElement
28 {
29     Q_OBJECT
30     Q_PROPERTY(QStringList medias
31                READ medias
32                NOTIFY mediasChanged)
33     Q_PROPERTY(QString media
34                READ media
35                WRITE setMedia
36                RESET resetMedia
37                NOTIFY mediaChanged)
38     Q_PROPERTY(QList<int> streams
39                READ streams
40                WRITE setStreams
41                RESET resetStreams
42                NOTIFY streamsChanged)
43     Q_PROPERTY(bool loop
44                READ loop
45                WRITE setLoop
46                RESET resetLoop
47                NOTIFY loopChanged)
48     Q_PROPERTY(qint64 maxPacketQueueSize
49                READ maxPacketQueueSize
50                WRITE setMaxPacketQueueSize
51                RESET resetMaxPacketQueueSize
52                NOTIFY maxPacketQueueSizeChanged)
53     Q_PROPERTY(bool showLog
54                READ showLog
55                WRITE setShowLog
56                RESET resetShowLog
57                NOTIFY showLogChanged)
58 
59     public:
60         MultiSrcElement();
61         ~MultiSrcElement();
62 
63         Q_INVOKABLE QStringList medias();
64         Q_INVOKABLE QString media() const;
65         Q_INVOKABLE QList<int> streams();
66         Q_INVOKABLE bool loop() const;
67         Q_INVOKABLE QList<int> listTracks(const QString &type="");
68         Q_INVOKABLE QString streamLanguage(int stream);
69         Q_INVOKABLE int defaultStream(const QString &mimeType);
70         Q_INVOKABLE QString description(const QString &media);
71         Q_INVOKABLE AkCaps caps(int stream);
72         Q_INVOKABLE qint64 maxPacketQueueSize() const;
73         Q_INVOKABLE bool showLog() const;
74 
75     private:
76         MultiSrcElementPrivate *d;
77 
78     protected:
79         QString controlInterfaceProvide(const QString &controlId) const;
80         void controlInterfaceConfigure(QQmlContext *context,
81                                        const QString &controlId) const;
82 
83     signals:
84         void mediasChanged(const QStringList &medias);
85         void mediaChanged(const QString &media);
86         void streamsChanged(const QList<int> &streams);
87         void loopChanged(bool loop);
88         void error(const QString &message);
89         void maxPacketQueueSizeChanged(qint64 maxPacketQueue);
90         void showLogChanged(bool showLog);
91 
92     public slots:
93         void setMedia(const QString &media);
94         void setStreams(const QList<int> &streams);
95         void setLoop(bool loop);
96         void setMaxPacketQueueSize(qint64 maxPacketQueueSize);
97         void setShowLog(bool showLog);
98         void resetMedia();
99         void resetStreams();
100         void resetLoop();
101         void resetMaxPacketQueueSize();
102         void resetShowLog();
103         bool setState(AkElement::ElementState state);
104 };
105 
106 #endif // MULTISRCELEMENT_H
107