Video Callback and libswscale_plugin.dll Crash

This forum is about all development around libVLC.
mstevens
New Cone
New Cone
Posts: 3
Joined: 01 Dec 2011 17:08

Video Callback and libswscale_plugin.dll Crash

Postby mstevens » 01 Dec 2011 17:58

I am trying to use libvlc to receive frames in a video processing application.

I have been working from the samples on the wiki. I am able to display a video using the libvlc_media_player_play function. Now I am attempting to uses the call backs so that I can have direct access to the data.

I added three function (lock, unlock and display) which are all void at this time.

Then I call
libvlc_video_set_callbacks(pVlcMediaPlayer, Lock, unlock, display, 0) ;
libvlc_video_set_format(pVlcMediaPlayer, "RV16", VIDEOWIDTH, VIDEOHEIGHT,VIDEOWIDTH*2);
The code in its entirety can be found below.

The applications runs and crashes in with a memory access violation in libswscale_plugin.dll
I am running this on windows using VS2008 and the call stack locks as follows:
libswscale_plugin.dll!6b8ce795()
[Frames below may be incorrect and/or missing, no symbols loaded for libswscale_plugin.dll]
libswscale_plugin.dll!6b8d6f30()
libswscale_plugin.dll!6b8c07ee()
libswscale_plugin.dll!6b8b2a1c()
libvmem_plugin.dll!68a112f3()
libvlccore.dll!6feebdac()
libvout_wrapper_plugin.dll!68a217c2()
libvlccore.dll!6fea637d()
ntdll.dll!774cf965()
KernelBase.dll!753204d6()
libvlccore.dll!6feef86d()
msvcrt.dll!754d1287()
msvcrt.dll!754d1328()
kernel32.dll!75ce339a()
ntdll.dll!774e9ed2()
ntdll.dll!774e9ea5()
Please let me know if there is any other information that would be useful to help solve this issue.

Code: Select all

extern "C" { #include <vlc/vlc.h> } #include <wx/app.h> using namespace std; int VIDEOWIDTH = 100; int VIDEOHEIGHT = 200; extern "C" { //***************************************************************************** //***************************************************************************** static void* Lock(void *data, void **p_pixels) { return NULL; } //***************************************************************************** //***************************************************************************** static void display(void *data, void *id) { } //***************************************************************************** //***************************************************************************** static void unlock(void *data, void *id, void *const *p_pixels) { } } //***************************************************************************** //***************************************************************************** int main() { libvlc_instance_t* pLibVlc; libvlc_media_player_t* pVlcMediaPlayer; libvlc_media_t* pVlcMedia; /* Load the VLC engine */ pLibVlc = libvlc_new(0, NULL); /* Create a new item */ pVlcMedia = libvlc_media_new_path( pLibVlc, "C:\\DataLocal\\Video\\Simpsons.mp4"); /* Create a media player playing environement */ pVlcMediaPlayer = libvlc_media_player_new_from_media(pVlcMedia); /* No need to keep the media now */ libvlc_media_release(pVlcMedia); libvlc_video_set_callbacks( pVlcMediaPlayer, Lock, unlock, display, 0); libvlc_video_set_format( pVlcMediaPlayer, "RV16", VIDEOWIDTH, VIDEOHEIGHT, VIDEOWIDTH*2); /* play the media_player */ libvlc_media_player_play(pVlcMediaPlayer); ::wxMilliSleep(30000); /* Let it play a bit */ /* Stop playing */ libvlc_media_player_stop(pVlcMediaPlayer); /* Free the media_player */ libvlc_media_player_release(pVlcMediaPlayer); libvlc_release(pLibVlc); return 0; }

Rémi Denis-Courmont
Developer
Developer
Posts: 15324
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Video Callback and libswscale_plugin.dll Crash

Postby Rémi Denis-Courmont » 01 Dec 2011 18:36

Lock is not allowed to fail. You must set p_pixels to point to a memory buffer for the picture. If you hit a fatal error allocating memory, then don't start the playback.

What you see is the scaler trying to output the picture to your undefined invalid memory area.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

mstevens
New Cone
New Cone
Posts: 3
Joined: 01 Dec 2011 17:08

Re: Video Callback and libswscale_plugin.dll Crash

Postby mstevens » 04 Dec 2011 00:06

Thank You. That solved the issue.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 6 guests