-
Notifications
You must be signed in to change notification settings - Fork 0
/
GStreamer.hpp
68 lines (54 loc) · 2.19 KB
/
GStreamer.hpp
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
/// Copyright (c) 2017-2019 Ashley Brighthope
/// SPDX-License-Identifier: BSL-1.0
#pragma once
#include "GStreamerTypes.hpp"
#include <Pothos/Framework.hpp>
#include <gst/gst.h>
#include <string>
#include <memory> /* std::unique_ptr */
#include <type_traits>
extern const char SIGNAL_BUS_NAME[];
extern const char SIGNAL_TAG[];
extern const char SIGNAL_EOS_NAME[];
// Forward declare
class GStreamerSubWorker;
class GStreamer : public Pothos::Block
{
private:
const std::string m_pipeline_string;
std::unique_ptr< GstPipeline, GstTypes::GstObjectUnrefFunc > m_pipeline;
std::unique_ptr< GstBus, GstTypes::GstObjectUnrefFunc > m_bus;
std::vector< std::unique_ptr< GStreamerSubWorker > > m_gstreamerSubWorkers;
int m_blockingNodes;
bool m_pipelineActive;
GstState m_gstState;
void gstChangeState( GstState state );
void workerStop(const std::string &reason);
Pothos::ObjectKwargs gstMessageToFormattedObject(GstMessage *gstMessage);
Pothos::Object gstMessageToObject(GstMessage *gstMessage);
void processGstMessagesTimeout(GstClockTime timeout);
void setState(const std::string &state);
void findSourcesAndSinks(GstBin *bin);
void createPipeline();
void destroyPipeline();
Pothos::ObjectKwargs gstMessageInfoWarnError( GstMessage *message );
void debugPipelineToDot(const std::string &fileName);
public:
GStreamer(const GStreamer&) = delete;
GStreamer& operator=(const GStreamer&) = delete;
explicit GStreamer(const std::string &pipelineString);
~GStreamer() override;
static Block *make(const std::string &pipelineString);
GstTypes::GstElementPtr getPipelineElementByName(const std::string &name) const;
std::string getPipelineString() const;
GstPipeline* getPipeline() const;
Pothos::Object getPipelineLatency() const;
int64_t getPipelinePosition(const std::string &format) const;
int64_t getPipelineDuration(const std::string &format) const;
std::string getPipelineGraph();
void savePipelineGraph(const std::string &fileName);
void activate() override;
void deactivate() override;
void propagateLabels(const Pothos::InputPort *input) override;
void work() override;
}; // class GStreamer