I am trying to use the "video_take_snapshot" method. It thinly wraps "libvlc_video_take_snapshot". No exception is raised, and a file is created, but the file is always 0 bytes in size and (obviously) does not contain an image.
All the parameters seem correct based on the API docs. I have tried bot explicitly setting the size and allowing the native size to be used (0,0 for width,height) but still nothing.
I have tried pausing first, and a number of other variations but still no luck. BTW I tried this with 0.9.2, 0.9.3, and the current nightly 0.9.4 and still luck.
Anyone know what I might be doing wrong? Has anyone ever gotten this to work?
The two problems mentioned happen to be related.
Firstly, libvlc_media_player.video_set_parent(libvlc_core.Handle, hDT, ex) in my multithreaded version needs to be placed after the play() command, or else I get a deadlock and the interface freezes. I've also had to wrap it in a try/Catch block to handle the exception.
The exception appears to be coming from libvlc, but does not effect binding VLC's output to the window. So, I think there may be a some code that references a null pointer within libvlc, after it has attached the output to a window.
When I get a chance, I'll get the wrapper finished. I have only two portions to do now, libvlc_vlm and libvlc_event. I need to review how the events are managed and the best way to connect to them. In fact, for a basic media player, you can avoid using libvlc_event and lib_vlm. In terms of state info, there are a few commands that will give you some info, anything that I found to be lacking I just created flags for in the interface and kept track of the state that way.Also I see that getting of state is not yet implemented. Is there any other way to get state?
Here is a copy of the latest build, I haven't had a chance to work on this the last few weeks, but I'll get back to it soon:
Marx libvlc Wrapper for 0.9.0 version 0.0.2 (Alpha Release)
http://www.2shared.com/file/3586524/6c4 ... apper.html
I was having the same problem, but i solved it copying every single dll that comes with the 0.9.2 win32 release, to the "bin/Debug" and "bin/Release".
It seems that it is not enough with just the libvlc.dll, libvlccore.dll and the plugins.
Code: Select all
public void AddAndPlay(string fileName, string options)
{
if (working)
return;
this.locca(true);
try
{
IntPtr hDT = this.Handle;
bool forceGC = false;
if (libvlc_media_player != null)
{
libvlc_media_player.Handle.Dispose();
libvlc_media_player = null;
forceGC = true;
}
if (libvlc_media != null)
{
libvlc_media.Handle.Dispose();
libvlc_media = null;
forceGC = true;
}
if (libvlc_core != null)
{
libvlc_core.Handle.Dispose();
libvlc_core = null;
forceGC = true;
}
ArrayList opz = (ArrayList)StandardArgs.Clone();
if (!String.IsNullOrEmpty(options))
{
foreach (string s in options.Split('\n'))
{
opz.Add(s);
}
}
string[] aopz = (string[])opz.ToArray(typeof(string));
libvlc_core = new Marx_libvlc_core(aopz, ref ex);
this.HandleRespose("new Marx_libvlc_core");
libvlc_media = new Marx_libvlc_media(libvlc_core.Handle, fileName, ref ex);
this.HandleRespose("new Marx_libvlc_media");
libvlc_media_player = new Marx_libvlc_media_player(libvlc_media.Handle, ref ex);
this.HandleRespose("new Marx_libvlc_media_player");
if (libvlc_media != null)
{
//Dispose of media Handle and force garbage collection
libvlc_media.Handle.Dispose();
libvlc_media = null;
forceGC = true;
}
if (forceGC)
{
GC.Collect();
GC.WaitForPendingFinalizers();
}
#if DEPRECATED
libvlc_media_player.play(ref ex);
this.HandleRespose("libvlc_media_player.play");
libvlc_media_player.video_set_parent(libvlc_core.Handle, hDT, ref ex);
// questa torna sempre un errore, per ora
exClass.clear(ref ex);
#else
libvlc_media_player.set_drawable(hDT, ref ex);
libvlc_media_player.play(ref ex);
this.HandleRespose("libvlc_media_player.set_drawable");
#endif
}
catch (Exception excp)
{
this.HandleResposeNET("AddAndPlay", excp);
}
finally
{
this.locca(false);
}
}
Code: Select all
public void stop(ref libvlc_exception_struct ex)
{
Thread.BeginThreadAffinity();
Thread.BeginCriticalRegion();
libvlc_media_player_stop(libvlc_media_player_handle, ref ex);
Thread.EndCriticalRegion();
Thread.EndThreadAffinity();
}
Code: Select all
Private _StopDone As Threading.ManualResetEvent
Private ex_g As libvlc_exception_struct
Public Sub [stop](ByRef ex As libvlc_exception_struct)
Dim t As New Threading.Thread(AddressOf _StopThread)
_StopDone = New Threading.ManualResetEvent(False)
ex_g = ex
t.Start()
If Not _StopDone.WaitOne(3000, False) Then System.Diagnostics.Debug.WriteLine("Media_Player_Stop: TIMEOUT")
End Sub
Private Sub _StopThread()
Dim ex As libvlc_exception_struct = ex_g
libvlc_media_player_stop(libvlc_media_player_handle, ex)
_StopDone.Set()
End Sub
Code: Select all
Private _ReleaseDone As Threading.ManualResetEvent
Protected Overrides Function ReleaseHandle() As Boolean
If (Not IsInvalid) Then
_ReleaseDone = New Threading.ManualResetEvent(False)
Dim t As New Threading.Thread(AddressOf _ReleaseThread)
t.Start()
If Not _ReleaseDone.WaitOne(3000, False) Then System.Diagnostics.Debug.WriteLine(Now & " Marx_libvlc_media_player_handle TIMEOUT")
handle = IntPtr.Zero
End If
Return True
End Function
Private Sub _ReleaseThread()
Try
libvlc_media_player_release(Me)
Catch
System.Diagnostics.Debug.WriteLine(Now & " Marx_libvlc_media_player_handle FAIL")
End Try
_ReleaseDone.Set()
End Sub
All I want to do is get a ibvlc_MediaPlayerEndReachedI've spent the last few days building a C# wrapper to the new API. Anything that has been depreciated has been removed. So far, I've implemented most of the API and I'm able to play media files and attach the process to a
The following are yet to be implemented. If I get some time this weekend, I should get the bulk of it done.
libvlc_event
I made a rubbish work-around:All I want to do is get a ibvlc_MediaPlayerEndReached
Code: Select all
//declare timer
timer = new Timer();
timer.Interval = 500;
timer.Tick += new EventHandler(TimerOnTick);
timer.Enabled = true;
//do something when ended
void TimerOnTick(object obj, EventArgs ea)
{
Console.WriteLine("Media position : " + Math.Ceiling(libvlc_media_player.get_position(ref ex)*100) + "%");
if (Math.Ceiling(libvlc_media_player.get_position(ref ex) * 100) > 99)
{
//do something useful
}
}
I made a rubbish work-around:All I want to do is get a ibvlc_MediaPlayerEndReached
Are there any fully functional alternatives, such as (although I haven't tested them):Code: Select all
//declare timer timer = new Timer(); timer.Interval = 500; timer.Tick += new EventHandler(TimerOnTick); timer.Enabled = true; //do something when ended void TimerOnTick(object obj, EventArgs ea) { Console.WriteLine("Media position : " + Math.Ceiling(libvlc_media_player.get_position(ref ex)*100) + "%"); if (Math.Ceiling(libvlc_media_player.get_position(ref ex) * 100) > 99) { //do something useful } }
C#
http://meedios.svn.sourceforge.net/view ... Auxiliary/
Java:
http://mailman.videolan.org/pipermail/v ... 46719.html
Code: Select all
private VideoLan.VideoLanClient vlc;
private VideoLan.VlcMediaPlayer video;
//init stuff:
vlc = new VideoLan.VideoLanClient(@"C:\Program Files\VideoLAN\VLC");
owner = yourcontrol; // (I used a picturebox)
video = vlc.NewMediaPlayer(owner.Handle);
//play a file:
VideoLan.VlcMedia desc = vlc.NewMedia(aFile);
video.Load(desc);
desc.Dispose();
//cleanup when you are done playing the video:
video.Dispose();
vlc.Dispose();
arogan, I'm glad you like the MeediOS wrapper. I wrote it to fit my needs, that's why I never got around to support the MediaList or vlm stuff. Unfortunately, the functionality your looking for no longer exists in libvlc. If you look at my source code you will see the '__var_Set' stuff is all there inside the VlcObject class under the folder obsolete. If you try to call any of those functions you will get an error saying 'the entry point could not be found'. I too miss those function because now there is no way to do on the fly adjustments of the basic filter settings like brightness, contrast, hue, gamma, and saturation.I tried the meedios one and it worked fine. I'm having trouble finding some missing functionality. Specifically, I'm looking for the setVariable functions of old so I can send the hotkey presses to vlc (I used it for dvd navigation and other things).
basically I'm looking for something equivalent to:
enmErr = VLC_VariableSet(m_iVlcHandle, "key-pressed", valKey);
[DllImport("libvlc")]
static extern VlcError __var_Set(IntPtr p_vlc, String name, vlc_value_t value);
static extern Error VLC_VariableSet(int iVLC, string Name, vlc_value_t value);
LOL, I had just found your little \obsolete folder and hooked it all in getting all excited and boom got the 'the entry point could not be found'. Doh! Oh well. Thanks Karios for all the hard work. It was an incredibly clean and easy to follow/use wrapper. I will miss __var_set. I was using it to do all sorts of things like toggle audio tracks, cycle deinterlacing modes, aspect ratios, dvd menu navigation (arrow keys, enter), cycle subtitles, etc. Some things I see you can sort of duplicate through libvlc_audio and libvlc_video but not every thing. I don't see a way to set deinterlacing mode on the fly. Anyways, if anybody has any ideas how to duplicate some of the functionality I listed in this post 0.9.0 world please share.arogan, I'm glad you like the MeediOS wrapper. I wrote it to fit my needs, that's why I never got around to support the MediaList or vlm stuff. Unfortunately, the functionality your looking for no longer exists in libvlc. If you look at my source code you will see the '__var_Set' stuff is all there inside the VlcObject class under the folder obsolete. If you try to call any of those functions you will get an error saying 'the entry point could not be found'. I too miss those function because now there is no way to do on the fly adjustments of the basic filter settings like brightness, contrast, hue, gamma, and saturation.I tried the meedios one and it worked fine. I'm having trouble finding some missing functionality. Specifically, I'm looking for the setVariable functions of old so I can send the hotkey presses to vlc (I used it for dvd navigation and other things).
basically I'm looking for something equivalent to:
enmErr = VLC_VariableSet(m_iVlcHandle, "key-pressed", valKey);
[DllImport("libvlc")]
static extern VlcError __var_Set(IntPtr p_vlc, String name, vlc_value_t value);
static extern Error VLC_VariableSet(int iVLC, string Name, vlc_value_t value);
Return to “Development around libVLC”
Users browsing this forum: No registered users and 27 guests