Loading...
Searching...
No Matches
GStreamerPipelineParse.hpp File Reference

Appsink discovery and media-type classification from a pipeline string. More...

Detailed Description

Appsink discovery and media-type classification from a pipeline string.

A live source has no negotiated caps when the pipeline is built, so the only thing that can say whether an appsink carries audio or video – and at what geometry – is the pipeline description itself. Kept out of GStreamerDevice.cpp so it can be exercised without a GStreamer library: this is ctre over a string plus Video::gstreamerToLibav().

Go to the source code of this file.

Classes

struct  Gfx::GStreamer::AppsinkInfo
 

Namespaces

namespace  Gfx
 Binds the rendering pipeline to ossia processes.
 

Functions

std::vector< std::string > Gfx::GStreamer::find_appsink_names (const std::string &pipeline)
 
std::vector< std::string > Gfx::GStreamer::find_all_named_elements (const std::string &pipeline)
 
template<ctll::fixed_string Rexp>
int Gfx::GStreamer::last_int_of (std::string_view str, int fallback)
 
void Gfx::GStreamer::classify_from_pipeline_string (const std::string &pipeline, const std::string &sink_name, AppsinkInfo &info)
 
std::string Gfx::GStreamer::resample_audio_sinks (const std::string &pipeline, const std::vector< std::string > &audio_sinks, int rate)
 The pipeline with the given audio appsinks fed through a resampler.
 

Variables

constexpr auto Gfx::GStreamer::appsink_name_rexp = ctll::fixed_string{R"(appsink\b[^!]*?\bname\s*=\s*([A-Za-z0-9_]+))"}
 
constexpr auto Gfx::GStreamer::elem_name_rexp = ctll::fixed_string{R"(\bname\s*=\s*([A-Za-z0-9_]+))"}
 
constexpr auto Gfx::GStreamer::channels_rexp = ctll::fixed_string{R"(channels=(?:\‍(int\))?\s*([0-9]+))"}
 
constexpr auto Gfx::GStreamer::rate_rexp = ctll::fixed_string{R"((?:^|[^A-Za-z0-9_\-])rate=(?:\‍(int\))?\s*([0-9]+))"}
 
constexpr auto Gfx::GStreamer::width_rexp = ctll::fixed_string{R"(width=(?:\‍(int\))?\s*([0-9]+))"}
 
constexpr auto Gfx::GStreamer::height_rexp = ctll::fixed_string{R"(height=(?:\‍(int\))?\s*([0-9]+))"}
 
constexpr auto Gfx::GStreamer::format_rexp = ctll::fixed_string{R"(format=(?:\‍(string\))?\s*([A-Za-z0-9]+))"}
 

Function Documentation

◆ resample_audio_sinks()

std::string Gfx::GStreamer::resample_audio_sinks ( const std::string &  pipeline,
const std::vector< std::string > &  audio_sinks,
int  rate 
)
inline

The pipeline with the given audio appsinks fed through a resampler.

The engine reads an appsink's samples at its own rate, whatever rate the pipeline produces them at: a 48 kHz pipeline into a 44.1 kHz engine plays 8% flat. Each listed sink gets audioconvert ! audioresample and caps for F32LE at rate in front of it, so the samples arrive at the engine's rate in the format it reads.

Only a sink linked with ! is handled; one linked by name elsewhere in the description would be left with an unlinked converter in front of it.