You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.4 KiB

  1. using JT1078.FMp4.Interfaces;
  2. using JT1078.FMp4.MessagePack;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Text;
  6. namespace JT1078.FMp4
  7. {
  8. /// <summary>
  9. /// moof
  10. /// </summary>
  11. public class MovieFragmentBox : Mp4Box, IFMp4MessagePackFormatter
  12. {
  13. /// <summary>
  14. /// moof
  15. /// </summary>
  16. public MovieFragmentBox() : base("moof")
  17. {
  18. }
  19. /// <summary>
  20. /// mfhd
  21. /// </summary>
  22. public MovieFragmentHeaderBox MovieFragmentHeaderBox { get; set; }
  23. /// <summary>
  24. /// traf
  25. /// </summary>
  26. public TrackFragmentBox TrackFragmentBox { get; set; }
  27. public void ToBuffer(ref FMp4MessagePackWriter writer)
  28. {
  29. Start(ref writer);
  30. if (MovieFragmentHeaderBox != null)
  31. {
  32. MovieFragmentHeaderBox.ToBuffer(ref writer);
  33. }
  34. if (TrackFragmentBox != null)
  35. {
  36. TrackFragmentBox.ToBuffer(ref writer);
  37. }
  38. End(ref writer);
  39. var trunOffsetPosition = writer.GetTrunOffsetPosition();
  40. if (trunOffsetPosition > 0)
  41. {
  42. writer.WriteInt32Return(writer.GetCurrentPosition() - SizePosition + 8, trunOffsetPosition);
  43. writer.ClearTrunOffsetPosition();
  44. }
  45. }
  46. }
  47. }