private void EnablePlaybackMenu(bool bEnable, MediaType nMediaType) { // Enable/disable menu items related to playback (pause, stop, mute) menuFilePause.Enabled = bEnable; menuFileStop.Enabled = bEnable; menuFileMute.Enabled = bEnable; menuRateIncrease.Enabled = bEnable; menuRateDecrease.Enabled = bEnable; menuRateNormal.Enabled = bEnable; menuRateHalf.Enabled = bEnable; menuRateDouble.Enabled = bEnable; // Enable/disable menu items related to video size bool isVideo = (nMediaType == MediaType.Video) ? true : false; menuSingleStep.Enabled = isVideo; menuFileSizeHalf.Enabled = isVideo; menuFileSizeDouble.Enabled = isVideo; menuFileSizeNormal.Enabled = isVideo; menuFileSizeThreeQuarter.Enabled = isVideo; menuFileFullScreen.Enabled = isVideo; }
public int OnMediaTypeChanged(int videoRate, int videoFormat, int audioFormat) { Log.Info("BDPlayer OnMediaTypeChanged() - Video: {0}({1} fps), Audio: {2}", StreamTypetoString(videoFormat), VideoRatetoDouble(videoRate), StreamTypetoString(audioFormat)); _mChangedMediaType = MediaType.None; if (videoFormat != _currentVideoFormat) { _mChangedMediaType |= MediaType.Video; _currentVideoFormat = videoFormat; } if (audioFormat != _currentAudioFormat) { _mChangedMediaType |= MediaType.Audio; _currentAudioFormat = audioFormat; } UpdateRefreshRate(videoRate); if (_mChangedMediaType != MediaType.None) { _bMediaTypeChanged = Playing ? true : false; } return _bMediaTypeChanged ? 0 : 1; }
protected void DoGraphRebuild() { if (_mediaCtrl != null) { int hr; try { hr = _mediaCtrl.Stop(); DsError.ThrowExceptionForHR(hr); } catch (Exception error) { Log.Error("BDPlayer: Error stopping graph: {0}", error.Message); MovieEnded(); } // this is a hack for MS Video Decoder and AC3 audio change // would suggest to always do full audio and video rendering for all filters IBaseFilter MSVideoCodec = null; _graphBuilder.FindFilterByName("Microsoft DTV-DVD Video Decoder", out MSVideoCodec); if (MSVideoCodec != null) { _mChangedMediaType = MediaType.Audio | MediaType.Video; DirectShowUtil.ReleaseComObject(MSVideoCodec); MSVideoCodec = null; } // hack end switch (_mChangedMediaType) { case MediaType.Audio: // audio changed Log.Info("BDPlayer: Rerendering audio pin of BDReader filter."); UpdateFilters("Audio"); break; case MediaType.Video: // video changed Log.Info("BDPlayer: Rerendering video pin of BDReader filter."); UpdateFilters("Video"); break; case MediaType.Audio | MediaType.Video: // both changed Log.Info("BDPlayer: Rerendering audio and video pins of BDReader filter."); UpdateFilters("Audio"); UpdateFilters("Video"); break; } if (_mChangedMediaType != MediaType.Audio && VideoChange) { //Release and init Post Process Filter if (PostProcessingEngine.engine != null) PostProcessingEngine.GetInstance().FreePostProcess(); IPostProcessingEngine postengine = PostProcessingEngine.GetInstance(true); if (!postengine.LoadPostProcessing(_graphBuilder)) { PostProcessingEngine.engine = new PostProcessingEngine.DummyEngine(); } } if (_interfaceBDReader != null) { DirectShowUtil.RenderGraphBuilderOutputPins(_graphBuilder, _interfaceBDReader); } DirectShowUtil.RemoveUnusedFiltersFromGraph(_graphBuilder); //remove InternalScriptRenderer as it takes subtitle pin disableISR(); // disable Closed Captions! disableCC(); /*if (_mChangedMediaType == MediaType.Audio) RemoveAudioR();*/ try { hr = _mediaCtrl.Run(); DsError.ThrowExceptionForHR(hr); } catch (Exception error) { Log.Error("BDPlayer: Error starting graph: {0}", error.Message); MovieEnded(); return; } Log.Info("BDPlayer: Reconfigure graph done"); } }
protected void DoGraphRebuild() { if (_mediaCtrl != null) { int hr; try { hr = _mediaCtrl.Stop(); DsError.ThrowExceptionForHR(hr); } catch (Exception error) { Log.Error("BDPlayer: Error stopping graph: {0}", error.Message); MovieEnded(); } // this is a hack for MS Video Decoder and AC3 audio change // would suggest to always do full audio and video rendering for all filters IBaseFilter MSVideoCodec = null; _graphBuilder.FindFilterByName("Microsoft DTV-DVD Video Decoder", out MSVideoCodec); if (MSVideoCodec != null) { _mChangedMediaType = MediaType.Audio | MediaType.Video; DirectShowUtil.ReleaseComObject(MSVideoCodec); MSVideoCodec = null; } // hack end switch (_mChangedMediaType) { case MediaType.Audio: // audio changed Log.Info("BDPlayer: Rerendering audio pin of BDReader filter."); UpdateFilters("Audio"); break; case MediaType.Video: // video changed Log.Info("BDPlayer: Rerendering video pin of BDReader filter."); UpdateFilters("Video"); break; case MediaType.Audio | MediaType.Video: // both changed Log.Info("BDPlayer: Rerendering audio and video pins of BDReader filter."); UpdateFilters("Audio"); UpdateFilters("Video"); break; } DirectShowUtil.RenderUnconnectedOutputPins(_graphBuilder, _interfaceBDReader); DirectShowUtil.RemoveUnusedFiltersFromGraph(_graphBuilder); try { hr = _mediaCtrl.Run(); DsError.ThrowExceptionForHR(hr); } catch (Exception error) { Log.Error("BDPlayer: Error starting graph: {0}", error.Message); MovieEnded(); return; } Log.Info("BDPlayer: Reconfigure graph done"); } }