Beispiel #1
0
STDMETHODIMP CBaseSplitterFilter::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
{
	CheckPointer(pszFileName, E_POINTER);

	m_fn = pszFileName;
	HRESULT hr = E_FAIL;
	CComPtr<IAsyncReader> pAsyncReader;
	CAtlList<CHdmvClipInfo::PlaylistItem> Items;
	if (BuildPlaylist (pszFileName, Items)) {
		pAsyncReader = (IAsyncReader*)DNew CAsyncFileReader(Items, hr);
	} else {
		pAsyncReader = (IAsyncReader*)DNew CAsyncFileReader(CString(pszFileName), hr);
	}
	if(FAILED(hr)
			|| FAILED(hr = DeleteOutputs())
			|| FAILED(hr = CreateOutputs(pAsyncReader))) {
		m_fn = "";
		return hr;
	}

	ChapSort();

	m_pSyncReader = pAsyncReader;

	return S_OK;
}
Beispiel #2
0
STDMETHODIMP CBaseSplitterFilter::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
{
	CheckPointer(pszFileName, E_POINTER);

	m_fn = pszFileName;
	HRESULT hr = E_FAIL;
	CComPtr<IAsyncReader> pAsyncReader;
	CHdmvClipInfo::CPlaylistChapter Chapters;

	if (BuildPlaylist(pszFileName, m_Items)) {
		pAsyncReader = (IAsyncReader*)DNew CAsyncFileReader(m_Items, hr);
	} else {
		pAsyncReader = (IAsyncReader*)DNew CAsyncFileReader(CString(pszFileName), hr);
	}

	if (FAILED(hr)
			|| FAILED(hr = DeleteOutputs())
			|| FAILED(hr = CreateOutputs(pAsyncReader))) {
		m_fn = "";
		return hr;
	}

	SortOutputPin();

	if (BuildChapters(pszFileName, m_Items, Chapters)) {
		POSITION pos	= Chapters.GetHeadPosition();
		int	i			= 1;
		while (pos) {
			CString str;
			CHdmvClipInfo::PlaylistChapter& chap = Chapters.GetNext(pos);
			if (chap.m_nMarkType == CHdmvClipInfo::EntryMark) {
				str.Format (_T("Chapter %d"), i);
				ChapAppend (chap.m_rtTimestamp, str);
				i++;
			}
		}
	}

	ChapSort();

	m_pSyncReader = pAsyncReader;

	return S_OK;
}