Browse Source

Display service type along with the service name and service provider.

Georgi Chorbadzhiyski 11 years ago
parent
commit
c59c882840
1 changed files with 16 additions and 4 deletions
  1. 16
    4
      tables.c

+ 16
- 4
tables.c View File

@@ -177,6 +177,7 @@ void process_pmt(struct ts *ts, uint16_t pid, uint8_t *ts_packet) {
177 177
 
178 178
 static int sdt_parse_service_name_desc(
179 179
 	int desc_len, uint8_t *desc,
180
+	uint8_t *service_type,
180 181
 	uint8_t *pname_len, uint8_t **pname,
181 182
 	uint8_t *sname_len, uint8_t **sname)
182 183
 {
@@ -192,13 +193,12 @@ static int sdt_parse_service_name_desc(
192 193
 			ofs += len;
193 194
 			continue;
194 195
 		}
195
-		// Parse descriptor 0x48 - Service name descriptor
196
+		// Parse descriptor 0x48 - service_descriptor
196 197
 		// +3 == +1 for service type, +1 for provider len, +1 for service len
197 198
 		if (ofs + 3 > desc_len)
198 199
 			break;
199 200
 
200
-		ofs++; // Skip service type
201
-
201
+		*service_type = desc[ofs++];
202 202
 		*pname_len = desc[ofs++];
203 203
 		if (*pname_len)
204 204
 			*pname = desc + ofs;
@@ -226,10 +226,12 @@ void process_sdt(struct ts *ts, uint16_t pid, uint8_t *ts_packet) {
226 226
 
227 227
 	for(i=0;i<ts->sdt->streams_num;i++) {
228 228
 		struct ts_sdt_stream *stream = ts->sdt->streams[i];
229
+		uint8_t service_type;
229 230
 		uint8_t *pname, *sname;
230 231
 		uint8_t pname_len, sname_len;
231 232
 		if (sdt_parse_service_name_desc(
232 233
 			stream->descriptor_size, stream->descriptor_data,
234
+			&service_type,
233 235
 			&pname_len, &pname, &sname_len, &sname))
234 236
 		{
235 237
 			int r;
@@ -241,8 +243,18 @@ void process_sdt(struct ts *ts, uint16_t pid, uint8_t *ts_packet) {
241 243
 				if (sname[r] < ' ')
242 244
 					sname[r] = '*';
243 245
 			}
244
-			ts_LOGf("SDT | Service 0x%04x (%5d) Provider: \"%.*s\" Service: \"%.*s\"\n",
246
+			ts_LOGf("SDT | Service 0x%04x (%5d) Type: 0x%02x (%s) Provider: \"%.*s\" Service: \"%.*s\"\n",
245 247
 				stream->service_id, stream->service_id,
248
+				service_type,
249
+				// The service types are described in Table 87 of
250
+				// ETSI EN 300 468 v1.12.1 and also in annex I of the
251
+				// same document.
252
+				service_type == 0x01 ? "Tv" :
253
+				service_type == 0x02 ? "Radio" :
254
+				service_type == 0x11 ? "Tv/HD" :
255
+				service_type == 0x16 ? "Tv/h264" :
256
+				service_type == 0x19 ? "Tv/HD/h264" :
257
+				service_type == 0x1c ? "Tv/3d" : "unknown",
246 258
 				pname_len, (char *)pname,
247 259
 				sname_len, (char *)sname);
248 260
 		} else {

Loading…
Cancel
Save