diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-03-23 21:38:17 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-03-23 21:38:17 +0300 |
commit | 463b4d1de1a5c2fd7c59f49308bddccf3008ce5b (patch) | |
tree | 5c124d80234b1124e8268d6032753c8f9025a688 /src/apps | |
parent | 6d31e0852d3274826b573034160bc34765ca01a0 (diff) |
Various DVB fixes and improvements:
- Now the channel's name is shown in the OSD for a few seconds
- Switching channels is cleaner (and quite faster in some cases)
- Fixed some channels could not be found during scan
- Fixed error when creating and connecting DVB_EPG stream for Mpeg2Demux
Patch by XPC
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1763 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/apps')
-rw-r--r-- | src/apps/mplayerc/FGManagerBDA.cpp | 47 | ||||
-rw-r--r-- | src/apps/mplayerc/FGManagerBDA.h | 1 | ||||
-rw-r--r-- | src/apps/mplayerc/MainFrm.cpp | 24 | ||||
-rw-r--r-- | src/apps/mplayerc/MainFrm.h | 3 |
4 files changed, 55 insertions, 20 deletions
diff --git a/src/apps/mplayerc/FGManagerBDA.cpp b/src/apps/mplayerc/FGManagerBDA.cpp index f3c384ee3..7155e1e1f 100644 --- a/src/apps/mplayerc/FGManagerBDA.cpp +++ b/src/apps/mplayerc/FGManagerBDA.cpp @@ -76,6 +76,7 @@ static const AM_MEDIA_TYPE mt_Mpv = { };
#define FCC_h264 MAKEFOURCC('h', '2', '6', '4')
+#define MS_NETWORK_PROVIDER "Microsoft Network Provider"
/// Format, Vidéo H264
static const VIDEOINFOHEADER2 vih2_H264 = {
@@ -402,6 +403,8 @@ STDMETHODIMP CFGManagerBDA::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayL // Create Mpeg2 demux
CheckAndLog (CreateMicrosoftDemux (pReceiver, pMpeg2Demux), "BDA : Microsoft demux creation");
+ if (s.BDANetworkProvider.Find(_T(MS_NETWORK_PROVIDER), 0) != -1)
+ m_BDANetworkProvider = _T(MS_NETWORK_PROVIDER);
return S_OK;
}
@@ -515,7 +518,8 @@ STDMETHODIMP CFGManagerBDA::Enable(long lIndex, DWORD dwFlags) if (pStream && pStreamInfo)
{
nState = GetState();
- SwitchStream (m_nCurAudioType, pStreamInfo->Type);
+ if (m_nCurAudioType != pStreamInfo->Type)
+ SwitchStream (m_nCurAudioType, pStreamInfo->Type);
pStream->Map (pStreamInfo->PID);
ChangeState ((FILTER_STATE)nState);
@@ -627,18 +631,21 @@ HRESULT CFGManagerBDA::CreateMicrosoftDemux(IBaseFilter* pReceiver, CComPtr<IBas DVB_STREAM_TYPE nType = m_DVBStreams.GetNextKey(pos);
CDVBStream& Stream = m_DVBStreams[nType];
- if (!Stream.GetFindExisting() ||
- (pPin = FindPin (pMpeg2Demux, PINDIR_OUTPUT, Stream.GetMediaType())) == NULL)
- {
- CheckNoLog (pDemux->CreateOutputPin ((AM_MEDIA_TYPE*)Stream.GetMediaType(), Stream.GetName(), &pPin));
- }
- CheckNoLog (Connect (pPin, NULL, false));
- Stream.SetPin (pPin);
+ if (nType != DVB_EPG) // Hack: DVB_EPG stream is identical to DVB_TIF and cannot be connected !!!
+ {
+ if (!Stream.GetFindExisting() ||
+ (pPin = FindPin (pMpeg2Demux, PINDIR_OUTPUT, Stream.GetMediaType())) == NULL)
+ {
+ CheckNoLog (pDemux->CreateOutputPin ((AM_MEDIA_TYPE*)Stream.GetMediaType(), Stream.GetName(), &pPin));
+ }
+ CheckNoLog (Connect (pPin, NULL, false));
+ Stream.SetPin (pPin);
- // Complete graph for one audio stream and one video stream (using standard graph builder rules)
- if (nType == m_nCurVideoType || nType == m_nCurAudioType)
- {
- Connect (GetFirstDisconnectedPin (Stream.GetFilter(), PINDIR_OUTPUT), NULL);
+ // Complete graph for one audio stream and one video stream (using standard graph builder rules)
+ if (nType == m_nCurVideoType || nType == m_nCurAudioType)
+ {
+ Connect (GetFirstDisconnectedPin (Stream.GetFilter(), PINDIR_OUTPUT), NULL);
+ }
}
}
@@ -648,19 +655,20 @@ HRESULT CFGManagerBDA::CreateMicrosoftDemux(IBaseFilter* pReceiver, CComPtr<IBas HRESULT CFGManagerBDA::SetChannelInternal (CDVBChannel* pChannel)
{
- HRESULT hr;
- ULONG ulCurFreq;
- FILTER_STATE nState;
-
- nState = GetState();
+ HRESULT hr;
+ ULONG ulCurFreq;
+ int nState = GetState();
+ if (m_BDANetworkProvider == MS_NETWORK_PROVIDER)
+ ChangeState (State_Stopped); // Only stops when using Microsoft Network Provider
SwitchStream (m_nCurVideoType, pChannel->GetVideoType());
SwitchStream (m_nCurAudioType, pChannel->GetDefaultAudioType());
- ChangeState ((FILTER_STATE)nState);
CheckNoLog (SetFrequency (pChannel->GetFrequency()));
CheckNoLog (m_DVBStreams[m_nCurVideoType].Map (pChannel->GetVideoPID()));
CheckNoLog (m_DVBStreams[m_nCurAudioType].Map (pChannel->GetDefaultAudioPID()));
+ if (GetState() == State_Stopped)
+ ChangeState ((FILTER_STATE)nState);
// TODO : remove sub later!
// CheckNoLog (m_DVBStreams[DVB_SUB].Map (pChannel->GetDefaultSubtitlePID()));
@@ -679,7 +687,8 @@ HRESULT CFGManagerBDA::SwitchStream (DVB_STREAM_TYPE& nOldType, DVB_STREAM_TYPE CComPtr<IPin> pInPin;
CComPtr<IPin> pNewOut = GetFirstPin (pFGNew, PINDIR_OUTPUT);
- ChangeState (State_Stopped);
+ if (GetState() != State_Stopped)
+ ChangeState (State_Stopped);
pOldOut->ConnectedTo(&pInPin);
Disconnect (pOldOut);
Disconnect (pInPin);
diff --git a/src/apps/mplayerc/FGManagerBDA.h b/src/apps/mplayerc/FGManagerBDA.h index 167141eac..cd50b1c30 100644 --- a/src/apps/mplayerc/FGManagerBDA.h +++ b/src/apps/mplayerc/FGManagerBDA.h @@ -154,6 +154,7 @@ private : DVB_STREAM_TYPE m_nCurVideoType;
DVB_STREAM_TYPE m_nCurAudioType;
+ CString m_BDANetworkProvider;
HRESULT CreateKSFilter(IBaseFilter** ppBF, CLSID KSCategory, CStringW& DisplayName);
HRESULT ConnectFilters(IBaseFilter* pOutFiter, IBaseFilter* pInFilter);
diff --git a/src/apps/mplayerc/MainFrm.cpp b/src/apps/mplayerc/MainFrm.cpp index cb4b83dc4..d0cebcd9c 100644 --- a/src/apps/mplayerc/MainFrm.cpp +++ b/src/apps/mplayerc/MainFrm.cpp @@ -6110,7 +6110,10 @@ void CMainFrame::OnPlayPlay() {
CComQIPtr<IBDATuner> pTun = pGB;
if (pTun)
+ {
pTun->SetChannel (AfxGetAppSettings().DVBLastChannel);
+ DisplayCurrentChannelOSD();
+ }
}
}
@@ -7315,12 +7318,14 @@ void CMainFrame::OnNavigateSkip(UINT nID) if(nID == ID_NAVIGATE_SKIPBACK)
{
pTun->SetChannel (nCurrentChannel - 1);
+ DisplayCurrentChannelOSD();
if (m_wndNavigationBar.IsVisible())
m_wndNavigationBar.m_navdlg.UpdatePos(nCurrentChannel - 1);
}
else if(nID == ID_NAVIGATE_SKIPFORWARD)
{
pTun->SetChannel (nCurrentChannel + 1);
+ DisplayCurrentChannelOSD();
if (m_wndNavigationBar.IsVisible())
m_wndNavigationBar.m_navdlg.UpdatePos(nCurrentChannel + 1);
}
@@ -7524,6 +7529,7 @@ void CMainFrame::OnNavigateChapters(UINT nID) if (pTun)
{
pTun->SetChannel (nID);
+ DisplayCurrentChannelOSD();
if (m_wndNavigationBar.IsVisible())
m_wndNavigationBar.m_navdlg.UpdatePos(nID);
}
@@ -10455,7 +10461,7 @@ void CMainFrame::DoTunerScan(TunerScanData* pTSD) LONG lQuality;
int nProgress;
m_bStopTunerScan = false;
- for(ULONG ulFrequency = pTSD->FrequencyStart; ulFrequency<pTSD->FrequencyStop; ulFrequency += pTSD->Bandwidth)
+ for(ULONG ulFrequency = pTSD->FrequencyStart; ulFrequency <= pTSD->FrequencyStop; ulFrequency += pTSD->Bandwidth)
{
pTun->SetFrequency (ulFrequency);
Sleep (200);
@@ -12605,6 +12611,22 @@ void CMainFrame::StopTunerScan() m_bStopTunerScan = true;
}
+void CMainFrame::DisplayCurrentChannelOSD()
+{
+ AppSettings& s = AfxGetAppSettings();
+ CDVBChannel* pChannel = s.FindChannelByPref(s.DVBLastChannel);
+ CString osd;
+ CString strDescription;
+ int i = osd.Find(_T("\n"));
+
+ if (pChannel != NULL)
+ {
+ osd = pChannel->GetName();
+ if(i > 0) osd.Delete(i, osd.GetLength()-i);
+ m_OSD.DisplayMessage(OSD_TOPLEFT, osd ,2000);
+ }
+}
+
//
// CGraphThread
//
diff --git a/src/apps/mplayerc/MainFrm.h b/src/apps/mplayerc/MainFrm.h index 211e9b7a5..c5feaa02f 100644 --- a/src/apps/mplayerc/MainFrm.h +++ b/src/apps/mplayerc/MainFrm.h @@ -466,6 +466,9 @@ public: virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
virtual void RecalcLayout(BOOL bNotify = TRUE);
+ // Dvb capture
+ void DisplayCurrentChannelOSD();
+
// Implementation
public:
virtual ~CMainFrame();
|