Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: DSPlayer/DSConfig.cpp
- ===================================================================
- --- DSPlayer/DSConfig.cpp (revision 27111)
- +++ DSPlayer/DSConfig.cpp (working copy)
- @@ -93,6 +93,17 @@
- CLog::Log(LOGDEBUG, "%s Looking for audio streams in %s splitter", __FUNCTION__, splitterName.c_str());
- + /* Regex to rename audio stream */
- + std::vector<CRegExp *> regex;
- +
- + CRegExp *reg = new CRegExp(true);
- + reg->RegComp("(.*?)(\\(audio.*?\\)|\\(subtitle.*?\\))"); // mkv source audio / subtitle
- + regex.push_back(reg);
- +
- + reg = new CRegExp(true);
- + reg->RegComp(".* - (.*),.*\\(.*\\)"); // mpeg source audio / subtitle
- + regex.push_back(reg);
- +
- /* Does the splitter support IAMStreamSelect ?*/
- HRESULT hr = m_pSplitter->QueryInterface(__uuidof(m_pIAMStreamSelect), (void **) &m_pIAMStreamSelect);
- if (SUCCEEDED(hr))
- @@ -107,7 +118,7 @@
- m_pIAMStreamSelect->Count(&nStreams);
- AM_MEDIA_TYPE * mediaType = NULL;
- - for(long i = 0; i < nStreams; i++)
- + for(int i = 0; i < nStreams; i++)
- {
- infos = new IAMStreamSelectInfos();
- infos->group = 0; infos->lcid = 0; infos->pObj = 0; infos->pUnk = 0; infos->flags = 0;
- @@ -116,13 +127,23 @@
- g_charsetConverter.wToUTF8(wname, infos->name);
- CoTaskMemFree(wname);
- + /* Apply regex */
- + for (std::vector<CRegExp *>::const_iterator it = regex.begin(); it != regex.end(); ++it)
- + {
- + if ( (*it)->RegFind(infos->name) > -1 )
- + {
- + infos->name = (*it)->GetMatch(1);
- + break;
- + }
- + }
- +
- if (mediaType->majortype == MEDIATYPE_Audio)
- {
- /* Audio stream */
- m_pAudioStreams.insert( std::pair<long, IAMStreamSelectInfos *>(i, infos) );
- CLog::Log(LOGNOTICE, "%s Audio stream found : %s", __FUNCTION__, infos->name.c_str());
- - } else if (mediaType->majortype == MEDIATYPE_Subtitle || mediaType->majortype == GUID_NULL)
- + } else if (mediaType->majortype == MEDIATYPE_Subtitle)
- {
- /* Embed subtitles */
- m_pEmbedSubtitles.insert( std::pair<long, IAMStreamSelectInfos *>(i, infos) );
- @@ -136,110 +157,119 @@
- // Enumerate output pins
- PIN_DIRECTION dir;
- - AM_MEDIA_TYPE mediaType;
- int i = 0, j = 0;
- - CStdStringW pinName;
- + CStdStringW pinNameW;
- + CStdString pinName;
- IAMStreamSelectInfos *infos;
- bool pinConnected = FALSE;
- bool audioPinAlreadyConnected = FALSE, subtitlePinAlreadyConnected = FALSE;
- - //the regex for removing the (audio #) in the name
- - CRegExp reAudioName(true);
- - reAudioName.RegComp("(.*?)(\\(audio.*?\\)\|\\(subtitle.*?\\))");
- + int nIn = 0, nOut = 0, nInC = 0, nOutC = 0;
- + DShowUtil::CountPins(m_pSplitter, nIn, nOut, nInC, nOutC);
- + CLog::Log(LOGDEBUG, "%s The splitter has %d output pins", __FUNCTION__, nOut);
- +
- BeginEnumPins(m_pSplitter, pEP, pPin)
- {
- if (SUCCEEDED(pPin->QueryDirection(&dir)) && ( dir == PINDIR_OUTPUT ))
- {
- - if (SUCCEEDED(pPin->ConnectionMediaType(&mediaType))
- - && ( mediaType.majortype == MEDIATYPE_Audio ))
- +
- + pinNameW = DShowUtil::GetPinName(pPin);
- + g_charsetConverter.wToUTF8(pinNameW, pinName);
- + CLog::Log(LOGDEBUG, "%s Output pin found : %s", __FUNCTION__, pinName.c_str());
- +
- + /* TODO: Ne pas utiliser ConnectionMediaType. Renvois false si la pin n'est pas connect� -> probl�me.
- + Utiliser BeginEnumMediaTypes comme en dessous pour TOUTES les pins */
- +
- + BeginEnumMediaTypes(pPin, pET, pMediaType)
- {
- - pinName = DShowUtil::GetPinName(pPin);
- -
- +
- + CLog::Log(LOGDEBUG, "%s Output pin major type : %s", __FUNCTION__, GuidNames[pMediaType->majortype]);
- + CLog::Log(LOGDEBUG, "%s Output pin sub type : %s", __FUNCTION__, GuidNames[pMediaType->subtype]);
- + CLog::Log(LOGDEBUG, "%s Output pin format type : %s", __FUNCTION__, GuidNames[pMediaType->formattype]);
- +
- + if (pMediaType->majortype != MEDIATYPE_Audio &&
- + pMediaType->majortype != MEDIATYPE_Subtitle)
- + continue;
- +
- infos = new IAMStreamSelectInfos();
- infos->group = 0; infos->lcid = 0; infos->pObj = 0; infos->pUnk = 0; infos->flags = 0;
- pinConnected = FALSE;
- - g_charsetConverter.wToUTF8(pinName, infos->name);
- - if ( reAudioName.RegFind(infos->name) > -1 )
- - {
- - // "English, 3/2 (Audio 1)" should be renamed to "English, 3/2" - Treat also subtitles
- - infos->name = reAudioName.GetMatch(1);
- - }
- + infos->name = pinName;
- - infos->pObj = pPin;
- -
- - if (SUCCEEDED(DShowUtil::IsPinConnected(pPin)))
- + /* Apply regex */
- + for (std::vector<CRegExp *>::const_iterator it = regex.begin(); it != regex.end(); ++it)
- {
- - if (audioPinAlreadyConnected)
- - { // Prevent multiple audio stream at the same time
- - IPin *pin = NULL;
- - pPin->ConnectedTo(&pin);
- - m_pGraphBuilder->Disconnect(pPin);
- - m_pGraphBuilder->Disconnect(pin);
- - SAFE_RELEASE(pin);
- - }
- - else
- + if ( (*it)->RegFind(infos->name) > -1 )
- {
- - infos->flags = AMSTREAMSELECTINFO_ENABLED;
- - audioPinAlreadyConnected = TRUE;
- + infos->name = (*it)->GetMatch(1);
- + break;
- }
- }
- - m_pAudioStreams.insert( std::pair<long, IAMStreamSelectInfos *>(i, infos) );
- - CLog::Log(LOGNOTICE, "%s Audio stream found : %s", __FUNCTION__, infos->name.c_str());
- - i++;
- + infos->pObj = pPin;
- - } else {
- -
- - BeginEnumMediaTypes(pPin, pET, pMediaType)
- + if (pMediaType->majortype == MEDIATYPE_Audio)
- {
- - if (pMediaType->majortype == MEDIATYPE_Subtitle)
- + if (SUCCEEDED(DShowUtil::IsPinConnected(pPin)))
- {
- - pinName = DShowUtil::GetPinName(pPin);
- -
- - infos = new IAMStreamSelectInfos();
- - infos->group = 0; infos->lcid = 0; infos->pObj = 0; infos->pUnk = 0; infos->flags = 0;
- - pinConnected = FALSE;
- -
- - g_charsetConverter.wToUTF8(pinName, infos->name);
- - if ( reAudioName.RegFind(infos->name) > -1 )
- + if (audioPinAlreadyConnected)
- + { // Prevent multiple audio stream at the same time
- + IPin *pin = NULL;
- + pPin->ConnectedTo(&pin);
- + m_pGraphBuilder->Disconnect(pPin);
- + m_pGraphBuilder->Disconnect(pin);
- + SAFE_RELEASE(pin);
- + }
- + else
- {
- - // "English, 3/2 (Audio 1)" should be renamed to "English, 3/2" - Treat also subtitles
- - infos->name = reAudioName.GetMatch(1);
- + infos->flags = AMSTREAMSELECTINFO_ENABLED;
- + audioPinAlreadyConnected = TRUE;
- }
- + }
- - infos->pObj = pPin;
- + m_pAudioStreams.insert( std::pair<long, IAMStreamSelectInfos *>(i, infos) );
- + CLog::Log(LOGNOTICE, "%s Audio stream found : %s", __FUNCTION__, infos->name.c_str());
- + i++;
- + } else {
- - if (SUCCEEDED(DShowUtil::IsPinConnected(pPin)))
- + if (SUCCEEDED(DShowUtil::IsPinConnected(pPin)))
- + {
- + if (subtitlePinAlreadyConnected)
- + { // Prevent multiple audio stream at the same time
- + IPin *pin = NULL;
- + pPin->ConnectedTo(&pin);
- + m_pGraphBuilder->Disconnect(pPin);
- + m_pGraphBuilder->Disconnect(pin);
- + SAFE_RELEASE(pin);
- + }
- + else
- {
- - if (subtitlePinAlreadyConnected)
- - { // Prevent multiple audio stream at the same time
- - IPin *pin = NULL;
- - pPin->ConnectedTo(&pin);
- - m_pGraphBuilder->Disconnect(pPin);
- - m_pGraphBuilder->Disconnect(pin);
- - SAFE_RELEASE(pin);
- - }
- - else
- - {
- - infos->flags = AMSTREAMSELECTINFO_ENABLED;
- - subtitlePinAlreadyConnected = TRUE;
- - }
- + infos->flags = AMSTREAMSELECTINFO_ENABLED;
- + subtitlePinAlreadyConnected = TRUE;
- }
- + }
- - m_pEmbedSubtitles.insert( std::pair<long, IAMStreamSelectInfos *>(j, infos) );
- - CLog::Log(LOGNOTICE, "%s Embed subtitle found : %s", __FUNCTION__, infos->name.c_str());
- - j++;
- - }
- + m_pEmbedSubtitles.insert( std::pair<long, IAMStreamSelectInfos *>(j, infos) );
- + CLog::Log(LOGNOTICE, "%s Embed subtitle found : %s", __FUNCTION__, infos->name.c_str());
- + j++;
- +
- }
- - EndEnumMediaTypes(pMediaType)
- }
- - DeleteMediaType(&mediaType);
- + EndEnumMediaTypes(pMediaType)
- }
- }
- EndEnumPins
- }
- +
- + /* Delete regex */
- + while (! regex.empty())
- + {
- + delete regex.back();
- + regex.pop_back();
- + }
- +
- return false;
- }
- @@ -277,6 +307,8 @@
- if ( (*it).second->flags == AMSTREAMSELECTINFO_ENABLED)
- return i;
- }
- +
- + return -1;
- }
- void CDSConfig::GetAudioStreamName(int iStream, CStdString &strStreamName)
- @@ -335,6 +367,8 @@
- if ( (*it).second->flags == AMSTREAMSELECTINFO_ENABLED)
- return i;
- }
- +
- + return -1;
- }
- void CDSConfig::GetSubtitleName(int iStream, CStdString &strStreamName)
- Index: DSPlayer/DSGraph.cpp
- ===================================================================
- --- DSPlayer/DSGraph.cpp (revision 27111)
- +++ DSPlayer/DSGraph.cpp (working copy)
- @@ -96,8 +96,7 @@
- hr = m_pGraphBuilder->QueryInterface(__uuidof(m_pMediaControl),(void **)&m_pMediaControl);
- hr = m_pGraphBuilder->QueryInterface(__uuidof(m_pMediaEvent),(void **)&m_pMediaEvent);
- hr = m_pGraphBuilder->QueryInterface(__uuidof(m_pBasicAudio),(void **)&m_pBasicAudio);
- - hr = m_pGraphBuilder->QueryInterface(__uuidof(m_pBasicVideo),(void **)&m_pBasicVideo);
- -
- + hr = m_pGraphBuilder->QueryInterface(__uuidof(m_pBasicVideo),(void **)&m_pBasicVideo);
- LONGLONG tmestamp;
- tmestamp = CTimeUtils::GetTimeMS();
- Index: DSPlayer/DSPlayer.cpp
- ===================================================================
- --- DSPlayer/DSPlayer.cpp (revision 27111)
- +++ DSPlayer/DSPlayer.cpp (working copy)
- @@ -43,7 +43,6 @@
- {
- m_hReadyEvent = CreateEvent(NULL, true, false, NULL);
- m_bAbortRequest = false;
- -
- }
- CDSPlayer::~CDSPlayer()
- Index: DSPlayer/FGLoader.cpp
- ===================================================================
- --- DSPlayer/FGLoader.cpp (revision 27111)
- +++ DSPlayer/FGLoader.cpp (working copy)
- @@ -195,7 +195,7 @@
- HRESULT CFGLoader::InsertVideoDecoder(TiXmlElement *pRule)
- {
- HRESULT hr = S_OK;
- - IBaseFilter* ppBF;
- + IBaseFilter* ppBF = NULL;
- for (list<CFGFilterFile*>::iterator it = m_configFilter.begin(); it != m_configFilter.end(); it++)
- {
- if ( ((CStdString)pRule->Attribute("videodec")).Equals((*it)->GetXFilterName().c_str(),false) )
- Index: DSPlayer/Filters/EVRPresentEngine.cpp
- ===================================================================
- --- DSPlayer/Filters/EVRPresentEngine.cpp (revision 27111)
- +++ DSPlayer/Filters/EVRPresentEngine.cpp (working copy)
- @@ -185,12 +185,29 @@
- SAFE_DELETE(m_pVideoTexture);
- m_pVideoTexture = new CD3DTexture();
- -
- +
- + D3DFORMAT d3dFormat;
- + GUID subtype = GUID_NULL;
- + /* Get D3DFORMAT from MEDIA_SubType*/
- +
- + pFormat->GetGUID(MF_MT_SUBTYPE, & subtype);
- +
- + if (subtype == MFVideoFormat_RGB565)
- + d3dFormat = D3DFMT_R5G6B5;
- + else if (subtype == MFVideoFormat_RGB555)
- + d3dFormat = D3DFMT_X1R5G5B5;
- + else if (subtype == MFVideoFormat_RGB24)
- + d3dFormat = D3DFMT_R8G8B8;
- + else if (subtype == MFVideoFormat_ARGB32)
- + d3dFormat = D3DFMT_A8R8G8B8;
- + else
- + d3dFormat = D3DFMT_X8R8G8B8;
- +
- if (!m_pVideoTexture->Create(m_iVideoWidth ,
- m_iVideoHeight ,
- 1 ,
- D3DUSAGE_RENDERTARGET,
- - D3DFMT_X8R8G8B8,
- + d3dFormat,
- D3DPOOL_DEFAULT))
- {
- CLog::Log(LOGERROR,"%s Error while creating the video texture",__FUNCTION__);
- @@ -206,7 +223,7 @@
- m_iVideoHeight ,
- 1 ,
- D3DUSAGE_RENDERTARGET ,
- - D3DFMT_X8R8G8B8 ,
- + d3dFormat ,
- D3DPOOL_DEFAULT ,
- &m_pInternalVideoTexture[i] ,
- NULL);
Advertisement
Add Comment
Please, Sign In to add comment