//========================================================================== public void libvlc_video_set_callbacks(IntPtr mp, libvlc_video_lock_cb _lock, libvlc_video_unlock_cb unlock, libvlc_video_display_cb display) { VerifyAccess(); m_libvlc_video_set_callbacks(mp, _lock, unlock, display); }
public static extern void libvlc_video_set_callbacks(libvlc_media_player_t mp, libvlc_video_lock_cb lock_calback, libvlc_video_unlock_cb unlock_calback, libvlc_video_display_cb display, IntPtr opaque);
/// <summary> /// Initialize VLC player with path of LibVlc and options. /// </summary> /// <param name="libVlcPath"></param> /// <param name="libVlcOption"></param> public void Initialize(string libVlcPath, params string[] libVlcOption) { if (!ApiManager.IsInitialized) { ApiManager.Initialize(libVlcPath, libVlcOption); } if (VlcMediaPlayer != null) { throw new InvalidOperationException("VlcPlayer is been initialized."); } switch (CreateMode) { case PlayerCreateMode.NewVlcInstance: Vlc = new Vlc(libVlcOption); ApiManager.Vlcs.Add(Vlc); break; case PlayerCreateMode.Default: default: Vlc = ApiManager.DefaultVlc; break; } var player = Vlc.CreateMediaPlayer(); _lockCallback = VideoLockCallback; _unlockCallback = VideoUnlockCallback; _displayCallback = VideoDisplayCallback; _formatCallback = VideoFormatCallback; _cleanupCallback = VideoCleanupCallback; //_audioSetupCallback = AudioFormatSetupCallback; //_audioCleanupCallback = AudioFormatCleanupCallback; //_audioPlayCallback = AudioPlayCallback; //_audioPauseCallback = AudioPauseCallback; //_audioResumeCallback = AudioResumeCallback; //_audioFlushCallback = AudioFlushCallback; //_audioDrainCallback = AudioDrainCallback; //_audioSetVolumeCallback = AudioSetVolumeCallback; _lockCallbackHandle = GCHandle.Alloc(_lockCallback); _unlockCallbackHandle = GCHandle.Alloc(_unlockCallback); _displayCallbackHandle = GCHandle.Alloc(_displayCallback); _formatCallbackHandle = GCHandle.Alloc(_formatCallback); _cleanupCallbackHandle = GCHandle.Alloc(_cleanupCallback); //_audioSetupCallbackHandle = GCHandle.Alloc(_audioSetupCallback); //_audioCleanupCallbackHandle = GCHandle.Alloc(_audioCleanupCallback); //_audioPlayCallbackHandle = GCHandle.Alloc(_audioPlayCallback); //_audioPauseCallbackHandle = GCHandle.Alloc(_audioPauseCallback); //_audioResumeCallbackHandle = GCHandle.Alloc(_audioResumeCallback); //_audioFlushCallbackHandle = GCHandle.Alloc(_audioFlushCallback); //_audioDrainCallbackHandle = GCHandle.Alloc(_audioDrainCallback); //_audioSetVolumeCallbackHandle = GCHandle.Alloc(_audioSetVolumeCallback); if (player == null) { throw new Exception("Vlc media player initialize fail."); } AttachPlayer(player); }