-
Notifications
You must be signed in to change notification settings - Fork 1
/
ReStreamer.h
57 lines (43 loc) · 1.12 KB
/
ReStreamer.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
#pragma once
#include <memory>
#include <string>
#include <functional>
#include <CxxPtr/GstPtr.h>
class ReStreamer
{
public:
ReStreamer(
const std::string& sourceUrl,
const std::string& targetUrl,
const std::function<void ()>& onEos);
~ReStreamer();
void start() noexcept;
private:
void setState(GstState) noexcept;
void pause() noexcept;
void play() noexcept;
void stop() noexcept;
gboolean onBusMessage(GstMessage*);
void unknownType(
GstElement* decodebin,
GstPad*,
GstCaps*);
void srcPadAdded(GstElement* decodebin, GstPad*);
void noMorePads(GstElement* decodebin);
static void postEos(
GstElement* rtcbin,
gboolean error);
void onEos(bool error);
private:
std::function<void ()> _onEos;
const std::string _sourceUrl;
const std::string _targetUrl;
GstElementPtr _pipelinePtr;
GstElementPtr _flvMuxPtr;
GstPadPtr _flvVideoSinkPad;
GstPadPtr _flvAudioSinkPad;
GstCapsPtr _h264CapsPtr;
GstCapsPtr _audioRawCapsPtr;
bool _videoLinked = false;
bool _audioLinked = false;
};