Forward metadata and properties in meta stream

This commit is contained in:
badaix 2021-06-27 13:00:35 +02:00
parent fba20fb7fe
commit 3120a18326
4 changed files with 36 additions and 13 deletions

View file

@ -86,18 +86,21 @@ void MetaStream::stop()
void MetaStream::onMetadataChanged(const PcmStream* pcmStream, const Metatags& metadata)
{
std::ignore = metadata;
LOG(DEBUG, LOG_TAG) << "onMetadataChanged: " << pcmStream->getName() << "\n";
std::lock_guard<std::mutex> lock(mutex_);
if (pcmStream != active_stream_.get())
return;
setMetadata(metadata);
}
void MetaStream::onPropertiesChanged(const PcmStream* pcmStream, const Properties& properties)
{
std::ignore = properties;
LOG(DEBUG, LOG_TAG) << "onPropertiesChanged: " << pcmStream->getName() << "\n";
std::lock_guard<std::mutex> lock(mutex_);
if (pcmStream != active_stream_.get())
return;
setProperties(properties);
}
@ -117,6 +120,8 @@ void MetaStream::onStateChanged(const PcmStream* pcmStream, ReaderState state)
LOG(INFO, LOG_TAG) << "Stream: " << name_ << ", switching active stream: " << (active_stream_ ? active_stream_->getName() : "<null>") << " => "
<< stream->getName() << "\n";
active_stream_ = stream;
setMetadata(active_stream_->getMetadata());
setProperties(active_stream_->getProperties());
resampler_ = make_unique<Resampler>(active_stream_->getSampleFormat(), sampleFormat_);
}