Add EnsureInitialised()

This commit is contained in:
Jonas Kvinge 2018-10-22 20:40:02 +02:00
parent 262df6b461
commit 3a02ece169
1 changed files with 7 additions and 1 deletions

View File

@ -368,6 +368,8 @@ const Engine::Scope &GstEngine::scope(int chunk_length) {
EngineBase::OutputDetailsList GstEngine::GetOutputsList() const { EngineBase::OutputDetailsList GstEngine::GetOutputsList() const {
const_cast<GstEngine*>(this)->EnsureInitialised();
EngineBase::OutputDetailsList ret; EngineBase::OutputDetailsList ret;
PluginDetailsList plugins = GetPluginList("Sink/Audio"); PluginDetailsList plugins = GetPluginList("Sink/Audio");
@ -391,6 +393,8 @@ EngineBase::OutputDetailsList GstEngine::GetOutputsList() const {
bool GstEngine::ValidOutput(const QString &output) { bool GstEngine::ValidOutput(const QString &output) {
EnsureInitialised();
PluginDetailsList plugins = GetPluginList("Sink/Audio"); PluginDetailsList plugins = GetPluginList("Sink/Audio");
for (const PluginDetails &plugin : plugins) { for (const PluginDetails &plugin : plugins) {
if (plugin.name == output) return(true); if (plugin.name == output) return(true);
@ -701,6 +705,8 @@ void GstEngine::BufferingFinished() {
GstEngine::PluginDetailsList GstEngine::GetPluginList(const QString &classname) const { GstEngine::PluginDetailsList GstEngine::GetPluginList(const QString &classname) const {
const_cast<GstEngine*>(this)->EnsureInitialised();
PluginDetailsList ret; PluginDetailsList ret;
GstRegistry *registry = gst_registry_get(); GstRegistry *registry = gst_registry_get();
@ -750,7 +756,7 @@ QByteArray GstEngine::FixupUrl(const QUrl &url) {
QStringList path = url.path().split('/'); QStringList path = url.path().split('/');
str = QString("cdda://%1a").arg(path.takeLast()); str = QString("cdda://%1a").arg(path.takeLast());
QString device = path.join("/"); QString device = path.join("/");
current_pipeline_->SetSourceDevice(device); if (current_pipeline_) current_pipeline_->SetSourceDevice(device);
} }
uri = str.toLocal8Bit(); uri = str.toLocal8Bit();
} }