internal MediaTrack(uint codec, uint originalFourcc, int id, TrackType trackType, int profile, int level, MediaTrackData data, uint bitrate, string?language, string?description) { Codec = codec; OriginalFourcc = originalFourcc; Id = id; TrackType = trackType; Profile = profile; Level = level; Data = data; Bitrate = bitrate; Language = language; Description = description; }
internal MediaTrack(IntPtr mediaTrackPtr) : base(() => Native.LibVLCMediaTrackHold(mediaTrackPtr), Native.LibVLCMediaTrackRelease) { MediaTrackStructure = MarshalUtils.PtrToStructure <MediaTrackStructure>(mediaTrackPtr); AudioTrack audioTrack = default; VideoTrack videoTrack = default; SubtitleTrack subtitleTrack = default; switch (MediaTrackStructure.TrackType) { case TrackType.Audio: audioTrack = MarshalUtils.PtrToStructure <AudioTrack>(MediaTrackStructure.TrackData); break; case TrackType.Video: videoTrack = MarshalUtils.PtrToStructure <VideoTrack>(MediaTrackStructure.TrackData); break; case TrackType.Text: subtitleTrack = MarshalUtils.PtrToStructure <SubtitleTrackStructure>(MediaTrackStructure.TrackData).Build(); break; case TrackType.Unknown: break; } Codec = MediaTrackStructure.Codec; OriginalFourcc = MediaTrackStructure.OriginalFourcc; TrackType = MediaTrackStructure.TrackType; Profile = MediaTrackStructure.Profile; Level = MediaTrackStructure.Level; Data = new MediaTrackData(audioTrack, videoTrack, subtitleTrack); Bitrate = MediaTrackStructure.Bitrate; Language = MediaTrackStructure.Language.FromUtf8(); Description = MediaTrackStructure.Description.FromUtf8(); Id = MediaTrackStructure.StrId.FromUtf8(); if (string.IsNullOrEmpty(Id)) { Id = MediaTrackStructure.Id.ToString(); } Stable = MediaTrackStructure.IdStable; Name = MediaTrackStructure.Name.FromUtf8(); Selected = MediaTrackStructure.Selected; }