Beispiel #1
0
        public IMediaTrack this[CodecTypes type, int id] {
            get
            {
                if (MediaTracks.Count == 0)
                {
                    return(null);
                }

                GenericMediaTrack track = null;
                if (id == 0) // get the first track with the given type
                {
                    if (MediaTracks.Any(trk => trk.Codec.CodecType == type))
                    {
                        track = (GenericMediaTrack)MediaTracks.First(trk => trk.Codec.CodecType == type);
                    }
                }
                else // get specific track with the given type and track ID
                {
                    if (MediaTracks.Any(trk => trk.Codec.CodecType == type && trk.TrackID == id))
                    {
                        track = (GenericMediaTrack)MediaTracks.First(trk => trk.Codec.CodecType == type && trk.TrackID == id);
                    }
                }
                return(track);
            }
        }
Beispiel #2
0
 /// <summary>
 /// Copy Constructor
 /// </summary>
 /// <param name="mt"></param>
 public GenericMediaTrack(GenericMediaTrack mt) : this()
 {
     this.TrackID = mt.TrackID;
     this.Codec   = mt.Codec;
     this.SampleStreamLocations = mt.SampleStreamLocations;
     this.ParentStream          = mt.ParentStream;
     //this.TrackDuration = mt.TrackDuration;
 }
Beispiel #3
0
        public virtual void Initialize(GenericMediaTrack cachedTrack)
        {
            track  = cachedTrack;
            format = track.TrackFormat;
            stream = track.ParentStream;

            if (stream.IsForReading)
            {
                track.BlockWithSlice             += new NextBlock(track_BlockWithSlice);
                track.TrackFormat.FetchNextBatch += new LazyRead(GetMoreBoxes);

                if ((writeCache == 0) && (readCache == 0))
                {
                    PrepareSampleInfo(0UL); // fill up the cache with first four blocks
                }
            }
            else
            {
                track.PrepareMediaHeaders += new SlicePutRequest(track_PrepareMediaHeaders);
            }
        }
Beispiel #4
0
 public void PrepareSampleWriting(GenericMediaTrack sourceTrack, ref ulong currMdatOffset)
 {
     base.PrepareSampleWriting(sourceTrack, ref currMdatOffset);
 }