[Dsmyth-checkins] MythTVReader/MythSource MythSource.idl,1.6,1.7 MythSource.rc,1.10,1.11 MythSourceF
Brought to you by:
tobbej
From: Torbjörn J. <to...@us...> - 2004-08-02 19:15:28
|
Update of /cvsroot/dsmyth/MythTVReader/MythSource In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10750 Modified Files: MythSource.idl MythSource.rc MythSourceFilter.cpp MythSourceFilter.h MythSourcePage.cpp MythSourcePage.h RecordedProgramsPage.h RemoteEncoder.cpp RemoteEncoder.h resource.h Log Message: added functions to get current channel information (used with livetv). new status propertypage with channel changing support. i hope i didn't break backwards compatibility with the idl file changes. Index: MythSource.idl =================================================================== RCS file: /cvsroot/dsmyth/MythTVReader/MythSource/MythSource.idl,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** MythSource.idl 27 Feb 2004 18:42:36 -0000 1.6 --- MythSource.idl 2 Aug 2004 19:15:15 -0000 1.7 *************** *** 18,21 **** --- 18,26 ---- }PositionMap; + const LONG CHANNEL_DIRECTION_UP=0; + const LONG CHANNEL_DIRECTION_DOWN=1; + const LONG CHANNEL_DIRECTION_FAVORITE=2; + const LONG CHANNEL_DIRECTION_SAME=3; + [ helpstring("PlaybackState enumeration") *************** *** 50,53 **** --- 55,70 ---- [ + uuid(C7B32760-BA15-4320-9E25-14DC6218FEF9), + pointer_default(unique), + helpstring("IMythSource2 Interface") + ] + interface IMythSource2 : IMythSouce + { + [helpstring("method GetInputName")] HRESULT GetInputName([in,out] CHAR** ppszInputName); + [helpstring("method GetChannelInfo")] HRESULT GetChannelInfo([in,out] WCHAR** title, [in,out] WCHAR** subtitle, [in,out] WCHAR** desc, [in,out] WCHAR** category, [in,out] WCHAR** starttime, [in,out] WCHAR** endtime, [in,out] WCHAR** callsign, [in,out] WCHAR** iconpath, [in,out] WCHAR** channelname, [in,out] WCHAR** chanid, [in,out] WCHAR** seriesid, [in,out] WCHAR** programid, [in,out] WCHAR** outputFilters); + }; + + + [ uuid(A10292A3-CE95-4DF3-B6AA-45F71F018722), version(1.0), *************** *** 64,67 **** --- 81,85 ---- { [default] interface IUnknown; + interface IMythSource2; }; [ Index: MythSourcePage.h =================================================================== RCS file: /cvsroot/dsmyth/MythTVReader/MythSource/MythSourcePage.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MythSourcePage.h 29 Dec 2003 21:49:37 -0000 1.2 --- MythSourcePage.h 2 Aug 2004 19:15:15 -0000 1.3 *************** *** 21,24 **** --- 21,29 ---- // // $Log$ + // Revision 1.3 2004/08/02 19:15:15 tobbej + // added functions to get current channel information (used with livetv). + // new status propertypage with channel changing support. + // i hope i didn't break backwards compatibility with the idl file changes. + // // Revision 1.2 2003/12/29 21:49:37 tobbej // no message *************** *** 40,44 **** /** ! * CMythSourcePage */ class ATL_NO_VTABLE CMythSourcePage : --- 45,49 ---- /** ! * A Status propertypage. */ class ATL_NO_VTABLE CMythSourcePage : *************** *** 76,79 **** --- 81,85 ---- // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); + STDMETHOD(SetObjects)(ULONG nObjects, IUnknown **ppUnk); STDMETHOD(Apply)(void); STDMETHOD(Activate)(HWND hWndParent, LPCRECT pRect, BOOL bModal); *************** *** 81,85 **** private: ! CComPtr<IMythSouce> m_MythSource; }; --- 87,98 ---- private: ! void UpdateDialog(); ! void ChangeChannel(LONG direction); ! CAtlString GetErrorMsg(HRESULT hr); ! ! CComPtr<IMythSource2> m_pMythSource2; ! CComPtr<IBaseFilter> m_pFilter; ! CComPtr<IGraphBuilder> m_pBuilder; ! CComPtr<IMediaControl> m_pMediaControl; }; Index: MythSourcePage.cpp =================================================================== RCS file: /cvsroot/dsmyth/MythTVReader/MythSource/MythSourcePage.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MythSourcePage.cpp 22 Nov 2003 11:13:41 -0000 1.1 --- MythSourcePage.cpp 2 Aug 2004 19:15:15 -0000 1.2 *************** *** 21,24 **** --- 21,29 ---- // // $Log$ + // Revision 1.2 2004/08/02 19:15:15 tobbej + // added functions to get current channel information (used with livetv). + // new status propertypage with channel changing support. + // i hope i didn't break backwards compatibility with the idl file changes. + // // Revision 1.1 2003/11/22 11:13:41 tobbej // added a propertypage for debuging *************** *** 53,71 **** } HRESULT CMythSourcePage::Activate(HWND hWndParent, LPCRECT pRect, BOOL bModal) { ! if(m_nObjects>0) { ! HRESULT hr=m_ppUnk[0]->QueryInterface(IID_IMythSouce,(void**)&m_MythSource); ! if(FAILED(hr)) { ! return hr; } } ! else { ! return E_FAIL; } - return IPropertyPageImpl<CMythSourcePage>::Activate(hWndParent,pRect,bModal); } --- 58,210 ---- } + HRESULT CMythSourcePage::SetObjects(ULONG nObjects, IUnknown **ppUnk) + { + HRESULT hr=IPropertyPageImpl<CMythSourcePage>::SetObjects(nObjects,ppUnk); + if(SUCCEEDED(hr)) + { + if(m_nObjects>0) + { + HRESULT hr=m_ppUnk[0]->QueryInterface(IID_IMythSource2,(void**)&m_pMythSource2); + if(FAILED(hr)) + { + return hr; + } + + hr=m_pMythSource2.QueryInterface(&m_pFilter); + if(FAILED(hr)) + { + return hr; + } + + FILTER_INFO info; + ZeroMemory(&info,sizeof(info)); + hr=m_pFilter->QueryFilterInfo(&info); + if(FAILED(hr) ||info.pGraph==NULL) + { + return hr; + } + + hr=info.pGraph->QueryInterface(IID_IMediaControl,(void**)&m_pMediaControl); + if(FAILED(hr)) + { + return hr; + } + + hr=info.pGraph->QueryInterface(IID_IGraphBuilder,(void**)&m_pBuilder); + if(FAILED(hr)) + { + return hr; + } + info.pGraph->Release(); + info.pGraph=NULL; + + } + else + { + return E_FAIL; + } + } + return hr; + } + HRESULT CMythSourcePage::Activate(HWND hWndParent, LPCRECT pRect, BOOL bModal) { ! HRESULT hr=IPropertyPageImpl<CMythSourcePage>::Activate(hWndParent,pRect,bModal); ! if(SUCCEEDED(hr)) { ! UpdateDialog(); ! } ! return hr; ! } ! ! void CMythSourcePage::UpdateDialog() ! { ! SetDlgItemText(IDC_MYTHSOURCEPAGE_INPUTNAME,_T("Unknown")); ! SetDlgItemText(IDC_MYTHSOURCEPAGE_STATUS,_T("Unknown")); ! SetDlgItemText(IDC_MYTHSOURCEPAGE_CHANNEL,_T("")); ! SetDlgItemText(IDC_MYTHSOURCEPAGE_TITLE,_T("")); ! SetDlgItemText(IDC_MYTHSOURCEPAGE_SUBTITLE,_T("")); ! SetDlgItemText(IDC_MYTHSOURCEPAGE_CATEGORY,_T("")); ! SetDlgItemText(IDC_MYTHSOURCEPAGE_CALLSIGN,_T("")); ! SetDlgItemText(IDC_MYTHSOURCEPAGE_DESCRIPTION,_T("")); ! ! PlaybackState state=(PlaybackState)-1; ! HRESULT hr1=m_pMythSource2->GetState(&state); ! if(SUCCEEDED(hr1)) ! { ! switch(state) { ! case PlaybackState_Stopped: ! SetDlgItemText(IDC_MYTHSOURCEPAGE_STATUS,_T("Stopped")); ! break; ! case PlaybackState_PlayingFile: ! SetDlgItemText(IDC_MYTHSOURCEPAGE_STATUS,_T("Playing a file")); ! break; ! case PlaybackState_PlayingRecording: ! SetDlgItemText(IDC_MYTHSOURCEPAGE_STATUS,_T("Playing recording while it is being recorded")); ! break; ! case PlaybackState_PlayingLiveTV: ! SetDlgItemText(IDC_MYTHSOURCEPAGE_STATUS,_T("Watching LiveTV")); ! break; } } ! ! if(state==PlaybackState_PlayingLiveTV || state==PlaybackState_PlayingRecording) { ! CHAR *pszName=NULL; ! hr1=m_pMythSource2->GetInputName(&pszName); ! if(SUCCEEDED(hr1)) ! { ! SetDlgItemText(IDC_MYTHSOURCEPAGE_INPUTNAME,pszName); ! CoTaskMemFree(pszName); ! pszName=NULL; ! } ! WCHAR *pTitle=NULL; ! WCHAR *pSubtitle=NULL; ! WCHAR *pCategory=NULL; ! WCHAR *pChannelName=NULL; ! WCHAR *pCallSign=NULL; ! WCHAR *pDescription=NULL; ! hr1=m_pMythSource2->GetChannelInfo(&pTitle,&pSubtitle,&pDescription,&pCategory,NULL,NULL,&pCallSign,NULL,&pChannelName,NULL,NULL,NULL,NULL); ! if(SUCCEEDED(hr1)) ! { ! if(pTitle!=NULL) ! { ! SetDlgItemText(IDC_MYTHSOURCEPAGE_TITLE,CW2A(pTitle)); ! CoTaskMemFree(pTitle); ! pTitle=NULL; ! } ! if(pSubtitle!=NULL) ! { ! SetDlgItemText(IDC_MYTHSOURCEPAGE_SUBTITLE,CW2A(pSubtitle)); ! CoTaskMemFree(pSubtitle); ! pSubtitle=NULL; ! } ! if(pCategory!=NULL) ! { ! SetDlgItemText(IDC_MYTHSOURCEPAGE_CATEGORY,CW2A(pCategory)); ! CoTaskMemFree(pCategory); ! pCategory=NULL; ! } ! if(pChannelName!=NULL) ! { ! SetDlgItemText(IDC_MYTHSOURCEPAGE_CHANNEL,CW2A(pChannelName)); ! CoTaskMemFree(pChannelName); ! pChannelName=NULL; ! } ! if(pCallSign!=NULL) ! { ! SetDlgItemText(IDC_MYTHSOURCEPAGE_CALLSIGN,CW2A(pCallSign)); ! CoTaskMemFree(pCallSign); ! pCallSign=NULL; ! } ! if(pDescription!=NULL) ! { ! SetDlgItemText(IDC_MYTHSOURCEPAGE_DESCRIPTION,CW2A(pDescription)); ! CoTaskMemFree(pDescription); ! pDescription=NULL; ! } ! } } } *************** *** 90,100 **** if(pNMUpDown->iDelta>0) { ! m_MythSource->ChangeChannel(0); } else if(pNMUpDown->iDelta<0) { ! m_MythSource->ChangeChannel(1); } ! return 0; } --- 229,327 ---- if(pNMUpDown->iDelta>0) { ! ChangeChannel(CHANNEL_DIRECTION_DOWN); } else if(pNMUpDown->iDelta<0) { ! ChangeChannel(CHANNEL_DIRECTION_UP); } ! UpdateDialog(); return 0; } + + void CMythSourcePage::ChangeChannel(LONG direction) + { + CAtlString msg; + + //make sure the graph is stopped. + FILTER_STATE state; + HRESULT hr=m_pMediaControl->GetState(5000,(OAFilterState*)&state); + if(hr!=S_OK) + { + msg.Format(_T("Unable to determine filter state\n%s"),(LPCTSTR)GetErrorMsg(hr)); + MessageBox(msg,_T("Error"),MB_OK|MB_ICONERROR); + return; + } + + if(state!=State_Stopped) + { + hr=m_pMediaControl->Stop(); + if(FAILED(hr)) + { + msg.Format(_T("IMediaControl::Stop failed\n%s"),(LPCTSTR)GetErrorMsg(hr)); + MessageBox(msg,_T("Error"),MB_OK|MB_ICONERROR); + return; + } + } + + + hr=m_pMythSource2->ChangeChannel(direction); + if(SUCCEEDED(hr)) + { + CComPtr<IPin> pOutputPin; + CComPtr<IEnumPins> pPins; + hr=m_pFilter->EnumPins(&pPins); + if(FAILED(hr)) + { + return; + } + hr=pPins->Next(1,&pOutputPin,NULL); + if(hr==S_OK && pOutputPin!=NULL) + { + //this coud potentialy connnect the output pin to other filters + //than that it was connected to before the channel change. + hr=m_pBuilder->Render(pOutputPin); + if(FAILED(hr)) + { + msg.Format(_T("IGraphBuilder::Render on output pin failed\n%s"),(LPCTSTR)GetErrorMsg(hr)); + MessageBox(msg,_T("Error"),MB_OK|MB_ICONERROR); + } + } + + //restart filter graph if it was running + if(state==State_Running) + { + hr=m_pMediaControl->Run(); + if(FAILED(hr)) + { + msg.Format(_T("IMediaControl::Run failed\n%s"),(LPCTSTR)GetErrorMsg(hr)); + MessageBox(msg,_T("Error"),MB_OK|MB_ICONERROR); + } + } + else if(state==State_Paused) + { + hr=m_pMediaControl->Pause(); + if(FAILED(hr)) + { + msg.Format(_T("IMediaControl::Pause failed\n%s"),(LPCTSTR)GetErrorMsg(hr)); + MessageBox(msg,_T("Error"),MB_OK|MB_ICONERROR); + } + } + } + else + { + msg.Format(_T("Failed to change channel\n%s"),(LPCTSTR)GetErrorMsg(hr)); + MessageBox(msg,_T("Error"),MB_OK|MB_ICONERROR); + } + } + + #pragma comment(lib,"quartz.lib") + CAtlString CMythSourcePage::GetErrorMsg(HRESULT hr) + { + CAtlString tmpstr; + DWORD len=AMGetErrorText(hr,tmpstr.GetBufferSetLength(MAX_ERROR_TEXT_LEN),MAX_ERROR_TEXT_LEN); + tmpstr.ReleaseBuffer(len); + CAtlString errormsg; + errormsg.Format("ErrorCode: %#lx\nErrorText: '%s'",hr,(LPCTSTR)tmpstr); + return errormsg; + } + Index: MythSourceFilter.cpp =================================================================== RCS file: /cvsroot/dsmyth/MythTVReader/MythSource/MythSourceFilter.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** MythSourceFilter.cpp 30 Jul 2004 19:45:32 -0000 1.20 --- MythSourceFilter.cpp 2 Aug 2004 19:15:15 -0000 1.21 *************** *** 21,24 **** --- 21,29 ---- // // $Log$ + // Revision 1.21 2004/08/02 19:15:15 tobbej + // added functions to get current channel information (used with livetv). + // new status propertypage with channel changing support. + // i hope i didn't break backwards compatibility with the idl file changes. + // // Revision 1.20 2004/07/30 19:45:32 tobbej // Implemented channel changing and fixed FillpositionMap after channel change. *************** *** 351,354 **** --- 356,364 ---- HRESULT CMythSourceFilter::ChangeChannel(LONG direction) { + if(direction<CHANNEL_DIRECTION_UP || direction>CHANNEL_DIRECTION_SAME) + { + return E_INVALIDARG; + } + if(!IsStopped()) { *************** *** 722,723 **** --- 732,872 ---- return S_OK; } + + HRESULT CMythSourceFilter::GetInputName(CHAR **ppszInputName) + { + ATLTRACE(_T("%s(%d) : CMythSourceFilter::GetInputName\n"),__FILE__,__LINE__); + if(ppszInputName==NULL) + { + return E_POINTER; + } + CRemoteEncoder *pEncoder=m_BackendComm.GetRemoteEncoder(); + if(pEncoder==NULL) + { + return E_UNEXPECTED; + } + + try + { + CAtlString name; + pEncoder->GetInputName(name); + *ppszInputName=AtlString2Char(name); + return S_OK; + } + catch(CRemoteEncoderException e) + { + return E_FAIL; + } + } + + HRESULT CMythSourceFilter::GetChannelInfo(WCHAR **ppTitle,WCHAR **ppSubtitle,WCHAR **ppDesc,WCHAR **ppCategory,WCHAR **ppStarttime,WCHAR **ppEndtime,WCHAR **ppCallsign,WCHAR **ppIconpath,WCHAR **ppChannelname,WCHAR **ppChanid,WCHAR **ppSeriesid,WCHAR **ppProgramid,WCHAR **ppOutputFilters) + { + ATLTRACE(_T("%s(%d) : CMythSourceFilter::GetChannelInfo\n"),__FILE__,__LINE__); + CRemoteEncoder *pEncoder=m_BackendComm.GetRemoteEncoder(); + if(pEncoder==NULL) + { + return E_UNEXPECTED; + } + + try + { + CAtlString title; + CAtlString subtitle; + CAtlString desc; + CAtlString category; + CAtlString starttime; + CAtlString endtime; + CAtlString callsign; + CAtlString iconpath; + CAtlString channelname; + CAtlString chanid; + CAtlString seriesid; + CAtlString programid; + CAtlString outputFilters; + pEncoder->GetChannelInfo(title,subtitle,desc,category,starttime,endtime,callsign,iconpath,channelname,chanid,seriesid,programid,outputFilters); + if(ppTitle!=NULL) + { + *ppTitle=AtlString2CharW(title.Trim()); + } + if(ppSubtitle!=NULL) + { + *ppSubtitle=AtlString2CharW(subtitle.Trim()); + } + if(ppDesc!=NULL) + { + *ppDesc=AtlString2CharW(desc.Trim()); + } + if(ppCategory!=NULL) + { + *ppCategory=AtlString2CharW(category.Trim()); + } + if(ppStarttime!=NULL) + { + *ppStarttime=AtlString2CharW(starttime.Trim()); + } + if(ppEndtime!=NULL) + { + *ppEndtime=AtlString2CharW(endtime.Trim()); + } + if(ppCallsign!=NULL) + { + *ppCallsign=AtlString2CharW(callsign.Trim()); + } + if(ppIconpath!=NULL) + { + *ppIconpath=AtlString2CharW(iconpath.Trim()); + } + if(ppChannelname!=NULL) + { + *ppChannelname=AtlString2CharW(channelname.Trim()); + } + if(ppChanid!=NULL) + { + *ppChanid=AtlString2CharW(chanid.Trim()); + } + if(ppSeriesid!=NULL) + { + *ppSeriesid=AtlString2CharW(seriesid.Trim()); + } + if(ppProgramid!=NULL) + { + *ppProgramid=AtlString2CharW(programid.Trim()); + } + if(ppOutputFilters!=NULL) + { + *ppOutputFilters=AtlString2CharW(outputFilters.Trim()); + } + return S_OK; + } + catch(CRemoteEncoderException e) + { + return E_FAIL; + } + } + + CHAR * CMythSourceFilter::AtlString2Char(CAtlString &string) + { + CHAR *pString=NULL; + int length=string.GetLength()*sizeof(TCHAR); + pString=(CHAR*)CoTaskMemAlloc(length+sizeof(TCHAR)); + if(pString!=NULL) + { + ZeroMemory(pString,length+sizeof(TCHAR)); + CopyMemory(pString,string.GetBuffer(),length); + } + return pString; + } + + WCHAR * CMythSourceFilter::AtlString2CharW(CAtlString &string) + { + WCHAR *pString=NULL; + int length=string.GetLength(); + CT2W conv(string,CP_UTF8); + + pString=(WCHAR*)CoTaskMemAlloc((length+1)*sizeof(WCHAR)); + if(pString!=NULL) + { + ZeroMemory(pString,(length+1)*sizeof(WCHAR)); + CopyMemory(pString,conv,length*sizeof(WCHAR)); + } + return pString; + } \ No newline at end of file Index: MythSource.rc =================================================================== RCS file: /cvsroot/dsmyth/MythTVReader/MythSource/MythSource.rc,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** MythSource.rc 17 Jul 2004 14:51:31 -0000 1.10 --- MythSource.rc 2 Aug 2004 19:15:15 -0000 1.11 *************** *** 103,112 **** // ! IDD_MYTHSOURCEPAGE DIALOGEX 0, 0, 271, 105 STYLE DS_SETFONT | WS_CHILD FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN CONTROL "",IDC_MYTHSOURCEPAGE_SPIN,"msctls_updown32", ! UDS_ARROWKEYS,90,12,10,14 END --- 103,133 ---- // ! IDD_MYTHSOURCEPAGE DIALOGEX 0, 0, 234, 230 STYLE DS_SETFONT | WS_CHILD FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN CONTROL "",IDC_MYTHSOURCEPAGE_SPIN,"msctls_updown32", ! UDS_ARROWKEYS,65,210,11,14 ! LTEXT "Change channel:",IDC_STATIC,6,213,55,8 ! LTEXT "Status:",IDC_STATIC,6,12,23,8 ! LTEXT "Unknown",IDC_MYTHSOURCEPAGE_STATUS,54,12,174,8 ! LTEXT "Current input:",IDC_STATIC,6,24,43,8 ! LTEXT "Unknown",IDC_MYTHSOURCEPAGE_INPUTNAME,54,24,174,8 ! GROUPBOX "",IDC_STATIC,0,0,234,40 ! GROUPBOX "Current program",IDC_STATIC,0,42,234,162 ! LTEXT "Title:",IDC_STATIC,6,78,16,8 ! LTEXT "Static",IDC_MYTHSOURCEPAGE_TITLE,42,78,186,8 ! LTEXT "Subtitle:",IDC_STATIC,6,90,26,8 ! LTEXT "Static",IDC_MYTHSOURCEPAGE_SUBTITLE,42,90,186,8 ! LTEXT "Category:",IDC_STATIC,6,102,31,8 ! LTEXT "Static",IDC_MYTHSOURCEPAGE_CATEGORY,42,102,186,8 ! LTEXT "Channel:",IDC_STATIC,6,54,29,8 ! LTEXT "Static",IDC_MYTHSOURCEPAGE_CHANNEL,42,54,186,8 ! LTEXT "Static",IDC_MYTHSOURCEPAGE_CALLSIGN,42,66,186,8 ! LTEXT "Callsign:",IDC_STATIC,6,66,27,8 ! EDITTEXT IDC_MYTHSOURCEPAGE_DESCRIPTION,6,132,216,60,ES_MULTILINE | ! ES_AUTOVSCROLL | ES_READONLY | NOT WS_BORDER | ! WS_VSCROLL ! LTEXT "Description:",IDC_STATIC,6,120,38,8 END *************** *** 136,142 **** BEGIN LEFTMARGIN, 7 ! RIGHTMARGIN, 264 TOPMARGIN, 7 ! BOTTOMMARGIN, 98 END --- 157,163 ---- BEGIN LEFTMARGIN, 7 ! RIGHTMARGIN, 227 TOPMARGIN, 7 ! BOTTOMMARGIN, 223 END *************** *** 160,164 **** BEGIN IDS_PROJNAME "MythSource" ! IDS_TITLEMythSourcePage "Title" IDS_HELPFILEMythSourcePage "Help File Name" IDS_DOCSTRINGMythSourcePage "Your Help String" --- 181,185 ---- BEGIN IDS_PROJNAME "MythSource" ! IDS_TITLEMythSourcePage "Status" IDS_HELPFILEMythSourcePage "Help File Name" IDS_DOCSTRINGMythSourcePage "Your Help String" Index: RecordedProgramsPage.h =================================================================== RCS file: /cvsroot/dsmyth/MythTVReader/MythSource/RecordedProgramsPage.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RecordedProgramsPage.h 29 Dec 2003 21:43:22 -0000 1.1 --- RecordedProgramsPage.h 2 Aug 2004 19:15:15 -0000 1.2 *************** *** 21,24 **** --- 21,29 ---- // // $Log$ + // Revision 1.2 2004/08/02 19:15:15 tobbej + // added functions to get current channel information (used with livetv). + // new status propertypage with channel changing support. + // i hope i didn't break backwards compatibility with the idl file changes. + // // Revision 1.1 2003/12/29 21:43:22 tobbej // new propertypage for displaying recorded programs *************** *** 84,87 **** --- 89,93 ---- LRESULT OnBnClickedOpen(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); LRESULT OnBnClickedDel(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); + private: bool IsComctl32Unicode(); Index: MythSourceFilter.h =================================================================== RCS file: /cvsroot/dsmyth/MythTVReader/MythSource/MythSourceFilter.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** MythSourceFilter.h 30 Jul 2004 19:45:32 -0000 1.10 --- MythSourceFilter.h 2 Aug 2004 19:15:15 -0000 1.11 *************** *** 21,24 **** --- 21,29 ---- // // $Log$ + // Revision 1.11 2004/08/02 19:15:15 tobbej + // added functions to get current channel information (used with livetv). + // new status propertypage with channel changing support. + // i hope i didn't break backwards compatibility with the idl file changes. + // // Revision 1.10 2004/07/30 19:45:32 tobbej // Implemented channel changing and fixed FillpositionMap after channel change. *************** *** 74,78 **** public IBaseFilter, public IFileSourceFilter, ! public IMythSouce, public ISpecifyPropertyPagesImpl<CMythSourceFilter> { --- 79,83 ---- public IBaseFilter, public IFileSourceFilter, ! public IMythSource2, public ISpecifyPropertyPagesImpl<CMythSourceFilter> { *************** *** 80,99 **** CMythSourceFilter(); ! DECLARE_REGISTRY_RESOURCEID(IDR_MYTHSOURCEFILTER) ! DECLARE_NOT_AGGREGATABLE(CMythSourceFilter) ! BEGIN_COM_MAP(CMythSourceFilter) ! COM_INTERFACE_ENTRY(IBaseFilter) ! COM_INTERFACE_ENTRY(IFileSourceFilter) ! COM_INTERFACE_ENTRY(IMythSouce) ! COM_INTERFACE_ENTRY(ISpecifyPropertyPages) ! COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p) ! END_COM_MAP() ! BEGIN_PROP_MAP(CMythSourceFilter) ! PROP_PAGE(CLSID_RecordedProgramsPage) ! //PROP_PAGE(CLSID_MythSourcePage) ! END_PROP_MAP() DECLARE_PROTECT_FINAL_CONSTRUCT() --- 85,105 ---- CMythSourceFilter(); ! DECLARE_REGISTRY_RESOURCEID(IDR_MYTHSOURCEFILTER) ! DECLARE_NOT_AGGREGATABLE(CMythSourceFilter) ! BEGIN_COM_MAP(CMythSourceFilter) ! COM_INTERFACE_ENTRY(IBaseFilter) ! COM_INTERFACE_ENTRY(IFileSourceFilter) ! COM_INTERFACE_ENTRY2(IMythSouce, IMythSource2) ! COM_INTERFACE_ENTRY(ISpecifyPropertyPages) ! COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p) ! COM_INTERFACE_ENTRY(IMythSource2) ! END_COM_MAP() ! BEGIN_PROP_MAP(CMythSourceFilter) ! PROP_PAGE(CLSID_RecordedProgramsPage) ! PROP_PAGE(CLSID_MythSourcePage) ! END_PROP_MAP() DECLARE_PROTECT_FINAL_CONSTRUCT() *************** *** 105,112 **** CComPtr<IUnknown> m_pUnkMarshaler; ! // IPersist STDMETHOD(GetClassID(CLSID *pClassID)); ! // IMediaFilter STDMETHOD(Stop()); STDMETHOD(Pause()); --- 111,118 ---- CComPtr<IUnknown> m_pUnkMarshaler; ! // IPersist STDMETHOD(GetClassID(CLSID *pClassID)); ! // IMediaFilter STDMETHOD(Stop()); STDMETHOD(Pause()); *************** *** 116,120 **** STDMETHOD(GetSyncSource(IReferenceClock **pClock)); ! // IBaseFilter STDMETHOD(EnumPins(IEnumPins **ppEnum)); STDMETHOD(FindPin(LPCWSTR Id,IPin **ppPin)); --- 122,126 ---- STDMETHOD(GetSyncSource(IReferenceClock **pClock)); ! // IBaseFilter STDMETHOD(EnumPins(IEnumPins **ppEnum)); STDMETHOD(FindPin(LPCWSTR Id,IPin **ppPin)); *************** *** 123,131 **** STDMETHOD(QueryVendorInfo(LPWSTR *pVendorInfo)); ! // IFileSourceFilter STDMETHOD(Load)(LPCOLESTR pszFileName,const AM_MEDIA_TYPE *pmt); STDMETHOD(GetCurFile)(LPOLESTR *ppszFileName,AM_MEDIA_TYPE *pmt); ! // IMythSouce /** * This function needs some help from the caller to work properly. --- 129,141 ---- STDMETHOD(QueryVendorInfo(LPWSTR *pVendorInfo)); ! // IFileSourceFilter STDMETHOD(Load)(LPCOLESTR pszFileName,const AM_MEDIA_TYPE *pmt); STDMETHOD(GetCurFile)(LPOLESTR *ppszFileName,AM_MEDIA_TYPE *pmt); ! // IMythSource2 ! STDMETHOD(GetInputName)(CHAR **ppszInputName); ! STDMETHOD(GetChannelInfo)(WCHAR **ppTitle,WCHAR **ppSubtitle,WCHAR **ppDesc,WCHAR **ppCategory,WCHAR **ppStarttime,WCHAR **ppEndtime,WCHAR **ppCallsign,WCHAR **ppIconpath,WCHAR **ppChannelname,WCHAR **ppChanid,WCHAR **ppSeriesid,WCHAR **ppProgramid,WCHAR **ppOutputFilters); ! ! // IMythSouce /** * This function needs some help from the caller to work properly. *************** *** 143,148 **** bool IsStopped(); bool GetMediaType(AM_MEDIA_TYPE &mt); ! friend CAsyncOutputPin; private: CComAutoCriticalSection m_Lock; FILTER_STATE m_FilterState; --- 153,164 ---- bool IsStopped(); bool GetMediaType(AM_MEDIA_TYPE &mt); ! friend CAsyncOutputPin; ! private: + ///@return a copy of the string allocated with CoTaskMemAlloc + CHAR * AtlString2Char(CAtlString &string); + ///Convert from utf-8 string + WCHAR * AtlString2CharW(CAtlString &string); + CComAutoCriticalSection m_Lock; FILTER_STATE m_FilterState; *************** *** 153,157 **** CAsyncOutputPin *m_pAsyncOutput; CAtlString m_FileName; ! CMythBackendComm m_BackendComm; GUID m_MajorType; --- 169,173 ---- CAsyncOutputPin *m_pAsyncOutput; CAtlString m_FileName; ! CMythBackendComm m_BackendComm; GUID m_MajorType; Index: resource.h =================================================================== RCS file: /cvsroot/dsmyth/MythTVReader/MythSource/resource.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** resource.h 29 Dec 2003 21:43:36 -0000 1.3 --- resource.h 2 Aug 2004 19:15:15 -0000 1.4 *************** *** 22,25 **** --- 22,34 ---- #define IDC_BUTTON2 206 #define IDC_RECORDEDPROGRAMSPAGE_DEL 206 + #define IDC_MYTHSOURCEPAGE_STATUS 207 + #define IDC_MYTHSOURCEPAGE_INPUTNAME 208 + #define IDC_MYTHSOURCEPAGE_CHANNEL 209 + #define IDC_MYTHSOURCEPAGE_TITLE 210 + #define IDC_MYTHSOURCEPAGE_SUBTITLE 211 + #define IDC_MYTHSOURCEPAGE_CATEGORY 212 + #define IDC_MYTHSOURCEPAGE_CALLSIGN 213 + #define IDC_EDIT1 214 + #define IDC_MYTHSOURCEPAGE_DESCRIPTION 214 // Next default values for new objects *************** *** 29,33 **** #define _APS_NEXT_RESOURCE_VALUE 201 #define _APS_NEXT_COMMAND_VALUE 32768 ! #define _APS_NEXT_CONTROL_VALUE 207 #define _APS_NEXT_SYMED_VALUE 114 #endif --- 38,42 ---- #define _APS_NEXT_RESOURCE_VALUE 201 #define _APS_NEXT_COMMAND_VALUE 32768 ! #define _APS_NEXT_CONTROL_VALUE 215 #define _APS_NEXT_SYMED_VALUE 114 #endif Index: RemoteEncoder.h =================================================================== RCS file: /cvsroot/dsmyth/MythTVReader/MythSource/RemoteEncoder.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** RemoteEncoder.h 30 Jul 2004 19:41:18 -0000 1.7 --- RemoteEncoder.h 2 Aug 2004 19:15:15 -0000 1.8 *************** *** 21,24 **** --- 21,29 ---- // // $Log$ + // Revision 1.8 2004/08/02 19:15:15 tobbej + // added functions to get current channel information (used with livetv). + // new status propertypage with channel changing support. + // i hope i didn't break backwards compatibility with the idl file changes. + // // Revision 1.7 2004/07/30 19:41:18 tobbej // Changed FillpositionMap to allow the file offsets to be offseted, used when header buffer is active to correct file offsets *************** *** 65,73 **** }; - #define CHANNEL_DIRECTION_UP 0 - #define CHANNEL_DIRECTION_DOWN 1 - #define CHANNEL_DIRECTION_FAVORITE 2 - #define CHANNEL_DIRECTION_SAME 3 - class CRemoteEncoder { --- 70,73 ---- *************** *** 83,86 **** --- 83,94 ---- void ChangeChannel(int direction); void SetChannel(CAtlString channel); + void GetChannelInfo(CAtlString &title,CAtlString &subtitle, + CAtlString &desc, CAtlString &category, + CAtlString &starttime,CAtlString &endtime, + CAtlString &callsign,CAtlString &iconpath, + CAtlString &channelname,CAtlString &chanid, + CAtlString &seriesid,CAtlString &programid, + CAtlString &outputFilters); + void GetInputName(CAtlString &inputname); LONGLONG GetFilePosition(); Index: RemoteEncoder.cpp =================================================================== RCS file: /cvsroot/dsmyth/MythTVReader/MythSource/RemoteEncoder.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** RemoteEncoder.cpp 30 Jul 2004 19:41:18 -0000 1.11 --- RemoteEncoder.cpp 2 Aug 2004 19:15:15 -0000 1.12 *************** *** 21,24 **** --- 21,29 ---- // // $Log$ + // Revision 1.12 2004/08/02 19:15:15 tobbej + // added functions to get current channel information (used with livetv). + // new status propertypage with channel changing support. + // i hope i didn't break backwards compatibility with the idl file changes. + // // Revision 1.11 2004/07/30 19:41:18 tobbej // Changed FillpositionMap to allow the file offsets to be offseted, used when header buffer is active to correct file offsets *************** *** 127,130 **** --- 132,202 ---- } + void CRemoteEncoder::GetChannelInfo(CAtlString &title,CAtlString &subtitle, + CAtlString &desc, CAtlString &category, + CAtlString &starttime,CAtlString &endtime, + CAtlString &callsign,CAtlString &iconpath, + CAtlString &channelname,CAtlString &chanid, + CAtlString &seriesid,CAtlString &programid, + CAtlString &outputFilters) + { + ATLTRACE(_T("%s(%d) : CRemoteEncoder::GetChannelInfo\n"),__FILE__,__LINE__); + CAutoLockCriticalSection<CComAutoCriticalSection> lock(&m_Lock); + CAtlString cmd; + cmd.Format("QUERY_RECORDER %d[]:[]GET_PROGRAM_INFO",m_recnum); + CAtlString result; + if(!SendCommand(m_sock,cmd,result)) + { + throw CRemoteEncoderException("SendCommand failed"); + } + CAtlArray<CAtlString> list; + SplitString(result,list); + ATLASSERT(list.GetCount()==13); + if(list.GetCount()==13) + { + title=list[0]; + subtitle=list[1]; + desc=list[2]; + category=list[3]; + starttime=list[4]; + endtime=list[5]; + callsign=list[6]; + iconpath=list[7]; + channelname=list[8]; + chanid=list[9]; + seriesid=list[10]; + programid=list[11]; + outputFilters=list[12]; + } + else + { + throw CRemoteEncoderException("Protocol error (GET_PROGRAM_INFO)"); + } + } + + void CRemoteEncoder::GetInputName(CAtlString &inputname) + { + ATLTRACE(_T("%s(%d) : CRemoteEncoder::GetInputName\n"),__FILE__,__LINE__); + CAutoLockCriticalSection<CComAutoCriticalSection> lock(&m_Lock); + CAtlString cmd; + cmd.Format("QUERY_RECORDER %d[]:[]GET_INPUT_NAME",m_recnum); + CAtlString result; + if(!SendCommand(m_sock,cmd,result)) + { + throw CRemoteEncoderException("SendCommand failed"); + } + CAtlArray<CAtlString> list; + SplitString(result,list); + ATLASSERT(list.GetCount()==1); + if(list.GetCount()==1) + { + inputname=list[0]; + } + else + { + throw CRemoteEncoderException("Protocol error (GET_INPUT_NAME)"); + } + } + + bool CRemoteEncoder::IsRecording() { |