Merge branch 'master' of https://github.com/clementine-player/Clementine
This commit is contained in:
commit
4fc9530c9a
|
@ -53,7 +53,7 @@ GstEnginePipeline::GstEnginePipeline(GstEngine* engine)
|
||||||
sink_(GstEngine::kAutoSink),
|
sink_(GstEngine::kAutoSink),
|
||||||
segment_start_(0),
|
segment_start_(0),
|
||||||
segment_start_received_(false),
|
segment_start_received_(false),
|
||||||
emit_track_ended_on_segment_start_(false),
|
emit_track_ended_on_stream_start_(false),
|
||||||
emit_track_ended_on_time_discontinuity_(false),
|
emit_track_ended_on_time_discontinuity_(false),
|
||||||
last_buffer_offset_(0),
|
last_buffer_offset_(0),
|
||||||
eq_enabled_(false),
|
eq_enabled_(false),
|
||||||
|
@ -540,6 +540,15 @@ GstBusSyncReply GstEnginePipeline::BusCallbackSync(GstBus*, GstMessage* msg,
|
||||||
instance->StreamStatusMessageReceived(msg);
|
instance->StreamStatusMessageReceived(msg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GST_MESSAGE_STREAM_START:
|
||||||
|
if (instance->emit_track_ended_on_stream_start_) {
|
||||||
|
qLog(Debug) << "New segment started, EOS will signal on next buffer "
|
||||||
|
"discontinuity";
|
||||||
|
instance->emit_track_ended_on_stream_start_ = false;
|
||||||
|
instance->emit_track_ended_on_time_discontinuity_ = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -792,21 +801,20 @@ GstPadProbeReturn GstEnginePipeline::EventHandoffCallback(GstPad*,
|
||||||
|
|
||||||
qLog(Debug) << instance->id() << "event" << GST_EVENT_TYPE_NAME(e);
|
qLog(Debug) << instance->id() << "event" << GST_EVENT_TYPE_NAME(e);
|
||||||
|
|
||||||
if (GST_EVENT_TYPE(e) == GST_EVENT_SEGMENT &&
|
switch (GST_EVENT_TYPE(e)) {
|
||||||
!instance->segment_start_received_) {
|
case GST_EVENT_SEGMENT:
|
||||||
|
if (!instance->segment_start_received_) {
|
||||||
// The segment start time is used to calculate the proper offset of data
|
// The segment start time is used to calculate the proper offset of data
|
||||||
// buffers from the start of the stream
|
// buffers from the start of the stream
|
||||||
const GstSegment* segment = nullptr;
|
const GstSegment* segment = nullptr;
|
||||||
gst_event_parse_segment(e, &segment);
|
gst_event_parse_segment(e, &segment);
|
||||||
instance->segment_start_ = segment->start;
|
instance->segment_start_ = segment->start;
|
||||||
instance->segment_start_received_ = true;
|
instance->segment_start_received_ = true;
|
||||||
|
|
||||||
if (instance->emit_track_ended_on_segment_start_) {
|
|
||||||
qLog(Debug) << "New segment started, EOS will signal on next buffer "
|
|
||||||
"discontinuity";
|
|
||||||
instance->emit_track_ended_on_segment_start_ = false;
|
|
||||||
instance->emit_track_ended_on_time_discontinuity_ = true;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GST_PAD_PROBE_OK;
|
return GST_PAD_PROBE_OK;
|
||||||
|
@ -886,9 +894,9 @@ void GstEnginePipeline::TransitionToNext() {
|
||||||
next_end_offset_nanosec_ = 0;
|
next_end_offset_nanosec_ = 0;
|
||||||
|
|
||||||
// This function gets called when the source has been drained, even if the
|
// This function gets called when the source has been drained, even if the
|
||||||
// song hasn't finished playing yet. We'll get a new segment when it really
|
// song hasn't finished playing yet. We'll get a new stream when it really
|
||||||
// does finish, so emit TrackEnded then.
|
// does finish, so emit TrackEnded then.
|
||||||
emit_track_ended_on_segment_start_ = true;
|
emit_track_ended_on_stream_start_ = true;
|
||||||
|
|
||||||
// This has to happen *after* the gst_element_set_state on the new bin to
|
// This has to happen *after* the gst_element_set_state on the new bin to
|
||||||
// fix an occasional race condition deadlock.
|
// fix an occasional race condition deadlock.
|
||||||
|
|
|
@ -193,7 +193,7 @@ signals:
|
||||||
QMutex buffer_consumers_mutex_;
|
QMutex buffer_consumers_mutex_;
|
||||||
qint64 segment_start_;
|
qint64 segment_start_;
|
||||||
bool segment_start_received_;
|
bool segment_start_received_;
|
||||||
bool emit_track_ended_on_segment_start_;
|
bool emit_track_ended_on_stream_start_;
|
||||||
bool emit_track_ended_on_time_discontinuity_;
|
bool emit_track_ended_on_time_discontinuity_;
|
||||||
qint64 last_buffer_offset_;
|
qint64 last_buffer_offset_;
|
||||||
|
|
||||||
|
|
|
@ -286,14 +286,14 @@ int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
RegisterMetaTypes();
|
RegisterMetaTypes();
|
||||||
|
|
||||||
CommandlineOptions options(argc, argv);
|
// Initialise logging. Log levels are set after the commandline options are
|
||||||
|
// parsed below.
|
||||||
// Initialise logging
|
|
||||||
logging::Init();
|
logging::Init();
|
||||||
logging::SetLevels(options.log_levels());
|
|
||||||
g_log_set_default_handler(reinterpret_cast<GLogFunc>(&logging::GLog),
|
g_log_set_default_handler(reinterpret_cast<GLogFunc>(&logging::GLog),
|
||||||
nullptr);
|
nullptr);
|
||||||
|
|
||||||
|
CommandlineOptions options(argc, argv);
|
||||||
|
|
||||||
{
|
{
|
||||||
// Only start a core application now so we can check if there's another
|
// Only start a core application now so we can check if there's another
|
||||||
// Clementine running without needing an X server.
|
// Clementine running without needing an X server.
|
||||||
|
@ -306,6 +306,7 @@ int main(int argc, char* argv[]) {
|
||||||
// Parse commandline options - need to do this before starting the
|
// Parse commandline options - need to do this before starting the
|
||||||
// full QApplication so it works without an X server
|
// full QApplication so it works without an X server
|
||||||
if (!options.Parse()) return 1;
|
if (!options.Parse()) return 1;
|
||||||
|
logging::SetLevels(options.log_levels());
|
||||||
|
|
||||||
if (a.isRunning()) {
|
if (a.isRunning()) {
|
||||||
if (options.is_empty()) {
|
if (options.is_empty()) {
|
||||||
|
|
Loading…
Reference in New Issue