Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: DSConfig.cpp
- ===================================================================
- --- DSConfig.cpp (revision 27106)
- +++ 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) );
- @@ -138,32 +159,52 @@
- 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());
- + ZeroMemory(&mediaType, sizeof(mediaType));
- +
- + if (SUCCEEDED(pPin->ConnectionMediaType(&mediaType)))
- {
- - pinName = DShowUtil::GetPinName(pPin);
- + CLog::Log(LOGDEBUG, "%s Output pin major type : %s", __FUNCTION__, GuidNames[mediaType.majortype]);
- + CLog::Log(LOGDEBUG, "%s Output pin sub type : %s", __FUNCTION__, GuidNames[mediaType.subtype]);
- + CLog::Log(LOGDEBUG, "%s Output pin format type : %s", __FUNCTION__, GuidNames[mediaType.formattype]);
- + } else {
- + CLog::Log(LOGDEBUG, "%s ConnectionMediaType failed", __FUNCTION__);
- + }
- +
- + if (mediaType.majortype == MEDIATYPE_Audio)
- + {
- 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 )
- + infos->name = pinName;
- +
- + /* Apply regex */
- + for (std::vector<CRegExp *>::const_iterator it = regex.begin(); it != regex.end(); ++it)
- {
- - // "English, 3/2 (Audio 1)" should be renamed to "English, 3/2" - Treat also subtitles
- - infos->name = reAudioName.GetMatch(1);
- + if ( (*it)->RegFind(infos->name) > -1 )
- + {
- + infos->name = (*it)->GetMatch(1);
- + break;
- + }
- }
- infos->pObj = pPin;
- @@ -202,10 +243,15 @@
- pinConnected = FALSE;
- g_charsetConverter.wToUTF8(pinName, infos->name);
- - if ( reAudioName.RegFind(infos->name) > -1 )
- +
- + /* Apply regex */
- + for (std::vector<CRegExp *>::const_iterator it = regex.begin(); it != regex.end(); ++it)
- {
- - // "English, 3/2 (Audio 1)" should be renamed to "English, 3/2" - Treat also subtitles
- - infos->name = reAudioName.GetMatch(1);
- + if ( (*it)->RegFind(infos->name) > -1 )
- + {
- + infos->name = (*it)->GetMatch(1);
- + break;
- + }
- }
- infos->pObj = pPin;
- @@ -240,6 +286,14 @@
- }
- EndEnumPins
- }
- +
- + /* Delete regex */
- + while (! regex.empty())
- + {
- + delete regex.back();
- + regex.pop_back();
- + }
- +
- return false;
- }
- @@ -277,6 +331,8 @@
- if ( (*it).second->flags == AMSTREAMSELECTINFO_ENABLED)
- return i;
- }
- +
- + return -1;
- }
- void CDSConfig::GetAudioStreamName(int iStream, CStdString &strStreamName)
- @@ -335,6 +391,8 @@
- if ( (*it).second->flags == AMSTREAMSELECTINFO_ENABLED)
- return i;
- }
- +
- + return -1;
- }
- void CDSConfig::GetSubtitleName(int iStream, CStdString &strStreamName)
- Index: DSGraph.cpp
- ===================================================================
- --- DSGraph.cpp (revision 27106)
- +++ 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.cpp
- ===================================================================
- --- DSPlayer.cpp (revision 27106)
- +++ DSPlayer.cpp (working copy)
- @@ -43,7 +43,6 @@
- {
- m_hReadyEvent = CreateEvent(NULL, true, false, NULL);
- m_bAbortRequest = false;
- -
- }
- CDSPlayer::~CDSPlayer()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement