shithub: mcfs

Download patch

ref: a076ccdfc2ed52cebd6d3db15644228826b0db67
parent: a3e881fec9069ee8786d4d37f4dc145159d5e332
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Thu Sep 10 10:01:07 EDT 2020

dumpstc: support IVF for video as well

--- a/iso.c
+++ b/iso.c
@@ -491,7 +491,7 @@
 	SampleToChunk *stc;
 	u32int si, ch, nextch;
 	u32int samplelast, sample, rawsz, samplesz;
-	u64int o, wo;
+	u64int ts;
 	u8int *raw;
 
 	raw = nil;
@@ -498,7 +498,6 @@
 	rawsz = 0;
 	sample = samplelast = 0;
 	stc = t->stc;
-	wo = 0;
 	ch = 0;
 	for(si = 0; si < t->numstc; si++, stc++){
 		nextch = t->numchunks;
@@ -505,8 +504,7 @@
 		if(si+1 < t->numstc)
 			nextch = stc[1].firstchunk - 1;
 		for(; ch < nextch; ch++){
-			o = t->chunkoffset[ch];
-			if(Bseek(f, o, 0) != o){
+			if(Bseek(f, t->chunkoffset[ch], 0) != t->chunkoffset[ch]){
 				werrstr("chunk %ud: %r", ch);
 				return -1;
 			}
@@ -536,15 +534,29 @@
 						werrstr("eof");
 						break;
 					}
-					wo += 7;
-					o += 7;
+				}else if(t->video.format == FmtAv01){
+					ts = 0;
+					frame[0] = samplesz;
+					frame[1] = samplesz >> 8;
+					frame[2] = samplesz >> 16;
+					frame[3] = samplesz >> 24;
+					frame[4] = ts;
+					frame[5] = ts >> 8;
+					frame[6] = ts >> 16;
+					frame[7] = ts >> 24;
+					frame[8] = ts >> 32;
+					frame[9] = ts >> 40;
+					frame[10] = ts >> 48;
+					frame[11] = ts >> 56;
+					if(Bwrite(out, frame, 12) != 12){ /* EOF */
+						werrstr("eof");
+						break;
+					}
 				}
 				if(Bwrite(out, raw, samplesz) != samplesz){ /* EOF? */
 					werrstr("eof");
 					break;
 				}
-				wo += samplesz;
-				o += samplesz;
 			}
 			samplelast = sample;
 		}