Click here to Skip to main content
16,016,500 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionDVD burning API for XP Pin
Anorexic Tribble23-May-07 13:04
Anorexic Tribble23-May-07 13:04 
AnswerRe: DVD burning API for XP Pin
Hamid_RT23-May-07 19:03
Hamid_RT23-May-07 19:03 
QuestionC++ too many initializer? Pin
C_Zealot23-May-07 12:46
C_Zealot23-May-07 12:46 
QuestionRe: C++ too many initializer? Pin
Mark Salsbery23-May-07 13:25
Mark Salsbery23-May-07 13:25 
AnswerRe: C++ too many initializer? Pin
C_Zealot23-May-07 13:27
C_Zealot23-May-07 13:27 
QuestionDivx.dll Access Violation Pin
Skywalker200823-May-07 11:48
Skywalker200823-May-07 11:48 
AnswerRe: Divx.dll Access Violation Pin
Mark Salsbery23-May-07 12:01
Mark Salsbery23-May-07 12:01 
GeneralRe: Divx.dll Access Violation Pin
Skywalker200824-May-07 4:29
Skywalker200824-May-07 4:29 
Yes. The exception was possibly handled in the dll. I got the same violation in the AVIStreamSetFormat() but it returned AVIERR_OK. The real problem is the AVIStreamWrite(), which returned AVIERR_BADFORMAT.

The code is pasted. This problem happens for Divx 6.6.1 Codec. it works fine for others like Huffyuv. Any thought?

Thanks a lot,


--------Code sample--------



int CVideoWriter::SaveAviFrame(HWND *phFrameWnd, HBITMAP *phBitmap)
{

AVISTREAMINFO sAviStreamInfo;
HRESULT hResult;
DIBSECTION sDibSection;
int iSizeDIBSection;

AVICOMPRESSOPTIONS m_opts;
AVICOMPRESSOPTIONS *m_aopts[1];

iSizeDIBSection = GetObject((*phBitmap),sizeof(sDibSection),&sDibSection);
if (iSizeDIBSection != sizeof(DIBSECTION))
return OPERATION_ERROR;

if (m_pStream == NULL)
{
ZeroMemory(&sAviStreamInfo, sizeof(AVISTREAMINFO));
sAviStreamInfo.fccType = streamtypeVIDEO;
sAviStreamInfo.fccHandler = 0;
sAviStreamInfo.dwScale = m_dwPeriod;
sAviStreamInfo.dwRate = 1000;
sAviStreamInfo.dwQuality = -1;
sAviStreamInfo.dwSuggestedBufferSize = sDibSection.dsBmih.biSizeImage;
SetRect(&sAviStreamInfo.rcFrame, 0, 0, sDibSection.dsBmih.biWidth,
sDibSection.dsBmih.biHeight);
hResult = AVIFileCreateStream(m_pAviFile, &m_pStream, &sAviStreamInfo);
if (hResult != AVIERR_OK)
return OPERATION_ERROR;
}


if (!(*m_pbIsCompressionOptionDone))
{
ZeroMemory(&m_opts,sizeof(AVICOMPRESSOPTIONS));
m_aopts[0] = &m_opts;
BOOL bPressOk = (BOOL) AVISaveOptions(*phFrameWnd, 0, 1, &m_pStream,
(LPAVICOMPRESSOPTIONS *) m_aopts);
if (!bPressOk)
{
AVISaveOptionsFree(1,m_aopts);
(*m_pbIsCompressionOptionDone) = TRUE;
return OPERATION_CANCEL;
}
}


if (m_pCompressedStream == NULL)
{
m_opts.fccType = streamtypeVIDEO;
m_opts.dwFlags = AVICOMPRESSF_VALID;
hResult = AVIMakeCompressedStream(&m_pCompressedStream, m_pStream,
&m_opts, NULL);
if (hResult != AVIERR_OK)
return OPERATION_ERROR;

hResult = AVIStreamSetFormat(m_pCompressedStream, 0, &sDibSection.dsBmih,
sDibSection.dsBmih.biSize + sDibSection.dsBmih.biClrUsed*sizeof(RGBQUAD));
if (hResult != AVIERR_OK)
return OPERATION_ERROR;

}


if (!(*m_pbIsCompressionOptionDone))
{
AVISaveOptionsFree(1,m_aopts);
(*m_pbIsCompressionOptionDone) = TRUE;
}


hResult = AVIStreamWrite(m_pCompressedStream, m_iFrameNumber, 1,
sDibSection.dsBm.bmBits, sDibSection.dsBmih.biSizeImage, 0, NULL, NULL);
if (hResult != AVIERR_OK)
return OPERATION_ERROR;


return NO_ERROR;
}

GeneralRe: Divx.dll Access Violation Pin
Mark Salsbery24-May-07 6:08
Mark Salsbery24-May-07 6:08 
GeneralRe: Divx.dll Access Violation Pin
Skywalker200825-May-07 3:14
Skywalker200825-May-07 3:14 
GeneralRe: Divx.dll Access Violation Pin
Mark Salsbery25-May-07 4:35
Mark Salsbery25-May-07 4:35 
QuestionLayered window ! Pin
Adno23-May-07 10:58
Adno23-May-07 10:58 
AnswerRe: Layered window ! Pin
Mark Salsbery23-May-07 12:16
Mark Salsbery23-May-07 12:16 
GeneralRe: Layered window ! Pin
Adno23-May-07 12:34
Adno23-May-07 12:34 
GeneralRe: Layered window ! Pin
Mark Salsbery23-May-07 12:40
Mark Salsbery23-May-07 12:40 
GeneralRe: Layered window ! Pin
Adno23-May-07 12:45
Adno23-May-07 12:45 
GeneralRe: Layered window ! Pin
Mark Salsbery23-May-07 12:55
Mark Salsbery23-May-07 12:55 
GeneralRe: Layered window ! Pin
Adno23-May-07 13:11
Adno23-May-07 13:11 
GeneralRe: Layered window ! Pin
Mark Salsbery23-May-07 13:18
Mark Salsbery23-May-07 13:18 
GeneralRe: Layered window ! Pin
Adno23-May-07 13:31
Adno23-May-07 13:31 
GeneralRe: Layered window ! Pin
Adno23-May-07 13:39
Adno23-May-07 13:39 
GeneralRe: Layered window ! Pin
Mark Salsbery23-May-07 14:04
Mark Salsbery23-May-07 14:04 
GeneralRe: Layered window ! Pin
Mark Salsbery23-May-07 14:03
Mark Salsbery23-May-07 14:03 
GeneralRe: Layered window ! Pin
Adno23-May-07 14:29
Adno23-May-07 14:29 
GeneralRe: Layered window ! Pin
Mark Salsbery23-May-07 15:04
Mark Salsbery23-May-07 15:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.