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 void LoadStreamLists(Player player) { ClearOptionsMenu(); if (player == null) { Logger?.Error("player null, cannot load stream lists"); return; } Logger?.Info($"loading stream lists"); SubtitlesOn = false; foreach (var streamType in new[] { StreamType.Video, StreamType.Audio, StreamType.Subtitle }) { var streamDescriptionsList = new StreamDescriptionsList(streamType, _streams.Count); streamDescriptionsList.Descriptions.AddRange(player.GetStreamsDescription(streamType)); AddSubmenu(streamDescriptionsList, streamType); _streams.Add(streamDescriptionsList); } SetDefaultState(); }