Hi all,
I'm tring to develop a SW that extracts single bmp frames from a video file encoded with 3ivx codec. I must use vfw interfaces...
First of all I'have installed 3ivx decoder (3ivx_MPEG-4_504) and check that with "mediaplayer classic" video is played correctly. Im'm working on win8.1 64bit machine - Vs2010 c++.
Then if I run my SW (w32 app) with "Administrator Privileges" or in "compatibility mode" works; otherwise, if run it with normal privileges and with no compatibility function, "AVIStreamGetFrameOpen" always returns NULL.
Searching on the web i found a lot of possible configuration, almost all of them works correctly with compatibilty mode but not without.
If I run the SW in WIN_XP everything works.
Follows an extract of the source code:
PGETFRAME m_pFrame;
PAVIFILE m_Avi;
PAVISTREAM m_pStream;
bool m_bAviLibInitialized;
bool m_bAviFileOpened;
unsigned int m_nSize;
AVIFileInit();
int res=AVIFileOpen(&m_Avi, szFileName, OF_READ, NULL);
AVIFILEINFO avi_info;
AVIFileInfo(m_Avi, &avi_info, sizeof(AVIFILEINFO));
res=AVIFileGetStream(m_Avi, &m_pStream, streamtypeVIDEO ,
0 );
int iNumFrames;
int iFirstFrame;
iFirstFrame=AVIStreamStart(m_pStream);
if (iFirstFrame==-1)
{
if (m_pStream!=NULL)
AVIStreamRelease(m_pStream);
AVIFileExit();
return FALSE;
}
iNumFrames=AVIStreamLength(m_pStream);
if (iNumFrames==-1)
{
if (m_pStream!=NULL)
AVIStreamRelease(m_pStream);
AVIFileExit();
return FALSE;
}
BITMAPINFOHEADER bih;
ZeroMemory(&bih, sizeof(BITMAPINFOHEADER));
bih.biBitCount=24; bih.biClrImportant=0;
bih.biClrUsed = 0;
bih.biCompression = BI_RGB;
bih.biPlanes = 1;
bih.biSize = 40;
bih.biXPelsPerMeter = 0;
bih.biYPelsPerMeter = 0;
bih.biSizeImage = (((bih.biWidth * 3) + 3) & 0xFFFC) * bih.biHeight;
AVIStreamStart(m_pStream);
m_pFrame=AVIStreamGetFrameOpen(m_pStream, &bih);
if (m_pFrame == NULL)
{
AfxMessageBox(_T("Unable to Open Video File"),MB_ICONERROR | MB_OK);
}
I also try to call AVIStreamGetFrameOpen with following parameters:
m_pFrame=AVIStreamGetFrameOpen(m_pStream, NULL);
m_pFrame=AVIStreamGetFrameOpen(m_pStream, (BITMAPINFOHEADER*) AVIGETFRAMEF_BESTDISPLAYFMT);
Thanks in advance for any suggestion!