YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
GstreamerDecoder.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2024-2024 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef YARP_GSTREAMERDECODER_H
7#define YARP_GSTREAMERDECODER_H
8
9#include <mutex>
10#include <yarp/sig/Image.h>
11#include <yarp/os/Semaphore.h>
13
14#include <gst/gst.h>
15#include <glib.h>
16#include <gst/app/gstappsink.h>
17
19{
23
24 int remotePort; // the port on which the server send data
25};
26
27//---------------------------------------------------------------------------------------------
37
38//---------------------------------------------------------------------------------------------
40{
41private:
42 GstElement* m_pipeline = nullptr;
43
44 data_for_gst_callback m_gst_cbk_data;
45
46 yarp::sig::ImageOf<yarp::sig::PixelRgb>* m_pointer_frame = nullptr;
47 std::mutex* m_pointer_mutex = nullptr;
48 yarp::os::Semaphore m_semaphore_reading_from_gst = 0;
49 yarp::os::Semaphore m_semaphore_reading_from_stream;
50
51
53
54public:
57 bool init(std::string pipeline_string);
58 bool start();
59 bool stop();
61 void prepareNextFrame();
62};
63
64#endif
yarp::sig::ImageOf< yarp::sig::PixelRgb > * getLastFrame()
bool init(std::string pipeline_string)
A class for thread synchronization and mutual exclusion.
Definition Semaphore.h:25
Typed image class.
Definition Image.h:605
yarp::os::Semaphore * sem_pointer_stream
yarp::sig::ImageOf< yarp::sig::PixelRgb > * img_pointer
yarp::os::Semaphore * sem_pointer_gst
data_for_gst_callback()=default