Getting vlc to render in wpf is my primary goal. The project I work on, MeediOS, is 99% WPF. The 1% is a WinFormsHost with a panel that we use to render vlc on.Kairos
Thank you for sharing your interop with us. Maybe you can start a new thread so that anyone can focus on developing or enhancing your interop. By the way, did you get to render vlc in wpf(i mean, full wpf features support)?
Thanks. Im gonna download it and test it.
No reason.I tried VideoLanPlayer.UI. Is there any particular reason that you choose panel as the video container? just curious.
Yes I have. Personally I'm not a big fan of just outputting the vlc pixelbuffer to the screen. The VLC Element (posted elsewhere on the forums) replaces the VLC vout module losing all the color space conversions and Direct3D goodies that make the picture look good.
It seemed to be one problem after another trying to compile vlc on windows. I finally gave up and decided to cross compile from Ubuntu. Worked like a charm on the first try.i believe you are not the only one who have troubles compiling vlc for windows. i too have trouble compiling videolan for windows.
short on windows devs! I can't imagine why. Anyway, I was planning on making the changes myself since I need wpf rendering ASAP. I've already been able to add my new module 'libd3dimage_plugin' to the tree and get it to compile. For the time being I'm just going to alter the new module and leave libvlc alone. I'll add hooks into the module that I can use to call into directly from the interop assembly. All in all, now that I can compile my module, its starting to look like wpf rendering may be possible.since, videolan team is short in windows developers, modifying direct3d vout module would be very hard.
Compiling VLC is a pain, I know... My knowledge of Direct3D is near to 0, so well, I can't say.Kairos
i believe you are not the only one who have troubles compiling vlc for windows. i too have trouble compiling videolan for windows. and since, videolan team is short in windows developers, modifying direct3d vout module would be very hard. but the result if successful, is awesome. but maybe you can forward the idea to the windows developers of videolan hoping that they consider it future release.
what do you think j-b?
thanks.
Code: Select all
public Form1()
{
InitializeComponent();
videoLanClient = new VideoLanClient();
vlcMediaPlayer = videoLanClient.NewMediaPlayer(pnlVideo.Handle);
vlcMediaPlayer.StateChanged += new EventHandler<StateChangedEventArgs>(vlcMediaPlayer_StateChanged);
}
void vlcMediaPlayer_StateChanged(object sender, StateChangedEventArgs e)
{
if (vlcMediaPlayer.State == VlcState.Playing)
{
trackBar.Maximum = (int)vlcMediaPlayer.Length;
}
}
Code: Select all
_Vlc = new VideoLanClient();
_player = _Vlc.NewMediaPlayer(VideoPanel.Handle);
_player.TimeChanged += new EventHandler<TimeChangedEventArgs>(_player_TimeChanged);
_player.StateChanged += new EventHandler<StateChangedEventArgs>(_player_StateChanged);
...
private void _player_TimeChanged(object sender, TimeChangedEventArgs e)
{
//tArg and tProp should be the same value but they are not. use tProp for now
long tArg = e.Time;
long tProp = _player.Time;
}
private void _player_StateChanged(object sender, StateChangedEventArgs e)
{
switch (e.NewState)
{
case VlcState.Ended:
//The file ended play the next one
break;
case VlcState.Error:
//Handle playing error
break;
case VlcState.Buffering:
//Notify system is buffering
break;
}
}
Yes, the event is executing in the vlc thread, not your applications thread. WinForms UI elements cannot be directly accessed from another thread. You have to use Invoke or BeginInvoke in your code. Here is some background info for you on threading and winforms.this is the snippet of my code. im trying to set the trackbar to the length of the media. error that i get was "Cross-thread operation not valid: Control 'trackBar' accessed from a thread other than the thread it was created on." can someone shed a light on this.
by the way, where can i find example on how to use the events in videolan.interop.
thanks.
Code: Select all
void vlcMediaPlayer_StateChanged(object sender, StateChangedEventArgs e)
{
if (InvokeRequired == true)
Invoke(new EventHandler<StateChangedEventArgs>(vlcMediaPlayer_StateChanged), sender, e);
else
{
if (vlcMediaPlayer.State == VlcState.Playing)
{
trackBar.Maximum = (int)vlcMediaPlayer.Length;
}
}
}
The process quits fine. I do not see anything left over. Dispose() gets called on the VideoLan-Object before the app quits. I am also able to reproduce the behaviour with the example app from the meedios repository. I am using the latest VLC 0.9.4, but 0.9.2 is giving the same results. The only way to do a "one time reset" is to run the main VLC application, start playback of any file and the use an app with your interop.Sounds like vlc may not be getting released properly when the application exits. When you close the program does it show the process as still running in the task manager? If that is the case you can try to manually call the Dispose() method on your VideoLanClient object when you close your application.
I'm really not sure what the problem is because I can't reproduce it at all. Do you have VLC installed or are you just using the zipped up binaries? Are you just pointing your app at the vlc install or are you copying all the vlc binaries over to your application?The process quits fine. I do not see anything left over. Dispose() gets called on the VideoLan-Object before the app quits. I am also able to reproduce the behaviour with the example app from the meedios repository. I am using the latest VLC 0.9.4, but 0.9.2 is giving the same results. The only way to do a "one time reset" is to run the main VLC application, start playback of any file and the use an app with your interop.Sounds like vlc may not be getting released properly when the application exits. When you close the program does it show the process as still running in the task manager? If that is the case you can try to manually call the Dispose() method on your VideoLanClient object when you close your application.
I have the latest VLC release installed and read the installation dir from the registry. I then pass this path as argument to the constructor.I'm really not sure what the problem is because I can't reproduce it at all. Do you have VLC installed or are you just using the zipped up binaries? Are you just pointing your app at the vlc install or are you copying all the vlc binaries over to your application?
I did investigate on the issue a little further. When I copy the dlls over to my app, it works just fine. The issue does not come up and videos are played each and every time I start the app. On the other hand, when I point the app to a vlc install the error comes up. Maybe this might help you to track down the bug.I'm really not sure what the problem is because I can't reproduce it at all. Do you have VLC installed or are you just using the zipped up binaries? Are you just pointing your app at the vlc install or are you copying all the vlc binaries over to your application?
Code: Select all
if ( position < mediaTrackBar.Maximum || position > mediaTrackBar.Minimum)
Code: Select all
if ( position < mediaTrackBar.Maximum && position > mediaTrackBar.Minimum)
Code: Select all
// mono/linux Constuructor
public VideoLanClient(string[] args)
{
//Initalize our exception pointer
p_exception = new libvlc_exception_t();
p_exception.Initalize();
//create out vlc instance
this.p_instance = InteropMethods.libvlc_new(args.Length, args, ref p_exception);
p_exception.CheckException();
}
Return to “Development around libVLC”
Users browsing this forum: No registered users and 0 guests