public static IEnumerable <eBoxType> readChildren(this Mp4Reader reader) { int lvl = reader.level; Debug.Assert(lvl > 0); Debug.Assert(reader.currentBox.isContainer()); lvl--; while (true) { eBoxType boxType = reader.readBox(); // Console.WriteLine( "{0}: {1}", reader.currentBoxNames, boxType ); if (boxType == eBoxType.ChildContainerEnd) { if (reader.level == lvl) { yield break; } } else { yield return(boxType); } } }
public static void moveToBox(this Mp4Reader reader, eBoxType boxType) { while (true) { var bt = reader.readBox(); if (bt == boxType) { return; } if (bt == eBoxType.Empty) { throw new EndOfStreamException(); } } }