LibVLCSharp Video Callback dont work

This forum is about all development around libVLC.
WorldMaster
New Cone
New Cone
Posts: 5
Joined: 30 Mar 2018 23:02

LibVLCSharp Video Callback dont work

Postby WorldMaster » 24 Sep 2020 22:20

Hello. Help me solve one problem.
I am using VLSSharp. it is necessary to do feedback when rendering each image. My program should process it in its own way and show it to the user.

Code: Select all

// callback declare private readonly ConcurrentDictionary<IntPtr, VideoBuffer> m_VideoBuffers = new ConcurrentDictionary<IntPtr, VideoBuffer>(); private readonly MediaPlayer.LibVLCVideoFormatCb m_VideoFormatCallback = null; private readonly MediaPlayer.LibVLCVideoLockCb m_VideoLockCallback = null; private readonly MediaPlayer.LibVLCVideoUnlockCb m_VideoUnlockCallback = null; private readonly MediaPlayer.LibVLCVideoDisplayCb m_VideoDisplayCallback = null; private readonly MediaPlayer.LibVLCVideoCleanupCb m_VideoCleanupCallback = null; ... public MainWindow() { InitializeComponent(); _libVLC = new LibVLC(); _mediaPlayer = new MediaPlayer(_libVLC); // initializing m_VideoFormatCallback = new MediaPlayer.LibVLCVideoFormatCb(Video_Format); m_VideoLockCallback = new MediaPlayer.LibVLCVideoLockCb(Video_Lock); m_VideoUnlockCallback = new MediaPlayer.LibVLCVideoUnlockCb(Video_Unlock); m_VideoDisplayCallback = new MediaPlayer.LibVLCVideoDisplayCb(Video_Display); m_VideoCleanupCallback = new MediaPlayer.LibVLCVideoCleanupCb(Video_Cleanup); // connect _mediaPlayer.SetVideoFormatCallbacks(m_VideoFormatCallback, m_VideoCleanupCallback); _mediaPlayer.SetVideoCallbacks(m_VideoLockCallback, m_VideoUnlockCallback, m_VideoDisplayCallback); }
Initialization is successful.
When I try to play any video, I hit a breakpoint in the Video_Format function.

Code: Select all

private uint Video_Format(ref IntPtr opaque, IntPtr chroma, ref uint width, ref uint height, ref uint pitches, ref uint lines) { Debug.WriteLine("Video_Format", "MediaPlayer"); VideoBuffer video_buffer; if (m_VideoBuffers.TryGetValue(opaque, out video_buffer)) m_VideoBuffers.TryRemove(opaque, out video_buffer); video_buffer = new VideoBuffer(width, height); m_VideoBuffers.TryAdd(opaque, video_buffer); // https://www.videolan.org/developers/vlc/doc/doxygen/html/fourcc__list_8h_source.html ToFourCC("RV32", chroma); width = video_buffer.Width; height = video_buffer.Height; pitches = video_buffer.Stride; lines = video_buffer.Height; opaque = _mediaPlayer.NativeReference ; return 1; }
But after passing this function, the whole program falls into an error.

Image

What did I miss?? Why doesn't it want to work ?.
Thanks.

mfkl
Developer
Developer
Posts: 739
Joined: 13 Jun 2017 10:41

Re: LibVLCSharp Video Callback dont work

Postby mfkl » 25 Sep 2020 11:59

Hi,

Could you translate the error message in english please?

Also, sharing a minimal but full sample we can run will help.

https://code.videolan.org/mfkl/libvlcsh ... Program.cs

https://github.com/ZeBobo5/Vlc.DotNet/b ... er.cs#L145 (that's vlc.dotnet but APIs are similar).
https://mfkl.github.io

WorldMaster
New Cone
New Cone
Posts: 5
Joined: 30 Mar 2018 23:02

Re: LibVLCSharp Video Callback dont work

Postby WorldMaster » 25 Sep 2020 14:14

Here my project
https://drive.google.com/file/d/1qQRY5g ... sp=sharing



Yes. If the required format is set by force as in the example, it works, but why does the callback not work?
// Set the size and format of the video here.
mediaPlayer.SetVideoFormat("RV32", Width, Height, Pitch);
mediaPlayer.SetVideoCallbacks(Lock, null, Display);


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 27 guests