Skip to content

Commit

Permalink
[dvbreader.c] add service_name_encoding and provider_name_encoding to…
Browse files Browse the repository at this point in the history
… SDT output

Contains the "first byte value" used to reference the alternative character table to be used.

For more infomation see ETSI EN 300 468, Table A.3: Character coding tables.
  • Loading branch information
Huevos committed Feb 29, 2024
1 parent e8e9371 commit 0321820
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions AutoBouquetsMaker/lib/dvbreader.c
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,9 @@ PyObject *ss_parse_sdt(unsigned char *data, int length) {
int free_ca = (data[offset + 3] >> 4) & 0x01;
int descriptors_loop_length = ((data[offset + 3] & 0x0f) << 8) | data[offset + 4];
char service_name[256];
int service_name_encoding = 0;
char provider_name[256];
int provider_name_encoding = 0;
int service_type = 0;
int region_code = 0;
int city_code = 0;
Expand Down Expand Up @@ -1027,19 +1029,27 @@ PyObject *ss_parse_sdt(unsigned char *data, int length) {
offset2 += (size + 2);
}

provider_name_encoding = 0;
char *provider_name_ptr = provider_name;
if (strlen(provider_name) == 0)
strcpy(provider_name, "Unknown");
else if (provider_name[0] == 0x05)
provider_name_ptr++;
else if (provider_name[0] < 0x20)
{
provider_name_encoding = provider_name[0];
provider_name_ptr++;
}

service_name_encoding = 0;
char *service_name_ptr = service_name;
if (strlen(service_name) == 0)
strcpy(service_name, "Unknown");
else if (service_name[0] == 0x05)
service_name_ptr++;
else if (service_name[0] < 0x20)
{
service_name_encoding = service_name[0];
service_name_ptr++;
}

PyObject *item = Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:s,s:s,s:i,s:i,s:i,s:i,s:i,s:i}",
PyObject *item = Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:s,s:s,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i}",
"transport_stream_id", transport_stream_id,
"original_network_id", original_network_id,
"service_id", service_id,
Expand All @@ -1057,7 +1067,9 @@ PyObject *ss_parse_sdt(unsigned char *data, int length) {
"service_group_id", service_group_id,
"category_id", category_id,
"region_code", region_code,
"city_code", city_code);
"city_code", city_code,
"provider_name_encoding", provider_name_encoding,
"service_name_encoding", service_name_encoding);
PyList_Append(list, item);
Py_DECREF(item);
}
Expand Down

0 comments on commit 0321820

Please sign in to comment.