Example #1
0
        protected void CreateTracks <T1, T0, T2>() where T1 : GenericAudioTrack, new() where T0 : GenericVideoTrack, new() where T2 : MP4TrackFormat, new()
        {
            // boolean for calling event MediaTrackLogicalBreak only once
            bool breakCalled       = false;
            GenericMediaTrack trak = null;
            T2 trackFormat;

            foreach (TrackBox trackb in mmb.TrackBoxes)
            {
                trackFormat          = new T2();
                trackFormat.TrackBox = trackb;
                switch (trackb.PayloadType)
                {
                case "samr": // 3gpp audio
                case "wma ":
                case "mp4a":
                    trak          = new T1();
                    Hints.object1 = trackb.EdtsBox;
                    break;

                case "mp4v": // 3gpp video
                case "vc-1":
                case "avc1":
                    trak = new T0();
                    IVideoTrack    vt        = trak as IVideoTrack;
                    MP4TrackFormat mp4format = trackFormat as MP4TrackFormat;
                    vt.IsAnamorphic = mp4format.IsAnamorphic;
                    Hints.object2   = trackb.EdtsBox;
                    break;

                case "mp4s":
                    break; // ignore - in the case of vc-1 and wma, these are processed in ISMVStreamReader

                default:
                    throw new Exception(string.Format("Unknown track type: {0}", trackb.PayloadType));
                }
                if (trak != null)
                {
                    trak.TrackFormat  = trackFormat;
                    trak.ParentStream = this;
                    AddTrack(trak);

                    if (!breakCalled)
                    {
                        TriggerLogicalBreak(trak);
                        breakCalled = true;
                    }
                }
            }
        }
Example #2
0
 public MP4VideoTrack(MP4TrackFormat format, MP4Stream stream)
     : base(format, stream)
 {
 }
Example #3
0
 public MP4VideoTrack(MP4TrackFormat format, MP4Stream stream)
     : base(format, stream)
 {
 }