Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ETT improvements #26

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 44 additions & 2 deletions libdvbtee/decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1447,16 +1447,21 @@ void decode::dump_epg_event(const decoded_vct_channel_t *channel, const decoded_
fprintf(stderr, "%04d-%02d-%02d %02d:%02d-%02d:%02d,%s\n",
tms.tm_year+1900, tms.tm_mon+1, tms.tm_mday,
tms.tm_hour, tms.tm_min, tme.tm_hour, tme.tm_min, name );

unsigned char message[4096];
const char* etm = (const char *)get_decoded_ett((channel->source_id << 16) | (event->event_id << 2) | 0x02, message, sizeof(message));
if (message[0])
fprintf(stderr, "\t%s\n", message);

if (reporter) {
unsigned char message[4096];
reporter->epg_event((const char *)service_name,
channel->chan_major, channel->chan_minor,
physical_channel, channel->program,
event->event_id,
start,
(end - start),
(const char *)name,
(const char *)get_decoded_ett((channel->source_id << 16) | (event->event_id << 2) | 0x02, message, sizeof(message)));
(const char *)message);
}
return;
}
Expand Down Expand Up @@ -2009,6 +2014,43 @@ bool decode::got_all_eit(int limit)
return true;
}

bool decode::got_all_ett()
{
int missing_etts=0;
int total_events=0;
for (int eit_num=0;
eit_num < 128 && !decoded_atsc_eit[eit_num].empty();
eit_num++)
{
map_decoded_atsc_eit::const_iterator eit_iter;
for (eit_iter = decoded_atsc_eit[eit_num].begin();
eit_iter != decoded_atsc_eit[eit_num].end();
eit_iter++)
{
uint32_t source_id = eit_iter->first;
map_decoded_atsc_eit_events events = eit_iter->second.events;
map_decoded_atsc_eit_events::const_iterator event_iter;
for (event_iter = events.begin();
event_iter != events.end();
event_iter++)
{
if (!event_iter->second.etm_location) continue;
// TODO: not yet supported? haven't tested
if (event_iter->second.etm_location == 2) continue;
total_events++;

uint32_t event_id = event_iter->second.event_id;
uint32_t etm_id = (source_id << 16) | (event_id << 2) | 0x02;
if (!decoded_ett.count(etm_id)) {
missing_etts++;
}
}
}
}
fprintf(stderr, "%3d/%3d ETTs remaining...\r", missing_etts, total_events);
return (missing_etts == 0);
}

const decode_network* decode::get_decoded_network() const
{
map_network_decoder::const_iterator it = networks.find(orig_network_id);
Expand Down
1 change: 1 addition & 0 deletions libdvbtee/decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ class decode
void dump_eit_x(decode_report *reporter, uint8_t eit_x, uint16_t source_id = 0);
bool eit_x_complete(uint8_t current_eit_x);
bool got_all_eit(int limit = -1);
bool got_all_ett();

void dump_epg(decode_report *reporter);

Expand Down
19 changes: 17 additions & 2 deletions libdvbtee/parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,13 @@ parse::parse()
, ts_id(0)
, epg_mode(false)
, scan_mode(false)
, dont_collect_ett(true)
, dont_collect_ett(
#if ETT
false
#else
true
#endif
)
, has_pat(false)
, has_mgt(false)
, has_vct(false)
Expand Down Expand Up @@ -1152,7 +1158,16 @@ bool parse::is_psip_ready()

bool parse::is_epg_ready()
{
return ((is_psip_ready()) && ((decoders.count(get_ts_id()) && (decoders[get_ts_id()].got_all_eit(eit_collection_limit)))));
if (!is_psip_ready()) return false;
if (!decoders.count(get_ts_id())) return false;
decode& d=decoders[get_ts_id()];
if (!d.got_all_eit(eit_collection_limit)) return false;
#if ETT
#if 1
if (!d.got_all_ett()) return false;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to need to be conditionalized. I can imagine cases where the user may want to know a quick list of all shows currently airing without the need for collecting all the events long descriptions.

EIT's are conditionalized by the eit_collection_limit, which might be zero. For ETT I think we just need a boolean, and your function seems to have the right idea comparing received ETTs against expected ETTs.

#endif
#endif
return true;
}

int parse::add_output(void* priv, stream_callback callback)
Expand Down