Ejemplo n.º 1
0
        // assumption: this can ONLY be called when we know the next box is a fragment...
        private void ScanForAudioOrVideo()
        {
            long pos = boxReader.BaseStream.Position;
              do
              {
            long fragPos = boxReader.BaseStream.Position;
            Fragment frag = new Fragment();

            int trakID = (int)frag.GetMP4TrackID(boxReader);
            if (GetFragmentHandlerType(trakID) == _handlerType)
            {
              if (_handlerType.Equals("soun"))
              {
            nextAudioFragPosition = fragPos;
            audioTrackID = trakID;
              }
              else if (_handlerType.Equals("vide"))
              {
            nextVideoFragPosition = fragPos;
            videoTrackID = trakID;
              }
              break;
            }
              } while (this.boxReader.PeekNextBoxType() == BoxTypes.MovieFragment);
              boxReader.BaseStream.Position = pos;
              audiovideoScanCompleted = true;
        }
Ejemplo n.º 2
-1
        private Fragment GetNextVideoFrag()
        {
            if (nextVideoFragPosition < 0) return (null); // there are no more!!
              boxReader.BaseStream.Position = nextVideoFragPosition;

              // we know where at least the next frag is as we prepared this prior to the call of this function...
              Fragment answer = new Fragment(GetTimeScale(videoTrackID), GetPayloadType(videoTrackID), runningTimeIn100NanoSecs, runningSliceIndex);
              answer.Read(boxReader);
              runningTimeIn100NanoSecs += (ulong)TimeArithmetic.ConvertToStandardUnit(answer.TimeScale, (decimal)answer.Duration);
              runningSliceIndex += answer.Length;

              nextVideoFragPosition = -1;
              while (this.boxReader.PeekNextBoxType() == BoxTypes.MovieFragment)
              {
            long fragPos = boxReader.BaseStream.Position;
            Fragment tmp = new Fragment();

            int trakID = (int)tmp.GetMP4TrackID(boxReader);
            if (GetFragmentHandlerType(trakID) == "vide")
            {
              nextVideoFragPosition = fragPos;
              break;
            }
              }

              return (answer);
        }