问题
We're using VideoLan DotNet for WPF to play DVD movies in our WPF application. Some movies have multiple audio stream. (for example in multiple languages) How can we choose the desired audio stream?
While searching VideoLan's Wiki, I found this:
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int AudioTrack
{
get
{
return this.nativeVlc.GetVlcObjectInt(ObjectType.VLC_OBJECT_INPUT, "audio-es", -1);
}
set
{
this.nativeVlc.SetVlcObjectInt(ObjectType.VLC_OBJECT_INPUT, "audio-es", value);
}
}
But I can't find the same property in the project I'm using (Vlc.DotNet)
So how can I detect how many audio streams exist and choose one?
回答1:
I found out how to do so (mediaPlayer is an instance of VlcControl):
We can count audio streams using mediaPlayer.AudioProperties.TrackCount and select the index using mediaPlayer.AudioProperties.Track.
Now is there any way to get their description? (They usually have a name such as "English")
回答2:
i'm using VLC control in Windows form and my code for work
private void karaokeToolStripMenuItem_Click(object sender, EventArgs e)
{
// MessageBox.Show(axVLCPlugin21.audio.count.ToString(), "audio track");
if (axVLCPlugin21.audio.track == 1)
{
try
{
axVLCPlugin21.audio.track = 2;
}
catch (Exception ex)
{
// show Exception here by messageBox or other
//if there are exceptions, the file has only one track
}
}
else
axVLCPlugin21.audio.track = 1;
}
I hope to help you.
来源:https://stackoverflow.com/questions/24466265/change-audio-stream-in-videolan-dotnet-for-wpf