本文整理汇总了C#中System.IO.MemoryStream.ReadBytesExtend方法的典型用法代码示例。如果您正苦于以下问题:C# System.IO.MemoryStream.ReadBytesExtend方法的具体用法?C# System.IO.MemoryStream.ReadBytesExtend怎么用?C# System.IO.MemoryStream.ReadBytesExtend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.MemoryStream
的用法示例。
在下文中一共展示了System.IO.MemoryStream.ReadBytesExtend方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AnalyzeFileHeader
/// <summary>
/// 分析amf文件头部
/// </summary>
/// <param name="header">文件头字符数组</param>
/// <returns></returns>
public static AmfHeadInfo AnalyzeFileHeader(Byte[] header)
{
try
{
if (header.Length != 76)
return null;
System.IO.MemoryStream ms = new System.IO.MemoryStream(header);
var temp = new AmfHeadInfo
{
Format = AmfTools.Byte2String(ms.ReadBytesExtend(0, 4)),
FileSize = AmfTools.ConvertToInt32(header, 4) + 8,
AudioFlag = AmfTools.SubArray(header, 8, 4),
AudioHeadSize = AmfTools.ConvertToInt32(header, 12),
AudioCodec = new Char4 { Value = AmfTools.Byte2String(ms.ReadBytesExtend(16, 4)) },//AmfTools.SubArray(header,16,4)},
AudioBitRate = AmfTools.ConvertToInt32(header, 20),
ChannelCount = AmfTools.ConvertToInt32(header, 24),
SamplingRate = AmfTools.ConvertToInt32(header, 28),
SamplingTime = AmfTools.ConvertToInt32(header, 32),
AudioFrameCount = AmfTools.ConvertToInt32(header, 36),
VideoFlag = AmfTools.SubArray(header, 40, 4),
VideoHeadSize = AmfTools.ConvertToInt32(header, 44),
VideoCodec = new Char4 { Value = AmfTools.Byte2String(ms.ReadBytesExtend(48, 4)) },//AmfTools.SubArray(header, 48, 4),
Width = AmfTools.ConvertToInt32(header, 52),
Height = AmfTools.ConvertToInt32(header, 56),
VideoFrameRate = AmfTools.ConvertToInt32(header, 60),
VideoFrameCount = AmfTools.ConvertToInt32(header, 64),
DataBlockFlag = AmfTools.SubArray(header, 68, 4),
DataSize = AmfTools.ConvertToInt32(header, 72)
};
ms.Close();
return temp;
}
catch
{
throw;
}
}