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);
}
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;
}
What did I miss?? Why doesn't it want to work ?.
Thanks.