0xC0000005: Access violation writing location 0x0C8B7000 RRS feed

  • Question

  • Hey guys:

    I am building an video editor app and I am using windows media foundation. What I am trying to do here is to implement the functionality of creating a title clip. This involves creating an empty clip with a particular background color. So what I am trying to do is write data to an buffer attached a IMFsample.



    HRESULT ReadResult::CreateDummySample(IMFSample** ppOutSample, int VIDEO_WIDTH, int VIDEO_HEIGHT, const LONGLONG& rtStart, // Time stamp. const LONGLONG& rtDuration, // Frame duration. UINT sampleColour = 0xFF00FF00 ) { IMFSample *pSample = NULL; IMFMediaBuffer *pBuffer = NULL; const LONG cbWidth = 4 * VIDEO_WIDTH; //bytes per line const DWORD cbBuffer = 4 * VIDEO_WIDTH * VIDEO_HEIGHT; //bytes for the whole frame BYTE *pData = NULL; //create a dummy RGBA32 buffer to get "source data" from UINT* pDummyData = new UINT[VIDEO_WIDTH*VIDEO_HEIGHT]; //copy in the provided sampleColour into every pixel of the dummy data buffer for(size_t x=0; x<VIDEO_WIDTH; ++x) { for(size_t y=0; y<VIDEO_HEIGHT; ++y) { size_t t= x*y; pDummyData[x * VIDEO_WIDTH + y] = sampleColour; }


    So I am getting a an exception at 0xC0000005: Access violation writing location 0x0C8B7000 on the line pDummyData[x * VIDEO_WIDTH + y] = sampleColour; and I'm not sure what I've done wrong. Cheers.
    Wednesday, May 1, 2013 8:57 AM