-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPipeline.h
111 lines (84 loc) · 2.49 KB
/
Pipeline.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#pragma once
#define GST_USE_UNSTABLE_API 1
#include <chrono>
#include <cstdint>
#include <gst/gst.h>
#include <map>
#include <memory>
#include <string>
struct Config;
namespace http
{
class WhipClient;
}
class Pipeline
{
public:
Pipeline(http::WhipClient& whipClient, const Config& config);
~Pipeline();
void run();
void stop();
void onDemuxPadAdded(GstPad* newPad);
void onDemuxNoMorePads();
void onOfferCreated(GstPromise* promise);
void onNegotiationNeeded();
void onIceCandidate(guint mLineIndex, gchar* candidate);
static gboolean pipelineBusWatch(GstBus* /*bus*/, GstMessage* message, gpointer userData);
static void demuxPadAddedCallback(GstElement* /*src*/, GstPad* newPad, gpointer userData);
static void demuxNoMorePadsCallback(GstElement* /*src*/, gpointer userData);
static void onOfferCreatedCallback(GstPromise* promise, gpointer userData);
static void onNegotiationNeededCallback(GstElement* /*webRtcBin*/, gpointer userData);
static void onIceCandidateCallback(GstElement* /*webrtc*/, guint mLineIndex, gchar* candidate, gpointer userData);
private:
private:
enum class ElementLabel
{
UDP_SOURCE,
UDP_QUEUE,
TS_DEMUX,
SRT_SOURCE,
TEE,
RESTREAM_QUEUE,
UDP_DEST,
SRT_DEST,
H264_PARSE,
H264_DECODE,
H265_PARSE,
H265_DECODE,
VIDEO_CONVERT,
CLOCK_OVERLAY,
MPEG2_PARSE,
MPEG2_DECODE,
RTP_VIDEO_ENCODE,
RTP_VIDEO_PAYLOAD,
RTP_VIDEO_PAYLOAD_QUEUE,
RTP_VIDEO_FILTER,
AAC_PARSE,
AAC_DECODE,
PCM_PARSE,
OPUS_PARSE,
OPUS_DECODE,
AUDIO_CONVERT,
AUDIO_RESAMPLE,
RTP_AUDIO_ENCODE,
RTP_AUDIO_PAYLOAD,
RTP_AUDIO_PAYLOAD_QUEUE,
RTP_AUDIO_FILTER,
WEBRTC_BIN
};
http::WhipClient& whipClient_;
const Config& config_;
GstBus* pipelineMessageBus_;
GstElement* pipeline_;
std::map<ElementLabel, GstElement*> elements_;
std::string whipResource_;
std::string etag_;
void makeElement(const ElementLabel elementLabel, const char* element);
void onH264SinkPadAdded(GstPad* newPad);
void onH265SinkPadAdded(GstPad* newPad);
void onMpeg2SinkPadAdded(GstPad* newPad);
void onAacSinkPadAdded(GstPad* newPad);
void onPcmSinkPadAdded(GstPad* newPad);
void onOpusSinkPadAdded(GstPad* newPad);
GstElement* addClockOverlay(GstElement* lastElement);
};