Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
8 Views

MPEG-4 splitter initialisation problem

I have a file that contains a raw MPEG-4 bitstream (.m4v) that I can successfully play with simple_player. I've written an MFC test app to play my file by assembling snippets from the UMC manual and bits and pieces found here on this forum (special thanks to franknatoli). However,Visual Studio 2008 reportsa heap corruption errorwhen I attempt to initialise my splitter.

The code for MPEG-4 decoding resides in a separate worker thread, and this thread is spawned when the main dialog window is about to be displayed in OnInitDialog(). The code is as follows:

[cpp]unsigned int CRenderM4VDlg::ThreadFunction()
{
    unsigned int nResult= 0;
    TCHAR szFilename[MAX_PATH]= { _T("D:\Development\Code\C++\Mfc\RenderM4V\ella.m4v") };
    CString str;
    UMC::Status umcResult;

    // Initialise file reader
    UMC::FIOReader reader;
    UMC::FileReaderParams readerParams;
    readerParams.m_portion_size= 0;
    vm_string_strcpy(readerParams.m_file_name, szFilename);
    umcResult= reader.Init(&readerParams);

    if (umcResult != UMC::UMC_OK)
    {
        str.Format(_T("FIOReader.Init failure %d"), umcResult);
        AfxMessageBox(str);
        return 0xFFFFFFFF;
    }

    // Create splitter
    UMC::Splitter *splitter;
    UMC::SystemStreamType streamType= UMC::Splitter::GetStreamType(&reader);

    // Identify input stream and instantiate appropriate splitter
    switch (streamType)
    {
    case UMC::MP4_ATOM_STREAM :
        splitter = (UMC::Splitter*)(new UMC::MP4Splitter());
        break;
    case UMC::MPEGx_SYSTEM_STREAM :
        splitter = (UMC::Splitter*)(new UMC::ThreadedDemuxer()); // This splitter is used
        break;
    default :
        AfxMessageBox(_T("Splitter::GetStreamType unknown"));
        return 0xFFFFFFFF;
    }

    // Initialize splitter
    UMC::SplitterParams splitterParams;
    splitterParams.m_lFlags = UMC::VIDEO_SPLITTER;	// Extract only video
    splitterParams.m_pDataReader = &reader;
    umcResult = splitter->Init(splitterParams);[/cpp]

After executing this final line VisualStudio pops up an error dialog reporting heap corruption.

Could someone please tell me what I've done wrong? I'm using VS2008 on Vista SP1.

Thanks in advance.

0 Kudos
1 Reply
Highlighted
Beginner
8 Views

Quoting - mark_moore

I have a file that contains a raw MPEG-4 bitstream (.m4v) that I can successfully play with simple_player. I've written an MFC test app to play my file by assembling snippets from the UMC manual and bits and pieces found here on this forum (special thanks to franknatoli). However,Visual Studio 2008 reportsa heap corruption errorwhen I attempt to initialise my splitter.

The code for MPEG-4 decoding resides in a separate worker thread, and this thread is spawned when the main dialog window is about to be displayed in OnInitDialog(). The code is as follows:

[cpp]unsigned int CRenderM4VDlg::ThreadFunction()
{
    unsigned int nResult= 0;
    TCHAR szFilename[MAX_PATH]= { _T("D:DevelopmentCodeC++MfcRenderM4Vella.m4v") };
    CString str;
    UMC::Status umcResult;

    // Initialise file reader
    UMC::FIOReader reader;
    UMC::FileReaderParams readerParams;
    readerParams.m_portion_size= 0;
    vm_string_strcpy(readerParams.m_file_name, szFilename);
    umcResult= reader.Init(&readerParams);

    if (umcResult != UMC::UMC_OK)
    {
        str.Format(_T("FIOReader.Init failure %d"), umcResult);
        AfxMessageBox(str);
        return 0xFFFFFFFF;
    }

    // Create splitter
    UMC::Splitter *splitter;
    UMC::SystemStreamType streamType= UMC::Splitter::GetStreamType(&reader);

    // Identify input stream and instantiate appropriate splitter
    switch (streamType)
    {
    case UMC::MP4_ATOM_STREAM :
        splitter = (UMC::Splitter*)(new UMC::MP4Splitter());
        break;
    case UMC::MPEGx_SYSTEM_STREAM :
        splitter = (UMC::Splitter*)(new UMC::ThreadedDemuxer()); // This splitter is used
        break;
    default :
        AfxMessageBox(_T("Splitter::GetStreamType unknown"));
        return 0xFFFFFFFF;
    }

    // Initialize splitter
    UMC::SplitterParams splitterParams;
    splitterParams.m_lFlags = UMC::VIDEO_SPLITTER;	// Extract only video
    splitterParams.m_pDataReader = &reader;
    umcResult = splitter->Init(splitterParams);[/cpp]

After executing this final line VisualStudio pops up an error dialog reporting heap corruption.

Could someone please tell me what I've done wrong? I'm using VS2008 on Vista SP1.

Thanks in advance.

More information:I'm using IPP v5.3 Update 4. I successfully compiled the all the UMC libraries, executables etc.by using the build32.bat file. I'm running a Intel Pentium 4 CPU 3.20 GHz with 1 GB RAM.

Can anyone help?

0 Kudos