Explorar el Código

pts 和dts 算法

tags/v1.1.0
waterliu99 hace 5 años
padre
commit
0eaabfcff9
Se han modificado 2 ficheros con 31 adiciones y 6 borrados
  1. +30
    -1
      src/JT1078.Hls.Test/TS_Package_Test.cs
  2. +1
    -5
      src/JT1078.Hls.Test/TS_SDT_Package_Test.cs

+ 30
- 1
src/JT1078.Hls.Test/TS_Package_Test.cs Ver fichero

@@ -154,6 +154,35 @@ namespace JT1078.Hls.Test
fileStream?.Close();
fileStream?.Dispose();
}
}
}
[Fact]
public void PTSTest()
{
//pts
//31 00 09 08 97

long ptsvalue = 132171;
var str = Convert.ToString(ptsvalue, 2).PadLeft(40, '0');
str = str.Insert(str.Length, "1");
str = str.Insert(str.Length - 16, "1");
str = str.Insert(str.Length - 32, "1");
str = str.Insert(str.Length - 36, "0011");
str = str.Substring(str.Length - 40, 40);
var pts = Convert.ToInt64(str, 2);
}
[Fact]
public void DTSTest1()
{
//dts
//11 00 07 D8 61
long value = 126000;
var str = Convert.ToString(value, 2).PadLeft(40, '0');
str = str.Insert(str.Length, "1");
str = str.Insert(str.Length - 16, "1");
str = str.Insert(str.Length - 32, "1");
str = str.Insert(str.Length - 36, "0001");
str = str.Substring(str.Length - 40, 40);
var dts = Convert.ToInt64(str, 2);
}
}
}

+ 1
- 5
src/JT1078.Hls.Test/TS_SDT_Package_Test.cs Ver fichero

@@ -51,11 +51,7 @@ namespace JT1078.Hls.Test
Assert.Equal("47 40 11 10 00 42 F0 25 00 01 C1 00 00 FF 01 FF 00 01 FC 80 14 48 12 01 06 46 46 6D 70 65 67 09 53 65 72 76 69 63 65 30 31 77 7C 43 CA FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF".Replace(" ", ""), patData);

}

[Fact]
public void Test() {
byte a = 0x01;
var b = (ushort)(a << 15);
}
}
}

Cargando…
Cancelar
Guardar