Browse Source

1.初始化所需要的fmp4盒子

2.增加fmp4封装资料及解析工具
tags/v1.1.0
SmallChi(Koike) 4 years ago
parent
commit
473ff42bd8
100 changed files with 1983 additions and 1 deletions
  1. +2
    -1
      README.md
  2. BIN
      doc/fmp4/ISO Language Codes.txt
  3. BIN
      doc/fmp4/ISO_IEC_14496-12_2012.pdf
  4. +19
    -0
      doc/fmp4/fmp4info.txt
  5. BIN
      doc/fmp4/img/fmp4_1.png
  6. BIN
      doc/fmp4/img/fmp4_2.png
  7. BIN
      doc/fmp4/img/parser_pic.png
  8. BIN
      doc/fmp4/img/structure_model.png
  9. BIN
      doc/fmp4/parser_manual.txt
  10. BIN
      doc/fmp4/parser_manual_fmp4.txt
  11. BIN
      doc/tools/mp4info.exe
  12. +20
    -0
      src/JT1078.FMp4.Test/JT1078.FMp4.Test.csproj
  13. +14
    -0
      src/JT1078.FMp4.Test/UnitTest1.cs
  14. +14
    -0
      src/JT1078.FMp4/Boxs/AVCConfigurationBox.cs
  15. +66
    -0
      src/JT1078.FMp4/Boxs/AVCDecoderConfigurationRecord.cs
  16. +18
    -0
      src/JT1078.FMp4/Boxs/ChunkLargeOffsetBox.cs
  17. +19
    -0
      src/JT1078.FMp4/Boxs/ChunkOffsetBox.cs
  18. +22
    -0
      src/JT1078.FMp4/Boxs/CleanApertureBox.cs
  19. +21
    -0
      src/JT1078.FMp4/Boxs/ColourInformationBox.cs
  20. +27
    -0
      src/JT1078.FMp4/Boxs/CompactSampleSizeBox.cs
  21. +26
    -0
      src/JT1078.FMp4/Boxs/CompositionOffsetBox.cs
  22. +19
    -0
      src/JT1078.FMp4/Boxs/CompositionToDecodeBox.cs
  23. +24
    -0
      src/JT1078.FMp4/Boxs/CopyrightBox.cs
  24. +13
    -0
      src/JT1078.FMp4/Boxs/DataEntryBox.cs
  25. +19
    -0
      src/JT1078.FMp4/Boxs/DataEntryUrlBox.cs
  26. +19
    -0
      src/JT1078.FMp4/Boxs/DataEntryUrnBox.cs
  27. +14
    -0
      src/JT1078.FMp4/Boxs/DataInformationBox.cs
  28. +20
    -0
      src/JT1078.FMp4/Boxs/DataReferenceBox.cs
  29. +17
    -0
      src/JT1078.FMp4/Boxs/DegradationPriorityBox.cs
  30. +15
    -0
      src/JT1078.FMp4/Boxs/EditBox.cs
  31. +21
    -0
      src/JT1078.FMp4/Boxs/EditListBox.cs
  32. +21
    -0
      src/JT1078.FMp4/Boxs/FDItemInformationBox.cs
  33. +29
    -0
      src/JT1078.FMp4/Boxs/FDSessionGroupBox.cs
  34. +23
    -0
      src/JT1078.FMp4/Boxs/FECReservoirBox.cs
  35. +32
    -0
      src/JT1078.FMp4/Boxs/FilePartitionBox.cs
  36. +22
    -0
      src/JT1078.FMp4/Boxs/FileReservoirBox.cs
  37. +32
    -0
      src/JT1078.FMp4/Boxs/FileTypeBox.cs
  38. +12
    -0
      src/JT1078.FMp4/Boxs/FragmentBox.cs
  39. +13
    -0
      src/JT1078.FMp4/Boxs/FreeBox.cs
  40. +21
    -0
      src/JT1078.FMp4/Boxs/FreeSpaceBox.cs
  41. +24
    -0
      src/JT1078.FMp4/Boxs/GroupIdToNameBox.cs
  42. +18
    -0
      src/JT1078.FMp4/Boxs/HandlerBox.cs
  43. +19
    -0
      src/JT1078.FMp4/Boxs/HintMediaHeaderBox.cs
  44. +57
    -0
      src/JT1078.FMp4/Boxs/ItemLocationBox.cs
  45. +16
    -0
      src/JT1078.FMp4/Boxs/ItemProtectionBox.cs
  46. +40
    -0
      src/JT1078.FMp4/Boxs/LevelAssignmentBox.cs
  47. +17
    -0
      src/JT1078.FMp4/Boxs/MPEG4BitRateBox.cs
  48. +17
    -0
      src/JT1078.FMp4/Boxs/MediaBox.cs
  49. +15
    -0
      src/JT1078.FMp4/Boxs/MediaDataBox.cs
  50. +24
    -0
      src/JT1078.FMp4/Boxs/MediaHeaderBox.cs
  51. +16
    -0
      src/JT1078.FMp4/Boxs/MediaInformationBox.cs
  52. +22
    -0
      src/JT1078.FMp4/Boxs/MetaBox.cs
  53. +17
    -0
      src/JT1078.FMp4/Boxs/MovieBox.cs
  54. +15
    -0
      src/JT1078.FMp4/Boxs/MovieExtendsBox.cs
  55. +14
    -0
      src/JT1078.FMp4/Boxs/MovieExtendsHeaderBox.cs
  56. +16
    -0
      src/JT1078.FMp4/Boxs/MovieFragmentBox.cs
  57. +15
    -0
      src/JT1078.FMp4/Boxs/MovieFragmentHeaderBox.cs
  58. +17
    -0
      src/JT1078.FMp4/Boxs/MovieFragmentRandomAccessBox.cs
  59. +15
    -0
      src/JT1078.FMp4/Boxs/MovieFragmentRandomAccessOffsetBox.cs
  60. +24
    -0
      src/JT1078.FMp4/Boxs/MovieHeaderBox.cs
  61. +13
    -0
      src/JT1078.FMp4/Boxs/NullMediaHeaderBox.cs
  62. +17
    -0
      src/JT1078.FMp4/Boxs/OriginalFormatBox.cs
  63. +25
    -0
      src/JT1078.FMp4/Boxs/PaddingBitsBox.cs
  64. +15
    -0
      src/JT1078.FMp4/Boxs/PartitionEntryBox.cs
  65. +15
    -0
      src/JT1078.FMp4/Boxs/PixelAspectRatioBox.cs
  66. +15
    -0
      src/JT1078.FMp4/Boxs/PrimaryItemBox.cs
  67. +20
    -0
      src/JT1078.FMp4/Boxs/ProducerReferenceTimeBox.cs
  68. +21
    -0
      src/JT1078.FMp4/Boxs/ProgressiveDownloadInfoBox.cs
  69. +20
    -0
      src/JT1078.FMp4/Boxs/ProtectionSchemeInfoBox.cs
  70. +20
    -0
      src/JT1078.FMp4/Boxs/RestrictedSchemeInfoBox.cs
  71. +30
    -0
      src/JT1078.FMp4/Boxs/SampleAuxiliaryInformationOffsetsBox.cs
  72. +28
    -0
      src/JT1078.FMp4/Boxs/SampleAuxiliaryInformationSizesBox.cs
  73. +28
    -0
      src/JT1078.FMp4/Boxs/SampleDependencyTypeBox.cs
  74. +20
    -0
      src/JT1078.FMp4/Boxs/SampleDescriptionBox.cs
  75. +29
    -0
      src/JT1078.FMp4/Boxs/SampleGroupDescriptionBox.cs
  76. +21
    -0
      src/JT1078.FMp4/Boxs/SampleSizeBox.cs
  77. +29
    -0
      src/JT1078.FMp4/Boxs/SampleTableBox.cs
  78. +21
    -0
      src/JT1078.FMp4/Boxs/SampleToChunkBox.cs
  79. +29
    -0
      src/JT1078.FMp4/Boxs/SampleToGroupBox.cs
  80. +15
    -0
      src/JT1078.FMp4/Boxs/SchemeInformationBox.cs
  81. +26
    -0
      src/JT1078.FMp4/Boxs/SchemeTypeBox.cs
  82. +58
    -0
      src/JT1078.FMp4/Boxs/SegmentIndexBox.cs
  83. +23
    -0
      src/JT1078.FMp4/Boxs/ShadowSyncSampleBox.cs
  84. +13
    -0
      src/JT1078.FMp4/Boxs/SkipBox.cs
  85. +16
    -0
      src/JT1078.FMp4/Boxs/SoundMediaHeaderBox.cs
  86. +28
    -0
      src/JT1078.FMp4/Boxs/StereoVideoBox.cs
  87. +37
    -0
      src/JT1078.FMp4/Boxs/SubSampleInformationBox.cs
  88. +13
    -0
      src/JT1078.FMp4/Boxs/SubTrackBox.cs
  89. +13
    -0
      src/JT1078.FMp4/Boxs/SubTrackDefinitionBox.cs
  90. +18
    -0
      src/JT1078.FMp4/Boxs/SubTrackInformationBox.cs
  91. +19
    -0
      src/JT1078.FMp4/Boxs/SubTrackSampleGroupBox.cs
  92. +40
    -0
      src/JT1078.FMp4/Boxs/SubsegmentIndexBox.cs
  93. +17
    -0
      src/JT1078.FMp4/Boxs/SyncSampleBox.cs
  94. +24
    -0
      src/JT1078.FMp4/Boxs/TimeToSampleBox.cs
  95. +17
    -0
      src/JT1078.FMp4/Boxs/TrackBox.cs
  96. +19
    -0
      src/JT1078.FMp4/Boxs/TrackExtendsBox.cs
  97. +14
    -0
      src/JT1078.FMp4/Boxs/TrackFragmentBaseMediaDecodeTimeBox.cs
  98. +19
    -0
      src/JT1078.FMp4/Boxs/TrackFragmentBox.cs
  99. +26
    -0
      src/JT1078.FMp4/Boxs/TrackFragmentHeaderBox.cs
  100. +40
    -0
      src/JT1078.FMp4/Boxs/TrackFragmentRandomAccessBox.cs

+ 2
- 1
README.md View File

@@ -6,7 +6,8 @@
2. [企业平台到政府监管的通信也就是JT809](#809Ext)
3. [设备终端上传的实时音视频流数据也就是视频服务器](#1078)
3.1 [将1078的数据(h264)编码成FLV](#1078flv)
3.2 [将1078的数据(h264)编码成HLS](#1078hls)
3.2 [将1078的数据(h264)编码成HLS](#1078hls)
3.3 [将1078的数据(h264)编码成FMp4](#1078fmp4)

[![MIT Licence](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/SmallChi/JT1078/blob/master/LICENSE)[![Github Build status](https://github.com/SmallChi/JT1078/workflows/.NET%20Core/badge.svg)]()



BIN
doc/fmp4/ISO Language Codes.txt View File


BIN
doc/fmp4/ISO_IEC_14496-12_2012.pdf View File


+ 19
- 0
doc/fmp4/fmp4info.txt View File

@@ -0,0 +1,19 @@
ref https://stackoverflow.com/questions/53992918/about-fmp4-encoding-how-to-fill-the-mdat-box-wit-h264-frame?r=SearchResults

H.264 can be in different stream formats. One is called "Annex B" the other one is MP4. In "Annex B" your NAL units are prefix with start codes 00 00 00 01 or 00 00 01. In MP4 your NAL units are prefixed with the size in bytes.

I assume your encoder emits "Annex B".

Remove the start code (00) 00 00 01

Prefix your NAL units with the size (typically 4 bytes)

Filter out AUD/SPS/PPS NAL units from your stream

Write you converted NAL units into the MDAT box

Create an AVC Configuration Box ('avcC') based on your SPS, PPS and the length size

Store your avcC box in moov->trak->mdia->minf->stbl->avc1->avcC

While you are writing your samples into mdat - keep track of sizes, offsets and frame types to create the correct stts, stss, stsc, stsz and stco boxes.

BIN
doc/fmp4/img/fmp4_1.png View File

Before After
Width: 953  |  Height: 521  |  Size: 57 KiB

BIN
doc/fmp4/img/fmp4_2.png View File

Before After
Width: 957  |  Height: 526  |  Size: 48 KiB

BIN
doc/fmp4/img/parser_pic.png View File

Before After
Width: 1347  |  Height: 711  |  Size: 50 KiB

BIN
doc/fmp4/img/structure_model.png View File

Before After
Width: 603  |  Height: 901  |  Size: 222 KiB

BIN
doc/fmp4/parser_manual.txt View File


BIN
doc/fmp4/parser_manual_fmp4.txt View File


BIN
doc/tools/mp4info.exe View File


+ 20
- 0
src/JT1078.FMp4.Test/JT1078.FMp4.Test.csproj View File

@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="coverlet.collector" Version="1.2.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\JT1078.FMp4\JT1078.FMp4.csproj" />
</ItemGroup>

</Project>

+ 14
- 0
src/JT1078.FMp4.Test/UnitTest1.cs View File

@@ -0,0 +1,14 @@
using System;
using Xunit;

namespace JT1078.FMp4.Test
{
public class UnitTest1
{
[Fact]
public void Test1()
{

}
}
}

+ 14
- 0
src/JT1078.FMp4/Boxs/AVCConfigurationBox.cs View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class AVCConfigurationBox : Mp4Box
{
public AVCConfigurationBox() : base("avcC")
{
}
public AVCDecoderConfigurationRecord AVCDecoderConfigurationRecord { get; set; }
}
}

+ 66
- 0
src/JT1078.FMp4/Boxs/AVCDecoderConfigurationRecord.cs View File

@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
//AVCDecoderConfigurationRecord 结构的定义:
//aligned(8) class AVCDecoderConfigurationRecord
//{
//unsigned int (8) configurationVersion = 1;
//unsigned int (8) AVCProfileIndication;
//unsigned int (8) profile_compatibility;
//unsigned int (8) AVCLevelIndication;
//bit(6) reserved = ‘111111’b;
//unsigned int (2) lengthSizeMinusOne;
//bit(3) reserved = ‘111’b;
//unsigned int (5) numOfSequenceParameterSets;
//for (i=0; i<numOfSequenceParameterSets; i++) {
//unsigned int (16) sequenceParameterSetLength ;
//bit(8*sequenceParameterSetLength) sequenceParameterSetNALUnit;
//}
//unsigned int (8) numOfPictureParameterSets;
//for (i=0; i<numOfPictureParameterSets; i++) {
//unsigned int (16) pictureParameterSetLength;
//bit(8*pictureParameterSetLength) pictureParameterSetNALUnit;
//}
//}

/// <summary>
///
/// </summary>
public class AVCDecoderConfigurationRecord
{
public byte ConfigurationVersion { get; set; } = 1;
public byte AVCProfileIndication { get; set; }
public byte ProfileCompatibility { get; set; }
public byte AVCLevelIndication { get; set; }
public int LengthSizeMinusOne { get; set; }
public int NumOfSequenceParameterSets { get; set; }
public List<SPSInfo> SPS { get; set; }
public byte[] SPSBuffer { get; set; }
public byte NumOfPictureParameterSets { get; set; } = 1;
public List<PPSInfo> PPS { get; set; }
public byte[] PPSBuffer { get; set; }

#region Just for non-spec-conform encoders ref:org.JT1078.FMp4.boxes.iso14496.part15.AvcDecoderConfigurationRecord
public const int LengthSizeMinusOnePaddingBits = 63;
public const int NumberOfSequenceParameterSetsPaddingBits = 7;
public const int ChromaFormatPaddingBits = 31;
public const int BitDepthLumaMinus8PaddingBits = 31;
public const int BitDepthChromaMinus8PaddingBits = 31;
#endregion

public struct SPSInfo
{
public ushort SequenceParameterSetLength { get; set; }
public byte[] SequenceParameterSetNALUnit { get; set; }
}

public struct PPSInfo
{
public ushort PictureParameterSetLength { get; set; }
public byte[] PictureParameterSetNALUnit { get; set; }
}
}
}

+ 18
- 0
src/JT1078.FMp4/Boxs/ChunkLargeOffsetBox.cs View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class ChunkLargeOffsetBox : FullBox
{
public ChunkLargeOffsetBox(byte version=0, uint flags=0) : base("co64", version, flags)
{
}
public uint EntryCount { get; set; }
/// <summary>
/// length:EntryCount
/// </summary>
public List<ulong> ChunkOffset { get; set; }
}
}

+ 19
- 0
src/JT1078.FMp4/Boxs/ChunkOffsetBox.cs View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class ChunkOffsetBox : FullBox
{
public ChunkOffsetBox( byte version=0, uint flags=0) : base("stco", version, flags)
{
}

public uint EntryCount { get; set; }
/// <summary>
/// length:EntryCount
/// </summary>
public List<uint> ChunkOffset { get; set; }
}
}

+ 22
- 0
src/JT1078.FMp4/Boxs/CleanApertureBox.cs View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class CleanApertureBox : Mp4Box
{
public CleanApertureBox() : base("clap")
{
}

public uint CleanApertureWidthN { get; set; }
public uint CleanApertureWidthD { get; set; }
public uint CleanApertureHeightN { get; set; }
public uint CleanApertureHeightD { get; set; }
public uint HorizOffN { get; set; }
public uint HorizOffD { get; set; }
public uint VertOffN { get; set; }
public uint VertOffD { get; set; }
}
}

+ 21
- 0
src/JT1078.FMp4/Boxs/ColourInformationBox.cs View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class ColourInformationBox : Mp4Box
{
public ColourInformationBox() : base("colr")
{
}
public string ColourType { get; set; }
public ushort ColourPrimaries { get; set; }
public ushort TransferCharacteristics { get; set; }
public ushort MatrixCoefficients { get; set; }
public bool FullRangeFlag { get; set; }
public byte Reserved { get; set; }
#warning ICC_profile?????
public byte [] ICCProfile { get; set; }
}
}

+ 27
- 0
src/JT1078.FMp4/Boxs/CompactSampleSizeBox.cs View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class CompactSampleSizeBox : FullBox
{
public CompactSampleSizeBox(byte version=0, uint flags=0) : base("stz2", version, flags)
{
}

public byte[] Reserved { get; set; } = new byte[3];
/// <summary>
/// 4, 8 or 16
/// </summary>
public byte FieldSize { get; set; }

public uint SampleCount { get; set; }

/// <summary>
/// length:SampleCount
/// DepOn:field_size=>DataType
/// </summary>
public List<ushort> EntrySize { get; set; }
}
}

+ 26
- 0
src/JT1078.FMp4/Boxs/CompositionOffsetBox.cs View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class CompositionOffsetBox : FullBox
{
public CompositionOffsetBox(byte version=0, uint flags=0) : base("ctts", version, flags)
{
}
public uint EntryCount { get; set; }

public List<CompositionOffsetInfo> CompositionOffsetInfos { get; set; }

public class CompositionOffsetInfo
{
public uint SampleCount { get; set; }
public uint SampleOffset { get; set; }
/// <summary>
/// version == 1
/// </summary>
public int SignedSampleOffset { get; set; }
}
}
}

+ 19
- 0
src/JT1078.FMp4/Boxs/CompositionToDecodeBox.cs View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class CompositionToDecodeBox : FullBox
{
public CompositionToDecodeBox(byte version=0, uint flags=0) : base("cslg", version, flags)
{
}

public int CompositionToDTSShift { get; set; }
public int LeastDecodeToDisplayDelta { get; set; }
public int GreatestDecodeToDisplayDelta { get; set; }
public int CompositionStartTime { get; set; }
public int CompositionEndTime { get; set; }
}
}

+ 24
- 0
src/JT1078.FMp4/Boxs/CopyrightBox.cs View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class CopyrightBox : FullBox
{
public CopyrightBox(byte version=0, uint flags=0) : base("cprt", version, flags)
{
}
/// <summary>
/// 16-1
/// </summary>
public bool Pad { get; set; }
/// <summary>
/// 16-15
/// ISO-639-2/T language code
/// </summary>
public byte Language { get; set; }

public string Notice { get; set; }
}
}

+ 13
- 0
src/JT1078.FMp4/Boxs/DataEntryBox.cs View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public abstract class DataEntryBox : FullBox
{
public DataEntryBox(string boxType, byte version, uint flags) : base(boxType, version, flags)
{
}
}
}

+ 19
- 0
src/JT1078.FMp4/Boxs/DataEntryUrlBox.cs View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class DataEntryUrlBox : DataEntryBox
{
public DataEntryUrlBox(byte version, uint flags) : base("url ", version, flags)
{
}

public DataEntryUrlBox(uint flags) : this(0, flags)
{
}

public string Location { get; set; }
}
}

+ 19
- 0
src/JT1078.FMp4/Boxs/DataEntryUrnBox.cs View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class DataEntryUrnBox : DataEntryBox
{
public DataEntryUrnBox(byte version, uint flags) : base("urn ", version, flags)
{
}
public DataEntryUrnBox(uint flags) : this(0, flags)
{
}

public string Name { get; set; }
public string Location { get; set; }
}
}

+ 14
- 0
src/JT1078.FMp4/Boxs/DataInformationBox.cs View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class DataInformationBox : Mp4Box
{
public DataInformationBox() : base("dinf")
{
}
public DataReferenceBox DataReferenceBox { get; set; }
}
}

+ 20
- 0
src/JT1078.FMp4/Boxs/DataReferenceBox.cs View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class DataReferenceBox : FullBox
{
public DataReferenceBox(byte version=0, uint flags=0) : base("dref", version, flags)
{
}

public uint EntryCount { get; set; }

/// <summary>
/// length:EntryCount
/// </summary>
public List<DataEntryBox> DataEntryBoxes { get; set; }
}
}

+ 17
- 0
src/JT1078.FMp4/Boxs/DegradationPriorityBox.cs View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class DegradationPriorityBox : FullBox
{
public DegradationPriorityBox(byte version=0, uint flags=0) : base("stdp", version, flags)
{
}
/// <summary>
/// sample_count is taken from the sample_count in the Sample Size Box ('stsz').
/// </summary>
public List<ushort> Priorities { get; set; }
}
}

+ 15
- 0
src/JT1078.FMp4/Boxs/EditBox.cs View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class EditBox : Mp4Box
{
public EditBox() : base("edts")
{
}

public List<EditListBox> EditListBox { get; set; }
}
}

+ 21
- 0
src/JT1078.FMp4/Boxs/EditListBox.cs View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class EditListBox : FullBox
{
public EditListBox(byte version, uint flags=0) : base("elst", version, flags)
{
}
public uint EntryCount { get; set; }

public ulong SegmentDurationLarge { get; set; }
public long MediaTimeLarge { get; set; }
public uint SegmentDuration { get; set; }
public int MediaTime { get; set; }
public short MediaRateInteger { get; set; }
public short MediaRateFraction { get; set; }
}
}

+ 21
- 0
src/JT1078.FMp4/Boxs/FDItemInformationBox.cs View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class FDItemInformationBox : FullBox
{
public FDItemInformationBox(byte version, uint flags) : base("fiin", version, flags)
{
}

public ushort EntryCount { get; set; }
/// <summary>
/// length:EntryCount
/// </summary>
public List<PartitionEntryBox> PartitionEntries { get; set; }
public FDSessionGroupBox SessionInfo { get; set; }
public GroupIdToNameBox GroupIdToName { get; set; }
}
}

+ 29
- 0
src/JT1078.FMp4/Boxs/FDSessionGroupBox.cs View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class FDSessionGroupBox : Mp4Box
{
public FDSessionGroupBox() : base("segr")
{
}

public ushort NumSessionGroups { get; set; }

public class FDSessionGroupInfo
{
public byte EntryCount { get; set; }
/// <summary>
/// length:EntryCount
/// </summary>
public List<uint> GroupIDs { get; set; }
public ushort NumChannelsInSessionGroup { get; set; }
/// <summary>
/// length:NumChannelsInSessionGroup
/// </summary>
public List<uint> HintTrackId{ get; set; }
}
}
}

+ 23
- 0
src/JT1078.FMp4/Boxs/FECReservoirBox.cs View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class FECReservoirBox : FullBox
{
public FECReservoirBox(byte version=0, uint flags=0) : base("fecr", version, flags)
{
}

public ushort EntryCount { get; set; }

public List<FECReservoirInfo> FECReservoirInfos { get; set; }

public class FECReservoirInfo
{
public ushort ItemID { get; set; }
public uint SymbolCount { get; set; }
}
}
}

+ 32
- 0
src/JT1078.FMp4/Boxs/FilePartitionBox.cs View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class FilePartitionBox : FullBox
{
public FilePartitionBox(byte version=0, uint flags=0) : base("fpar", version, flags)
{
}
public ushort ItemID { get; set; }
public ushort PacketPayloadSize { get; set; }
public byte Reserved { get; set; }
public byte FECEncodingID { get; set; }
public ushort FECInstanceID { get; set; }
public ushort MaxSourceBlockLength { get; set; }
public ushort EncodingSymbolLength { get; set; }
public ushort MaxNumberOfEncodingSymbols { get; set; }
/// <summary>
/// 以null结尾
/// </summary>
public string SchemeSpecificInfo { get; set; }
public ushort EntryCount { get; set; }
public List<FilePartitionInfo> FilePartitionInfos { get; set; }
public class FilePartitionInfo
{
public ushort BlockCount { get; set; }
public ushort BlockSize { get; set; }
}
}
}

+ 22
- 0
src/JT1078.FMp4/Boxs/FileReservoirBox.cs View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class FileReservoirBox : FullBox
{
public FileReservoirBox(byte version=0, uint flags=0) : base("fire", version, flags)
{
}
public ushort EntryCount { get; set; }

public List<FileReservoirInfo> FileReservoirInfos { get; set; }

public class FileReservoirInfo
{
public ushort ItemID { get; set; }
public uint SymbolCount { get; set; }
}
}
}

+ 32
- 0
src/JT1078.FMp4/Boxs/FileTypeBox.cs View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;

namespace JT1078.FMp4
{
/// <summary>
/// ftyp 盒子相当于就是该 mp4 的纲领性说明。即,告诉解码器它的基本解码版本,兼容格式。简而言之,就是用来告诉客户端,该 MP4 的使用的解码标准。通常,ftyp 都是放在 MP4 的开头。
/// </summary>
public class FileTypeBox : Mp4Box
{
public FileTypeBox() : base("ftyp")
{
}
/// <summary>
///因为兼容性一般可以分为推荐兼容性和默认兼容性。这里 major_brand 就相当于是推荐兼容性。通常,在 Web 中解码,一般而言都是使用 isom 这个万金油即可。如果是需要特定的格式,可以自行定义。
/// 4位
/// </summary>
public string MajorBrand { get; set; }
/// <summary>
/// 最低兼容版本
/// 4位
/// </summary>
public uint MinorVersion { get; set; }
/// <summary>
/// 和MajorBrand类似,通常是针对 MP4 中包含的额外格式,比如,AVC,AAC 等相当于的音视频解码格式。
/// 4位*n
/// </summary>
public List<string> CompatibleBrands { get; set; }
}
}

+ 12
- 0
src/JT1078.FMp4/Boxs/FragmentBox.cs View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class FragmentBox
{
public MovieFragmentBox MovieFragmentBox { get; set; }
public MediaDataBox MediaDataBox { get; set; }
}
}

+ 13
- 0
src/JT1078.FMp4/Boxs/FreeBox.cs View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class FreeBox : FreeSpaceBox
{
public FreeBox() : base("free")
{
}
}
}

+ 21
- 0
src/JT1078.FMp4/Boxs/FreeSpaceBox.cs View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public abstract class FreeSpaceBox: Mp4Box
{
public FreeSpaceBox(string boxType) : base(boxType)
{
}
/// <summary>
/// 填充值
/// </summary>
public byte FillValue { get; set; }
/// <summary>
/// 填充数量
/// </summary>
public int FillCount { get; set; }
}
}

+ 24
- 0
src/JT1078.FMp4/Boxs/GroupIdToNameBox.cs View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class GroupIdToNameBox : FullBox
{
public GroupIdToNameBox(byte version=0, uint flags=0) : base("gitn", version, flags)
{
}

public ushort EntryCount { get; set; }

public List<GroupIdToNameInfo> GroupIdToNameInfos { get; set; }

public class GroupIdToNameInfo
{
public uint GroupID { get; set; }

public string GroupName { get; set; }
}
}
}

+ 18
- 0
src/JT1078.FMp4/Boxs/HandlerBox.cs View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class HandlerBox : FullBox
{
public HandlerBox(byte version=0, uint flags=0) : base("hdlr", version, flags)
{
}

public uint PreDefined { get; set; }
public string HandlerType { get; set; }
public uint[] Reserved { get; set; } = new uint[3];
public string Name { get; set; }
}
}

+ 19
- 0
src/JT1078.FMp4/Boxs/HintMediaHeaderBox.cs View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class HintMediaHeaderBox : FullBox
{
public HintMediaHeaderBox(byte version=0, uint flags=0) : base("hmhd", version, flags)
{
}

public ushort MaxPDUSize { get; set; }
public ushort AvgPDUSize { get; set; }
public ushort MaxBitRate { get; set; }
public ushort AvgBitRate { get; set; }
public ushort Reserved { get; set; }
}
}

+ 57
- 0
src/JT1078.FMp4/Boxs/ItemLocationBox.cs View File

@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class ItemLocationBox : FullBox
{
public ItemLocationBox(byte version, uint flags=0) : base("iloc", version, flags)
{
}
/// <summary>
/// 0, 4, 8
/// </summary>
public byte OffsetSize { get; set; }
/// <summary>
/// 0, 4, 8
/// </summary>
public byte LengthSize { get; set; }
/// <summary>
/// 0, 4, 8
/// </summary>
public byte BaseOffsetSize { get; set; }
/// <summary>
/// version == 1
/// </summary>
public byte IndexSize{ get; set; }
public byte Reserved { get; set; }
public ushort ItemCount { get; set; }
public List<ItemLocation> ItemLocations { get; set; }
public class ItemLocation
{
public ushort ItemID { get; set; }
/// <summary>
/// if (version == 1) 16-12
/// </summary>
public byte Reserved { get; set; } = 12;
/// <summary>
/// if (version == 1) 16-4
/// </summary>
public byte ConstructionMethod { get; set; }
public ushort DataReferenceIndex { get; set; }
public ulong BaseOffset { get; set; }
public ushort ExtentCount { get; set; }
public List<ItemLocationExtentInfo> ItemLocationExtentInfos { get; set; }
public class ItemLocationExtentInfo
{
/// <summary>
/// if ((version == 1) && (index_size > 0))
/// </summary>
public ulong ExtentIndex { get; set; }
public ulong ExtentOffset { get; set; }
public ulong ExtentLength { get; set; }
}
}
}
}

+ 16
- 0
src/JT1078.FMp4/Boxs/ItemProtectionBox.cs View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class ItemProtectionBox : FullBox
{
public ItemProtectionBox(byte version=0, uint flags=0) : base("ipro", version, flags)
{
}
public ushort ProtectionCount { get; set; }


}
}

+ 40
- 0
src/JT1078.FMp4/Boxs/LevelAssignmentBox.cs View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class LevelAssignmentBox : FullBox
{
public LevelAssignmentBox(byte version=0, uint flags=0) : base("leva", version, flags)
{
}

public byte LevelCount { get; set; }

public class LevelAssignmentInfo
{
public uint TrackId { get; set; }
/// <summary>
/// 1byte 8-1
/// </summary>
public bool PaddingFlag { get; set; }
/// <summary>
/// 1byte 8-7
/// </summary>
public byte AssignmentType { get; set; }
/// <summary>
/// AssignmentType == 0 || assignment_type == 1
/// </summary>
public uint GroupingType { get; set; }
/// <summary>
/// assignment_type == 1
/// </summary>
public uint GroupingTypeParameter { get; set; }
/// <summary>
/// assignment_type == 4
/// </summary>
public uint SubTrackId { get; set; }
}
}
}

+ 17
- 0
src/JT1078.FMp4/Boxs/MPEG4BitRateBox.cs View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class MPEG4BitRateBox : Mp4Box
{
public MPEG4BitRateBox() : base("btrt")
{
}

public uint BufferSizeDB { get; set; }
public uint MaxBitRate { get; set; }
public uint AvgBitRate { get; set; }
}
}

+ 17
- 0
src/JT1078.FMp4/Boxs/MediaBox.cs View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class MediaBox : Mp4Box
{
public MediaBox() : base("mdia")
{
}

public MediaHeaderBox MediaHeaderBox { get; set; }
public HandlerBox HandlerBox { get; set; }
public MediaInformationBox MediaInformationBox { get; set; }
}
}

+ 15
- 0
src/JT1078.FMp4/Boxs/MediaDataBox.cs View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class MediaDataBox : Mp4Box
{
public MediaDataBox() : base("mdat")
{
}

public byte[] Data { get; set; }
}
}

+ 24
- 0
src/JT1078.FMp4/Boxs/MediaHeaderBox.cs View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class MediaHeaderBox : FullBox
{
public MediaHeaderBox(byte version, uint flags=0) : base("mdhd", version, flags)
{
}
public uint CreationTime { get; set; }
public uint ModificationTime { get; set; }
public uint Timescale { get; set; }
public uint Duration { get; set; } = 1;
//public bool Pad { get; set; }
/// <summary>
/// ISO-639-2/T language code
/// und-undetermined
/// </summary>
public string Language { get; set; }
public ushort PreDefined { get; set; }
}
}

+ 16
- 0
src/JT1078.FMp4/Boxs/MediaInformationBox.cs View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class MediaInformationBox : Mp4Box
{
public MediaInformationBox() : base("minf")
{
}
public FullBox MediaHeaderBox { get; set; }
public DataInformationBox DataInformationBox { get; set; }
public SampleTableBox SampleTableBox { get; set; }
}
}

+ 22
- 0
src/JT1078.FMp4/Boxs/MetaBox.cs View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class MetaBox : FullBox
{
public MetaBox(string handlerType,byte version=0, uint flags=0) : base("meta", version, flags)
{
HandlerType = handlerType;
}

public string HandlerType { get; set; }

public HandlerBox TheHandler { get; set; }

public DataInformationBox FileLocations { get; set; }

public ItemLocationBox ItemLLocations { get; set; }
}
}

+ 17
- 0
src/JT1078.FMp4/Boxs/MovieBox.cs View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;

namespace JT1078.FMp4
{
public class MovieBox : Mp4Box
{
public MovieBox() : base("moov")
{
}
public MovieHeaderBox MovieHeaderBox { get; set; }
public TrackBox TrackBox { get; set; }
public MovieExtendsBox MovieExtendsBox { get; set; }
}
}

+ 15
- 0
src/JT1078.FMp4/Boxs/MovieExtendsBox.cs View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class MovieExtendsBox : Mp4Box
{
public MovieExtendsBox() : base("mvex")
{
}
public MovieExtendsHeaderBox MovieExtendsHeaderBox { get; set; }
public List<TrackExtendsBox> TrackExtendsBoxs { get; set; }
}
}

+ 14
- 0
src/JT1078.FMp4/Boxs/MovieExtendsHeaderBox.cs View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class MovieExtendsHeaderBox : FullBox
{
public MovieExtendsHeaderBox( byte version, uint flags=0) : base("mehd", version, flags)
{
}
public uint FragmentDuration { get; set; }
}
}

+ 16
- 0
src/JT1078.FMp4/Boxs/MovieFragmentBox.cs View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class MovieFragmentBox : Mp4Box
{
public MovieFragmentBox() : base("moof")
{
}

public MovieFragmentHeaderBox MovieFragmentHeaderBox { get; set; }
public TrackFragmentBox TrackFragmentBox { get; set; }
}
}

+ 15
- 0
src/JT1078.FMp4/Boxs/MovieFragmentHeaderBox.cs View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class MovieFragmentHeaderBox : FullBox
{
public MovieFragmentHeaderBox(byte version=0, uint flags=0) : base("mfhd", version, flags)
{
}

public uint SequenceNumber { get; set; }
}
}

+ 17
- 0
src/JT1078.FMp4/Boxs/MovieFragmentRandomAccessBox.cs View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class MovieFragmentRandomAccessBox : Mp4Box
{
public MovieFragmentRandomAccessBox() : base("mfra")
{
}

public TrackFragmentRandomAccessBox TrackFragmentRandomAccessBox { get; set; }

public MovieFragmentRandomAccessOffsetBox MovieFragmentRandomAccessOffsetBox { get; set; }
}
}

+ 15
- 0
src/JT1078.FMp4/Boxs/MovieFragmentRandomAccessOffsetBox.cs View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class MovieFragmentRandomAccessOffsetBox : FullBox
{
public MovieFragmentRandomAccessOffsetBox(byte version, uint flags=0) : base("mfro", version, flags)
{
}

public uint MfraSize { get; set; }
}
}

+ 24
- 0
src/JT1078.FMp4/Boxs/MovieHeaderBox.cs View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class MovieHeaderBox : FullBox
{
public MovieHeaderBox(byte version, uint flags=0) : base("mvhd", version, flags)
{
}
public uint CreationTime { get; set; }
public uint ModificationTime { get; set; }
public uint Timescale { get; set;}
public uint Duration { get; set; }
public int Rate { get; set; } = 0x00010000;
public short Volume { get; set; } = 0x0100;
public byte[] Reserved1 { get; set; } = new byte[2];
public uint[] Reserved2 { get; set; } = new uint[2];
public int[] Matrix { get; set; }=new int [9]{ 0x00010000, 0, 0, 0, 0x00010000, 0, 0, 0, 0x40000000 };
public byte[] PreDefined { get; set; } = new byte[24];
public uint NextTrackID { get; set; }= uint.MaxValue;
}
}

+ 13
- 0
src/JT1078.FMp4/Boxs/NullMediaHeaderBox.cs View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class NullMediaHeaderBox : FullBox
{
public NullMediaHeaderBox(byte version=0, uint flags=0) : base("nmhd", version, flags)
{
}
}
}

+ 17
- 0
src/JT1078.FMp4/Boxs/OriginalFormatBox.cs View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class OriginalFormatBox : Mp4Box
{
public OriginalFormatBox(string codingname) : base("frma")
{
DataFormat = codingname;
}

public string DataFormat { get; set; }

}
}

+ 25
- 0
src/JT1078.FMp4/Boxs/PaddingBitsBox.cs View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class PaddingBitsBox : FullBox
{
public PaddingBitsBox(byte version=0, uint flags=0) : base("padb", version, flags)
{
}

public uint SampleCount { get; set; }

public List<PaddingBitsInfo> PaddingBitsInfos { get; set; }

public class PaddingBitsInfo
{
public bool Reserved1 { get; set; }
public byte Pad1 { get; set; }
public bool Reserved2 { get; set; }
public byte Pad2 { get; set; }
}
}
}

+ 15
- 0
src/JT1078.FMp4/Boxs/PartitionEntryBox.cs View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class PartitionEntryBox : Mp4Box
{
public PartitionEntryBox() : base("paen")
{
}

}
}

+ 15
- 0
src/JT1078.FMp4/Boxs/PixelAspectRatioBox.cs View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class PixelAspectRatioBox : Mp4Box
{
public PixelAspectRatioBox() : base("pasp")
{
}
public uint HSpacing { get; set; }
public uint VSpacing { get; set; }
}
}

+ 15
- 0
src/JT1078.FMp4/Boxs/PrimaryItemBox.cs View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class PrimaryItemBox : FullBox
{
public PrimaryItemBox(byte version=0, uint flags=0) : base("pitm", version, flags)
{
}

public ushort ItemID { get; set; }
}
}

+ 20
- 0
src/JT1078.FMp4/Boxs/ProducerReferenceTimeBox.cs View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class ProducerReferenceTimeBox : FullBox
{
public ProducerReferenceTimeBox(byte version, uint flags) : base("prft", version, flags)
{
}
public ushort ReferenceTrackID { get; set; }
public uint NtpTimestamp { get; set; }
/// <summary>
/// if (version==0)
/// </summary>
public uint MediaTime { get; set; }
public ulong MediaTimeLagre { get; set; }
}
}

+ 21
- 0
src/JT1078.FMp4/Boxs/ProgressiveDownloadInfoBox.cs View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class ProgressiveDownloadInfoBox : FullBox
{
public ProgressiveDownloadInfoBox(byte version=0, uint flags=0) : base("pdin", version, flags)
{
}

public List<ProgressiveDownloadInfo> ProgressiveDownloadInfos { get; set; }

public class ProgressiveDownloadInfo
{
public ushort Rate { get; set; }
public ushort InitialDelay { get; set; }
}
}
}

+ 20
- 0
src/JT1078.FMp4/Boxs/ProtectionSchemeInfoBox.cs View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class ProtectionSchemeInfoBox : Mp4Box
{
public ProtectionSchemeInfoBox(string fmt) : base("sinf")
{
OriginalFormatBox = new OriginalFormatBox(fmt);
}

public OriginalFormatBox OriginalFormatBox { get; set; }

public SchemeTypeBox SchemeTypeBox { get; set; }

public SchemeInformationBox SchemeInformationBox { get; set; }
}
}

+ 20
- 0
src/JT1078.FMp4/Boxs/RestrictedSchemeInfoBox.cs View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class RestrictedSchemeInfoBox : Mp4Box
{
public RestrictedSchemeInfoBox(string fmt) : base("rinf")
{
OriginalFormatBox = new OriginalFormatBox(fmt);
}

public OriginalFormatBox OriginalFormatBox { get; set; }

public SchemeTypeBox SchemeTypeBox { get; set; }

public SchemeInformationBox SchemeInformationBox { get; set; }
}
}

+ 30
- 0
src/JT1078.FMp4/Boxs/SampleAuxiliaryInformationOffsetsBox.cs View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class SampleAuxiliaryInformationOffsetsBox : FullBox
{
public SampleAuxiliaryInformationOffsetsBox(byte version, uint flags) : base("saio", version, flags)
{
}
/// <summary>
/// if (flags & 1)
/// </summary>
public uint AuxInfoType { get; set; }
/// <summary>
/// if (flags & 1)
/// </summary>
public uint AuxInfoTypeParameter { get; set; }
public uint EntryCount { get; set; }
/// <summary>
/// length:entry_count
/// </summary>
public uint[] Offset { get; set; }
/// <summary>
/// length:entry_count
/// </summary>
public ulong[] OffsetLarge { get; set; }
}
}

+ 28
- 0
src/JT1078.FMp4/Boxs/SampleAuxiliaryInformationSizesBox.cs View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class SampleAuxiliaryInformationSizesBox : FullBox
{
public SampleAuxiliaryInformationSizesBox(byte version=0, uint flags=0) : base("saiz", version, flags)
{
}
/// <summary>
/// if (flags & 1)
/// </summary>
public uint AuxInfoType { get; set; }
/// <summary>
/// if (flags & 1)
/// </summary>
public uint AuxInfoTypeParameter { get; set; }
public byte DefaultSampleInfoSize { get; set; }
public uint SampleCount { get; set; }
/// <summary>
/// default_sample_info_size==0
/// length:sample_count
/// </summary>
public byte[] SampleInfoSize { get; set; }
}
}

+ 28
- 0
src/JT1078.FMp4/Boxs/SampleDependencyTypeBox.cs View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class SampleDependencyTypeBox : FullBox
{
public SampleDependencyTypeBox(byte version=0, uint flags=0) : base("sdtp", version, flags)
{
}
/// <summary>
/// is taken from the sample_count in the Sample Size Box ('stsz') or Compact Sample Size Box(‘stz2’).
/// </summary>
public List<SampleDependencyType> SampleDependencyTypes { get; set; }

public class SampleDependencyType
{
public byte IsLeading { get; set; }
public byte SampleDependsOn { get; set; }
public byte SampleIsDependedOn { get; set; }
public byte SampleHasRedundancy { get; set; }
public byte DegradPrio { get; set; }
public byte IsNonSync { get; set; }
public byte PaddingValue { get; set; }
}
}
}

+ 20
- 0
src/JT1078.FMp4/Boxs/SampleDescriptionBox.cs View File

@@ -0,0 +1,20 @@
using JT1078.FMp4.Samples;
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class SampleDescriptionBox : FullBox
{
public string HandlerType { get; set; }
public SampleDescriptionBox(string handlerType,byte version=0, uint flags=0) : base("stsd", version, flags)
{
HandlerType = handlerType;
}

public uint EntryCount { get; set; }
public List<SampleEntry> SampleEntries { get; set; }
}
}

+ 29
- 0
src/JT1078.FMp4/Boxs/SampleGroupDescriptionBox.cs View File

@@ -0,0 +1,29 @@
using JT1078.FMp4.Samples;
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class SampleGroupDescriptionBox : FullBox
{
public SampleGroupDescriptionBox(string handlerType, byte version, uint flags=0) : base("sgpd", version, flags)
{
HandlerType = handlerType;
}

public string HandlerType { get; set; }
/// <summary>
/// if (version==1)
/// </summary>
public uint DefaultLength { get; set; }
public uint EntryCount { get; set; }
public List<SampleGroupDescription> SampleGroupDescriptions { get; set; }
public class SampleGroupDescription
{
public uint DescriptionLength { get; set; }

public SampleGroupDescriptionEntry SampleGroupDescriptionEntry { get; set; }
}
}
}

+ 21
- 0
src/JT1078.FMp4/Boxs/SampleSizeBox.cs View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class SampleSizeBox : FullBox
{
public SampleSizeBox(byte version=0, uint flags=0) : base("stsz", version, flags)
{
}

public uint SampleSize { get; set; }
public uint SampleCount { get; set; }
/// <summary>
/// if (sample_size==0)
/// length:sample_count
/// </summary>
public List<uint> EntrySize { get; set; }
}
}

+ 29
- 0
src/JT1078.FMp4/Boxs/SampleTableBox.cs View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class SampleTableBox : Mp4Box
{
public SampleTableBox() : base("stbl")
{
}
public SampleDescriptionBox SampleDescriptionBox { get; set; }
public TimeToSampleBox TimeToSampleBox { get; set; }
public CompositionOffsetBox CompositionOffsetBox { get; set; }
public SampleToChunkBox SampleToChunkBox { get; set; }
public SampleSizeBox SampleSizeBox { get; set; }
public CompactSampleSizeBox CompactSampleSizeBox { get; set; }
public ChunkOffsetBox ChunkOffsetBox { get; set; }
public ChunkLargeOffsetBox ChunkLargeOffsetBox { get; set; }
public SyncSampleBox SyncSampleBox { get; set; }
public ShadowSyncSampleBox ShadowSyncSampleBox { get; set; }
public PaddingBitsBox PaddingBitsBox { get; set; }
public DegradationPriorityBox DegradationPriorityBox { get; set; }
public SampleDependencyTypeBox SampleDependencyTypeBox { get; set; }
public SampleToGroupBox SampleToGroupBox { get; set; }
public SampleGroupDescriptionBox SampleGroupDescriptionBox { get; set; }
public SubSampleInformationBox SubSampleInformationBox { get; set; }
}
}

+ 21
- 0
src/JT1078.FMp4/Boxs/SampleToChunkBox.cs View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class SampleToChunkBox : FullBox
{
public SampleToChunkBox(byte version=0, uint flags=0) : base("stsc", version, flags)
{
}
public uint EntryCount { get; set; }
public List<SampleToChunkInfo> SampleToChunkInfos { get; set; }
public class SampleToChunkInfo
{
public uint FirstChunk { get; set; }
public uint SamplesPerChunk { get; set; }
public uint SampleDescriptionIindex { get; set; }
}
}
}

+ 29
- 0
src/JT1078.FMp4/Boxs/SampleToGroupBox.cs View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class SampleToGroupBox : FullBox
{
public SampleToGroupBox(byte version, uint flags) : base("sbgp", version, flags)
{
}

public uint GroupingType { get; set; }
/// <summary>
/// version == 1
/// </summary>
public uint GroupingTypeParameter { get; set; }

public uint EntryCount { get; set; }

public List<SampleToGroupInfo> SampleToGroupInfos { get; set; }

public class SampleToGroupInfo
{
public uint SampleCount { get; set; }
public uint GroupDescriptionIndex { get; set; }
}
}
}

+ 15
- 0
src/JT1078.FMp4/Boxs/SchemeInformationBox.cs View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class SchemeInformationBox : Mp4Box
{
public SchemeInformationBox() : base("schi")
{
}

public List<Mp4Box> SchemeSpecificData { get; set; }
}
}

+ 26
- 0
src/JT1078.FMp4/Boxs/SchemeTypeBox.cs View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class SchemeTypeBox : FullBox
{
public SchemeTypeBox(byte version, uint flags) : base("schm", version, flags)
{
}

public SchemeTypeBox(uint flags) : this(0,flags)
{
}

public uint SchemeType { get; set; }

public uint SchemeVersion { get; set; }
/// <summary>
/// if (flags & 0x000001)
/// UTF-8
/// </summary>
public string SchemeUri { get; set; }
}
}

+ 58
- 0
src/JT1078.FMp4/Boxs/SegmentIndexBox.cs View File

@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class SegmentIndexBox : FullBox
{
public SegmentIndexBox(byte version, uint flags=0) : base("sidx", version, flags)
{
}

public uint ReferenceID { get; set; }
public string Timescale { get; set; }
/// <summary>
///
/// </summary>
public ulong EarliestPresentationTimeLarge { get; set; }
public ulong FirstOffsetLarge { get; set; }
/// <summary>
/// if(version==0)
/// </summary>
public uint EarliestPresentationTime { get; set; }
/// <summary>
/// if (version==0)
/// </summary>
public uint FirstOffset { get; set; }
public ushort Reserved { get; set; }
public ushort ReferenceCount { get; set; }

public List<SegmentIndex> SegmentIndexs { get; set; }

public class SegmentIndex
{
/// <summary>
/// 4byte 32 - 1
/// </summary>
public bool ReferenceType { get; set; }
/// <summary>
/// 4byte 32 - 31
/// </summary>
public uint ReferencedSize { get; set; }
public uint SubsegmentDuration { get; set; }
/// <summary>
/// 4byte 32 - 1
/// </summary>
public bool StartsWithSAP { get; set; }
/// <summary>
/// 4byte 32 - 3
/// </summary>
public byte SAPType { get; set; }
/// <summary>
/// 4byte 32 - 28
/// </summary>
public uint SAPDeltaTime { get; set; }
}
}
}

+ 23
- 0
src/JT1078.FMp4/Boxs/ShadowSyncSampleBox.cs View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class ShadowSyncSampleBox : FullBox
{
public ShadowSyncSampleBox(byte version, uint flags) : base("stsh", version, flags)
{
}

public uint EntryCount { get; set; }

public List<ShadowSyncSampleInfo> ShadowSyncSampleInfos { get; set; }

public class ShadowSyncSampleInfo
{
public uint ShadowedSampleNumber { get; set; }
public uint SyncSampleNumber { get; set; }
}
}
}

+ 13
- 0
src/JT1078.FMp4/Boxs/SkipBox.cs View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class SkipBox : FreeSpaceBox
{
public SkipBox() : base("skip")
{
}
}
}

+ 16
- 0
src/JT1078.FMp4/Boxs/SoundMediaHeaderBox.cs View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class SoundMediaHeaderBox : FullBox
{
public SoundMediaHeaderBox(byte version=0, uint flags=0) : base("smhd", version, flags)
{
}

public ushort Balance { get; set; }
public ushort Reserved { get; set; }
}
}

+ 28
- 0
src/JT1078.FMp4/Boxs/StereoVideoBox.cs View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class StereoVideoBox : FullBox
{
public StereoVideoBox(byte version=0, uint flags=0) : base("stvi", version, flags)
{
}
/// <summary>
///4btye 32 - 30
/// </summary>
public uint Reserved { get; set; }
/// <summary>
///4btye 32 - 2
/// </summary>
public byte SingleViewAllowed { get; set; }
public uint StereoScheme { get; set; }
public uint Length { get; set; }
/// <summary>
/// length:Length
/// </summary>
public byte[] StereoIndicationType { get; set; }
public List<Mp4Box> AnyBox { get; set; }
}
}

+ 37
- 0
src/JT1078.FMp4/Boxs/SubSampleInformationBox.cs View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class SubSampleInformationBox : FullBox
{
public SubSampleInformationBox(byte version, uint flags=0) : base("subs", version, flags)
{
}

public uint EntryCount { get; set; }

public List<SubSampleInformation> SubSampleInformations { get; set; }

public class SubSampleInformation
{
public uint SampleDelta { get; set; }
public ushort SubsampleCount { get; set; }

public List<InnerSubSampleInformation> InnerSubSampleInformations { get; set; }

public class InnerSubSampleInformation
{
/// <summary>
/// version == 1
/// </summary>
public uint SubsampleSizeLarge { get; set; }
public ushort SubsampleSize { get; set; }
public byte SubsamplePriority { get; set; }
public byte Discardable { get; set; }
public uint Reserved { get; set; }
}
}
}
}

+ 13
- 0
src/JT1078.FMp4/Boxs/SubTrackBox.cs View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class SubTrackBox : Mp4Box
{
public SubTrackBox() : base("strk")
{
}
}
}

+ 13
- 0
src/JT1078.FMp4/Boxs/SubTrackDefinitionBox.cs View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class SubTrackDefinitionBox : Mp4Box
{
public SubTrackDefinitionBox() : base("strd")
{
}
}
}

+ 18
- 0
src/JT1078.FMp4/Boxs/SubTrackInformationBox.cs View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class SubTrackInformationBox : FullBox
{
public SubTrackInformationBox(byte version=0, uint flags=0) : base("stri", version, flags)
{
}

public ushort SwitchGroup { get; set; }
public ushort AlternateGroup { get; set; }
public uint SubTrackID { get; set; }
public List<uint> AttributeList { get; set; }
}
}

+ 19
- 0
src/JT1078.FMp4/Boxs/SubTrackSampleGroupBox.cs View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class SubTrackSampleGroupBox : FullBox
{
public SubTrackSampleGroupBox(byte version=0, uint flags=0) : base("stsg", version, flags)
{
}
public uint GroupingType { get; set; }
public ushort ItemCount { get; set; }
/// <summary>
/// length:ItemCount
/// </summary>
public List<uint> GroupDescriptionIndex { get; set; }
}
}

+ 40
- 0
src/JT1078.FMp4/Boxs/SubsegmentIndexBox.cs View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class SubsegmentIndexBox : FullBox
{
public SubsegmentIndexBox(byte version = 0, uint flags = 0) : base("ssix", version, flags)
{
}

public uint SubSegmentCount { get; set; }
/// <summary>
/// length:SubSegmentCount
/// </summary>
public List<SubsegmentIndexInfo> SubsegmentIndexInfos { get; set; }

public class SubsegmentIndexInfo
{
public uint RangesCount { get; set; }
/// <summary>
/// length:RangesCount
/// </summary>
public List<SubsegmentRangeInfo> SubsegmentRangeInfos { get; set; }

public class SubsegmentRangeInfo
{
/// <summary>
/// 32 - 8
/// </summary>
public byte Level { get; set; }
/// <summary>
/// 32 - 4
/// </summary>
public uint RangeSize { get; set; }
}
}
}
}

+ 17
- 0
src/JT1078.FMp4/Boxs/SyncSampleBox.cs View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class SyncSampleBox : FullBox
{
public SyncSampleBox(byte version=0, uint flags=0) : base("stss", version, flags)
{
}

public uint EntryCount { get; set; }

public List<uint> SampleNumber { get; set; }
}
}

+ 24
- 0
src/JT1078.FMp4/Boxs/TimeToSampleBox.cs View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class TimeToSampleBox : FullBox
{
public TimeToSampleBox(byte version = 0, uint flags = 0) : base("stts", version, flags)
{
}

public uint EntryCount{get;set;}

public List<TimeToSampleInfo> TimeToSampleInfos { get; set; }

public class TimeToSampleInfo
{
public uint SampleCount { get; set; }

public uint SampleDelta { get; set; }
}
}
}

+ 17
- 0
src/JT1078.FMp4/Boxs/TrackBox.cs View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class TrackBox : Mp4Box
{
public TrackBox() : base("trak")
{
}
public TrackHeaderBox TrackHeaderBox { get; set; }
public TrackReferenceBox TrackReferenceBox { get; set; }
public EditBox EditBox { get; set; }
public MediaBox MediaBox { get; set; }
}
}

+ 19
- 0
src/JT1078.FMp4/Boxs/TrackExtendsBox.cs View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class TrackExtendsBox : FullBox
{
public TrackExtendsBox(byte version=0, uint flags=0) : base("trex", version, flags)
{
}

public uint TrackID { get; set; }
public uint DefaultSampleDescriptionIndex { get; set; }
public uint DefaultSampleDuration { get; set; }
public uint DefaultSampleSize { get; set; }
public uint DefaultSampleFlags { get; set; }
}
}

+ 14
- 0
src/JT1078.FMp4/Boxs/TrackFragmentBaseMediaDecodeTimeBox.cs View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class TrackFragmentBaseMediaDecodeTimeBox : FullBox
{
public TrackFragmentBaseMediaDecodeTimeBox(byte version, uint flags=0) : base("tfdt", version, flags)
{
}
public uint BaseMediaDecodeTime { get; set; }
}
}

+ 19
- 0
src/JT1078.FMp4/Boxs/TrackFragmentBox.cs View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class TrackFragmentBox : Mp4Box
{
public TrackFragmentBox() : base("traf")
{
}
public TrackFragmentHeaderBox TrackFragmentHeaderBox { get; set; }
public SampleDependencyTypeBox SampleDependencyTypeBox { get; set; }
public TrackRunBox TrackRunBox { get; set; }
public TrackFragmentBaseMediaDecodeTimeBox TrackFragmentBaseMediaDecodeTimeBox { get; set; }
public SampleToGroupBox SampleToGroupBox { get; set; }
public SubSampleInformationBox SubSampleInformationBox { get; set; }
}
}

+ 26
- 0
src/JT1078.FMp4/Boxs/TrackFragmentHeaderBox.cs View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class TrackFragmentHeaderBox : FullBox
{
public TrackFragmentHeaderBox(byte version, uint flags) : base("tfhd", version, flags)
{
}
public TrackFragmentHeaderBox(uint flags) : this(0, flags)
{
}

public uint TrackID { get; set; }

#region all the following are optional fields
public ulong BaseDataOffset { get; set; }
public uint SampleDescriptionIndex { get; set; }
public uint DefaultSampleDuration { get; set; }
public uint DefaultSampleSize { get; set; }
public uint DefaultSampleFlags { get; set; }
#endregion
}
}

+ 40
- 0
src/JT1078.FMp4/Boxs/TrackFragmentRandomAccessBox.cs View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace JT1078.FMp4
{
public class TrackFragmentRandomAccessBox : FullBox
{
public TrackFragmentRandomAccessBox(byte version, uint flags=0) : base("tfra", version, flags)
{
}
public uint TrackID { get; set; }
/// <summary>
/// 4byte 32-26
/// </summary>
public uint Reserved { get; set; } = 26;
/// <summary>
/// 4byte 32-28
/// </summary>
public uint LengthSizeOfTrafNum { get; set; }
/// <summary>
/// 4byte 32-30
/// </summary>
public uint LengthSizeOfTrunNum { get; set; }
/// <summary>
/// 4byte 32-32
/// </summary>
public uint LengthSizeOfSampleNum { get; set; }
public uint NumberOfEntry { get; set; }
public List<TrackFragmentRandomAccessInfo> TrackFragmentRandomAccessInfos { get; set; }
public class TrackFragmentRandomAccessInfo
{
public ulong Time { get; set; }
public ulong MoofOffset { get; set; }
public uint TrafNumber { get; set; }
public uint TrunNumber { get; set; }
public uint SampleNumber { get; set; }
}
}
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save