When i use marquee fonctions, randomly LibVlic freeze
at libvlc_media_player_stop.
Do i something wrong ? Bad implementation in videolan.interop
? Bug in Libvlc (deadlock?) ?
Platform : windows xp sp3 and windows 7 x64
Wrapper : Modified Videolan.interop from Xilasz
LibVlc : 1.1.5, 1.1.6, 1.1.7
Mofications or reactivation in Videolan.Interop (C#)
Code: Select all
internal static extern int
libvlc_video_get_marquee_int(IntPtr p_mi, [MarshalAs(UnmanagedType.U4)]
libvlc_video_marquee_option_t option);
[DllImport("libvlc",
CallingConvention = CallingConvention.Cdecl)]
internal static extern string
libvlc_video_get_marquee_string(IntPtr p_mi, [MarshalAs(UnmanagedType.U4)]
libvlc_video_marquee_option_t option);
[DllImport("libvlc",
CallingConvention = CallingConvention.Cdecl)]
internal static extern void
libvlc_video_set_marquee_int(IntPtr p_mi, [MarshalAs(UnmanagedType.U4)]
libvlc_video_marquee_option_t option, int i_val);
//[DllImport("libvlc",
CallingConvention = CallingConvention.Cdecl)]
//internal static extern void
libvlc_video_set_marquee_string(IntPtr p_mi, [MarshalAs(UnmanagedType.U4)]
libvlc_video_marquee_option_t option, [MarshalAs(UnmanagedType.LPStr)] string
psz_text);
[DllImport("libvlc",
CallingConvention = CallingConvention.Cdecl)]
internal static extern void
libvlc_video_set_marquee_string(IntPtr p_mi, [MarshalAs(UnmanagedType.U4)]
libvlc_video_marquee_option_t option, [MarshalAs(UnmanagedType.LPArray)] byte[]
psz_value);
Code: Select all
public bool MarqueeEnabled
{
get
{
InteropMethods.CheckException();
return rtn ;
}
set
{
InteropMethods.CheckException();
}
}
public string MarqueeText
{
get
{
InteropMethods.CheckException();
return rtn;
}
set
{
InteropMethods.ClearException();
}
}
public VlcColor MarqueeColor
{
get
{
InteropMethods.CheckException();
return rtn;
}
set
{
InteropMethods.CheckException();
}
}
public Position MarqueePosition
{
get
{
InteropMethods.CheckException();
return rtn;
}
set
{
InteropMethods.CheckException();
}
}
public int MarqueeRefresh
{
get
{
InteropMethods.CheckException();
return rtn;
}
set
{
InteropMethods.CheckException();
}
}
public int MarqueeSize
{
get
{
InteropMethods.CheckException();
return rtn;
}
set
{
InteropMethods.CheckException();
}
}
public int MarqueeTimeout
{
get
{
InteropMethods.CheckException();
return rtn;
}
set
{
InteropMethods.CheckException();
}
}
public int MarqueeX
{
get
{
InteropMethods.CheckException();
return rtn;
}
set
{
InteropMethods.CheckException();
}
}
public int MarqueeY
{
get
{
InteropMethods.CheckException();
return rtn;
}
set
{
InteropMethods.CheckException();
}
}
public int MarqueeOpacity
{
get
{
InteropMethods.CheckException();
return rtn;
}
set
{
InteropMethods.CheckException();
}
}
marquees.
And the code in my program (VB.NET)
Code: Select all
Public Sub AfficheOSDAllerA(ByVal texte As String)
vlcplayer.Video.MarqueeEnabled = False
vlcplayer.Video.MarqueeEnabled = True
vlcplayer.Video.MarqueeColor = VideoLan.VlcColor.Green
vlcplayer.Video.MarqueeTimeout = 3000
vlcplayer.Video.MarqueePosition = VideoLan.Position.TopLeft
vlcplayer.Video.MarqueeOpacity = 250
vlcplayer.Video.MarqueeText = texte
End Sub
Public Sub AfficheOSDVolume(ByVal texte As
String)
vlcplayer.Video.MarqueeEnabled = False
vlcplayer.Video.MarqueeEnabled = True
vlcplayer.Video.MarqueeColor = VideoLan.VlcColor.Yellow
vlcplayer.Video.MarqueeTimeout =
2000
vlcplayer.Video.MarqueePosition = VideoLan.Position.BottomLeft
vlcplayer.Video.MarqueeOpacity = 250
vlcplayer.Video.MarqueeText = texte
End Sub
Private Sub AfficheOSDNomChaine(ByVal texte As
String)
vlcplayer.Video.MarqueeEnabled = False
vlcplayer.Video.MarqueeEnabled = True
vlcplayer.Video.MarqueeColor = VideoLan.VlcColor.White
vlcplayer.Video.MarqueeTimeout = 5000
vlcplayer.Video.MarqueePosition = VideoLan.Position.Bottom
vlcplayer.Video.MarqueeOpacity = 250
vlcplayer.Video.MarqueeText = texte
End Sub
Code: Select all
Public Sub InitVlcPlayer(ByVal HandleVideo As IntPtr)
Dim Render As String = ""
If osversion = 5 Then
Render = "Directx"
ElseIf osversion >= 6 Then
Render = "Direct3d"
End If
vlc = New VideoLanClient(args)
vlcplayer = vlc.NewMediaPlayer()
Handle = HandleVideo
End Sub
Public Sub WatchTV()
vlcplayer.Video.MarqueeEnabled = False
'plante un peu moins
Threading.Thread.Sleep(100) 'plante un peu moins
vlcplayer.Stop()'<-----------------------------------------------------------FREEZE
HERE
Dim Media As VlcMedia = vlc.NewMedia(Location)
'libvlc_media_new_location
If Extension.Count > 0 Then
For t As Integer = 1 To Extension.Count -
1
Media.AddOption(Extension(t)) ' libvlc_media_add_option
Next
End If
If SilentRecording Then
Else
If Desentrelacement <> Deinterlace.Off
Then
Media.AddOption("vout-filter=deinterlace")
End If
If Recording And Not (RecordFileName.Equals(""))
Then
End If
End If
vlcplayer.Load(Media) 'libvlc_media_player_set_media
vlcplayer.Play(Handle) 'libvlc_media_player_set_hwnd
, libvlc_media_player_play
'Boucle d'attente
Dim timeout As Integer = 0
Do Until (vlcplayer.State
= VideoLan.VlcState.Playing) Or (timeout > 150)
Threading.Thread.Sleep(50)
'Trace.Write("timeout=" & timeout.ToString
& Environment.NewLine)
timeout += 1
Loop
Threading.Thread.Sleep(200) 'encore un peu d'attente
If vlcplayer.State = VideoLan.VlcState.Playing
Then
Threading.Thread.Sleep(500) ' et
encore un peu d'attente
AfficheOSDNomChaine(title)
End If
End Sub
The code for vlcplayer.Stop() (videolan.interop)
Code: Select all
public void Stop()
{
InteropMethods.CheckException();
InteropMethods.CheckException();
}
And the sequence :
-a video is playing
-the user entering the channel(number) he
want to see
-display with AfficheOSDAllerA(ByVal texte
As String)
-after 3 second,the data (location,extension
and title) are extract from database and the channel is viewing with WatchTV(),
-WatchTV() call AfficheOSDNomChaine(ByVal
texte As String) to display the title of the channel
Fixed. See : viewtopic.php?f=32&t=87932