Browse Source

Add pidmap API

Georgi Chorbadzhiyski 9 years ago
parent
commit
69322e5eef
3 changed files with 21 additions and 0 deletions
  1. 2 0
      tsdata.h
  2. 4 0
      tsfuncs.h
  3. 15 0
      tsfuncs_misc.c

+ 2 - 0
tsdata.h View File

@@ -440,4 +440,6 @@ struct pes_array {
440 440
 	struct pes_entry **entries;
441 441
 };
442 442
 
443
+typedef uint8_t pidmap_t[0x2000];
444
+
443 445
 #endif

+ 4 - 0
tsfuncs.h View File

@@ -278,4 +278,8 @@ char *			init_dvb_string_utf8		(char *text);
278 278
 char *			init_dvb_string_iso_8859_5	(char *text);
279 279
 int				ts_is_psi_pid				(uint16_t pid, struct ts_pat *pat);
280 280
 
281
+void			pidmap_clear				(pidmap_t *pm);
282
+void			pidmap_set					(pidmap_t *pm, uint16_t pid);
283
+int				pidmap_get					(pidmap_t *pm, uint16_t pid);
284
+
281 285
 #endif

+ 15 - 0
tsfuncs_misc.c View File

@@ -189,3 +189,18 @@ char *h222_stream_id_desc(uint8_t stream_id) {
189 189
 	}
190 190
 	return text;
191 191
 }
192
+
193
+void pidmap_clear(pidmap_t *pm) {
194
+	memset(pm, 0, sizeof(pidmap_t));
195
+}
196
+
197
+void pidmap_set(pidmap_t *pm, uint16_t pid) {
198
+	if (pid < sizeof(pidmap_t))
199
+		(*pm)[pid] = 1;
200
+}
201
+
202
+int pidmap_get(pidmap_t *pm, uint16_t pid) {
203
+	if (pid < sizeof(pidmap_t))
204
+		return (*pm)[pid];
205
+	return 0;
206
+}