Thread View: borland.public.cppbuilder.multimedia
3 messages
3 total messages
Started by Juampi David
Thu, 23 Dec 2004 16:01
Access Violation?!
Author: Juampi David
Date: Thu, 23 Dec 2004 16:01
Date: Thu, 23 Dec 2004 16:01
45 lines
2333 bytes
2333 bytes
Hello! ... I'm workin' with DES on C++ Builder 5. When I try to change MediaSubType of one Video Group appears this "fatal error" messange: Project Projecto1.exe raised exception class EAccessViolation with messange 'Access violation at adress BAADF00D. Read of address BAADF00D'. Process stoped. Use Step or Run to continue. This is the Code: AM_MEDIA_TYPE mtGroup; mtGroup.majortype = MEDIATYPE_Video; mtGroup.subtype = MEDIASUBTYPE_RGB555; mtGroup.pbFormat = (BYTE*)CoTaskMemAlloc(sizeof(VIDEOINFOHEADER)); VIDEOINFOHEADER *pVideoHeader = (VIDEOINFOHEADER*)mtGroup.pbFormat; ZeroMemory(pVideoHeader, sizeof(VIDEOINFOHEADER)); pVideoHeader->bmiHeader.biBitCount = 16; pVideoHeader->bmiHeader.biWidth = 320; pVideoHeader->bmiHeader.biHeight = 240; pVideoHeader->bmiHeader.biPlanes = 1; pVideoHeader->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); pVideoHeader->bmiHeader.biSizeImage = DIBSIZE(pVideoHeader->bmiHeader); mtGroup.formattype = FORMAT_VideoInfo; mtGroup.cbFormat = sizeof(VIDEOINFOHEADER); mtGroup.bFixedSizeSamples = TRUE; mtGroup.lSampleSize = DIBSIZE(pVideoHeader->bmiHeader); IAMTimelineGroup *pGroup; pGroup->SetMediaType(&mtGroup); CoTaskMemFree(mtGroup.pbFormat); And the error appears when I add this line: pGroup->SetMediaType(&mtGroup); Could anyone explain me why this error appears?!!? Thanks!!! Juampi David
Re: Access Violation?!
Author: Remy Lebeau (TeamB)
Date: Thu, 23 Dec 2004 18:06
Date: Thu, 23 Dec 2004 18:06
32 lines
1766 bytes
1766 bytes
"Juampi David" <multimedia@mdpsistemas.com.ar> wrote in message
news:41caebfa@newsgroups.borland.com...
> IAMTimelineGroup *pGroup;
>
> pGroup->SetMediaType(&mtGroup);
You are declaring an uninitialized pointer and not instantiating an
IAMTimelineGroup object before using it. For example:
IAMTimeline *pTimeline = NULL;
IAMTimelineObj *pObj = NULL;
IAMTimelineGroup *pGroup = NULL;
// first obtain the Timeline as needed, then do one of the following as
needed ...
pTimeline->CreateEmptyNode(&pObj, TIMELINE_MAJOR_TYPE_GROUP);
// or ...
pTimeline->GetGroup(&pObj, SomeIndex);
// then obtain the Group...
if( pObj )
{
pObj->QueryInterface(IID_IAMTimelineGroup, (LPVOID*)&pGroup);
// now use the Group as needed...
pGroup->Release();
}
Gambit
Re: Access Violation?!
Author: Juampi David
Date: Fri, 24 Dec 2004 01:17
Date: Fri, 24 Dec 2004 01:17
80 lines
3396 bytes
3396 bytes
Gambit ... Thanks for your help! ... and for your Time! ...
I found the solution on ...
1st ... Make a Timeline
2nd... Make a Group
3th... Adjust MediaSubType --->
AM_MEDIA_TYPE mtGroup;
ZeroMemory(&mtGroup, sizeof(AM_MEDIA_TYPE));
mtGroup.majortype = MEDIATYPE_Video;
pGroup->SetMediaType(&mtGroup);
mtGroup.majortype = MEDIATYPE_Video;
mtGroup.subtype = MEDIASUBTYPE_RGB24;
mtGroup.pbFormat = (BYTE*)CoTaskMemAlloc(sizeof(VIDEOINFOHEADER));
VIDEOINFOHEADER *pVideoHeader = (VIDEOINFOHEADER*)mtGroup.pbFormat;
ZeroMemory(pVideoHeader, sizeof(VIDEOINFOHEADER));
pVideoHeader->bmiHeader.biBitCount = 24;
pVideoHeader->bmiHeader.biWidth = 720;
pVideoHeader->bmiHeader.biHeight = 576;
pVideoHeader->bmiHeader.biPlanes = 1;
pVideoHeader->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
pVideoHeader->bmiHeader.biSizeImage = DIBSIZE(pVideoHeader->bmiHeader);
mtGroup.formattype = FORMAT_VideoInfo;
mtGroup.cbFormat = sizeof(VIDEOINFOHEADER);
mtGroup.bFixedSizeSamples = TRUE;
mtGroup.lSampleSize = DIBSIZE(pVideoHeader->bmiHeader);
pGroup->SetMediaType(&mtGroup);
CoTaskMemFree(mtGroup.pbFormat);
4th. Adding Group to TimeLine
pTimeline->AddGroup(pGroupObj);
pGroupObj->Release();
And following....
Thanks and if you want, tell me if my solution is or not Rigth! ...
Thanks!!!
Juampi David
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> escribi๏ฟฝ en el mensaje
news:41cb08f2$1@newsgroups.borland.com...
>
> "Juampi David" <multimedia@mdpsistemas.com.ar> wrote in message
> news:41caebfa@newsgroups.borland.com...
>
>> IAMTimelineGroup *pGroup;
>>
>> pGroup->SetMediaType(&mtGroup);
>
> You are declaring an uninitialized pointer and not instantiating an
> IAMTimelineGroup object before using it. For example:
>
> IAMTimeline *pTimeline = NULL;
> IAMTimelineObj *pObj = NULL;
> IAMTimelineGroup *pGroup = NULL;
>
> // first obtain the Timeline as needed, then do one of the following as
> needed ...
>
> pTimeline->CreateEmptyNode(&pObj, TIMELINE_MAJOR_TYPE_GROUP);
> // or ...
> pTimeline->GetGroup(&pObj, SomeIndex);
>
> // then obtain the Group...
> if( pObj )
> {
> pObj->QueryInterface(IID_IAMTimelineGroup, (LPVOID*)&pGroup);
> // now use the Group as needed...
> pGroup->Release();
> }
>
>
> Gambit
>
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads