Video Callback and libswscale_plugin.dll Crash
Posted: 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:
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:
Please let me know if there is any other information that would be useful to help solve this issue.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()
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;
}