BaseMuxerOutputPin.cpp

00001 /* 
00002  *      Copyright (C) 2003-2005 Gabest
00003  *      http://www.gabest.org
00004  *
00005  *  This Program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2, or (at your option)
00008  *  any later version.
00009  *   
00010  *  This Program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013  *  GNU General Public License for more details.
00014  *   
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with GNU Make; see the file COPYING.  If not, write to
00017  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
00018  *  http://www.gnu.org/copyleft/gpl.html
00019  *
00020  */
00021 
00022 #include "StdAfx.h"
00023 #include "BaseMuxerOutputPin.h"
00024 
00025 //
00026 // CBaseMuxerOutputPin
00027 //
00028 
00029 CBaseMuxerOutputPin::CBaseMuxerOutputPin(TCHAR* pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
00030         : CBaseOutputPin(pName, pFilter, pLock, phr, L"Output")
00031 {
00032 }
00033 
00034 CBaseMuxerOutputPin::~CBaseMuxerOutputPin()
00035 {
00036 }
00037 
00038 HRESULT CBaseMuxerOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
00039 {
00040     ASSERT(pAlloc);
00041     ASSERT(pProperties);
00042 
00043     HRESULT hr = NOERROR;
00044 
00045         pProperties->cBuffers = 1;
00046         pProperties->cbBuffer = 1;
00047 
00048     ALLOCATOR_PROPERTIES Actual;
00049     if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
00050 
00051     if(Actual.cbBuffer < pProperties->cbBuffer) return E_FAIL;
00052     ASSERT(Actual.cBuffers == pProperties->cBuffers);
00053 
00054     return NOERROR;
00055 }
00056 
00057 HRESULT CBaseMuxerOutputPin::CheckMediaType(const CMediaType* pmt)
00058 {
00059         return pmt->majortype == MEDIATYPE_Stream && pmt->subtype == MEDIASUBTYPE_NULL
00060                 ? S_OK
00061                 : E_INVALIDARG;
00062 }
00063 
00064 HRESULT CBaseMuxerOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
00065 {
00066     CAutoLock cAutoLock(m_pLock);
00067 
00068         if(iPosition < 0) return E_INVALIDARG;
00069         if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
00070 
00071         pmt->ResetFormatBuffer();
00072         pmt->InitMediaType();
00073         pmt->majortype = MEDIATYPE_Stream;
00074         pmt->subtype = MEDIASUBTYPE_NULL;
00075         pmt->formattype = FORMAT_None;
00076 
00077         return S_OK;
00078 }
00079 
00080 STDMETHODIMP CBaseMuxerOutputPin::Notify(IBaseFilter* pSender, Quality q)
00081 {
00082         return E_NOTIMPL;
00083 }

Generated on Tue Dec 13 14:47:08 2005 for guliverkli by  doxygen 1.4.5