locked
0xC0000005: Access violation writing location 0x0C8B7000

    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 01, 2013 8:57 AM

Answers

  • try

    pDummyData[y * VIDEO_WIDTH + x] = sampleColour;


    MCAD.NET C# - http://www.Global-webnet.com/Blog



    • Proposed as answer by MikeBMcLMVP Wednesday, May 01, 2013 5:08 PM
    • Edited by BillKrat1 Wednesday, May 01, 2013 5:34 PM
    • Marked as answer by Danny Wei023 Wednesday, May 01, 2013 9:09 PM
    Wednesday, May 01, 2013 12:55 PM

All replies

  • try

    pDummyData[y * VIDEO_WIDTH + x] = sampleColour;


    MCAD.NET C# - http://www.Global-webnet.com/Blog



    • Proposed as answer by MikeBMcLMVP Wednesday, May 01, 2013 5:08 PM
    • Edited by BillKrat1 Wednesday, May 01, 2013 5:34 PM
    • Marked as answer by Danny Wei023 Wednesday, May 01, 2013 9:09 PM
    Wednesday, May 01, 2013 12:55 PM
  • Cheers BillKrat. I found out about this problem  just a few hours ago, but thanks for the help :)
    Wednesday, May 01, 2013 9:09 PM