/// <summary> /// Callback when MediaType has changed. /// </summary> /// <param name="mediaType">new MediaType</param> /// <returns>0</returns> public int OnMediaTypeChanged(ChangedMediaType mediaType) { // Graph cannot be rebuilt inside this callback, it would lead to deadlocking when accessing the graphbuilder for rebuild. _graphRebuilder.DoAsynchRebuild(); _changedMediaType = mediaType; return(0); }
public int OnMediaTypeChanged(BluRayAPI.VideoRate videoRate, BluRayAPI.BluRayStreamFormats videoFormat, BluRayAPI.BluRayStreamFormats audioFormat) { BluRayPlayerBuilder.LogInfo("OnMediaTypeChanged() - {0} ({1} fps), {2}", videoFormat, videoRate, audioFormat); bool requireRebuild = false; _changedChangedMediaType = BluRayAPI.ChangedMediaType.None; if (videoFormat != _currentVideoFormat) { if (_currentVideoFormat != BluRayAPI.BluRayStreamFormats.Unknown) { requireRebuild = true; } _changedChangedMediaType |= BluRayAPI.ChangedMediaType.Video; _currentVideoFormat = videoFormat; } if (audioFormat != _currentAudioFormat) { if (_currentAudioFormat != BluRayAPI.BluRayStreamFormats.Unknown) { requireRebuild = true; } _changedChangedMediaType |= BluRayAPI.ChangedMediaType.Audio; _currentAudioFormat = audioFormat; } // Only rebuild the graph when we had a former media type (not on first run!) if (requireRebuild) { _graphRebuilder.DoAsynchRebuild(); } return(_changedChangedMediaType != BluRayAPI.ChangedMediaType.None && requireRebuild ? 0 : 1); }