当前位置: 首页>>代码示例>>C#>>正文


C# Slice.Copy方法代码示例

本文整理汇总了C#中Slice.Copy方法的典型用法代码示例。如果您正苦于以下问题:C# Slice.Copy方法的具体用法?C# Slice.Copy怎么用?C# Slice.Copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Slice的用法示例。


在下文中一共展示了Slice.Copy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSample

        public override Slice GetSample(StreamDataBlockInfo SampleInfo)
        {
            Slice ans = new Slice();
              ans.SliceBytes = new byte[SampleInfo.SliceSize];

              //ParentStream.EnterMutex();
              ISMVTrackFormat ismvFormat = TrackFormat as ISMVTrackFormat;
              ismvFormat.boxReader.BaseStream.Position = (long)SampleInfo.StreamOffset; // if this GetSample call follows another one, file should be in position
              ismvFormat.boxReader.BaseStream.Read(ans.SliceBytes, 0, SampleInfo.SliceSize);
              //ParentStream.LeaveMutex();

              ans.Copy(SampleInfo);
              return (ans);
        }
开发者ID:ctapang,项目名称:GPUCyclops,代码行数:14,代码来源:ISMVideoTrack.cs

示例2: GetSample

 public override Slice GetSample(StreamDataBlockInfo SampleInfo)
 {
     Slice ans = new Slice();
       ans.Copy(SampleInfo);
       ans.SliceBytes = new byte[SampleInfo.SliceSize];
       // read H264 payload for display and processing --
       // for display:
       ParentStream.Stream.Position = (long)ans.StreamOffset;
       ParentStream.Stream.Read(ans.SliceBytes, 0, ans.SliceSize);
       // for processing:
       // (hand-off the payload processing to a separate thread so this method
       // can return immediately)
     #if MV_Centerus
       H264Sample sample = new H264Sample(_sps, _pps, ans.SliceSize);
       sample.SampleDoneEvent += CompletionCallback;
       sample.ParseSample(ans.SliceBytes); // async call
       samples.Add(sample);
     #endif
       return (ans);
 }
开发者ID:ctapang,项目名称:GPUCyclops,代码行数:20,代码来源:MP4VideoTrack.cs

示例3: GetSample

        public override Slice GetSample(StreamDataBlockInfo SampleInfo)
        {
            int delimiterLength = 0;
              Slice ans = new Slice();
              ans.Copy(SampleInfo);
              ans.SliceBytes = new byte[SampleInfo.SliceSize];
            #if REMOVE_EXTRA_SPS
              NaluDelimiterBlockInfo blockInfo = SampleInfo as NaluDelimiterBlockInfo;
              if (blockInfo.AccessUnitDelimiter != null)
              {
            delimiterLength = blockInfo.AccessUnitDelimiter.Length + 4; // access unit delimiter length is always 2
            ans.SliceBytes[3] = (byte)(delimiterLength - 4); // assume that SliceBytes[0 to 2] are all zeroes, we only need to set LSB
            blockInfo.AccessUnitDelimiter.CopyTo(ans.SliceBytes, 4);
              }
            #endif
              //ParentStream.Stream.Position = (long)SampleInfo.StreamOffset;

              // remove empty NALUs (length == 0)
              // also remove trailing bytes, if any, from each NALU
              Slice inSlice = SampleInfo as Slice;
              BinaryReader br = new BinaryReader(new MemoryStream(inSlice.SliceBytes));
              //BinaryReader br = new BinaryReader(ParentStream.Stream);
              int totalSize = SampleInfo.SliceSize - delimiterLength;
              int offset = delimiterLength;
              while (totalSize > 4)
              {
            ulong naluLen = QBox.BE32(br.ReadUInt32());
            if (naluLen > 0UL)
            {
              br.BaseStream.Position -= 4;
              int readLen = (int)naluLen + 4;
              br.Read(ans.SliceBytes, offset, readLen);
              offset += readLen;
              totalSize -= readLen;
            }
            else naluLen = 0; // debugging break point
              }
              return (ans);
        }
开发者ID:ctapang,项目名称:GPUCyclops,代码行数:39,代码来源:QBoxVideoTrack.cs

示例4: GetSample

 public override Slice GetSample(StreamDataBlockInfo SampleInfo)
 {
     ADTSDataBlockInfo adtsInfo = (ADTSDataBlockInfo)SampleInfo;
       Slice ans = new Slice();
       ans.Copy(SampleInfo);
     #if ADTS
       if (adtsInfo.PESandADTSHeaders == null) // ADTS header may be absent, in which case we use the normal base.GetSample
       {
     return base.GetSample(SampleInfo);
       }
       int headerCount = adtsInfo.PESandADTSHeaders.Length;
       ans.SliceBytes = new byte[adtsInfo.SliceSize]; // SampleSize has already been incremented by length of PES + ADTS header
       adtsInfo.PESandADTSHeaders.CopyTo(ans.SliceBytes, 0);
       //if (ParentStream.Stream.Position != (long)adtsInfo.StreamOffset)
       //  ParentStream.Stream.Position = (long)adtsInfo.StreamOffset; // this if statement for debugging: just to be able to put a breakpoint here
       BinaryReader reader = new BinaryReader(new MemoryStream(adtsInfo.SliceBytes));
       //ParentStream.Stream.Read(ans.SliceBytes, headerCount, adtsInfo.SliceSize - headerCount);
       reader.Read(ans.SliceBytes, headerCount, adtsInfo.SliceSize - headerCount);
     #else
       ans.SliceBytes = adtsInfo.SliceBytes;
     #endif
       return (ans);
 }
开发者ID:ctapang,项目名称:GPUCyclops,代码行数:23,代码来源:QBoxAudioTrack.cs


注:本文中的Slice.Copy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。