aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Input/in_dshow/CWAAudioRenderer.cpp
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Plugins/Input/in_dshow/CWAAudioRenderer.cpp
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/Plugins/Input/in_dshow/CWAAudioRenderer.cpp')
-rw-r--r--Src/Plugins/Input/in_dshow/CWAAudioRenderer.cpp70
1 files changed, 70 insertions, 0 deletions
diff --git a/Src/Plugins/Input/in_dshow/CWAAudioRenderer.cpp b/Src/Plugins/Input/in_dshow/CWAAudioRenderer.cpp
new file mode 100644
index 00000000..fd59f733
--- /dev/null
+++ b/Src/Plugins/Input/in_dshow/CWAAudioRenderer.cpp
@@ -0,0 +1,70 @@
+#include "CWAAudioRenderer.h"
+
+
+CWAAudioRenderer::CWAAudioRenderer()
+ : CAudioSwitchRenderer(CLSID_WAAudioRend, TEXT("WAAudioRenderer"), NULL, NULL)//,
+ //CBaseReferenceClock(TEXT("WARefClock"), NULL, NULL, NULL)
+{
+ m_callback = NULL;
+}
+
+CWAAudioRenderer::~CWAAudioRenderer()
+{
+ delete(m_callback);
+}
+
+HRESULT CWAAudioRenderer::DoRenderSample(IMediaSample *pMediaSample)
+{
+ if (m_callback)
+ {
+ REFERENCE_TIME StartTime, StopTime;
+ pMediaSample->GetTime( &StartTime, &StopTime);
+ StartTime += m_pInputPin[m_inputSelected]->CurrentStartTime( );
+ StopTime += m_pInputPin[m_inputSelected]->CurrentStartTime( );
+ m_callback->sample_cb(StartTime, StopTime, pMediaSample);
+ }
+ return NOERROR;
+}
+
+HRESULT CWAAudioRenderer::CheckMediaType(const CMediaType *pmt)
+{
+ if (pmt->majortype != MEDIATYPE_Audio) return E_INVALIDARG;
+ if (pmt->formattype != FORMAT_WaveFormatEx) return E_INVALIDARG;
+ if (pmt->subtype != MEDIASUBTYPE_PCM && pmt->subtype != MEDIASUBTYPE_IEEE_FLOAT) return E_INVALIDARG;
+ return NOERROR;
+}
+
+HRESULT CWAAudioRenderer::SetMediaType(const CMediaType *pmt)
+{
+ m_mt = *pmt;
+ return NOERROR;
+}
+
+CMediaType *CWAAudioRenderer::GetAcceptedType()
+{
+ return &m_mt;
+}
+
+HRESULT CWAAudioRenderer::SetCallback(CSampleCB *Callback)
+{
+ m_callback = Callback;
+ return NOERROR;
+}
+
+
+HRESULT CWAAudioRenderer::EndOfStream(void)
+{
+ if (m_callback)
+ m_callback->endofstream();
+ return CAudioSwitchRenderer::EndOfStream();
+}
+
+HRESULT CWAAudioRenderer::ShouldDrawSampleNow(IMediaSample *pMediaSample, REFERENCE_TIME *pStartTime, REFERENCE_TIME *pEndTime)
+{
+ return S_OK;
+}
+
+HRESULT CWAAudioRenderer::GetSampleTimes(IMediaSample *pMediaSample, REFERENCE_TIME *pStartTime, REFERENCE_TIME *pEndTime)
+{
+ return S_OK;
+}