a0d1d3a2db0581345c2f5e1a548395ec8b6f675d
[platform/core/api/mediatransporter.git] / include / MediaTransporterReceiverSrt.h
1 /**
2  * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __TIZEN_MEDIA_TRANSPORTER_RECEIVER_SRT_H__
18 #define __TIZEN_MEDIA_TRANSPORTER_RECEIVER_SRT_H__
19
20 #ifdef __cplusplus
21
22 #include <string>
23
24 #include "MediaTransporter.h"
25 #include "MediaTransporterBase.h"
26 #include "MediaTransporterReceiver.h"
27 #include "MediaTransporterGst.h"
28 #include "MediaTransporterParam.h"
29
30 namespace tizen_media_transporter {
31
32 class MediaTransporterReceiverSrt : public MediaTransporterReceiver
33 {
34 public:
35         MediaTransporterReceiverSrt();
36         ~MediaTransporterReceiverSrt();
37
38         void buildPipeline() override;
39         void startPipeline() override;
40         void stopPipeline() override;
41
42         void setConnection(std::string name, std::string value) override;
43         std::string getConnection(std::string name) override;
44
45         void setSenderAddress(std::string address) override;
46         std::string getSenderAddress() override { return _senderAddress; }
47
48         mtprConnectionType type() override { return MTPR_CONNECTION_TYPE_SRT_RECEIVER; }
49         void foreachConnectionStats(InvokablePtr callback) override;
50
51 private:
52         static void _demuxPadAddedCallback(GstElement* demux, GstPad* new_pad, gpointer userData);
53         static void _demuxNoMorePadsCallback(GstElement* demux, gpointer userData);
54         static gboolean _statsForeachCb(GQuark fieldId, const GValue* val, gpointer userData);
55
56         param::srt::connectionParam _connectionParam;
57         std::string _senderAddress;
58         GstElement* _srtSrc { nullptr };
59 };
60
61 } // namespace
62
63 #endif // __cplusplus
64 #endif // __TIZEN_MEDIA_TRANSPORTER_RECEIVER_SRT_H__