private unsafe void UpdatePlaybackControls() { if (_progressBarShown && Player?.State == Common.PlayerState.Playing && (DateTime.Now - _lastKeyPressTime).TotalMilliseconds >= _progressBarFadeout.TotalMilliseconds) { _progressBarShown = false; _options.Hide(); Logger?.Info( $"{(DateTime.Now - _lastKeyPressTime).TotalMilliseconds} ms of inactivity, hiding progress bar."); } fixed(byte *name = ResourceLoader.GetBytes(_resourceLoader.ContentList[_selectedTile].Title)) { DllImports.UpdatePlaybackControls(new DllImports.PlaybackData() { show = _progressBarShown ? 1 : 0, state = (int)ToPlayerState(Player?.State ?? Common.PlayerState.Idle), currentTime = (int)_seekLogic.CurrentPositionUI.TotalMilliseconds, totalTime = (int)_seekLogic.Duration.TotalMilliseconds, text = name, textLen = _resourceLoader.ContentList[_selectedTile].Title.Length, buffering = _bufferingInProgress ? 1 : 0, bufferingPercent = _bufferingProgress, seeking = (_seekLogic.IsSeekInProgress || _seekLogic.IsSeekAccumulationInProgress) ? 1 : 0 }); } }
private unsafe void UpdatePlaybackControls() { if (_seekBufferingInProgress == false && _seekInProgress == false) { _playerTimeCurrentPosition = _player?.CurrentPosition ?? TimeSpan.Zero; } _playerTimeDuration = _player?.Duration ?? TimeSpan.Zero; if (_progressBarShown && _player?.State == PlayerState.Playing && (DateTime.Now - _lastKeyPressTime).TotalMilliseconds >= _progressBarFadeout.TotalMilliseconds) { _progressBarShown = false; _options.Hide(); Logger?.Info( $"{(DateTime.Now - _lastKeyPressTime).TotalMilliseconds} ms of inactivity, hiding progress bar."); } fixed(byte *name = ResourceLoader.GetBytes(_resourceLoader.ContentList[_selectedTile].Title)) { DllImports.UpdatePlaybackControls(new DllImports.PlaybackData() { show = _progressBarShown ? 1 : 0, state = (int)(_player?.State ?? PlayerState.Idle), currentTime = (int)_playerTimeCurrentPosition.TotalMilliseconds, totalTime = (int)_playerTimeDuration.TotalMilliseconds, text = name, textLen = _resourceLoader.ContentList[_selectedTile].Title.Length, buffering = _bufferingInProgress ? 1 : 0, bufferingPercent = _bufferingProgress }); } }
public unsafe int AddMetric(string tag, float minimumValue, float maximumValue, int sampleCount, Func <float> getCurrentValue) { int id; fixed(byte *tagBytes = ResourceLoader.GetBytes(tag)) { id = DllImports.AddGraph(new DllImports.GraphData() { tag = tagBytes, tagLen = tag.Length, minVal = minimumValue, maxVal = maximumValue, valuesCount = sampleCount }); } if (id <= DllImports.FpsGraphId) { return(DllImports.WrongGraphId); } _metrics.Add(new Metric { Id = id, Update = getCurrentValue }); DllImports.SetGraphVisibility(id, _metricsShown ? 1 : 0); return(id); }
private static unsafe void SetMenuFooter() { string footer = $"JuvoPlayer v{typeof(Program).Assembly.GetName().Version.Major}.{typeof(Program).Assembly.GetName().Version.Minor}.{typeof(Program).Assembly.GetName().Version.Build}, OpenGL Native #{DllImports.OpenGLLibVersion():x}, Samsung R&D Poland 2017-{DateTime.Now.Year}"; fixed(byte *f = ResourceLoader.GetBytes(footer)) DllImports.SetFooter(f, footer.Length); }
private unsafe void UpdateSubtitles() { if (Player?.CurrentCueText != null && _options.SubtitlesOn) { fixed(byte *cueText = ResourceLoader.GetBytes(Player.CurrentCueText)) DllImports.ShowSubtitle(0, cueText, Player.CurrentCueText.Length); // 0ms duration - special value just for next frame } }
private unsafe void ShowAlert(string title, string body, string button) { fixed(byte *titleBytes = ResourceLoader.GetBytes(title), bodyBytes = ResourceLoader.GetBytes(body), buttonBytes = ResourceLoader.GetBytes(button)) { DllImports.ShowAlert(new DllImports.AlertData() { title = titleBytes, titleLen = title.Length, body = bodyBytes, bodyLen = body.Length, button = buttonBytes, buttonLen = button.Length }); } _isAlertShown = true; }
private void AddSubmenu(StreamDescriptionsList streamDescriptionsList, StreamType streamType) { fixed(byte *text = ResourceLoader.GetBytes(streamDescriptionsList.StreamType.ToString())) DllImports.AddOption(streamDescriptionsList.Id, text, streamDescriptionsList.StreamType.ToString().Length); for (int id = 0; id < streamDescriptionsList.Descriptions.Count; ++id) { var s = streamDescriptionsList.Descriptions[id]; Logger?.Info($"stream.Description=\"{s.Description}\", stream.Id=\"{s.Id}\", stream.Type=\"{s.StreamType}\", stream.Default=\"{s.Default}\""); if (s.Default) { streamDescriptionsList.Active = id; if (streamType == StreamType.Subtitle) { SubtitlesOn = true; } } fixed(byte *text = ResourceLoader.GetBytes(s.Description)) DllImports.AddSubOption(streamDescriptionsList.Id, id, text, s.Description.Length); } }
public static unsafe void PushLog(string log) { fixed(byte *text = ResourceLoader.GetBytes(log)) DllImports.PushLog(text, log.Length); }