MoodbarPipeline: Rename variables

This commit is contained in:
Jonas Kvinge 2024-09-22 20:43:44 +02:00
parent 04eb97ef93
commit af8a7d5093
2 changed files with 14 additions and 14 deletions

View File

@ -158,18 +158,18 @@ void MoodbarPipeline::ReportError(GstMessage *msg) {
} }
void MoodbarPipeline::NewPadCallback(GstElement *element, GstPad *pad, gpointer data) { void MoodbarPipeline::NewPadCallback(GstElement *element, GstPad *pad, gpointer self) {
Q_UNUSED(element) Q_UNUSED(element)
MoodbarPipeline *self = reinterpret_cast<MoodbarPipeline*>(data); MoodbarPipeline *instance = reinterpret_cast<MoodbarPipeline*>(self);
if (!self->running_) { if (!instance->running_) {
qLog(Warning) << "Received gstreamer callback after pipeline has stopped."; qLog(Warning) << "Received gstreamer callback after pipeline has stopped.";
return; return;
} }
GstPad *const audiopad = gst_element_get_static_pad(self->convert_element_, "sink"); GstPad *const audiopad = gst_element_get_static_pad(instance->convert_element_, "sink");
if (!audiopad) return; if (!audiopad) return;
if (GST_PAD_IS_LINKED(audiopad)) { if (GST_PAD_IS_LINKED(audiopad)) {
@ -190,8 +190,8 @@ void MoodbarPipeline::NewPadCallback(GstElement *element, GstPad *pad, gpointer
gst_caps_unref(caps); gst_caps_unref(caps);
} }
if (self->builder_) { if (instance->builder_) {
self->builder_->Init(kBands, rate); instance->builder_->Init(kBands, rate);
} }
else { else {
qLog(Error) << "Builder does not exist"; qLog(Error) << "Builder does not exist";
@ -199,20 +199,20 @@ void MoodbarPipeline::NewPadCallback(GstElement *element, GstPad *pad, gpointer
} }
GstBusSyncReply MoodbarPipeline::BusCallbackSync(GstBus *bus, GstMessage *message, gpointer data) { GstBusSyncReply MoodbarPipeline::BusCallbackSync(GstBus *bus, GstMessage *message, gpointer self) {
Q_UNUSED(bus) Q_UNUSED(bus)
MoodbarPipeline *self = reinterpret_cast<MoodbarPipeline*>(data); MoodbarPipeline *instance = reinterpret_cast<MoodbarPipeline*>(self);
switch (GST_MESSAGE_TYPE(message)) { switch (GST_MESSAGE_TYPE(message)) {
case GST_MESSAGE_EOS: case GST_MESSAGE_EOS:
self->Stop(true); instance->Stop(true);
break; break;
case GST_MESSAGE_ERROR: case GST_MESSAGE_ERROR:
self->ReportError(message); instance->ReportError(message);
self->Stop(false); instance->Stop(false);
break; break;
default: default:
@ -227,7 +227,7 @@ void MoodbarPipeline::Stop(const bool success) {
success_ = success; success_ = success;
running_ = false; running_ = false;
if (builder_ != nullptr) { if (builder_) {
data_ = builder_->Finish(1000); data_ = builder_->Finish(1000);
builder_.reset(); builder_.reset();
} }

View File

@ -61,8 +61,8 @@ class MoodbarPipeline : public QObject {
void Stop(const bool success); void Stop(const bool success);
void Cleanup(); void Cleanup();
static void NewPadCallback(GstElement *element, GstPad *pad, gpointer data); static void NewPadCallback(GstElement *element, GstPad *pad, gpointer self);
static GstBusSyncReply BusCallbackSync(GstBus *bus, GstMessage *message, gpointer data); static GstBusSyncReply BusCallbackSync(GstBus *bus, GstMessage *message, gpointer self);
private: private:
QUrl url_; QUrl url_;