1

I'm working on a c# dvd player. I'm using libvlcsharp and am able to play video from the disk when specifying the title and chapter. The problem is I need to know a list of titles/chapters that are available to have the user pick from. I've tried using the Media.Parse on it and it shows that it has been parsed, but the track list and other information is empty.

    _mediaPlayer.Media = new Media(_libVLC, new Uri(@"dvd:///e:"));
    await _mediaPlayer.Media.Parse(MediaParseOptions.ParseLocal);
    MessageBox.Show(_mediaPlayer.Media.Tracks.GetLength(0).ToString());

Is there any way to use libvlcsharp to get this information or am I forced to shell out to a command line ffmpeg to retrieve it?

Mike
  • 11
  • 2
  • Can you try with `MediaParseOptions.ParseLocal | MediaParseOptions.ParseNetwork` ? Tracks should be available, I guess, that's the whole point of the Parse API. If that still doesn't work, please file an issue with a repro project – cube45 Aug 28 '22 at 07:05
  • Yeah, it doesn't work. I got impatient and just started coding my own. I'll probably put it on github as a C# library to read dvd information. Thanks! – Mike Aug 29 '22 at 22:09

1 Answers1

0

There are a few properties and method on the mediaplayer that likely provide the info you need. It is not in the media tracks.

/// <summary>
/// Get the description of available titles.
/// </summary>
public TrackDescription[] TitleDescription

/// <summary>
/// Get the full description of available chapters.
/// </summary>
/// <param name="titleIndex">Index of the title to query for chapters (uses current title if set to -1)</param>
/// <returns>Array of chapter descriptions.</returns>
public ChapterDescription[] FullChapterDescriptions(int titleIndex = -1)

/// <summary>
/// Get the description of available chapters for specific title.
/// </summary>
/// <param name="titleIndex">selected title</param>
/// <returns>chapter descriptions</returns>
public TrackDescription[] ChapterDescription(int titleIndex)

The libvlcsharp unit tests have some example usage, if you need.

mfkl
  • 1,914
  • 1
  • 11
  • 21