All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/18] libdvbv5: fix reading multisection tables
@ 2013-12-30 12:48 André Roth
  2013-12-30 12:48 ` [PATCH 02/18] libdvbv5: service location descriptor support André Roth
                   ` (16 more replies)
  0 siblings, 17 replies; 29+ messages in thread
From: André Roth @ 2013-12-30 12:48 UTC (permalink / raw)
  To: linux-media; +Cc: André Roth

Signed-off-by: André Roth <neolynx@gmail.com>
---
 lib/libdvbv5/dvb-scan.c | 36 +++++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/lib/libdvbv5/dvb-scan.c b/lib/libdvbv5/dvb-scan.c
index e9ccc72..520bf9c 100644
--- a/lib/libdvbv5/dvb-scan.c
+++ b/lib/libdvbv5/dvb-scan.c
@@ -96,9 +96,13 @@ int dvb_read_section_with_id(struct dvb_v5_fe_parms *parms, int dmx_fd,
 	uint8_t *buf = NULL;
 	uint8_t *tbl = NULL;
 	ssize_t table_length = 0;
+
+	// handle sections
+	int start_id = -1;
+	int start_section = -1;
 	int first_section = -1;
 	int last_section = -1;
-	int table_id = -1;
+	/*int table_id = -1;*/
 	int sections = 0;
 	struct dmx_sct_filter_params f;
 	struct dvb_table_header *h;
@@ -108,7 +112,6 @@ int dvb_read_section_with_id(struct dvb_v5_fe_parms *parms, int dmx_fd,
 	*table = NULL;
 
 	// FIXME: verify known table
-
 	memset(&f, 0, sizeof(f));
 	f.pid = pid;
 	f.filter.filter[0] = tid;
@@ -185,24 +188,27 @@ int dvb_read_section_with_id(struct dvb_v5_fe_parms *parms, int dmx_fd,
 
 		h = (struct dvb_table_header *)buf;
 		dvb_table_header_init(h);
+
+		/* dvb_logdbg( "dvb_read_section: id %d, section %d/%d, current: %d", h->id, h->section_id, h->last_section, h->current_next ); */
+		if (start_id == h->id && start_section == h->section_id) {
+			dvb_logdbg( "dvb_read_section: section repeated, reading done" );
+			break;
+		}
+		if (start_id == -1) start_id = h->id;
+		if (start_section == -1) start_section = h->section_id;
+
 		if (id != -1 && h->id != id) { /* search for a specific table id */
 			continue;
-		} else {
-			if (table_id == -1)
-				table_id = h->id;
-			else if (h->id != table_id) {
-				dvb_logwarn("dvb_read_section: table ID mismatch reading multi section table: %d != %d", h->id, table_id);
-				continue;
-			}
 		}
 
+		/*dvb_logerr("dvb_read_section: got section %d, last %d, filter %d", h->section_id, h->last_section, id );*/
 		/* handle the sections */
 		if (first_section == -1)
 			first_section = h->section_id;
-		else if (h->section_id == first_section)
+		else if (start_id == h->id && h->section_id == first_section)
 			break;
 
-		if (last_section == -1)
+		if (last_section == -1 || h->last_section > last_section)
 			last_section = h->last_section;
 
 		if (!tbl) {
@@ -228,10 +234,14 @@ int dvb_read_section_with_id(struct dvb_v5_fe_parms *parms, int dmx_fd,
 		else
 			dvb_logerr("dvb_read_section: no initializer for table %d", tid);
 
-		if (++sections == last_section + 1)
+		if (id != -1 && ++sections == last_section + 1) {
+			dvb_logerr("dvb_read_section: ++sections == last_section + 1");
 			break;
+		}
 	}
-	free(buf);
+
+	if (buf)
+		free(buf);
 
 	dvb_dmx_stop(dmx_fd);
 
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2014-01-08 11:09 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-30 12:48 [PATCH 01/18] libdvbv5: fix reading multisection tables André Roth
2013-12-30 12:48 ` [PATCH 02/18] libdvbv5: service location descriptor support André Roth
2014-01-07 16:38   ` Mauro Carvalho Chehab
2013-12-30 12:48 ` [PATCH 03/18] libdvbv5: VCT table cleanup André Roth
2013-12-30 12:48 ` [PATCH 04/18] libdvbv5: mpeg elementary stream parsers André Roth
2014-01-07 16:47   ` Mauro Carvalho Chehab
2013-12-30 12:48 ` [PATCH 05/18] libdvbv5: fix NIT structures André Roth
2013-12-30 12:48 ` [PATCH 06/18] libdvbv5: implement dvb_fe_dummy for logging André Roth
2013-12-30 12:48 ` [PATCH 07/18] libdvbv5: fix EIT parsing André Roth
2014-01-07 17:00   ` Mauro Carvalho Chehab
2013-12-30 12:48 ` [PATCH 08/18] libdvbv5: implement MGT parser André Roth
2014-01-07 17:05   ` Mauro Carvalho Chehab
2013-12-30 12:48 ` [PATCH 09/18] libdvbv5: implement ATSC EIT André Roth
2014-01-07 17:12   ` Mauro Carvalho Chehab
2014-01-08 11:09     ` André Roth
2013-12-30 12:48 ` [PATCH 10/18] libdvbv5: prefix VCT with atsc_ instead of dvb_ André Roth
2013-12-30 12:48 ` [PATCH 11/18] libdvbv5: cleanup coding style André Roth
2014-01-07 17:23   ` Mauro Carvalho Chehab
2013-12-30 12:48 ` [PATCH 12/18] libdvbv5: fix missing includes André Roth
2013-12-30 12:48 ` [PATCH 13/18] libdvbv5: improve TS parsing André Roth
2014-01-07 17:27   ` Mauro Carvalho Chehab
2013-12-30 12:48 ` [PATCH 14/18] libdvbv5: cleanup dvb_nit_transport_foreach macro André Roth
2013-12-30 12:48 ` [PATCH 15/18] libdvbv5: remove c99 comments André Roth
2014-01-07 17:29   ` Mauro Carvalho Chehab
2013-12-30 12:48 ` [PATCH 17/18] libdvbv5: remove header files from SOURCES in Makefile.am André Roth
2014-01-07 17:30   ` Mauro Carvalho Chehab
2013-12-30 12:48 ` [PATCH 18/18] libdvbv5: README updated for shared libdvbv5 André Roth
2014-01-07 18:12   ` Mauro Carvalho Chehab
2014-01-07 16:32 ` [PATCH 01/18] libdvbv5: fix reading multisection tables Mauro Carvalho Chehab

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.