1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-11-11 04:20:03 +00:00

Only specify outputs for the requested streams

This commit is contained in:
Victor Castillo 2024-06-24 18:03:36 +02:00
parent 1f3047c67a
commit 38d548ba50
No known key found for this signature in database
GPG Key ID: 8EF1FC8B7182F608
2 changed files with 31 additions and 5 deletions

View File

@ -87,7 +87,7 @@ IONMetadataStdFileSource::IONMetadataStdFileSource(
: gr::sync_block( : gr::sync_block(
"ion_metadata_standard_source", "ion_metadata_standard_source",
gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0),
make_output_signature(block)), make_output_signature(block, stream_ids)),
file_metadata_(file), file_metadata_(file),
block_metadata_(block) block_metadata_(block)
{ {
@ -149,7 +149,7 @@ void IONMetadataStdFileSource::read_chunk_pattern(gr_vector_void_star& output_it
} }
} }
gr::io_signature::sptr IONMetadataStdFileSource::make_output_signature(const GnssMetadata::Block& block) gr::io_signature::sptr IONMetadataStdFileSource::make_output_signature(const GnssMetadata::Block& block, const std::vector<std::string>& stream_ids)
{ {
int nstreams = 0; int nstreams = 0;
std::vector<size_t> item_sizes{}; std::vector<size_t> item_sizes{};
@ -159,9 +159,35 @@ gr::io_signature::sptr IONMetadataStdFileSource::make_output_signature(const Gns
for (const auto& lump : chunk.Lumps()) for (const auto& lump : chunk.Lumps())
{ {
for (const auto& stream : lump.Streams()) for (const auto& stream : lump.Streams())
{
if (std::ranges::any_of(stream_ids.begin(), stream_ids.end(), [&](const std::string& it) {
return stream.Id() == it;
}))
{ {
++nstreams; ++nstreams;
item_sizes.emplace_back(stream.RateFactor() * stream.Quantization()); std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor();
if (sample_bitsize <= 8)
{
item_sizes.push_back(1);
}
else if (sample_bitsize <= 16)
{
item_sizes.push_back(2);
}
else if (sample_bitsize <= 32)
{
item_sizes.push_back(4);
}
else if (sample_bitsize <= 64)
{
item_sizes.push_back(8);
}
else
{
// This shouldn't happen
item_sizes.push_back(1);
}
}
} }
} }
} }

View File

@ -286,7 +286,7 @@ private:
void read_chunk_pattern(gr_vector_void_star& output_items); void read_chunk_pattern(gr_vector_void_star& output_items);
private: private:
static gr::io_signature::sptr make_output_signature(const GnssMetadata::Block& block); static gr::io_signature::sptr make_output_signature(const GnssMetadata::Block& block, const std::vector<std::string>& stream_ids);
private: private:
const GnssMetadata::File& file_metadata_; const GnssMetadata::File& file_metadata_;