Add type to metadata bundle to avoid updating previous song when it shouldn't
This commit is contained in:
parent
efcdfdf612
commit
2695169514
@ -666,16 +666,17 @@ void Player::SeekBackward() {
|
|||||||
|
|
||||||
void Player::EngineMetadataReceived(const Engine::SimpleMetaBundle &bundle) {
|
void Player::EngineMetadataReceived(const Engine::SimpleMetaBundle &bundle) {
|
||||||
|
|
||||||
|
if (bundle.type == Engine::SimpleMetaBundle::Type_Any || bundle.type == Engine::SimpleMetaBundle::Type_Current) {
|
||||||
PlaylistItemPtr item = app_->playlist_manager()->active()->current_item();
|
PlaylistItemPtr item = app_->playlist_manager()->active()->current_item();
|
||||||
if (!item) return;
|
if (item && bundle.url == item->Url()) {
|
||||||
|
|
||||||
if (bundle.url == item->Url()) {
|
|
||||||
Song song = item->Metadata();
|
Song song = item->Metadata();
|
||||||
bool minor = song.MergeFromSimpleMetaBundle(bundle);
|
bool minor = song.MergeFromSimpleMetaBundle(bundle);
|
||||||
app_->playlist_manager()->active()->SetStreamMetadata(item->Url(), song, minor);
|
app_->playlist_manager()->active()->SetStreamMetadata(item->Url(), song, minor);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bundle.type == Engine::SimpleMetaBundle::Type_Any || bundle.type == Engine::SimpleMetaBundle::Type_Next) {
|
||||||
int next_row = app_->playlist_manager()->active()->next_row();
|
int next_row = app_->playlist_manager()->active()->next_row();
|
||||||
if (next_row != -1) {
|
if (next_row != -1) {
|
||||||
PlaylistItemPtr next_item = app_->playlist_manager()->active()->item_at(next_row);
|
PlaylistItemPtr next_item = app_->playlist_manager()->active()->item_at(next_row);
|
||||||
@ -686,6 +687,7 @@ void Player::EngineMetadataReceived(const Engine::SimpleMetaBundle &bundle) {
|
|||||||
app_->playlist_manager()->active()->ItemChanged(next_row);
|
app_->playlist_manager()->active()->ItemChanged(next_row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,11 +52,10 @@ typedef std::vector<int16_t> Scope;
|
|||||||
class Base : public QObject {
|
class Base : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Base();
|
Base();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
~Base() override;
|
~Base() override;
|
||||||
|
|
||||||
struct OutputDetails {
|
struct OutputDetails {
|
||||||
@ -213,7 +212,13 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct SimpleMetaBundle {
|
struct SimpleMetaBundle {
|
||||||
SimpleMetaBundle() : length(-1), year(-1), track(-1), filetype(Song::FileType_Unknown), samplerate(-1), bitdepth(-1), bitrate(-1) {}
|
SimpleMetaBundle() : type(Type_Any), length(-1), year(-1), track(-1), filetype(Song::FileType_Unknown), samplerate(-1), bitdepth(-1), bitrate(-1) {}
|
||||||
|
enum Type {
|
||||||
|
Type_Any,
|
||||||
|
Type_Current,
|
||||||
|
Type_Next,
|
||||||
|
};
|
||||||
|
Type type;
|
||||||
QUrl url;
|
QUrl url;
|
||||||
QUrl stream_url;
|
QUrl stream_url;
|
||||||
QString title;
|
QString title;
|
||||||
|
@ -930,9 +930,11 @@ void GstEngine::StreamDiscovered(GstDiscoverer*, GstDiscovererInfo *info, GError
|
|||||||
|
|
||||||
Engine::SimpleMetaBundle bundle;
|
Engine::SimpleMetaBundle bundle;
|
||||||
if (discovered_url == instance->current_pipeline_->stream_url()) {
|
if (discovered_url == instance->current_pipeline_->stream_url()) {
|
||||||
|
bundle.type = Engine::SimpleMetaBundle::Type_Current;
|
||||||
bundle.url = instance->current_pipeline_->original_url();
|
bundle.url = instance->current_pipeline_->original_url();
|
||||||
}
|
}
|
||||||
else if (discovered_url == instance->current_pipeline_->next_stream_url()) {
|
else if (discovered_url == instance->current_pipeline_->next_stream_url()) {
|
||||||
|
bundle.type = Engine::SimpleMetaBundle::Type_Next;
|
||||||
bundle.url = instance->current_pipeline_->next_original_url();
|
bundle.url = instance->current_pipeline_->next_original_url();
|
||||||
}
|
}
|
||||||
bundle.stream_url = QUrl(discovered_url);
|
bundle.stream_url = QUrl(discovered_url);
|
||||||
|
@ -926,6 +926,7 @@ void GstEnginePipeline::TagMessageReceived(GstMessage *msg) {
|
|||||||
gst_message_parse_tag(msg, &taglist);
|
gst_message_parse_tag(msg, &taglist);
|
||||||
|
|
||||||
Engine::SimpleMetaBundle bundle;
|
Engine::SimpleMetaBundle bundle;
|
||||||
|
bundle.type = Engine::SimpleMetaBundle::Type_Current;
|
||||||
bundle.url = original_url_;
|
bundle.url = original_url_;
|
||||||
bundle.title = ParseStrTag(taglist, GST_TAG_TITLE);
|
bundle.title = ParseStrTag(taglist, GST_TAG_TITLE);
|
||||||
bundle.artist = ParseStrTag(taglist, GST_TAG_ARTIST);
|
bundle.artist = ParseStrTag(taglist, GST_TAG_ARTIST);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user