/// <summary> /// /// </summary> public DESAudioPlayer() { // FPS, BPP, Width, Height ds = new DESCombine(25, 24, 10, 10, true, false); // Wire events ds.Completed += new EventHandler(Completed); ds.FileCompleted += new EventHandler(FileCompleted); }
/// <summary> /// This method cuts the given user video to the /// appropriate length by copying the selected part to /// a new temporary file with the new output properties /// </summary> /// <param name="videoExportProperties">The <see cref="VideoExportProperties"/> /// to use during export.</param> private void CreatePartialUserVideo(VideoExportProperties videoExportProperties) { this.newSplash.IsPreviewVisible = false; this.newSplash.Header = "Preparing User Video"; string userVideoFile = this.videoExportProperties.UserVideoProperties.StreamFilename; MediaInfo videoHeader = new MediaInfo(); videoHeader.Open(userVideoFile); bool hasVideo = videoHeader.Get(StreamKind.Video, 0, "ID") != string.Empty; bool hasAudio = videoHeader.Get(StreamKind.Audio, 0, "ID") != string.Empty; videoHeader.Close(); // Init DESCombine with audio and/or video support depending on // what the user video contains. // audio is "", if there is no audio stream this.desCombine = new DESCombine( this.videoExportProperties.OutputVideoProperties.FrameRate, 32, this.videoExportProperties.UserVideoProperties.StreamSize.Width, this.videoExportProperties.UserVideoProperties.StreamSize.Height, hasAudio, hasVideo); if (hasVideo && hasAudio) { this.desCombine.AddAVFile( this.videoExportProperties.UserVideoProperties.StreamFilename, this.videoExportProperties.UserVideoProperties.StreamStartTime * 10000, this.videoExportProperties.UserVideoProperties.StreamEndTime * 10000); } else if (hasVideo) { this.desCombine.AddVideoFile( this.videoExportProperties.UserVideoProperties.StreamFilename, this.videoExportProperties.UserVideoProperties.StreamStartTime * 10000, this.videoExportProperties.UserVideoProperties.StreamEndTime * 10000); } else if (hasAudio) { this.desCombine.AddAudioFile( this.videoExportProperties.UserVideoProperties.StreamFilename, this.videoExportProperties.UserVideoProperties.StreamStartTime * 10000, this.videoExportProperties.UserVideoProperties.StreamEndTime * 10000); } IBaseFilter videoCompressor = null; if (this.videoExportProperties.OutputVideoProperties.VideoCompressor != string.Empty) { // Create the filter for the selected video compressor videoCompressor = DirectShowUtils.CreateFilter( FilterCategory.VideoCompressorCategory, this.videoExportProperties.OutputVideoProperties.VideoCompressor); } IBaseFilter audioCompressor = null; if (this.videoExportProperties.OutputVideoProperties.AudioCompressor != string.Empty) { // Create the filter for the selected video compressor audioCompressor = DirectShowUtils.CreateFilter( FilterCategory.AudioCompressorCategory, this.videoExportProperties.OutputVideoProperties.AudioCompressor); } this.desCombine.RenderToAVI( this.videoExportProperties.UserVideoTempFile, videoCompressor, audioCompressor, null, null); this.desCombine.Completed += new EventHandler(this.desCombine_Completed); this.desCombine.StartRendering(); }