Rename variables
This commit is contained in:
@@ -49,8 +49,8 @@ EngineBase::EngineBase(QObject *parent)
|
|||||||
exclusive_mode_(false),
|
exclusive_mode_(false),
|
||||||
volume_control_(true),
|
volume_control_(true),
|
||||||
volume_(100),
|
volume_(100),
|
||||||
beginning_nanosec_(0),
|
beginning_offset_nanosec_(0),
|
||||||
end_nanosec_(0),
|
end_offset_nanosec_(0),
|
||||||
ebur128_loudness_normalizing_gain_db_(0.0),
|
ebur128_loudness_normalizing_gain_db_(0.0),
|
||||||
scope_(kScopeSize),
|
scope_(kScopeSize),
|
||||||
buffering_(false),
|
buffering_(false),
|
||||||
@@ -84,15 +84,15 @@ EngineBase::EngineBase(QObject *parent)
|
|||||||
|
|
||||||
EngineBase::~EngineBase() = default;
|
EngineBase::~EngineBase() = default;
|
||||||
|
|
||||||
bool EngineBase::Load(const QUrl &media_url, const QUrl &stream_url, const TrackChangeFlags track_change_flags, const bool force_stop_at_end, const quint64 beginning_nanosec, const qint64 end_nanosec, const std::optional<double> ebur128_integrated_loudness_lufs) {
|
bool EngineBase::Load(const QUrl &media_url, const QUrl &stream_url, const TrackChangeFlags track_change_flags, const bool force_stop_at_end, const quint64 beginning_offset_nanosec, const qint64 end_offset_nanosec, const std::optional<double> ebur128_integrated_loudness_lufs) {
|
||||||
|
|
||||||
Q_UNUSED(track_change_flags)
|
Q_UNUSED(track_change_flags)
|
||||||
Q_UNUSED(force_stop_at_end);
|
Q_UNUSED(force_stop_at_end);
|
||||||
|
|
||||||
media_url_ = media_url;
|
media_url_ = media_url;
|
||||||
stream_url_ = stream_url;
|
stream_url_ = stream_url;
|
||||||
beginning_nanosec_ = beginning_nanosec;
|
beginning_offset_nanosec_ = beginning_offset_nanosec;
|
||||||
end_nanosec_ = end_nanosec;
|
end_offset_nanosec_ = end_offset_nanosec;
|
||||||
|
|
||||||
ebur128_loudness_normalizing_gain_db_ = 0.0;
|
ebur128_loudness_normalizing_gain_db_ = 0.0;
|
||||||
if (ebur128_loudness_normalization_ && ebur128_integrated_loudness_lufs) {
|
if (ebur128_loudness_normalization_ && ebur128_integrated_loudness_lufs) {
|
||||||
@@ -112,9 +112,9 @@ bool EngineBase::Load(const QUrl &media_url, const QUrl &stream_url, const Track
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EngineBase::Play(const QUrl &media_url, const QUrl &stream_url, const bool pause, const TrackChangeFlags flags, const bool force_stop_at_end, const quint64 beginning_nanosec, const qint64 end_nanosec, const quint64 offset_nanosec, const std::optional<double> ebur128_integrated_loudness_lufs) {
|
bool EngineBase::Play(const QUrl &media_url, const QUrl &stream_url, const bool pause, const TrackChangeFlags flags, const bool force_stop_at_end, const quint64 beginning_offset_nanosec, const qint64 end_offset_nanosec, const quint64 offset_nanosec, const std::optional<double> ebur128_integrated_loudness_lufs) {
|
||||||
|
|
||||||
if (!Load(media_url, stream_url, flags, force_stop_at_end, beginning_nanosec, end_nanosec, ebur128_integrated_loudness_lufs)) {
|
if (!Load(media_url, stream_url, flags, force_stop_at_end, beginning_offset_nanosec, end_offset_nanosec, ebur128_integrated_loudness_lufs)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class EngineBase : public QObject {
|
|||||||
virtual bool Init() = 0;
|
virtual bool Init() = 0;
|
||||||
virtual State state() const = 0;
|
virtual State state() const = 0;
|
||||||
virtual void StartPreloading(const QUrl&, const QUrl&, const bool, const qint64, const qint64) {}
|
virtual void StartPreloading(const QUrl&, const QUrl&, const bool, const qint64, const qint64) {}
|
||||||
virtual bool Load(const QUrl &media_url, const QUrl &stream_url, const TrackChangeFlags track_change_flags, const bool force_stop_at_end, const quint64 beginning_nanosec, const qint64 end_nanosec, const std::optional<double> ebur128_integrated_loudness_lufs);
|
virtual bool Load(const QUrl &media_url, const QUrl &stream_url, const TrackChangeFlags track_change_flags, const bool force_stop_at_end, const quint64 beginning_offset_nanosec, const qint64 end_offset_nanosec, const std::optional<double> ebur128_integrated_loudness_lufs);
|
||||||
virtual bool Play(const bool pause, const quint64 offset_nanosec) = 0;
|
virtual bool Play(const bool pause, const quint64 offset_nanosec) = 0;
|
||||||
virtual void Stop(const bool stop_after = false) = 0;
|
virtual void Stop(const bool stop_after = false) = 0;
|
||||||
virtual void Pause() = 0;
|
virtual void Pause() = 0;
|
||||||
@@ -106,9 +106,9 @@ class EngineBase : public QObject {
|
|||||||
|
|
||||||
// Sets new values for the beginning and end markers of the currently playing song.
|
// Sets new values for the beginning and end markers of the currently playing song.
|
||||||
// This doesn't change the state of engine or the stream's current position.
|
// This doesn't change the state of engine or the stream's current position.
|
||||||
virtual void RefreshMarkers(const quint64 beginning_nanosec, const qint64 end_nanosec) {
|
virtual void RefreshMarkers(const quint64 beginning_offset_nanosec, const qint64 end_offset_nanosec) {
|
||||||
beginning_nanosec_ = beginning_nanosec;
|
beginning_offset_nanosec_ = beginning_offset_nanosec;
|
||||||
end_nanosec_ = end_nanosec;
|
end_offset_nanosec_ = end_offset_nanosec;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual OutputDetailsList GetOutputsList() const = 0;
|
virtual OutputDetailsList GetOutputsList() const = 0;
|
||||||
@@ -179,8 +179,8 @@ class EngineBase : public QObject {
|
|||||||
bool exclusive_mode_;
|
bool exclusive_mode_;
|
||||||
bool volume_control_;
|
bool volume_control_;
|
||||||
uint volume_;
|
uint volume_;
|
||||||
quint64 beginning_nanosec_;
|
quint64 beginning_offset_nanosec_;
|
||||||
qint64 end_nanosec_;
|
qint64 end_offset_nanosec_;
|
||||||
QUrl media_url_;
|
QUrl media_url_;
|
||||||
QUrl stream_url_;
|
QUrl stream_url_;
|
||||||
double ebur128_loudness_normalizing_gain_db_;
|
double ebur128_loudness_normalizing_gain_db_;
|
||||||
|
|||||||
@@ -177,13 +177,13 @@ EngineBase::State GstEngine::state() const {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEngine::StartPreloading(const QUrl &media_url, const QUrl &stream_url, const bool force_stop_at_end, const qint64 beginning_nanosec, const qint64 end_nanosec) {
|
void GstEngine::StartPreloading(const QUrl &media_url, const QUrl &stream_url, const bool force_stop_at_end, const qint64 beginning_offset_nanosec, const qint64 end_offset_nanosec) {
|
||||||
|
|
||||||
const QByteArray gst_url = FixupUrl(stream_url);
|
const QByteArray gst_url = FixupUrl(stream_url);
|
||||||
|
|
||||||
// No crossfading, so we can just queue the new URL in the existing pipeline and get gapless playback (hopefully)
|
// No crossfading, so we can just queue the new URL in the existing pipeline and get gapless playback (hopefully)
|
||||||
if (current_pipeline_) {
|
if (current_pipeline_) {
|
||||||
current_pipeline_->PrepareNextUrl(media_url, stream_url, gst_url, beginning_nanosec, force_stop_at_end ? end_nanosec : 0);
|
current_pipeline_->PrepareNextUrl(media_url, stream_url, gst_url, beginning_offset_nanosec, force_stop_at_end ? end_offset_nanosec : 0);
|
||||||
// Add request to discover the stream
|
// Add request to discover the stream
|
||||||
if (discoverer_ && media_url.scheme() != u"spotify"_s) {
|
if (discoverer_ && media_url.scheme() != u"spotify"_s) {
|
||||||
if (!gst_discoverer_discover_uri_async(discoverer_, gst_url.constData())) {
|
if (!gst_discoverer_discover_uri_async(discoverer_, gst_url.constData())) {
|
||||||
@@ -194,9 +194,9 @@ void GstEngine::StartPreloading(const QUrl &media_url, const QUrl &stream_url, c
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GstEngine::Load(const QUrl &media_url, const QUrl &stream_url, const EngineBase::TrackChangeFlags change, const bool force_stop_at_end, const quint64 beginning_nanosec, const qint64 end_nanosec, const std::optional<double> ebur128_integrated_loudness_lufs) {
|
bool GstEngine::Load(const QUrl &media_url, const QUrl &stream_url, const EngineBase::TrackChangeFlags change, const bool force_stop_at_end, const quint64 beginning_offset_nanosec, const qint64 end_offset_nanosec, const std::optional<double> ebur128_integrated_loudness_lufs) {
|
||||||
|
|
||||||
EngineBase::Load(media_url, stream_url, change, force_stop_at_end, beginning_nanosec, end_nanosec, ebur128_integrated_loudness_lufs);
|
EngineBase::Load(media_url, stream_url, change, force_stop_at_end, beginning_offset_nanosec, end_offset_nanosec, ebur128_integrated_loudness_lufs);
|
||||||
|
|
||||||
const QByteArray gst_url = FixupUrl(stream_url);
|
const QByteArray gst_url = FixupUrl(stream_url);
|
||||||
|
|
||||||
@@ -215,7 +215,7 @@ bool GstEngine::Load(const QUrl &media_url, const QUrl &stream_url, const Engine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GstEnginePipelinePtr pipeline = CreatePipeline(media_url, stream_url, gst_url, force_stop_at_end ? end_nanosec : 0, ebur128_loudness_normalizing_gain_db_);
|
GstEnginePipelinePtr pipeline = CreatePipeline(media_url, stream_url, gst_url, static_cast<qint64>(beginning_offset_nanosec), force_stop_at_end ? end_offset_nanosec : 0, ebur128_loudness_normalizing_gain_db_);
|
||||||
if (!pipeline) return false;
|
if (!pipeline) return false;
|
||||||
|
|
||||||
GstEnginePipelinePtr old_pipeline = current_pipeline_;
|
GstEnginePipelinePtr old_pipeline = current_pipeline_;
|
||||||
@@ -289,7 +289,7 @@ bool GstEngine::Play(const bool pause, const quint64 offset_nanosec) {
|
|||||||
watcher->deleteLater();
|
watcher->deleteLater();
|
||||||
PlayDone(ret, pause, offset_nanosec, pipeline_id);
|
PlayDone(ret, pause, offset_nanosec, pipeline_id);
|
||||||
});
|
});
|
||||||
QFuture<GstStateChangeReturn> future = current_pipeline_->Play(pause, beginning_nanosec_ + offset_nanosec);
|
QFuture<GstStateChangeReturn> future = current_pipeline_->Play(pause, beginning_offset_nanosec_ + offset_nanosec);
|
||||||
watcher->setFuture(future);
|
watcher->setFuture(future);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -306,7 +306,7 @@ void GstEngine::Stop(const bool stop_after) {
|
|||||||
|
|
||||||
media_url_.clear();
|
media_url_.clear();
|
||||||
stream_url_.clear(); // To ensure we return Empty from state()
|
stream_url_.clear(); // To ensure we return Empty from state()
|
||||||
beginning_nanosec_ = end_nanosec_ = 0;
|
beginning_offset_nanosec_ = end_offset_nanosec_ = 0;
|
||||||
|
|
||||||
// Check if we started a fade out. If it isn't finished yet and the user pressed stop, we cancel the fader and just stop the playback.
|
// Check if we started a fade out. If it isn't finished yet and the user pressed stop, we cancel the fader and just stop the playback.
|
||||||
if (fadeout_pause_pipeline_) {
|
if (fadeout_pause_pipeline_) {
|
||||||
@@ -384,7 +384,7 @@ void GstEngine::Seek(const quint64 offset_nanosec) {
|
|||||||
|
|
||||||
if (!current_pipeline_) return;
|
if (!current_pipeline_) return;
|
||||||
|
|
||||||
seek_pos_ = beginning_nanosec_ + offset_nanosec;
|
seek_pos_ = beginning_offset_nanosec_ + offset_nanosec;
|
||||||
waiting_to_seek_ = true;
|
waiting_to_seek_ = true;
|
||||||
|
|
||||||
if (!seek_timer_->isActive()) {
|
if (!seek_timer_->isActive()) {
|
||||||
@@ -402,7 +402,7 @@ qint64 GstEngine::position_nanosec() const {
|
|||||||
|
|
||||||
if (!current_pipeline_) return 0;
|
if (!current_pipeline_) return 0;
|
||||||
|
|
||||||
const qint64 result = current_pipeline_->position() - static_cast<qint64>(beginning_nanosec_);
|
const qint64 result = current_pipeline_->position() - static_cast<qint64>(beginning_offset_nanosec_);
|
||||||
return std::max(0LL, result);
|
return std::max(0LL, result);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -411,7 +411,7 @@ qint64 GstEngine::length_nanosec() const {
|
|||||||
|
|
||||||
if (!current_pipeline_) return 0;
|
if (!current_pipeline_) return 0;
|
||||||
|
|
||||||
const qint64 result = end_nanosec_ - static_cast<qint64>(beginning_nanosec_);
|
const qint64 result = end_offset_nanosec_ - static_cast<qint64>(beginning_offset_nanosec_);
|
||||||
|
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
return result;
|
return result;
|
||||||
@@ -742,7 +742,7 @@ void GstEngine::PlayDone(const GstStateChangeReturn ret, const bool pause, const
|
|||||||
stream_url = old_pipeline->stream_url();
|
stream_url = old_pipeline->stream_url();
|
||||||
stream_url.detach();
|
stream_url.detach();
|
||||||
}
|
}
|
||||||
current_pipeline_ = CreatePipeline(media_url, stream_url, redirect_url, end_nanosec_, old_pipeline->ebur128_loudness_normalizing_gain_db());
|
current_pipeline_ = CreatePipeline(media_url, stream_url, redirect_url, beginning_offset_nanosec_, end_offset_nanosec_, old_pipeline->ebur128_loudness_normalizing_gain_db());
|
||||||
FinishPipeline(old_pipeline);
|
FinishPipeline(old_pipeline);
|
||||||
Play(pause, offset_nanosec);
|
Play(pause, offset_nanosec);
|
||||||
return;
|
return;
|
||||||
@@ -761,7 +761,7 @@ void GstEngine::PlayDone(const GstStateChangeReturn ret, const bool pause, const
|
|||||||
|
|
||||||
Q_EMIT StateChanged(pause ? State::Paused : State::Playing);
|
Q_EMIT StateChanged(pause ? State::Paused : State::Playing);
|
||||||
|
|
||||||
// We've successfully started playing a media stream with this url
|
// We've successfully started playing a media stream with this URL
|
||||||
Q_EMIT ValidSongRequested(stream_url_);
|
Q_EMIT ValidSongRequested(stream_url_);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -926,11 +926,11 @@ GstEnginePipelinePtr GstEngine::CreatePipeline() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GstEnginePipelinePtr GstEngine::CreatePipeline(const QUrl &media_url, const QUrl &stream_url, const QByteArray &gst_url, const qint64 end_nanosec, const double ebur128_loudness_normalizing_gain_db) {
|
GstEnginePipelinePtr GstEngine::CreatePipeline(const QUrl &media_url, const QUrl &stream_url, const QByteArray &gst_url, const qint64 beginning_offset_nanosec, const qint64 end_offset_nanosec, const double ebur128_loudness_normalizing_gain_db) {
|
||||||
|
|
||||||
GstEnginePipelinePtr ret = CreatePipeline();
|
GstEnginePipelinePtr ret = CreatePipeline();
|
||||||
QString error;
|
QString error;
|
||||||
if (!ret->InitFromUrl(media_url, stream_url, gst_url, end_nanosec, ebur128_loudness_normalizing_gain_db, error)) {
|
if (!ret->InitFromUrl(media_url, stream_url, gst_url, beginning_offset_nanosec, end_offset_nanosec, ebur128_loudness_normalizing_gain_db, error)) {
|
||||||
ret.reset();
|
ret.reset();
|
||||||
Q_EMIT Error(error);
|
Q_EMIT Error(error);
|
||||||
Q_EMIT StateChanged(State::Error);
|
Q_EMIT StateChanged(State::Error);
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ class GstEngine : public EngineBase, public GstBufferConsumer {
|
|||||||
|
|
||||||
bool Init() override;
|
bool Init() override;
|
||||||
State state() const override;
|
State state() const override;
|
||||||
void StartPreloading(const QUrl &media_url, const QUrl &stream_url, const bool force_stop_at_end, const qint64 beginning_nanosec, const qint64 end_nanosec) override;
|
void StartPreloading(const QUrl &media_url, const QUrl &stream_url, const bool force_stop_at_end, const qint64 beginning_offset_nanosec, const qint64 end_offset_nanosec) override;
|
||||||
bool Load(const QUrl &media_url, const QUrl &stream_url, const EngineBase::TrackChangeFlags change, const bool force_stop_at_end, const quint64 beginning_nanosec, const qint64 end_nanosec, const std::optional<double> ebur128_integrated_loudness_lufs) override;
|
bool Load(const QUrl &media_url, const QUrl &stream_url, const EngineBase::TrackChangeFlags change, const bool force_stop_at_end, const quint64 beginning_offset_nanosec, const qint64 end_offset_nanosec, const std::optional<double> ebur128_integrated_loudness_lufs) override;
|
||||||
bool Play(const bool pause, const quint64 offset_nanosec) override;
|
bool Play(const bool pause, const quint64 offset_nanosec) override;
|
||||||
void Stop(const bool stop_after = false) override;
|
void Stop(const bool stop_after = false) override;
|
||||||
void Pause() override;
|
void Pause() override;
|
||||||
@@ -133,7 +133,7 @@ class GstEngine : public EngineBase, public GstBufferConsumer {
|
|||||||
void StopTimers();
|
void StopTimers();
|
||||||
|
|
||||||
GstEnginePipelinePtr CreatePipeline();
|
GstEnginePipelinePtr CreatePipeline();
|
||||||
GstEnginePipelinePtr CreatePipeline(const QUrl &media_url, const QUrl &stream_url, const QByteArray &gst_url, const qint64 end_nanosec, const double ebur128_loudness_normalizing_gain_db);
|
GstEnginePipelinePtr CreatePipeline(const QUrl &media_url, const QUrl &stream_url, const QByteArray &gst_url, const qint64 beginning_offset_nanosec, const qint64 end_offset_nanosec, const double ebur128_loudness_normalizing_gain_db);
|
||||||
|
|
||||||
void FinishPipeline(GstEnginePipelinePtr pipeline);
|
void FinishPipeline(GstEnginePipelinePtr pipeline);
|
||||||
|
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ GstEnginePipeline::GstEnginePipeline(QObject *parent)
|
|||||||
ebur128_loudness_normalizing_gain_db_(0.0),
|
ebur128_loudness_normalizing_gain_db_(0.0),
|
||||||
segment_start_(0),
|
segment_start_(0),
|
||||||
segment_start_received_(false),
|
segment_start_received_(false),
|
||||||
|
beginning_offset_nanosec_(-1),
|
||||||
end_offset_nanosec_(-1),
|
end_offset_nanosec_(-1),
|
||||||
next_beginning_offset_nanosec_(-1),
|
next_beginning_offset_nanosec_(-1),
|
||||||
next_end_offset_nanosec_(-1),
|
next_end_offset_nanosec_(-1),
|
||||||
@@ -429,7 +430,7 @@ bool GstEnginePipeline::Finish() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GstEnginePipeline::InitFromUrl(const QUrl &media_url, const QUrl &stream_url, const QByteArray &gst_url, const qint64 end_nanosec, const double ebur128_loudness_normalizing_gain_db, QString &error) {
|
bool GstEnginePipeline::InitFromUrl(const QUrl &media_url, const QUrl &stream_url, const QByteArray &gst_url, const qint64 beginning_offset_nanosec, const qint64 end_offset_nanosec, const double ebur128_loudness_normalizing_gain_db, QString &error) {
|
||||||
|
|
||||||
{
|
{
|
||||||
QMutexLocker l(&mutex_url_);
|
QMutexLocker l(&mutex_url_);
|
||||||
@@ -438,7 +439,8 @@ bool GstEnginePipeline::InitFromUrl(const QUrl &media_url, const QUrl &stream_ur
|
|||||||
gst_url_ = gst_url;
|
gst_url_ = gst_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
end_offset_nanosec_ = end_nanosec;
|
beginning_offset_nanosec_ = beginning_offset_nanosec;
|
||||||
|
end_offset_nanosec_ = end_offset_nanosec;
|
||||||
ebur128_loudness_normalizing_gain_db_ = ebur128_loudness_normalizing_gain_db;
|
ebur128_loudness_normalizing_gain_db_ = ebur128_loudness_normalizing_gain_db;
|
||||||
|
|
||||||
guint version_major = 0, version_minor = 0, version_micro = 0, version_nano = 0;
|
guint version_major = 0, version_minor = 0, version_micro = 0, version_nano = 0;
|
||||||
@@ -1328,6 +1330,7 @@ GstPadProbeReturn GstEnginePipeline::BufferProbeCallback(GstPad *pad, GstPadProb
|
|||||||
if (instance->end_offset_nanosec_.value() > 0 && end_time > instance->end_offset_nanosec_.value()) {
|
if (instance->end_offset_nanosec_.value() > 0 && end_time > instance->end_offset_nanosec_.value()) {
|
||||||
if (instance->HasMatchingNextUrl() && instance->next_beginning_offset_nanosec_.value() == instance->end_offset_nanosec_.value()) {
|
if (instance->HasMatchingNextUrl() && instance->next_beginning_offset_nanosec_.value() == instance->end_offset_nanosec_.value()) {
|
||||||
// The "next" song is actually the next segment of this file - so cheat and keep on playing, but just tell the Engine we've moved on.
|
// The "next" song is actually the next segment of this file - so cheat and keep on playing, but just tell the Engine we've moved on.
|
||||||
|
instance->beginning_offset_nanosec_ = instance->next_beginning_offset_nanosec_;
|
||||||
instance->end_offset_nanosec_ = instance->next_end_offset_nanosec_;
|
instance->end_offset_nanosec_ = instance->next_end_offset_nanosec_;
|
||||||
instance->next_media_url_.clear();
|
instance->next_media_url_.clear();
|
||||||
instance->next_stream_url_.clear();
|
instance->next_stream_url_.clear();
|
||||||
@@ -1477,6 +1480,7 @@ void GstEnginePipeline::StreamStartMessageReceived() {
|
|||||||
next_media_url_.clear();
|
next_media_url_.clear();
|
||||||
next_gst_url_.clear();
|
next_gst_url_.clear();
|
||||||
}
|
}
|
||||||
|
beginning_offset_nanosec_ = next_beginning_offset_nanosec_;
|
||||||
end_offset_nanosec_ = next_end_offset_nanosec_;
|
end_offset_nanosec_ = next_end_offset_nanosec_;
|
||||||
next_beginning_offset_nanosec_ = 0;
|
next_beginning_offset_nanosec_ = 0;
|
||||||
next_end_offset_nanosec_ = 0;
|
next_end_offset_nanosec_ = 0;
|
||||||
@@ -2137,7 +2141,7 @@ bool GstEnginePipeline::HasMatchingNextUrl() const {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEnginePipeline::PrepareNextUrl(const QUrl &media_url, const QUrl &stream_url, const QByteArray &gst_url, const qint64 beginning_nanosec, const qint64 end_nanosec) {
|
void GstEnginePipeline::PrepareNextUrl(const QUrl &media_url, const QUrl &stream_url, const QByteArray &gst_url, const qint64 beginning_offset_nanosec, const qint64 end_offset_nanosec) {
|
||||||
|
|
||||||
{
|
{
|
||||||
QMutexLocker l(&mutex_next_url_);
|
QMutexLocker l(&mutex_next_url_);
|
||||||
@@ -2146,8 +2150,8 @@ void GstEnginePipeline::PrepareNextUrl(const QUrl &media_url, const QUrl &stream
|
|||||||
next_gst_url_ = gst_url;
|
next_gst_url_ = gst_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
next_beginning_offset_nanosec_ = beginning_nanosec;
|
next_beginning_offset_nanosec_ = beginning_offset_nanosec;
|
||||||
next_end_offset_nanosec_ = end_nanosec;
|
next_end_offset_nanosec_ = end_offset_nanosec;
|
||||||
|
|
||||||
if (about_to_finish_.value()) {
|
if (about_to_finish_.value()) {
|
||||||
SetNextUrl();
|
SetNextUrl();
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ class GstEnginePipeline : public QObject {
|
|||||||
bool Finish();
|
bool Finish();
|
||||||
|
|
||||||
// Creates the pipeline, returns false on error
|
// Creates the pipeline, returns false on error
|
||||||
bool InitFromUrl(const QUrl &media_url, const QUrl &stream_url, const QByteArray &gst_url, const qint64 end_nanosec, const double ebur128_loudness_normalizing_gain_db, QString &error);
|
bool InitFromUrl(const QUrl &media_url, const QUrl &stream_url, const QByteArray &gst_url, const qint64 beginning_offset_nanosec, const qint64 end_offset_nanosec, const double ebur128_loudness_normalizing_gain_db, QString &error);
|
||||||
|
|
||||||
// GstBufferConsumers get fed audio data. Thread-safe.
|
// GstBufferConsumers get fed audio data. Thread-safe.
|
||||||
void AddBufferConsumer(GstBufferConsumer *consumer);
|
void AddBufferConsumer(GstBufferConsumer *consumer);
|
||||||
@@ -105,7 +105,7 @@ class GstEnginePipeline : public QObject {
|
|||||||
// If this is set then it will be loaded automatically when playback finishes for gapless playback
|
// If this is set then it will be loaded automatically when playback finishes for gapless playback
|
||||||
bool HasNextUrl() const;
|
bool HasNextUrl() const;
|
||||||
bool HasMatchingNextUrl() const;
|
bool HasMatchingNextUrl() const;
|
||||||
void PrepareNextUrl(const QUrl &media_url, const QUrl &stream_url, const QByteArray &gst_url, const qint64 beginning_nanosec, const qint64 end_nanosec);
|
void PrepareNextUrl(const QUrl &media_url, const QUrl &stream_url, const QByteArray &gst_url, const qint64 beginning_offset_nanosec, const qint64 end_offset_nanosec);
|
||||||
void SetNextUrl();
|
void SetNextUrl();
|
||||||
|
|
||||||
void SetSourceDevice(const QString &device);
|
void SetSourceDevice(const QString &device);
|
||||||
@@ -287,6 +287,7 @@ class GstEnginePipeline : public QObject {
|
|||||||
mutex_protected<bool> segment_start_received_;
|
mutex_protected<bool> segment_start_received_;
|
||||||
GstSegment last_playbin_segment_{};
|
GstSegment last_playbin_segment_{};
|
||||||
|
|
||||||
|
mutex_protected<qint64> beginning_offset_nanosec_;
|
||||||
// If this is > 0 then the pipeline will be forced to stop when playback goes past this position.
|
// If this is > 0 then the pipeline will be forced to stop when playback goes past this position.
|
||||||
mutex_protected<qint64> end_offset_nanosec_;
|
mutex_protected<qint64> end_offset_nanosec_;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user