aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ensembledatabase.hpp3
-rw-r--r--src/etianalyse.cpp23
-rw-r--r--src/fig0_1.cpp12
3 files changed, 24 insertions, 14 deletions
diff --git a/src/ensembledatabase.hpp b/src/ensembledatabase.hpp
index eb83785..b0c9320 100644
--- a/src/ensembledatabase.hpp
+++ b/src/ensembledatabase.hpp
@@ -48,7 +48,8 @@ struct subchannel_t {
protection_type_t protection_type;
// Long form FIG0/1, i.e. EEP
- int protection_option;
+ enum class protection_eep_option_t { EEP_A, EEP_B };
+ protection_eep_option_t protection_option;
int protection_level;
int size;
diff --git a/src/etianalyse.cpp b/src/etianalyse.cpp
index f416c77..a1218c7 100644
--- a/src/etianalyse.cpp
+++ b/src/etianalyse.cpp
@@ -556,18 +556,19 @@ void ETI_Analyser::eti_analyse()
fprintf(stat_fd, " subchannel:\n");
fprintf(stat_fd, " id: %d\n", subch.id);
fprintf(stat_fd, " SAd: %d\n", subch.start_addr);
+
+ using ensemble_database::subchannel_t;
switch (subch.protection_type) {
- case ensemble_database::subchannel_t::protection_type_t::EEP:
- if (subch.protection_option == 0) {
- fprintf(stat_fd, " protection: EEP %d-A\n",
- subch.protection_level + 1);
- }
- else if (subch.protection_option == 0) {
- fprintf(stat_fd, " protection: EEP %d-B\n",
- subch.protection_level + 1);
- }
- else {
- fprintf(stat_fd, " protection: unknown\n");
+ case subchannel_t::protection_type_t::EEP:
+ switch (subch.protection_option) {
+ case subchannel_t::protection_eep_option_t::EEP_A:
+ fprintf(stat_fd, " protection: EEP %d-A\n",
+ subch.protection_level + 1);
+ case subchannel_t::protection_eep_option_t::EEP_B:
+ fprintf(stat_fd, " protection: EEP %d-B\n",
+ subch.protection_level + 1);
+ default:
+ fprintf(stat_fd, " protection: unknown\n");
}
fprintf(stat_fd, " size: %d\n", subch.size);
diff --git a/src/fig0_1.cpp b/src/fig0_1.cpp
index f8f9a1b..d878677 100644
--- a/src/fig0_1.cpp
+++ b/src/fig0_1.cpp
@@ -89,14 +89,22 @@ fig_result_t fig0_1(fig0_common_t& fig0, const display_settings_t &disp)
r.msgs.push_back(strprintf("EEP %d-B", protection_level+1));
}
else {
- r.errors.push_back(strprintf("Invalid option %d protection %d", option, protection_level));
+ r.errors.push_back(strprintf("Invalid option %d protection %d",
+ option, protection_level));
}
r.msgs.push_back(strprintf("subch size %d", subchannel_size));
if (fig0.fibcrccorrect) {
auto& subch = fig0.ensemble.get_subchannel(subch_id);
- subch.protection_option = option;
+ using ensemble_database::subchannel_t;
+ using eep_t = subchannel_t::protection_eep_option_t;
+ if (option == 0x00) {
+ subch.protection_option = eep_t::EEP_A;
+ }
+ else {
+ subch.protection_option = eep_t::EEP_B;
+ }
subch.protection_level = protection_level;
subch.size = subchannel_size;
}