shithub: mcfs

Download patch

ref: 451447fc7b3cf5d6849b1b6168ca1eec8dfdfdf4
parent: 7aee9d30601748c0affb1fe73331db5e5d9f069e
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Mon Mar 16 22:03:51 EDT 2020

stsz

--- a/iso.c
+++ b/iso.c
@@ -101,6 +101,12 @@
 		}stco_co64;
 
 		struct {
+			u32int samplesize;
+			u32int samplecount;
+			u32int *entrysize;
+		}stsz; /* FIXME need stz2 as well */
+
+		struct {
 			u64int creattime;
 			u64int modtime;
 			u32int trackid;
@@ -166,7 +172,8 @@
 	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 == BoxStss || b->type == BoxTkhd || \
-	b->type == BoxElst || b->type == BoxStsc || b->type == BoxStco || b->type == BoxCo64 \
+	b->type == BoxElst || b->type == BoxStsc || b->type == BoxStco || b->type == BoxCo64 || \
+	b->type == BoxStsz \
 )
 
 #define eBread(sz, e) if(Bread(f, d, (sz)) != (sz)){ werrstr(e); goto err; }
@@ -298,6 +305,13 @@
 			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 == BoxStsz){
+		print("\t%.*ssample_size\t%ud\n", dind, ind, b->stsz.samplesize);
+		print("\t%.*ssample_count\t%ud\n", dind, ind, b->stsz.samplecount);
+		if(b->stsz.samplesize == 0){
+			for(u = 0; u < b->stsz.samplecount; u++)
+				print("\t%.*sentrysize[%zd]\t%ud\n", dind, ind, u, b->stsz.entrysize[u]);
+		}
 	}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);
@@ -505,10 +519,23 @@
 	}else if(b->type == BoxStco || b->type == BoxCo64){
 		eBread(4, "entry_count");
 		b->stco_co64.entrycount = bu32(d);
-		b->stco_co64.chunkoffset = calloc(b->stco_co64.entrycount, sizeof(*b->stco_co64.chunkoffset));
+		b->stco_co64.chunkoffset = calloc(b->stco_co64.entrycount, sizeof(u64int));
 		for(u = 0; u < b->stco_co64.entrycount; u++){
 			eBread(b->type == BoxStco ? 4 : 8, "chunk_offset");
 			b->stco_co64.chunkoffset[u] = b->type == BoxStco ? bu32(d) : bu64(d);
+		}
+		printbox(b);
+	}else if(b->type == BoxStsz){
+		eBread(4, "sample_size");
+		b->stsz.samplesize = bu32(d);
+		eBread(4, "sample_count");
+		b->stsz.samplecount = bu32(d);
+		if(b->stsz.samplesize == 0){
+			b->stsz.entrysize = calloc(b->stsz.samplecount, sizeof(u32int));
+			for(u = 0; u < b->stsz.samplecount; u++){
+				eBread(4, "chunk_offset");
+				b->stsz.entrysize[u] = bu32(d);
+			}
 		}
 		printbox(b);
 	}else if(b->type == BoxTkhd){