Hello everyone,
I wrote a small demo with libvlc API, it randomly crashes for the "Unhandled exception in MyDemo.exe(libfreetype_pludgin.dll)0x0000005:Access voilation" error.
***programming environment: Visual Studio 2005 on Windows OS
***programming language: c++
***detailed call stack information:
=>libfreetype_pludgin.dll!04436d41() // last call stack where error occur
ntdll.dll!7c93005d()
msvcrt.dll!77bfc2de()
libfreetype_pludgin.dll!04437758()
libfreetype_pludgin.dll!04428872()
msvcrt.dll!77bfc2de()
ntdll.dll!7c90035d()
msvcrt.dll!77bfc2de()
libvlccore.dll!6a5c0515()
libvlccore.dll!6a5e16eb()
libvlccore.dll!6a59ddec()
...
relevant code:
int CPlayer::InitInstance(void )
{
const char * const vlc_args[] = {
"--ignore-config",
"--no-osd",
};
m_pVlcInstance = libvlc_new (sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args);
if (NULL == m_pVlcInstance)
return PLAYER_ERROR;
m_pMediaPlayer = libvlc_media_player_new(m_pVlcInstance);
if (NULL == m_pMediaPlayer)
return PLAYER_ERROR;
return 0;
}
size_t CPlayer::PlayFile(char *pstrFilePath)
{
if (NULL == pstrFilePath)
return PLAYER_ERROR
if (_access(pstrFilePath, 0x00) == -1)
return PLAYER_ERROR;
libvlc_media_t *pMedia = libvlc_media_new_path(m_pVlcInstance, pstrFilePath);
libvlc_media_add_option(pMedia, m_strMediaOption.c_str());
libvlc_media_player_set_media(m_pMediaPlayer, pMedia);
libvlc_media_player_play(m_pMediaPlayer);
}
In my project, 2 CPlayer object was created, and display different video on dialogs.
I've been puzzled by this for weeks now, has anybody met the same problem? I've checked the libfreetype_pldgin.dll file for times, it was copied out directly from the VLC SDK, there shouldn't be any problem on the dll file.
by the way, if someone can offer a stable C++ demo that I can learn from, I'll be really appreciate..