diff options
author | Casimir666 <casimir666@users.sourceforge.net> | 2008-08-03 14:26:08 +0400 |
---|---|---|
committer | Casimir666 <casimir666@users.sourceforge.net> | 2008-08-03 14:26:08 +0400 |
commit | 53d485714a6b65cfa895a9ab188b3ea8f7cf2b42 (patch) | |
tree | 88a42e6ac6ca7c68d036e63977946c0900cd353e /src/subtitles/RenderedHdmvSubtitle.cpp | |
parent | 271f2833192d7d972ff94229cbd7c0a1e66d1d8b (diff) |
Hdmv subtitles : intermediate commit
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@714 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/subtitles/RenderedHdmvSubtitle.cpp')
-rw-r--r-- | src/subtitles/RenderedHdmvSubtitle.cpp | 157 |
1 files changed, 157 insertions, 0 deletions
diff --git a/src/subtitles/RenderedHdmvSubtitle.cpp b/src/subtitles/RenderedHdmvSubtitle.cpp new file mode 100644 index 000000000..975bdf403 --- /dev/null +++ b/src/subtitles/RenderedHdmvSubtitle.cpp @@ -0,0 +1,157 @@ +/*
+ * $Id$
+ *
+ * (C) 2006-2007 see AUTHORS
+ *
+ * This file is part of mplayerc.
+ *
+ * Mplayerc is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mplayerc is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include "stdafx.h"
+#include "RenderedHdmvSubtitle.h"
+
+CRenderedHdmvSubtitle::CRenderedHdmvSubtitle(CCritSec* pLock)
+ : ISubPicProviderImpl(pLock)
+{
+}
+
+CRenderedHdmvSubtitle::~CRenderedHdmvSubtitle(void)
+{
+}
+
+
+STDMETHODIMP CRenderedHdmvSubtitle::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+ *ppv = NULL;
+
+ return
+ QI(IPersist)
+ QI(ISubStream)
+ QI(ISubPicProvider)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// ISubPicProvider
+
+STDMETHODIMP_(POSITION) CRenderedHdmvSubtitle::GetStartPosition(REFERENCE_TIME rt, double fps)
+{
+ return (GetNext((POSITION)0));
+}
+
+STDMETHODIMP_(POSITION) CRenderedHdmvSubtitle::GetNext(POSITION pos)
+{
+ return (POSITION)((int)pos==0 && m_HdmvSub.GetActiveObjects()>0 ? 1 : 0);
+}
+
+STDMETHODIMP_(REFERENCE_TIME) CRenderedHdmvSubtitle::GetStart(POSITION pos, double fps)
+{
+ return m_HdmvSub.GetStart() + m_rtStart;
+}
+
+STDMETHODIMP_(REFERENCE_TIME) CRenderedHdmvSubtitle::GetStop(POSITION pos, double fps)
+{
+// return(10000i64 * TranslateSegmentEnd((int)pos-1, fps));
+ return m_HdmvSub.GetStop() + m_rtStart;
+}
+
+STDMETHODIMP_(bool) CRenderedHdmvSubtitle::IsAnimated(POSITION pos)
+{
+ return(true);
+}
+
+STDMETHODIMP CRenderedHdmvSubtitle::Render(SubPicDesc& spd, REFERENCE_TIME rt, double fps, RECT& bbox)
+{
+ m_HdmvSub.Render (spd, bbox);
+
+ return S_OK;
+}
+
+STDMETHODIMP CRenderedHdmvSubtitle::GetTextureSize (SIZE& TextureSize, SIZE& VideoSize, POINT& VideoTopLeft)
+{
+ return m_HdmvSub.GetTextureSize(TextureSize, VideoSize, VideoTopLeft);
+};
+
+STDMETHODIMP CRenderedHdmvSubtitle::SetSubPic (ISubPic* pSubPic)
+{
+ return m_HdmvSub.SetSubPic(pSubPic);
+}
+
+// IPersist
+
+STDMETHODIMP CRenderedHdmvSubtitle::GetClassID(CLSID* pClassID)
+{
+ return pClassID ? *pClassID = __uuidof(this), S_OK : E_POINTER;
+}
+
+// ISubStream
+
+STDMETHODIMP_(int) CRenderedHdmvSubtitle::GetStreamCount()
+{
+ return (1);
+}
+
+STDMETHODIMP CRenderedHdmvSubtitle::GetStreamInfo(int iStream, WCHAR** ppName, LCID* pLCID)
+{
+ if(iStream != 0) return E_INVALIDARG;
+
+ if(ppName)
+ {
+ if(!(*ppName = (WCHAR*)CoTaskMemAlloc((m_name.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
+
+ wcscpy_s (*ppName, m_name.GetLength()+1, CStringW(m_name));
+ }
+
+ if(pLCID)
+ {
+ *pLCID = m_lcid;
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP_(int) CRenderedHdmvSubtitle::GetStream()
+{
+ return(0);
+}
+
+STDMETHODIMP CRenderedHdmvSubtitle::SetStream(int iStream)
+{
+ return iStream == 0 ? S_OK : E_FAIL;
+}
+
+STDMETHODIMP CRenderedHdmvSubtitle::Reload()
+{
+ return S_OK;
+}
+
+HRESULT CRenderedHdmvSubtitle::ParseSample (IMediaSample* pSample)
+{
+ HRESULT hr;
+
+ hr = m_HdmvSub.ParseSample (pSample);
+ return hr;
+}
+
+HRESULT CRenderedHdmvSubtitle::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+ m_HdmvSub.Reset();
+ m_rtStart = tStart;
+ return S_OK;
+}
+
|