Remove unused GstElementDeleter

This commit is contained in:
Jonas Kvinge 2021-10-10 16:32:54 +02:00
parent 3b37aea3da
commit fd74bbc868
5 changed files with 2 additions and 93 deletions

View File

@ -600,8 +600,8 @@ optional_source(HAVE_DBUS SOURCES osd/osddbus.cpp HEADERS osd/osddbus.h)
# GStreamer
optional_source(HAVE_GSTREAMER
SOURCES engine/gststartup.cpp engine/gstengine.cpp engine/gstenginepipeline.cpp engine/gstelementdeleter.cpp
HEADERS engine/gststartup.h engine/gstengine.h engine/gstenginepipeline.h engine/gstelementdeleter.h
SOURCES engine/gststartup.cpp engine/gstengine.cpp engine/gstenginepipeline.cpp
HEADERS engine/gststartup.h engine/gstengine.h engine/gstenginepipeline.h
)
# VLC

View File

@ -1,35 +0,0 @@
/*
* Strawberry Music Player
* This file was part of Clementine.
* Copyright 2010, David Sansome <me@davidsansome.com>
*
* Strawberry is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Strawberry is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <QObject>
#include "config.h"
#include "gstelementdeleter.h"
GstElementDeleter::GstElementDeleter(QObject *parent) : QObject(parent) {}
void GstElementDeleter::DeleteElementLater(GstElement *element) {
QMetaObject::invokeMethod(this, "DeleteElement", Qt::QueuedConnection, Q_ARG(GstElement*, element));
}
void GstElementDeleter::DeleteElement(GstElement *element) {
gst_element_set_state(element, GST_STATE_NULL);
}

View File

@ -1,47 +0,0 @@
/*
* Strawberry Music Player
* This file was part of Clementine.
* Copyright 2010, David Sansome <me@davidsansome.com>
*
* Strawberry is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Strawberry is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GSTELEMENTDELETER_H
#define GSTELEMENTDELETER_H
#include "config.h"
#include <gst/gst.h>
#include <QObject>
#include <QString>
class GstElementDeleter : public QObject {
Q_OBJECT
public:
explicit GstElementDeleter(QObject *parent = nullptr);
// If you call this function with any gstreamer element, the element will get deleted in the main thread.
// This is useful if you need to delete an element from its own callback.
// It's in a separate object so *your* object (GstEnginePipeline) can be destroyed,
// and the element that you scheduled for deletion is still deleted later regardless.
void DeleteElementLater(GstElement *element);
private slots:
static void DeleteElement(GstElement *element);
};
#endif // GSTELEMENTDELETER_H

View File

@ -56,7 +56,6 @@
#include "gstengine.h"
#include "gstenginepipeline.h"
#include "gstbufferconsumer.h"
#include "gstelementdeleter.h"
const int GstEnginePipeline::kGstStateTimeoutNanosecs = 10000000;
const int GstEnginePipeline::kFaderFudgeMsec = 2000;
@ -65,7 +64,6 @@ const int GstEnginePipeline::kEqBandCount = 10;
const int GstEnginePipeline::kEqBandFrequencies[] = { 60, 170, 310, 600, 1000, 3000, 6000, 12000, 14000, 16000 };
int GstEnginePipeline::sId = 1;
GstElementDeleter *GstEnginePipeline::sElementDeleter = nullptr;
GstEnginePipeline::GstEnginePipeline(GstEngine *engine, QObject *parent)
: QObject(parent),
@ -116,10 +114,6 @@ GstEnginePipeline::GstEnginePipeline(GstEngine *engine, QObject *parent)
about_to_finish_cb_id_(-1),
unsupported_analyzer_(false) {
if (!sElementDeleter) {
sElementDeleter = new GstElementDeleter(engine_);
}
eq_band_gains_.reserve(kEqBandCount);
for (int i = 0; i < kEqBandCount; ++i) eq_band_gains_ << 0;

View File

@ -47,7 +47,6 @@
class QTimerEvent;
class GstEngine;
class GstBufferConsumer;
class GstElementDeleter;
namespace Engine {
struct SimpleMetaBundle;
@ -177,8 +176,6 @@ class GstEnginePipeline : public QObject {
static const int kEqBandCount;
static const int kEqBandFrequencies[];
static GstElementDeleter *sElementDeleter;
GstEngine *engine_;
// Using == to compare two pipelines is a bad idea, because new ones often get created in the same address as old ones. This ID will be unique for each pipeline.