shithub: mcfs

Download patch

ref: ab497acde3c65099cedd199cf49602c743d7e669
parent: d5b4ab2f6f4446795242254fbb4e0a33966c9bf8
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Mon Mar 16 21:36:44 EDT 2020

stss and stsc

--- a/iso.c
+++ b/iso.c
@@ -82,6 +82,20 @@
 		}stts;
 
 		struct {
+			u32int entrycount;
+			/* FIXME entries */
+		}stss;
+
+		struct {
+			u32int entrycount;
+			struct {
+				u32int firstchunk;
+				u32int samplesperchunk;
+				u32int sdt;
+			}*entry;
+		}stsc;
+
+		struct {
 			u64int creattime;
 			u64int modtime;
 			u32int trackid;
@@ -112,6 +126,8 @@
 		BoxMvex = 0x6d766578u,
 			BoxTrex = 0x74726578u,
 		BoxTrak = 0x7472616bu,
+			BoxEdts = 0x65647473u,
+				BoxElst = 0x656c7374u,
 			BoxTkhd = 0x746b6864u,
 			BoxMdia = 0x6d646961u,
 				BoxMdhd = 0x6d646864u,
@@ -143,7 +159,8 @@
 #define isfullbox(b) ( \
 	b->type == BoxMvhd || b->type == BoxTrex || b->type == BoxMdhd || b->type == BoxHdlr || \
 	b->type == BoxMfhd || b->type == BoxTfhd || b->type == BoxTfdt || b->type == BoxTrun || \
-	b->type == BoxStsd || b->type == BoxStts || b->type == BoxTkhd \
+	b->type == BoxStsd || b->type == BoxStts || b->type == BoxStss || b->type == BoxTkhd || \
+	b->type == BoxElst || b->type == BoxStsc \
 )
 
 #define eBread(sz, e) if(Bread(f, d, sz) != sz){ werrstr(e); goto err; }
@@ -265,6 +282,16 @@
 		print("\t%.*sentry_count\t%ud\n", dind, ind, b->stsd.entrycount);
 	}else if(b->type == BoxStts){
 		print("\t%.*sentry_count\t%ud\n", dind, ind, b->stts.entrycount);
+	}else if(b->type == BoxStss){
+		print("\t%.*sentry_count\t%ud\n", dind, ind, b->stss.entrycount);
+	}else if(b->type == BoxStsc){
+		print("\t%.*sentry_count\t%ud\n", dind, ind, b->stss.entrycount);
+		for(u = 0; u < b->stsc.entrycount; u++){
+			print("\t%.*sentry[%zd]\n", dind, ind, u);
+			print("\t\t%.*sfirst_chunk\t%ud\n", dind, ind, b->stsc.entry[u].firstchunk);
+			print("\t\t%.*ssamples_per_chunk\t%ud\n", dind, ind, b->stsc.entry[u].samplesperchunk);
+			print("\t\t%.*ssample_description_table\t%ud\n", dind, ind, b->stsc.entry[u].sdt);
+		}
 	}else if(b->type == BoxTkhd){
 		print("\t%.*screation_time\t%zd\n", dind, ind, b->tkhd.creattime);
 		print("\t%.*smodification_timetime\t%zd\n", dind, ind, b->tkhd.modtime);
@@ -307,7 +334,7 @@
 		printbox(b);
 	}else if(b->type == BoxMoov || b->type == BoxMvex || b->type == BoxTrak ||
 		b->type == BoxMdia || b->type == BoxMinf || b->type == BoxStbl ||
-		b->type == BoxMoof || b->type == BoxTraf){
+		b->type == BoxMoof || b->type == BoxTraf || b->type == BoxEdts){
 		printbox(b);
 		dind++;
 		for(;;){
@@ -446,6 +473,24 @@
 		eBread(4, "entry_count");
 		b->stts.entrycount = bu32(d);
 		/* FIXME not reading actual entries here */
+		printbox(b);
+	}else if(b->type == BoxStss){
+		eBread(4, "entry_count");
+		b->stss.entrycount = bu32(d);
+		/* FIXME not reading actual entries here */
+		printbox(b);
+	}else if(b->type == BoxStsc){
+		eBread(4, "entry_count");
+		b->stsc.entrycount = bu32(d);
+		b->stsc.entry = calloc(b->stsc.entrycount, sizeof(*b->stsc.entry));
+		for(u = 0; u < b->stsc.entrycount; u++){
+			eBread(4, "first_chunk");
+			b->stsc.entry[u].firstchunk = bu32(d);
+			eBread(4, "samples_per_chunk");
+			b->stsc.entry[u].samplesperchunk = bu32(d);
+			eBread(4, "sample_description_table");
+			b->stsc.entry[u].sdt = bu32(d);
+		}
 		printbox(b);
 	}else if(b->type == BoxTkhd){
 		if(b->version == 1){