@@ -158,7 +158,7 @@ void CVapourSynthFile::SetVSNodes()
158158
159159 auto ai = m_vsAPI->getAudioInfo (vsNode);
160160
161- if (ai && ai->format .numChannels > 0 && ai->format .numChannels <= 32 ) {
161+ if (ai && ai->format .numChannels > 0 && ai->format .numChannels <= 32 && (ai-> format . channelLayout & 0xffffffff00000000ui64) == 0 ) {
162162 m_vsNodeAudio = vsNode;
163163 vsNode = nullptr ;
164164 }
@@ -174,8 +174,8 @@ void CVapourSynthFile::SetVSNodes()
174174//
175175
176176CVapourSynthVideoStream::CVapourSynthVideoStream (CVapourSynthFile* pVapourSynthFile, CSource* pParent, HRESULT* phr)
177- : CSourceStream(L" Audio " , phr, pParent, L" Audio " )
178- , CSourceSeeking(L" Audio " , (IPin*)this, phr, &m_cSharedState)
177+ : CSourceStream(L" Video " , phr, pParent, L" Video " )
178+ , CSourceSeeking(L" Video " , (IPin*)this, phr, &m_cSharedState)
179179 , m_pVapourSynthFile(pVapourSynthFile)
180180{
181181 CAutoLock cAutoLock (&m_cSharedState);
@@ -686,14 +686,17 @@ CVapourSynthAudioStream::CVapourSynthAudioStream(CVapourSynthFile* pVapourSynthF
686686 m_mt.SetTemporalCompression (FALSE );
687687 m_mt.SetSampleSize (m_BytesPerSample);
688688
689- WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.AllocFormatBuffer (sizeof (WAVEFORMATEX));
690- wfe->wFormatTag = wFormatTag;
691- wfe->nChannels = m_Channels;
692- wfe->nSamplesPerSec = m_SampleRate;
693- wfe->nAvgBytesPerSec = m_BytesPerSample * m_SampleRate;
694- wfe->nBlockAlign = m_BytesPerSample;
695- wfe->wBitsPerSample = m_BitDepth;
696- wfe->cbSize = 0 ;
689+ WAVEFORMATEXTENSIBLE* wfex = (WAVEFORMATEXTENSIBLE*)m_mt.AllocFormatBuffer (sizeof (WAVEFORMATEXTENSIBLE));
690+ wfex->Format .wFormatTag = WAVE_FORMAT_EXTENSIBLE;
691+ wfex->Format .nChannels = m_Channels;
692+ wfex->Format .nSamplesPerSec = m_SampleRate;
693+ wfex->Format .nAvgBytesPerSec = m_BytesPerSample * m_SampleRate;
694+ wfex->Format .nBlockAlign = m_BytesPerSample;
695+ wfex->Format .wBitsPerSample = m_BitDepth;
696+ wfex->Format .cbSize = sizeof (WAVEFORMATEXTENSIBLE) - sizeof (WAVEFORMATEX); // 22
697+ wfex->Samples .wValidBitsPerSample = m_BitDepth;
698+ wfex->dwChannelMask = (DWORD)m_vsAudioInfo->format .channelLayout ;
699+ wfex->SubFormat = m_Subtype;
697700
698701 m_StreamInfo = std::format (L" Audio stream: {} channels, {} Hz, " , m_Channels, m_SampleRate);
699702 if (m_SampleType == stFloat) {
0 commit comments