1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the test suite of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
21 | ** included in the packaging of this file. Please review the following |
22 | ** information to ensure the GNU General Public License requirements will |
23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
24 | ** |
25 | ** $QT_END_LICENSE$ |
26 | ** |
27 | ****************************************************************************/ |
28 | |
29 | #ifndef MOCKSERVICE_H |
30 | #define MOCKSERVICE_H |
31 | |
32 | #include "qmediaservice.h" |
33 | |
34 | #include "mockaudioencodercontrol.h" |
35 | #include "mockmediarecordercontrol.h" |
36 | #include "mockvideoencodercontrol.h" |
37 | #include "mockaudioinputselector.h" |
38 | #include "mockmediacontainercontrol.h" |
39 | #include "mockmetadatawritercontrol.h" |
40 | #include "mockavailabilitycontrol.h" |
41 | #include "mockaudioprobecontrol.h" |
42 | |
43 | class MockMediaRecorderService : public QMediaService |
44 | { |
45 | Q_OBJECT |
46 | public: |
47 | MockMediaRecorderService(QObject *parent = 0, QMediaControl *control = 0, MockAvailabilityControl *availability = 0): |
48 | QMediaService(parent), |
49 | mockControl(control), |
50 | mockAvailabilityControl(availability), |
51 | hasControls(true) |
52 | { |
53 | mockAudioInputSelector = new MockAudioInputSelector(this); |
54 | mockAudioEncoderControl = new MockAudioEncoderControl(this); |
55 | mockFormatControl = new MockMediaContainerControl(this); |
56 | mockVideoEncoderControl = new MockVideoEncoderControl(this); |
57 | mockMetaDataControl = new MockMetaDataWriterControl(this); |
58 | mockAudioProbeControl = new MockAudioProbeControl(this); |
59 | } |
60 | |
61 | QMediaControl* requestControl(const char *name) |
62 | { |
63 | if (hasControls && qstrcmp(str1: name,QAudioEncoderSettingsControl_iid) == 0) |
64 | return mockAudioEncoderControl; |
65 | if (hasControls && qstrcmp(str1: name,QAudioInputSelectorControl_iid) == 0) |
66 | return mockAudioInputSelector; |
67 | if (hasControls && qstrcmp(str1: name,QMediaRecorderControl_iid) == 0) |
68 | return mockControl; |
69 | if (hasControls && qstrcmp(str1: name,QMediaContainerControl_iid) == 0) |
70 | return mockFormatControl; |
71 | if (hasControls && qstrcmp(str1: name,QVideoEncoderSettingsControl_iid) == 0) |
72 | return mockVideoEncoderControl; |
73 | if (hasControls && qstrcmp(str1: name, QMetaDataWriterControl_iid) == 0) |
74 | return mockMetaDataControl; |
75 | if (hasControls && qstrcmp(str1: name, QMediaAvailabilityControl_iid) == 0) |
76 | return mockAvailabilityControl; |
77 | if (hasControls && qstrcmp(str1: name, QMediaAudioProbeControl_iid) == 0) |
78 | return mockAudioProbeControl; |
79 | |
80 | return 0; |
81 | } |
82 | |
83 | void releaseControl(QMediaControl*) |
84 | { |
85 | } |
86 | |
87 | QMediaControl *mockControl; |
88 | QAudioInputSelectorControl *mockAudioInputSelector; |
89 | QAudioEncoderSettingsControl *mockAudioEncoderControl; |
90 | QMediaContainerControl *mockFormatControl; |
91 | QVideoEncoderSettingsControl *mockVideoEncoderControl; |
92 | MockMetaDataWriterControl *mockMetaDataControl; |
93 | MockAvailabilityControl *mockAvailabilityControl; |
94 | MockAudioProbeControl *mockAudioProbeControl; |
95 | |
96 | bool hasControls; |
97 | }; |
98 | |
99 | #endif // MOCKSERVICE_H |
100 | |