Skip to content

Commit

Permalink
[play] Separate Encoding and Type in Player application. (#1836)
Browse files Browse the repository at this point in the history
  • Loading branch information
KerstinKeller authored Dec 5, 2024
1 parent ec86702 commit b6b66b2
Show file tree
Hide file tree
Showing 13 changed files with 70 additions and 15 deletions.
11 changes: 10 additions & 1 deletion app/play/play_core/include/ecal_play.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 Continental Corporation
* Copyright (C) 2016 - 2024 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -298,6 +298,15 @@ class EcalPlay
**/
std::string GetChannelType(const std::string& channel_name) const;

/**
* @brief Gets the encoding of the given channel
*
* @param channel_name channel name
*
* @return channel type
**/
std::string GetChannelEncoding(const std::string& channel_name) const;

void CalculateEstimatedSizeForChannels() const;

/**
Expand Down
5 changes: 5 additions & 0 deletions app/play/play_core/src/ecal_play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ std::string EcalPlay::GetChannelType(const std::string& channel_name) const
return play_thread_->GetChannelType(channel_name);
}

std::string EcalPlay::GetChannelEncoding(const std::string& channel_name) const
{
return play_thread_->GetChannelEncoding(channel_name);
}

void EcalPlay::CalculateEstimatedSizeForChannels() const
{
play_thread_->CalculateEstimatedSizeForChannels();
Expand Down
9 changes: 6 additions & 3 deletions app/play/play_core/src/measurement_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,12 @@ double MeasurementContainer::GetMaxTimestampOfChannel(const std::string& channel

std::string MeasurementContainer::GetChannelType(const std::string& channel_name) const
{
// This function needs to also return the proper datatypes information! To clean up.
auto datatype_information = hdf5_meas_->GetChannelDataTypeInformation(channel_name);
return eCAL::Util::CombinedTopicEncodingAndType(datatype_information.encoding, datatype_information.name);
return hdf5_meas_->GetChannelDataTypeInformation(channel_name).name;
}

std::string MeasurementContainer::GetChannelEncoding(const std::string& channel_name) const
{
return hdf5_meas_->GetChannelDataTypeInformation(channel_name).encoding;
}

size_t MeasurementContainer::GetChannelCumulativeEstimatedSize(const std::string& channel_name) const
Expand Down
1 change: 1 addition & 0 deletions app/play/play_core/src/measurement_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class MeasurementContainer
double GetMinTimestampOfChannel(const std::string& channel_name) const;
double GetMaxTimestampOfChannel(const std::string& channel_name) const;
std::string GetChannelType(const std::string& channel_name) const;
std::string GetChannelEncoding(const std::string& channel_name) const;
size_t GetChannelCumulativeEstimatedSize(const std::string& channel_name) const;
std::map<std::string, std::string> GetChannelMapping() const;

Expand Down
13 changes: 13 additions & 0 deletions app/play/play_core/src/play_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,19 @@ std::string PlayThread::GetChannelType(const std::string& channel_name)
}
}

std::string PlayThread::GetChannelEncoding(const std::string& channel_name)
{
std::shared_lock<std::shared_timed_mutex> measurement_lock(measurement_mutex_);
if (measurement_container_)
{
return measurement_container_->GetChannelEncoding(channel_name);
}
else
{
return std::string("");
}
}

void PlayThread::CalculateEstimatedSizeForChannels()
{
std::shared_lock<std::shared_timed_mutex> measurement_lock(measurement_mutex_);
Expand Down
9 changes: 9 additions & 0 deletions app/play/play_core/src/play_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,15 @@ class PlayThread : public InterruptibleThread
**/
std::string GetChannelType(const std::string& channel_name);

/**
* @brief Gets the data type of the given channel
*
* @param channel_name channel name
*
* @return channel type
**/
std::string GetChannelEncoding(const std::string& channel_name);

void CalculateEstimatedSizeForChannels();

/**
Expand Down
7 changes: 6 additions & 1 deletion app/play/play_gui/src/q_ecal_play.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 Continental Corporation
* Copyright (C) 2016 - 2024 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -128,6 +128,11 @@ std::string QEcalPlay::channelType(const std::string& channel_name) const
return ecal_play_.GetChannelType(channel_name);
}

std::string QEcalPlay::channelEncoding(const std::string& channel_name) const
{
return ecal_play_.GetChannelEncoding(channel_name);
}

size_t QEcalPlay::channelCumulativeEstimatedSize(const std::string& channel_name) const
{
return ecal_play_.GetChannelCumulativeEstimatedSize(channel_name);
Expand Down
3 changes: 2 additions & 1 deletion app/play/play_gui/src/q_ecal_play.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 Continental Corporation
* Copyright (C) 2016 - 2024 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -59,6 +59,7 @@ class QEcalPlay : public QObject
double minTimestampOfChannel(const std::string& channel_name) const;
double maxTimestampOfChannel(const std::string& channel_name) const;
std::string channelType(const std::string& channel_name) const;
std::string channelEncoding(const std::string& channel_name) const;
size_t channelCumulativeEstimatedSize(const std::string& channel_name) const;
std::map<std::string, ContinuityReport> createContinuityReport() const;
std::map<std::string, long long> messageCounters() const;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 Continental Corporation
* Copyright (C) 2016 - 2024 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -600,7 +600,7 @@ void ChannelWidget::setInitButtonToDeInit()

void ChannelWidget::autoSizeColumns()
{
ChannelTreeItem* dummy_item = new ChannelTreeItem("CameraSensorMapFusionCAF___", "Dummy_type", 99999999, 99999999.0, 99999999.0, 99999999, 99999999, 99999999);
ChannelTreeItem* dummy_item = new ChannelTreeItem("CameraSensorMapFusionCAF___", "proto", "Dummy_type", 99999999, 99999999.0, 99999999.0, 99999999, 99999999, 99999999);
channel_model_->insertItem(dummy_item);

for (int i = 0; i < channel_model_->columnCount(); i++)
Expand Down
7 changes: 5 additions & 2 deletions app/play/play_gui/src/widgets/models/channel_tree_item.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 Continental Corporation
* Copyright (C) 2016 - 2024 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -40,12 +40,13 @@ ChannelTreeItem::ChannelTreeItem(const QString& source_name)
, duration_(0)
{}

ChannelTreeItem::ChannelTreeItem(const QString& source_name, const QString& channel_type, size_t total_channel_size,
ChannelTreeItem::ChannelTreeItem(const QString& source_name, const QString& channel_encoding, const QString& channel_type, size_t total_channel_size,
double min_channel_timestamp, double max_channel_timestamp, long long expected_frames, long long existing_frames, double duration)
: QAbstractTreeItem()
, enabled_(true)
, source_name_(source_name)
, target_name_(source_name)
, channel_encoding_(channel_encoding)
, channel_type_(channel_type)
, total_channel_size_(total_channel_size)
, min_channel_timestamp_(min_channel_timestamp)
Expand Down Expand Up @@ -76,6 +77,8 @@ QVariant ChannelTreeItem::data(Columns column, Qt::ItemDataRole role) const
return source_name_;
case ChannelTreeItem::Columns::TARGET_CHANNEL_NAME:
return target_name_;
case ChannelTreeItem::Columns::CHANNEL_ENCODING:
return channel_encoding_;
case ChannelTreeItem::Columns::CHANNEL_TYPE:
return channel_type_;
case ChannelTreeItem::Columns::TOTAL_CHANNEL_SIZE:
Expand Down
6 changes: 4 additions & 2 deletions app/play/play_gui/src/widgets/models/channel_tree_item.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 Continental Corporation
* Copyright (C) 2016 - 2024 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,6 +32,7 @@ class ChannelTreeItem : public QAbstractTreeItem
SOURCE_CHANNEL_NAME,
TARGET_CHANNEL_NAME,

CHANNEL_ENCODING,
CHANNEL_TYPE,
TOTAL_CHANNEL_SIZE,

Expand All @@ -47,7 +48,7 @@ class ChannelTreeItem : public QAbstractTreeItem
};

ChannelTreeItem(const QString& source_name);
ChannelTreeItem(const QString& source_name, const QString& channel_type, size_t total_channel_size,
ChannelTreeItem(const QString& source_name, const QString& channel_encoding, const QString& channel_type, size_t total_channel_size,
double min_channel_timestamp, double max_channel_timestamp, long long expected_frames, long long existing_frames, double duration);

~ChannelTreeItem();
Expand Down Expand Up @@ -76,6 +77,7 @@ class ChannelTreeItem : public QAbstractTreeItem

QString source_name_;
QString target_name_;
QString channel_encoding_;
QString channel_type_;

size_t total_channel_size_;
Expand Down
5 changes: 3 additions & 2 deletions app/play/play_gui/src/widgets/models/channel_tree_model.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 Continental Corporation
* Copyright (C) 2016 - 2024 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -237,9 +237,10 @@ void ChannelTreeModel::reload()
double minTimestamp = QEcalPlay::instance()->minTimestampOfChannel(name);
double maxTimestamp = QEcalPlay::instance()->maxTimestampOfChannel(name);
std::string channel_type = QEcalPlay::instance()->channelType(name);
std::string channel_encoding = QEcalPlay::instance()->channelEncoding(name);
size_t total_channel_size = QEcalPlay::instance()->channelCumulativeEstimatedSize(name);

ChannelTreeItem* channel_item = new ChannelTreeItem(name.c_str(), channel_type.c_str(), total_channel_size,
ChannelTreeItem* channel_item = new ChannelTreeItem(name.c_str(), channel_encoding.c_str(), channel_type.c_str(), total_channel_size,
minTimestamp, maxTimestamp, expected_frames, existing_frames, duration);
new_channel_list.push_back(channel_item);
}
Expand Down
5 changes: 4 additions & 1 deletion app/play/play_gui/src/widgets/models/channel_tree_model.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 Continental Corporation
* Copyright (C) 2016 - 2024 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,6 +33,7 @@ class ChannelTreeModel : public QAbstractTreeModel
{
ENABLED,
CHANNEL_NAME,
CHANNEL_ENCODING,
CHANNEL_TYPE,
TOTAL_CHANNEL_SIZE,

Expand Down Expand Up @@ -82,6 +83,7 @@ class ChannelTreeModel : public QAbstractTreeModel
{
{ Columns::ENABLED, ""} ,
{ Columns::CHANNEL_NAME, "Channel" } ,
{ Columns::CHANNEL_ENCODING, "Channel encoding"},
{ Columns::CHANNEL_TYPE, "Channel type"},
{ Columns::MESSAGE_COUNTER, "Published messages" } ,
{ Columns::TOTAL_CHANNEL_SIZE, "Total estimated channel size" } ,
Expand All @@ -98,6 +100,7 @@ class ChannelTreeModel : public QAbstractTreeModel
{
{ Columns::ENABLED, (int)ChannelTreeItem::Columns::ENABLED },
{ Columns::CHANNEL_NAME, (int)ChannelTreeItem::Columns::SOURCE_CHANNEL_NAME },
{ Columns::CHANNEL_ENCODING, (int)ChannelTreeItem::Columns::CHANNEL_ENCODING},
{ Columns::CHANNEL_TYPE, (int)ChannelTreeItem::Columns::CHANNEL_TYPE},
{ Columns::TOTAL_CHANNEL_SIZE, (int)ChannelTreeItem::Columns::TOTAL_CHANNEL_SIZE},
{ Columns::MESSAGE_COUNTER, -1 },
Expand Down

0 comments on commit b6b66b2

Please sign in to comment.