Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksoid <aleksoid@users.sourceforge.net>2010-08-25 10:40:10 +0400
committerAleksoid <aleksoid@users.sourceforge.net>2010-08-25 10:40:10 +0400
commit228c6f21cef5ee8d8dfe25d862ab4c849a98ff9c (patch)
tree2e53637586de0f409f21d4303f0fa7e2d2444810 /src
parentc9d153e4053b92c18a6b2ac5b866b49035a5087b (diff)
Change : MPEGSplitter, Properties, Pit OUT - modify stream list for better visual perception;
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@2338 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src')
-rw-r--r--src/filters/parser/MpegSplitter/MpegSplitter.cpp753
1 files changed, 387 insertions, 366 deletions
diff --git a/src/filters/parser/MpegSplitter/MpegSplitter.cpp b/src/filters/parser/MpegSplitter/MpegSplitter.cpp
index 3fcec0f97..4f3c9e1c9 100644
--- a/src/filters/parser/MpegSplitter/MpegSplitter.cpp
+++ b/src/filters/parser/MpegSplitter/MpegSplitter.cpp
@@ -92,6 +92,367 @@ CFilterApp theApp;
#endif
+template <typename t_CType>
+t_CType GetFormatHelper(t_CType &_pInfo, const CMediaType *_pFormat)
+{
+ ASSERT(_pFormat->cbFormat >= sizeof(*_pInfo));
+ _pInfo = (t_CType)_pFormat->pbFormat;
+ return _pInfo;
+}
+
+static int GetHighestBitSet32(unsigned long _Value)
+{
+ unsigned long Ret;
+ unsigned char bNonZero = _BitScanReverse(&Ret, _Value);
+ if (bNonZero)
+ return Ret;
+ else
+ return -1;
+}
+
+CString FormatBitrate(double _Bitrate)
+{
+ CString Temp;
+ if (_Bitrate > 20000000) // More than 2 mbit
+ Temp.Format(L"%.2f mbit/s", double(_Bitrate)/1000000.0);
+ else
+ Temp.Format(L"%.1f kbit/s", double(_Bitrate)/1000.0);
+
+ return Temp;
+}
+
+CString FormatString(const wchar_t *pszFormat, ... )
+{
+ CString Temp;
+ ATLASSERT( AtlIsValidString( pszFormat ) );
+
+ va_list argList;
+ va_start( argList, pszFormat );
+ Temp.FormatV( pszFormat, argList );
+ va_end( argList );
+
+ return Temp;
+}
+
+CString GetMediaTypeDesc(const CMediaType *_pMediaType, const CHdmvClipInfo::Stream *pClipInfo, int _PresentationType)
+{
+ const WCHAR *pPresentationDesc = NULL;
+
+ if (pClipInfo)
+ pPresentationDesc = StreamTypeToName(pClipInfo->m_Type);
+ else
+ pPresentationDesc = StreamTypeToName((PES_STREAM_TYPE)_PresentationType);
+
+ CString MajorType;
+ CAtlList<CString> Infos;
+
+ if (_pMediaType->majortype == MEDIATYPE_Video)
+ {
+ MajorType = "Video";
+
+ if (pClipInfo)
+ {
+ CString name = ISO6392ToLanguage(pClipInfo->m_LanguageCode);
+
+ if (!name.IsEmpty())
+ Infos.AddTail(name);
+ }
+
+ const VIDEOINFOHEADER *pVideoInfo = NULL;
+ const VIDEOINFOHEADER2 *pVideoInfo2 = NULL;
+
+ if (_pMediaType->formattype == FORMAT_MPEGVideo)
+ {
+ Infos.AddTail(L"MPEG");
+
+ const MPEG1VIDEOINFO *pInfo = GetFormatHelper(pInfo, _pMediaType);
+
+ pVideoInfo = &pInfo->hdr;
+
+ }
+ else if (_pMediaType->formattype == FORMAT_MPEG2_VIDEO)
+ {
+ const MPEG2VIDEOINFO *pInfo = GetFormatHelper(pInfo, _pMediaType);
+
+ pVideoInfo2 = &pInfo->hdr;
+
+ bool bIsAVC = false;
+
+ if (pInfo->hdr.bmiHeader.biCompression == '1CVA')
+ {
+ bIsAVC = true;
+ Infos.AddTail(L"AVC (H.264)");
+ }
+ else if (pInfo->hdr.bmiHeader.biCompression == 0)
+ Infos.AddTail(L"MPEG2");
+ else
+ {
+ WCHAR Temp[5];
+ memset(Temp, 0, sizeof(Temp));
+ Temp[0] = (pInfo->hdr.bmiHeader.biCompression >> 0) & 0xFF;
+ Temp[1] = (pInfo->hdr.bmiHeader.biCompression >> 0) & 0xFF;
+ Temp[2] = (pInfo->hdr.bmiHeader.biCompression >> 0) & 0xFF;
+ Temp[3] = (pInfo->hdr.bmiHeader.biCompression >> 0) & 0xFF;
+ Infos.AddTail(Temp);
+ }
+
+ switch (pInfo->dwProfile)
+ {
+ case AM_MPEG2Profile_Simple: Infos.AddTail(L"Simple Profile"); break;
+ case AM_MPEG2Profile_Main: Infos.AddTail(L"Main Profile"); break;
+ case AM_MPEG2Profile_SNRScalable: Infos.AddTail(L"SNR Scalable Profile"); break;
+ case AM_MPEG2Profile_SpatiallyScalable: Infos.AddTail(L"Spatially Scalable Profile"); break;
+ case AM_MPEG2Profile_High: Infos.AddTail(L"High Profile"); break;
+ default:
+ if (pInfo->dwProfile)
+ {
+ if (bIsAVC)
+ {
+ switch (pInfo->dwProfile)
+ {
+ case 44: Infos.AddTail(L"CAVLC Profile"); break;
+ case 66: Infos.AddTail(L"Baseline Profile"); break;
+ case 77: Infos.AddTail(L"Main Profile"); break;
+ case 88: Infos.AddTail(L"Extended Profile"); break;
+ case 100: Infos.AddTail(L"High Profile"); break;
+ case 110: Infos.AddTail(L"High 10 Profile"); break;
+ case 122: Infos.AddTail(L"High 4:2:2 Profile"); break;
+ case 244: Infos.AddTail(L"High 4:4:4 Profile"); break;
+
+ default: Infos.AddTail(FormatString(L"Profile %d", pInfo->dwProfile)); break;
+ }
+ }
+ else
+ Infos.AddTail(FormatString(L"Profile %d", pInfo->dwProfile));
+ }
+ break;
+ }
+
+ switch (pInfo->dwLevel)
+ {
+ case AM_MPEG2Level_Low: Infos.AddTail(L"Low Level"); break;
+ case AM_MPEG2Level_Main: Infos.AddTail(L"Main Level"); break;
+ case AM_MPEG2Level_High1440: Infos.AddTail(L"High1440 Level"); break;
+ case AM_MPEG2Level_High: Infos.AddTail(L"High Level"); break;
+ default:
+ if (pInfo->dwLevel)
+ {
+ if (bIsAVC)
+ Infos.AddTail(FormatString(L"Level %1.1f", double(pInfo->dwLevel)/10.0));
+ else
+ Infos.AddTail(FormatString(L"Level %d", pInfo->dwLevel));
+ }
+ break;
+ }
+ }
+ else if (_pMediaType->formattype == FORMAT_VIDEOINFO2)
+ {
+ const VIDEOINFOHEADER2 *pInfo = GetFormatHelper(pInfo, _pMediaType);
+
+ pVideoInfo2 = pInfo;
+ bool bIsVC1 = false;
+
+ DWORD CodecType = pInfo->bmiHeader.biCompression;
+ if (CodecType == '1CVW')
+ {
+ bIsVC1 = true;
+ Infos.AddTail(L"VC-1");
+ }
+ else if (CodecType)
+ {
+ WCHAR Temp[5];
+ memset(Temp, 0, sizeof(Temp));
+ Temp[0] = (CodecType >> 0) & 0xFF;
+ Temp[1] = (CodecType >> 0) & 0xFF;
+ Temp[2] = (CodecType >> 0) & 0xFF;
+ Temp[3] = (CodecType >> 0) & 0xFF;
+ Infos.AddTail(Temp);
+ }
+ }
+ else if (_pMediaType->subtype == MEDIASUBTYPE_DVD_SUBPICTURE)
+ {
+ Infos.AddTail(L"DVD Sub Picture");
+ }
+ else if (_pMediaType->subtype == MEDIASUBTYPE_SVCD_SUBPICTURE)
+ {
+ Infos.AddTail(L"SVCD Sub Picture");
+ }
+ else if (_pMediaType->subtype == MEDIASUBTYPE_CVD_SUBPICTURE)
+ {
+ Infos.AddTail(L"CVD Sub Picture");
+ }
+
+ if (pVideoInfo2)
+ {
+ if (pVideoInfo2->bmiHeader.biWidth && pVideoInfo2->bmiHeader.biHeight)
+ Infos.AddTail(FormatString(L"%dx%d", pVideoInfo2->bmiHeader.biWidth, pVideoInfo2->bmiHeader.biHeight));
+ if (pVideoInfo2->AvgTimePerFrame)
+ Infos.AddTail(FormatString(L"%.3f fps", 10000000.0/double(pVideoInfo2->AvgTimePerFrame)));
+ if (pVideoInfo2->dwBitRate)
+ Infos.AddTail(FormatBitrate(pVideoInfo2->dwBitRate));
+ }
+ else if (pVideoInfo)
+ {
+ if (pVideoInfo->bmiHeader.biWidth && pVideoInfo->bmiHeader.biHeight)
+ Infos.AddTail(FormatString(L"%dx%d", pVideoInfo->bmiHeader.biWidth, pVideoInfo->bmiHeader.biHeight));
+ if (pVideoInfo->AvgTimePerFrame)
+ Infos.AddTail(FormatString(L"%.3f fps", 10000000.0/double(pVideoInfo->AvgTimePerFrame)));
+ if (pVideoInfo->dwBitRate)
+ Infos.AddTail(FormatBitrate(pVideoInfo->dwBitRate));
+ }
+
+ }
+ else if (_pMediaType->majortype == MEDIATYPE_Audio)
+ {
+ MajorType = "Audio";
+ if (pClipInfo)
+ {
+ CString name = ISO6392ToLanguage(pClipInfo->m_LanguageCode);
+ if (!name.IsEmpty())
+ Infos.AddTail(name);
+ }
+ if (_pMediaType->formattype == FORMAT_WaveFormatEx)
+ {
+ const WAVEFORMATEX *pInfo = GetFormatHelper(pInfo, _pMediaType);
+
+ if (_pMediaType->subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO)
+ {
+ Infos.AddTail(L"DVD LPCM");
+ }
+ else if (_pMediaType->subtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO)
+ {
+ const WAVEFORMATEX_HDMV_LPCM *pInfoHDMV = GetFormatHelper(pInfoHDMV, _pMediaType);
+ UNUSED_ALWAYS(pInfoHDMV);
+ Infos.AddTail(L"HDMV LPCM");
+ }
+ else
+ {
+ switch (pInfo->wFormatTag)
+ {
+ case WAVE_FORMAT_PS2_PCM:
+ {
+ Infos.AddTail(L"PS2 PCM");
+ }
+ break;
+ case WAVE_FORMAT_PS2_ADPCM:
+ {
+ Infos.AddTail(L"PS2 ADPCM");
+ }
+ break;
+ case WAVE_FORMAT_DVD_DTS:
+ {
+ if (pPresentationDesc)
+ Infos.AddTail(pPresentationDesc);
+ else
+ Infos.AddTail(L"DTS");
+ }
+ break;
+ case WAVE_FORMAT_DOLBY_AC3:
+ {
+ if (pPresentationDesc)
+ Infos.AddTail(pPresentationDesc);
+ else
+ Infos.AddTail(L"Dolby Digital");
+ }
+ break;
+ case WAVE_FORMAT_AAC:
+ {
+ Infos.AddTail(L"AAC");
+ }
+ break;
+ case WAVE_FORMAT_MP3:
+ {
+ Infos.AddTail(L"MP3");
+ }
+ break;
+ case WAVE_FORMAT_MPEG:
+ {
+ const MPEG1WAVEFORMAT* pInfoMPEG1 = GetFormatHelper(pInfoMPEG1, _pMediaType);
+
+ int layer = GetHighestBitSet32(pInfoMPEG1->fwHeadLayer) + 1;
+ Infos.AddTail(FormatString(L"MPEG1 - Layer %d", layer));
+ }
+ break;
+ }
+ }
+
+ if (pClipInfo && (pClipInfo->m_SampleRate == BDVM_SampleRate_48_192 || pClipInfo->m_SampleRate == BDVM_SampleRate_48_96))
+ {
+ switch (pClipInfo->m_SampleRate)
+ {
+ case BDVM_SampleRate_48_192:
+ Infos.AddTail(FormatString(L"192(48) kHz"));
+ break;
+ case BDVM_SampleRate_48_96:
+ Infos.AddTail(FormatString(L"96(48) kHz"));
+ break;
+ }
+ }
+ else if (pInfo->nSamplesPerSec)
+ Infos.AddTail(FormatString(L"%.1f kHz", double(pInfo->nSamplesPerSec)/1000.0));
+ if (pInfo->nChannels)
+ Infos.AddTail(FormatString(L"%d chn", pInfo->nChannels));
+ if (pInfo->wBitsPerSample)
+ Infos.AddTail(FormatString(L"%d bit", pInfo->wBitsPerSample));
+ if (pInfo->nAvgBytesPerSec)
+ Infos.AddTail(FormatBitrate(pInfo->nAvgBytesPerSec * 8));
+
+ }
+ }
+ else if (_pMediaType->majortype == MEDIATYPE_Subtitle)
+ {
+ MajorType = "Subtitle";
+
+ if (pPresentationDesc)
+ Infos.AddTail(pPresentationDesc);
+
+ if (_pMediaType->cbFormat == sizeof(SUBTITLEINFO))
+ {
+ const SUBTITLEINFO *pInfo = GetFormatHelper(pInfo, _pMediaType);
+ CString name = ISO6392ToLanguage(pInfo->IsoLang);
+
+ if (pInfo->TrackName[0])
+ Infos.AddHead(pInfo->TrackName);
+ if (!name.IsEmpty())
+ Infos.AddHead(name);
+ }
+ else
+ {
+ if (pClipInfo)
+ {
+ CString name = ISO6392ToLanguage(pClipInfo->m_LanguageCode);
+ if (!name.IsEmpty())
+ Infos.AddHead(name);
+ }
+ }
+ }
+
+ if (!Infos.IsEmpty())
+ {
+ CString Ret;
+
+ Ret += MajorType;
+ Ret += " - ";
+
+ bool bFirst = true;
+
+ for(POSITION pos = Infos.GetHeadPosition(); pos; Infos.GetNext(pos))
+ {
+ CString& String = Infos.GetAt(pos);
+
+ if (bFirst)
+ Ret += String;
+ else
+ Ret += L", " + String;
+
+ bFirst = false;
+ }
+
+ return Ret;
+ }
+ return CString();
+}
+
//
// CMpegSplitterFilter
//
@@ -350,13 +711,36 @@ HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
while(pos)
{
CMpegSplitterFile::stream& s = m_pFile->m_streams[i].GetNext(pos);
-
CAtlArray<CMediaType> mts;
mts.Add(s.mt);
-
+
CStringW name = CMpegSplitterFile::CStreamList::ToString(i);
+ CStringW str;
+
+ if (i == CMpegSplitterFile::subpic && s.pid == NO_SUBTITLE_PID)
+ {
+ str = _T("No subtitles");
+ }
+ else
+ {
+ int iProgram;
+ const CHdmvClipInfo::Stream *pClipInfo;
+ const CMpegSplitterFile::program * pProgram = m_pFile->FindProgram(s.pid, iProgram, pClipInfo);
+ const wchar_t *pStreamName = NULL;
+ int StreamType = pClipInfo ? pClipInfo->m_Type : pProgram ? pProgram->streams[iProgram].type : 0;
+ pStreamName = StreamTypeToName((PES_STREAM_TYPE)StreamType);
+
+ CString FormatDesc = GetMediaTypeDesc(&s.mt, pClipInfo, StreamType);
- CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CMpegSplitterOutputPin(mts, name, this, this, &hr));
+ if (!FormatDesc.IsEmpty())
+ str.Format(L"%s (%04x,%02x,%02x)", FormatDesc.GetString(), s.pid, s.pesid, s.ps1id); // TODO: make this nicer
+ else if (pStreamName)
+ str.Format(L"%s - %s (%04x,%02x,%02x)", name, pStreamName, s.pid, s.pesid, s.ps1id); // TODO: make this nicer
+ else
+ str.Format(L"%s (%04x,%02x,%02x)", name, s.pid, s.pesid, s.ps1id); // TODO: make this nicer
+ }
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(DNew CMpegSplitterOutputPin(mts, str, this, this, &hr));
if (i == CMpegSplitterFile::subpic)
(static_cast<CMpegSplitterOutputPin*>(pPinOut.m_p))->SetMaxShift (_I64_MAX);
if(S_OK == AddOutputPin(s, pPinOut))
@@ -578,48 +962,6 @@ STDMETHODIMP CMpegSplitterFilter::Enable(long lIndex, DWORD dwFlags)
return S_FALSE;
}
-template <typename t_CType>
-t_CType GetFormatHelper(t_CType &_pInfo, const CMediaType *_pFormat)
-{
- ASSERT(_pFormat->cbFormat >= sizeof(*_pInfo));
- _pInfo = (t_CType)_pFormat->pbFormat;
- return _pInfo;
-}
-
-static int GetHighestBitSet32(unsigned long _Value)
-{
- unsigned long Ret;
- unsigned char bNonZero = _BitScanReverse(&Ret, _Value);
- if (bNonZero)
- return Ret;
- else
- return -1;
-}
-
-CString FormatBitrate(double _Bitrate)
-{
- CString Temp;
- if (_Bitrate > 20000000) // More than 2 mbit
- Temp.Format(L"%.2f mbit/s", double(_Bitrate)/1000000.0);
- else
- Temp.Format(L"%.1f kbit/s", double(_Bitrate)/1000.0);
-
- return Temp;
-}
-
-CString FormatString(const wchar_t *pszFormat, ... )
-{
- CString Temp;
- ATLASSERT( AtlIsValidString( pszFormat ) );
-
- va_list argList;
- va_start( argList, pszFormat );
- Temp.FormatV( pszFormat, argList );
- va_end( argList );
-
- return Temp;
-}
-
LONGLONG GetMediaTypeQuality(const CMediaType *_pMediaType, int _PresentationFormat)
{
if (_pMediaType->formattype == FORMAT_WaveFormatEx)
@@ -734,327 +1076,6 @@ bool CMpegSplitterFile::stream::operator < (const stream &_Other) const
return DefaultFirst < DefaultSecond;
}
-CString GetMediaTypeDesc(const CMediaType *_pMediaType, const CHdmvClipInfo::Stream *pClipInfo, int _PresentationType)
-{
- const WCHAR *pPresentationDesc = NULL;
-
- if (pClipInfo)
- pPresentationDesc = StreamTypeToName(pClipInfo->m_Type);
- else
- pPresentationDesc = StreamTypeToName((PES_STREAM_TYPE)_PresentationType);
-
- CString MajorType;
- CAtlList<CString> Infos;
-
- if (_pMediaType->majortype == MEDIATYPE_Video)
- {
- MajorType = "Video";
-
- if (pClipInfo)
- {
- CString name = ISO6392ToLanguage(pClipInfo->m_LanguageCode);
-
- if (!name.IsEmpty())
- Infos.AddTail(name);
- }
-
- const VIDEOINFOHEADER *pVideoInfo = NULL;
- const VIDEOINFOHEADER2 *pVideoInfo2 = NULL;
-
- if (_pMediaType->formattype == FORMAT_MPEGVideo)
- {
- Infos.AddTail(L"MPEG");
-
- const MPEG1VIDEOINFO *pInfo = GetFormatHelper(pInfo, _pMediaType);
-
- pVideoInfo = &pInfo->hdr;
-
- }
- else if (_pMediaType->formattype == FORMAT_MPEG2_VIDEO)
- {
- const MPEG2VIDEOINFO *pInfo = GetFormatHelper(pInfo, _pMediaType);
-
- pVideoInfo2 = &pInfo->hdr;
-
- bool bIsAVC = false;
-
- if (pInfo->hdr.bmiHeader.biCompression == '1CVA')
- {
- bIsAVC = true;
- Infos.AddTail(L"AVC (H.264)");
- }
- else if (pInfo->hdr.bmiHeader.biCompression == 0)
- Infos.AddTail(L"MPEG2");
- else
- {
- WCHAR Temp[5];
- memset(Temp, 0, sizeof(Temp));
- Temp[0] = (pInfo->hdr.bmiHeader.biCompression >> 0) & 0xFF;
- Temp[1] = (pInfo->hdr.bmiHeader.biCompression >> 0) & 0xFF;
- Temp[2] = (pInfo->hdr.bmiHeader.biCompression >> 0) & 0xFF;
- Temp[3] = (pInfo->hdr.bmiHeader.biCompression >> 0) & 0xFF;
- Infos.AddTail(Temp);
- }
-
- switch (pInfo->dwProfile)
- {
- case AM_MPEG2Profile_Simple: Infos.AddTail(L"Simple Profile"); break;
- case AM_MPEG2Profile_Main: Infos.AddTail(L"Main Profile"); break;
- case AM_MPEG2Profile_SNRScalable: Infos.AddTail(L"SNR Scalable Profile"); break;
- case AM_MPEG2Profile_SpatiallyScalable: Infos.AddTail(L"Spatially Scalable Profile"); break;
- case AM_MPEG2Profile_High: Infos.AddTail(L"High Profile"); break;
- default:
- if (pInfo->dwProfile)
- {
- if (bIsAVC)
- {
- switch (pInfo->dwProfile)
- {
- case 44: Infos.AddTail(L"CAVLC Profile"); break;
- case 66: Infos.AddTail(L"Baseline Profile"); break;
- case 77: Infos.AddTail(L"Main Profile"); break;
- case 88: Infos.AddTail(L"Extended Profile"); break;
- case 100: Infos.AddTail(L"High Profile"); break;
- case 110: Infos.AddTail(L"High 10 Profile"); break;
- case 122: Infos.AddTail(L"High 4:2:2 Profile"); break;
- case 244: Infos.AddTail(L"High 4:4:4 Profile"); break;
-
- default: Infos.AddTail(FormatString(L"Profile %d", pInfo->dwProfile)); break;
- }
- }
- else
- Infos.AddTail(FormatString(L"Profile %d", pInfo->dwProfile));
- }
- break;
- }
-
- switch (pInfo->dwLevel)
- {
- case AM_MPEG2Level_Low: Infos.AddTail(L"Low Level"); break;
- case AM_MPEG2Level_Main: Infos.AddTail(L"Main Level"); break;
- case AM_MPEG2Level_High1440: Infos.AddTail(L"High1440 Level"); break;
- case AM_MPEG2Level_High: Infos.AddTail(L"High Level"); break;
- default:
- if (pInfo->dwLevel)
- {
- if (bIsAVC)
- Infos.AddTail(FormatString(L"Level %1.1f", double(pInfo->dwLevel)/10.0));
- else
- Infos.AddTail(FormatString(L"Level %d", pInfo->dwLevel));
- }
- break;
- }
- }
- else if (_pMediaType->formattype == FORMAT_VIDEOINFO2)
- {
- const VIDEOINFOHEADER2 *pInfo = GetFormatHelper(pInfo, _pMediaType);
-
- pVideoInfo2 = pInfo;
- bool bIsVC1 = false;
-
- DWORD CodecType = pInfo->bmiHeader.biCompression;
- if (CodecType == '1CVW')
- {
- bIsVC1 = true;
- Infos.AddTail(L"VC-1");
- }
- else if (CodecType)
- {
- WCHAR Temp[5];
- memset(Temp, 0, sizeof(Temp));
- Temp[0] = (CodecType >> 0) & 0xFF;
- Temp[1] = (CodecType >> 0) & 0xFF;
- Temp[2] = (CodecType >> 0) & 0xFF;
- Temp[3] = (CodecType >> 0) & 0xFF;
- Infos.AddTail(Temp);
- }
- }
- else if (_pMediaType->subtype == MEDIASUBTYPE_DVD_SUBPICTURE)
- {
- Infos.AddTail(L"DVD Sub Picture");
- }
- else if (_pMediaType->subtype == MEDIASUBTYPE_SVCD_SUBPICTURE)
- {
- Infos.AddTail(L"SVCD Sub Picture");
- }
- else if (_pMediaType->subtype == MEDIASUBTYPE_CVD_SUBPICTURE)
- {
- Infos.AddTail(L"CVD Sub Picture");
- }
-
- if (pVideoInfo2)
- {
- if (pVideoInfo2->bmiHeader.biWidth && pVideoInfo2->bmiHeader.biHeight)
- Infos.AddTail(FormatString(L"%dx%d", pVideoInfo2->bmiHeader.biWidth, pVideoInfo2->bmiHeader.biHeight));
- if (pVideoInfo2->AvgTimePerFrame)
- Infos.AddTail(FormatString(L"%.3f fps", 10000000.0/double(pVideoInfo2->AvgTimePerFrame)));
- if (pVideoInfo2->dwBitRate)
- Infos.AddTail(FormatBitrate(pVideoInfo2->dwBitRate));
- }
- else if (pVideoInfo)
- {
- if (pVideoInfo->bmiHeader.biWidth && pVideoInfo->bmiHeader.biHeight)
- Infos.AddTail(FormatString(L"%dx%d", pVideoInfo->bmiHeader.biWidth, pVideoInfo->bmiHeader.biHeight));
- if (pVideoInfo->AvgTimePerFrame)
- Infos.AddTail(FormatString(L"%.3f fps", 10000000.0/double(pVideoInfo->AvgTimePerFrame)));
- if (pVideoInfo->dwBitRate)
- Infos.AddTail(FormatBitrate(pVideoInfo->dwBitRate));
- }
-
- }
- else if (_pMediaType->majortype == MEDIATYPE_Audio)
- {
- MajorType = "Audio";
- if (pClipInfo)
- {
- CString name = ISO6392ToLanguage(pClipInfo->m_LanguageCode);
- if (!name.IsEmpty())
- Infos.AddTail(name);
- }
- if (_pMediaType->formattype == FORMAT_WaveFormatEx)
- {
- const WAVEFORMATEX *pInfo = GetFormatHelper(pInfo, _pMediaType);
-
- if (_pMediaType->subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO)
- {
- Infos.AddTail(L"DVD LPCM");
- }
- else if (_pMediaType->subtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO)
- {
- const WAVEFORMATEX_HDMV_LPCM *pInfoHDMV = GetFormatHelper(pInfoHDMV, _pMediaType);
- UNUSED_ALWAYS(pInfoHDMV);
- Infos.AddTail(L"HDMV LPCM");
- }
- else
- {
- switch (pInfo->wFormatTag)
- {
- case WAVE_FORMAT_PS2_PCM:
- {
- Infos.AddTail(L"PS2 PCM");
- }
- break;
- case WAVE_FORMAT_PS2_ADPCM:
- {
- Infos.AddTail(L"PS2 ADPCM");
- }
- break;
- case WAVE_FORMAT_DVD_DTS:
- {
- if (pPresentationDesc)
- Infos.AddTail(pPresentationDesc);
- else
- Infos.AddTail(L"DTS");
- }
- break;
- case WAVE_FORMAT_DOLBY_AC3:
- {
- if (pPresentationDesc)
- Infos.AddTail(pPresentationDesc);
- else
- Infos.AddTail(L"Dolby Digital");
- }
- break;
- case WAVE_FORMAT_AAC:
- {
- Infos.AddTail(L"AAC");
- }
- break;
- case WAVE_FORMAT_MP3:
- {
- Infos.AddTail(L"MP3");
- }
- break;
- case WAVE_FORMAT_MPEG:
- {
- const MPEG1WAVEFORMAT* pInfoMPEG1 = GetFormatHelper(pInfoMPEG1, _pMediaType);
-
- int layer = GetHighestBitSet32(pInfoMPEG1->fwHeadLayer) + 1;
- Infos.AddTail(FormatString(L"MPEG1 - Layer %d", layer));
- }
- break;
- }
- }
-
- if (pClipInfo && (pClipInfo->m_SampleRate == BDVM_SampleRate_48_192 || pClipInfo->m_SampleRate == BDVM_SampleRate_48_96))
- {
- switch (pClipInfo->m_SampleRate)
- {
- case BDVM_SampleRate_48_192:
- Infos.AddTail(FormatString(L"192(48) kHz"));
- break;
- case BDVM_SampleRate_48_96:
- Infos.AddTail(FormatString(L"96(48) kHz"));
- break;
- }
- }
- else if (pInfo->nSamplesPerSec)
- Infos.AddTail(FormatString(L"%.1f kHz", double(pInfo->nSamplesPerSec)/1000.0));
- if (pInfo->nChannels)
- Infos.AddTail(FormatString(L"%d chn", pInfo->nChannels));
- if (pInfo->wBitsPerSample)
- Infos.AddTail(FormatString(L"%d bit", pInfo->wBitsPerSample));
- if (pInfo->nAvgBytesPerSec)
- Infos.AddTail(FormatBitrate(pInfo->nAvgBytesPerSec * 8));
-
- }
- }
- else if (_pMediaType->majortype == MEDIATYPE_Subtitle)
- {
- MajorType = "Subtitle";
-
- if (pPresentationDesc)
- Infos.AddTail(pPresentationDesc);
-
- if (_pMediaType->cbFormat == sizeof(SUBTITLEINFO))
- {
- const SUBTITLEINFO *pInfo = GetFormatHelper(pInfo, _pMediaType);
- CString name = ISO6392ToLanguage(pInfo->IsoLang);
-
- if (pInfo->TrackName[0])
- Infos.AddHead(pInfo->TrackName);
- if (!name.IsEmpty())
- Infos.AddHead(name);
- }
- else
- {
- if (pClipInfo)
- {
- CString name = ISO6392ToLanguage(pClipInfo->m_LanguageCode);
- if (!name.IsEmpty())
- Infos.AddHead(name);
- }
- }
- }
-
- if (!Infos.IsEmpty())
- {
- CString Ret;
-
- Ret += MajorType;
- Ret += " - ";
-
- bool bFirst = true;
-
- for(POSITION pos = Infos.GetHeadPosition(); pos; Infos.GetNext(pos))
- {
- CString& String = Infos.GetAt(pos);
-
- if (bFirst)
- Ret += String;
- else
- Ret += L", " + String;
-
- bFirst = false;
- }
-
- return Ret;
- }
- return CString();
-}
-
-
-
STDMETHODIMP CMpegSplitterFilter::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFlags, LCID* plcid, DWORD* pdwGroup, WCHAR** ppszName, IUnknown** ppObject, IUnknown** ppUnk)
{
for(int i = 0, j = 0; i < countof(m_pFile->m_streams); i++)