sectionsd: simplify DMX::getSection code

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1408 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
seife
2011-04-17 17:36:48 +00:00
parent 102e156fc3
commit e563c2ecc4

View File

@@ -384,13 +384,14 @@ int DMX::getSection(char *buf, const unsigned timeoutInMSeconds, int &timeouts)
return rc; return rc;
} }
// the current section
sections_id_t s_id = create_sections_id(initial_header->table_id,
eh_tbl_extension_id,
extended_header->section_number,
current_onid,
current_tsid);
//find current section in list //find current section in list
MyDMXOrderUniqueKey::iterator di = myDMXOrderUniqueKey.find(create_sections_id( MyDMXOrderUniqueKey::iterator di = myDMXOrderUniqueKey.find(s_id);
initial_header->table_id,
eh_tbl_extension_id,
extended_header->section_number,
current_onid,
current_tsid));
if (di != myDMXOrderUniqueKey.end()) if (di != myDMXOrderUniqueKey.end())
{ {
//the current section was read before //the current section was read before
@@ -404,22 +405,12 @@ int DMX::getSection(char *buf, const unsigned timeoutInMSeconds, int &timeouts)
//the version number is still up2date //the version number is still up2date
if (first_skipped == 0) { if (first_skipped == 0) {
//the last section was new - this is the 1st dup //the last section was new - this is the 1st dup
first_skipped = create_sections_id( first_skipped = s_id;
initial_header->table_id,
eh_tbl_extension_id,
extended_header->section_number,
current_onid,
current_tsid);
} }
else { else {
//this is not the 1st new - check if it's the last //this is not the 1st new - check if it's the last
//or to be more precise only dups occured since //or to be more precise only dups occured since
if (first_skipped == create_sections_id( if (first_skipped == s_id)
initial_header->table_id,
eh_tbl_extension_id,
extended_header->section_number,
current_onid,
current_tsid))
timeouts = -1; timeouts = -1;
} }
//since version is still up2date, check if table complete //since version is still up2date, check if table complete
@@ -453,13 +444,7 @@ int DMX::getSection(char *buf, const unsigned timeoutInMSeconds, int &timeouts)
extended_header->section_number); extended_header->section_number);
#endif #endif
//section was not read before - insert in list //section was not read before - insert in list
myDMXOrderUniqueKey.insert(std::make_pair(create_sections_id( myDMXOrderUniqueKey.insert(std::make_pair(s_id, extended_header->version_number));
initial_header->table_id,
eh_tbl_extension_id,
extended_header->section_number,
current_onid,
current_tsid),
extended_header->version_number));
//check if table is now complete //check if table is now complete
if (check_complete(initial_header->table_id, if (check_complete(initial_header->table_id,
eh_tbl_extension_id, eh_tbl_extension_id,