static int packet_num = 0;
static int last_used_packet_num = 0;
+struct channel_id {
+ int i_network_id;
+ int i_service_id;
+ int i_extension;
+
+ bool operator< (const channel_id &other) const {
+ if (i_network_id != other.i_network_id)
+ return (i_network_id < other.i_network_id);
+ if (i_service_id != other.i_service_id)
+ return (i_service_id < other.i_service_id);
+ return (i_extension < other.i_extension);
+ }
+};
+
/**
@brief The different encodings that can be used
Cf EN 300 468 Annex A (I used v1.9.1)
static void ParseSDT(void *p_zero, dvbpsi_sdt_t * p_sdt)
{
- // Do our own deduplication, since libdvbpsi only deduplicates against
- // the last version seen, not the entire history.
- static std::set<std::pair<uint8_t, bool> > seen_sdt_tables;
- if (!seen_sdt_tables.insert(std::make_pair(p_sdt->i_version, p_sdt->b_current_next)).second) {
- return;
- }
-
- last_used_packet_num = packet_num;
dvbpsi_sdt_service_t *p_service = p_sdt->p_first_service;
for (dvbpsi_sdt_service_t * p_service = p_sdt->p_first_service;
p_service != NULL;
// Show television types only.
if (service_type == 0x01 || service_type == 0x11 || service_type == 0x16 ||
service_type == 0x19 || service_type == 0x1c) {
- printf("sid %d/%d: ts_id=%d, provider_name=\"%s\", channel_name=\"%s\"\n",
- p_sdt->i_network_id, p_service->i_service_id,
- p_sdt->i_extension, provider_name,
- channel_name);
+ // Do our own deduplication, since libdvbpsi only deduplicates against
+ // the last version seen, not the entire history.
+ static std::set<channel_id> seen_channels;
+ channel_id id = { p_sdt->i_network_id, p_service->i_service_id, p_sdt->i_extension };
+ if (seen_channels.insert(id).second) {
+ last_used_packet_num = packet_num;
+ printf("sid %d/%d: ts_id=%d, provider_name=\"%s\", channel_name=\"%s\"\n",
+ p_sdt->i_network_id, p_service->i_service_id,
+ p_sdt->i_extension, provider_name,
+ channel_name);
+ }
}
}
dvbpsi_sdt_delete(p_sdt);