public override void InitializeForWriting(List<IsochronousTrackInfo> mediaTracksInfo) { foreach (IsochronousTrackInfo trak in mediaTracksInfo) { if (trak.HandlerType.Equals("Video")) { GenericTrackFormat format = new H264Format(); format.Codec = new Codec(CodecTypes.Video); format.Codec.PrivateCodecData = trak.CodecPrivateData; IMediaTrack item = new GenericVideoTrack(format, this); MediaTracks.Add(item); } } base.InitializeForWriting(mediaTracksInfo); }
public RawTrackInfo(GenericAudioTrack audio, GenericVideoTrack video) { AudioTrackInfo = new RawAudioTrackInfo(audio); VideoTrackInfo = new RawVideoTrackInfo(video); }
/// <summary> /// CreateTracksForWriting /// Method for creating tracks given a list of RawBaseTrackInfo. /// </summary> /// <param name="tracksInfo">list of RawBaseTrackInfo</param> private void CreateTracksForWriting(List<IsochronousTrackInfo> tracksInfo) { // We can't just use the input tracksInfo and assign it to our _MediaTracks (that would not work because the types won't match). // The input or source media tracks will normally have different types than our _MediaTracks (although they are derived from the same GenericMediaTrack). foreach (IsochronousTrackInfo rawTrack in tracksInfo) { QBoxTrackFormat trackFormat = new QBoxTrackFormat(rawTrack); trackFormat.WriteFirstQBox(_binaryWriter); switch (rawTrack.HandlerType) { case "Audio": GenericAudioTrack audioTrack = new GenericAudioTrack(trackFormat, this); base.AddTrack(audioTrack); break; case "Video": GenericVideoTrack videoTrack = new GenericVideoTrack(trackFormat, this); base.AddTrack(videoTrack); break; default: throw new Exception("Unknown source handler type"); } } }