- Main Page
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

# MP4SplitterFile.cpp

    00001 #include "StdAfx.h"
    00002 #include "MP4SplitterFile.h"
    00003 #include "Ap4AsyncReaderStream.cpp" // FIXME
    00004
    00005 CMP4SplitterFile::CMP4SplitterFile(IAsyncReader* pReader, HRESULT& hr)
    00006         : CBaseSplitterFileEx(pReader, hr)
    00007         , m_pAp4File(NULL)
    00008 {
    00009         if(FAILED(hr)) return;
    00010
    00011         hr = Init();
    00012 }
    00013
    00014 CMP4SplitterFile::~CMP4SplitterFile()
    00015 {
    00016         delete (AP4_File*)m_pAp4File;
    00017 }
    00018
    00019 void* /* AP4_Movie* */ CMP4SplitterFile::GetMovie()
    00020 {
    00021         ASSERT(m_pAp4File);
    00022         return m_pAp4File ? ((AP4_File*)m_pAp4File)->GetMovie() : NULL;
    00023 }
    00024
    00025 HRESULT CMP4SplitterFile::Init()
    00026 {
    00027         Seek(0);
    00028
    00029         delete (AP4_File*)m_pAp4File;
    00030
    00031         AP4_ByteStream* stream = new AP4_AsyncReaderStream(this);
    00032
    00033         m_pAp4File = new AP4_File(*stream);
    00034
    00035         AP4_Movie* movie = ((AP4_File*)m_pAp4File)->GetMovie();
    00036
    00037         stream->Release();
    00038
    00039         return movie ? S_OK : E_FAIL;
    00040 }