From 8a39cb74b3cd6d2257164dc38764bf445db4d4e1 Mon Sep 17 00:00:00 2001 From: xy Date: Wed, 14 Dec 2011 21:58:53 +0800 Subject: [PATCH] Add a switch option for switching between use upstream filter's preferred media type order and use our own preferred order. --- src/filters/transform/vsfilter/DirectVobSub.cpp | 21 +++++++++++++++++++++ src/filters/transform/vsfilter/DirectVobSub.h | 5 +++++ .../transform/vsfilter/DirectVobSubFilter.cpp | 15 +++++++++++++++ src/filters/transform/vsfilter/DirectVobSubFilter.h | 2 ++ .../transform/vsfilter/DirectVobSubPropPage.cpp | 20 +++++++++++++++++++- .../transform/vsfilter/DirectVobSubPropPage.h | 3 +++ src/filters/transform/vsfilter/IDirectVobSub.h | 9 +++++++++ src/filters/transform/vsfilter/VSFilter.rc | 18 +++++++++++------- src/filters/transform/vsfilter/resource.h | 4 +++- 9 files changed, 88 insertions(+), 9 deletions(-) diff --git a/src/filters/transform/vsfilter/DirectVobSub.cpp b/src/filters/transform/vsfilter/DirectVobSub.cpp index b4bca6f..a777889 100644 --- a/src/filters/transform/vsfilter/DirectVobSub.cpp +++ b/src/filters/transform/vsfilter/DirectVobSub.cpp @@ -68,6 +68,7 @@ CDirectVobSub::CDirectVobSub() if(m_subpixel_pos_level<0) m_subpixel_pos_level=0; else if(m_subpixel_pos_level>=SubpixelPositionControler::MAX_COUNT) m_subpixel_pos_level=SubpixelPositionControler::EIGHT_X_EIGHT; + m_fFollowUpstreamPreferredOrder = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_USE_UPSTREAM_PREFERRED_ORDER), true); // get output colorspace config if(pData) { @@ -724,6 +725,25 @@ STDMETHODIMP CDirectVobSub::put_SubpixelPositionLevel(int subpixel_pos_level) return S_OK; } +STDMETHODIMP CDirectVobSub::get_FollowUpstreamPreferredOrder( bool *fFollowUpstreamPreferredOrder ) +{ + CAutoLock cAutoLock(&m_propsLock); + + if(fFollowUpstreamPreferredOrder) *fFollowUpstreamPreferredOrder=m_fFollowUpstreamPreferredOrder; + + return S_OK; +} + +STDMETHODIMP CDirectVobSub::put_FollowUpstreamPreferredOrder( bool fFollowUpstreamPreferredOrder ) +{ + CAutoLock cAutoLock(&m_propsLock); + + if(m_fFollowUpstreamPreferredOrder == fFollowUpstreamPreferredOrder) return S_FALSE; + m_fFollowUpstreamPreferredOrder = fFollowUpstreamPreferredOrder; + + return S_OK; +} + STDMETHODIMP CDirectVobSub::UpdateRegistry() { AFX_MANAGE_STATE(AfxGetStaticModuleState()); @@ -757,6 +777,7 @@ STDMETHODIMP CDirectVobSub::UpdateRegistry() theApp.WriteProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_SCAN_LINE_DATA_CACHE_MAX_ITEM_NUM), m_scan_line_data_cache_max_item_num); theApp.WriteProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_PATH_DATA_CACHE_MAX_ITEM_NUM), m_path_data_cache_max_item_num); theApp.WriteProfileInt(ResStr(IDS_R_PERFORMANCE), ResStr(IDS_RP_SUBPIXEL_POS_LEVEL), m_subpixel_pos_level); + theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_USE_UPSTREAM_PREFERRED_ORDER), m_fFollowUpstreamPreferredOrder); //save output color config { diff --git a/src/filters/transform/vsfilter/DirectVobSub.h b/src/filters/transform/vsfilter/DirectVobSub.h index 3a9cfa2..61c5502 100644 --- a/src/filters/transform/vsfilter/DirectVobSub.h +++ b/src/filters/transform/vsfilter/DirectVobSub.h @@ -57,6 +57,8 @@ protected: int m_subpixel_pos_level; + bool m_fFollowUpstreamPreferredOrder; + STSStyle m_defStyle; bool m_fAdvancedRenderer; @@ -132,6 +134,9 @@ public: STDMETHODIMP get_SubpixelPositionLevel(int* subpixel_pos_level); STDMETHODIMP put_SubpixelPositionLevel(int subpixel_pos_level); + STDMETHODIMP get_FollowUpstreamPreferredOrder(bool *fFollowUpstreamPreferredOrder); + STDMETHODIMP put_FollowUpstreamPreferredOrder(bool fFollowUpstreamPreferredOrder); + STDMETHODIMP UpdateRegistry(); STDMETHODIMP HasConfigDialog(int iSelected); diff --git a/src/filters/transform/vsfilter/DirectVobSubFilter.cpp b/src/filters/transform/vsfilter/DirectVobSubFilter.cpp index 26b54ba..d0d66ec 100644 --- a/src/filters/transform/vsfilter/DirectVobSubFilter.cpp +++ b/src/filters/transform/vsfilter/DirectVobSubFilter.cpp @@ -118,6 +118,8 @@ CDirectVobSubFilter::CDirectVobSubFilter(LPUNKNOWN punk, HRESULT* phr, const GUI memset(&m_CurrentVIH2, 0, sizeof(VIDEOINFOHEADER2)); + m_donot_follow_upstream_preferred_order = !m_fFollowUpstreamPreferredOrder; + m_time_alphablt = m_time_rasterization = 0; } @@ -1304,6 +1306,19 @@ STDMETHODIMP CDirectVobSubFilter::put_SubpixelPositionLevel(int subpixel_pos_lev return hr; } +STDMETHODIMP CDirectVobSubFilter::put_FollowUpstreamPreferredOrder( bool fFollowUpstreamPreferredOrder ) +{ + CAutoLock cAutolock(&m_csQueueLock); + HRESULT hr = CDirectVobSub::put_FollowUpstreamPreferredOrder(fFollowUpstreamPreferredOrder); + + if(hr == NOERROR) + { + m_donot_follow_upstream_preferred_order = !m_fFollowUpstreamPreferredOrder; + } + + return hr; +} + STDMETHODIMP CDirectVobSubFilter::get_MediaFPS(bool* fEnabled, double* fps) { HRESULT hr = CDirectVobSub::get_MediaFPS(fEnabled, fps); diff --git a/src/filters/transform/vsfilter/DirectVobSubFilter.h b/src/filters/transform/vsfilter/DirectVobSubFilter.h index 64e0c0e..f1dff51 100644 --- a/src/filters/transform/vsfilter/DirectVobSubFilter.h +++ b/src/filters/transform/vsfilter/DirectVobSubFilter.h @@ -111,6 +111,8 @@ public: STDMETHODIMP put_SubpixelPositionLevel(int subpixel_pos_level); + STDMETHODIMP put_FollowUpstreamPreferredOrder(bool fFollowUpstreamPreferredOrder); + STDMETHODIMP get_MediaFPS(bool* fEnabled, double* fps); STDMETHODIMP put_MediaFPS(bool fEnabled, double fps); STDMETHODIMP get_ZoomRect(NORMALIZEDRECT* rect); diff --git a/src/filters/transform/vsfilter/DirectVobSubPropPage.cpp b/src/filters/transform/vsfilter/DirectVobSubPropPage.cpp index 9d2f223..c92c3cd 100644 --- a/src/filters/transform/vsfilter/DirectVobSubPropPage.cpp +++ b/src/filters/transform/vsfilter/DirectVobSubPropPage.cpp @@ -981,7 +981,10 @@ CDVSColorPPage::CDVSColorPPage(LPUNKNOWN pUnk, HRESULT* phr) : { BindControl(IDC_OUTPUT_FORMAT_LIST, m_outputFmtList); BindControl(IDC_INPUT_FORMAT_LIST, m_inputFmtList); - + BindControl(IDC_CHECK_FOLLOW_UPSTREAM, m_followUpstreamPreferredOrder); + BindControl(IDC_COLORUP, m_btnColorUp); + BindControl(IDC_COLORDOWN, m_btnColorDown); + m_fDisableInstantUpdate = true; //donot know how to detect check event of CListCtrl's checkboxes @@ -1045,6 +1048,13 @@ bool CDVSColorPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) } return(true); } + case IDC_CHECK_FOLLOW_UPSTREAM: + { + AFX_MANAGE_STATE(AfxGetStaticModuleState()); + m_btnColorUp.EnableWindow(!m_followUpstreamPreferredOrder.GetCheck()); + m_btnColorDown.EnableWindow(!m_followUpstreamPreferredOrder.GetCheck()); + return true; + } } } break; @@ -1060,11 +1070,13 @@ void CDVSColorPPage::UpdateObjectData(bool fSave) { if(fSave) { + m_pDirectVobSub->put_FollowUpstreamPreferredOrder(m_fFollowUpstream); m_pDirectVobSub->put_OutputColorFormat(m_outputColorSpace, m_selectedOutputColorSpace, m_outputColorSpaceCount); m_pDirectVobSub->put_InputColorFormat(m_inputColorSpace, m_selectedInputColorSpace, m_inputColorSpaceCount); } else { + m_pDirectVobSub->get_FollowUpstreamPreferredOrder(&m_fFollowUpstream); m_pDirectVobSub->get_OutputColorFormat(m_outputColorSpace, m_selectedOutputColorSpace, &m_outputColorSpaceCount); m_pDirectVobSub->get_InputColorFormat(m_inputColorSpace, m_selectedInputColorSpace, &m_inputColorSpaceCount); } @@ -1092,9 +1104,15 @@ void CDVSColorPPage::UpdateControlData(bool fSave) } } else ASSERT(0); + + m_fFollowUpstream = !!m_followUpstreamPreferredOrder.GetCheck(); } else { + m_followUpstreamPreferredOrder.SetCheck(m_fFollowUpstream); + m_btnColorUp.EnableWindow(!m_fFollowUpstream); + m_btnColorDown.EnableWindow(!m_fFollowUpstream); + m_outputFmtList.ShowScrollBar(SB_HORZ, FALSE); m_outputFmtList.DeleteAllItems(); m_outputFmtList.DeleteColumn(0); diff --git a/src/filters/transform/vsfilter/DirectVobSubPropPage.h b/src/filters/transform/vsfilter/DirectVobSubPropPage.h index 39973df..500978c 100644 --- a/src/filters/transform/vsfilter/DirectVobSubPropPage.h +++ b/src/filters/transform/vsfilter/DirectVobSubPropPage.h @@ -194,6 +194,7 @@ public: class CDVSColorPPage : public CDVSBasePPage { CListCtrl m_outputFmtList, m_inputFmtList; + CButton m_followUpstreamPreferredOrder, m_btnColorUp, m_btnColorDown; static const int MAX_COLOR_SPACE = 256; ColorSpaceId m_outputColorSpace[MAX_COLOR_SPACE]; @@ -203,6 +204,8 @@ class CDVSColorPPage : public CDVSBasePPage ColorSpaceId m_inputColorSpace[MAX_COLOR_SPACE]; bool m_selectedInputColorSpace[MAX_COLOR_SPACE]; UINT m_inputColorSpaceCount; + + bool m_fFollowUpstream; protected: virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); virtual void UpdateControlData(bool fSave); diff --git a/src/filters/transform/vsfilter/IDirectVobSub.h b/src/filters/transform/vsfilter/IDirectVobSub.h index aeb4bb1..a8a5bff 100644 --- a/src/filters/transform/vsfilter/IDirectVobSub.h +++ b/src/filters/transform/vsfilter/IDirectVobSub.h @@ -333,6 +333,15 @@ extern "C" { STDMETHOD(put_SubpixelPositionLevel) (THIS_ int subpixel_pos_level ) PURE; + + // + STDMETHOD(get_FollowUpstreamPreferredOrder) (THIS_ + bool *fFollowUpstreamPreferredOrder + ) PURE; + + STDMETHOD(put_FollowUpstreamPreferredOrder) (THIS_ + bool fFollowUpstreamPreferredOrder + ) PURE; }; [uuid("FE6EC6A0-21CA-4970-9EF0-B296F7F38AF0")] diff --git a/src/filters/transform/vsfilter/VSFilter.rc b/src/filters/transform/vsfilter/VSFilter.rc index ab5a1cc..98a9a53 100644 --- a/src/filters/transform/vsfilter/VSFilter.rc +++ b/src/filters/transform/vsfilter/VSFilter.rc @@ -123,12 +123,14 @@ STYLE DS_SETFONT | WS_CHILD FONT 8, "MS Sans Serif", 400, 0, 0x1 BEGIN GROUPBOX "Input",IDC_STATIC,7,7,70,156,NOT WS_VISIBLE - GROUPBOX "Output",IDC_STATIC,54,7,103,156 - LTEXT "To force an specific output format, uncheck all formats except the one you want. You need to reload xy-VSFilter to apply the changes.",IDC_DYNCHGWARNING,160,19,72,75 - PUSHBUTTON "&Up",IDC_COLORUP,73,141,25,12 - PUSHBUTTON "&Down",IDC_COLORDOWN,108,141,25,12 - CONTROL "",IDC_OUTPUT_FORMAT_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,62,19,91,115 - CONTROL "",IDC_INPUT_FORMAT_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | NOT WS_VISIBLE | WS_BORDER | WS_TABSTOP,7,19,63,115 + GROUPBOX "Output",IDC_STATIC,43,7,103,156 + LTEXT "To force an specific output format, uncheck all formats except the one you want. You need to reload xy-VSFilter to apply the changes.",IDC_DYNCHGWARNING,157,63,72,69 + PUSHBUTTON "&Up",IDC_COLORUP,64,141,25,12 + PUSHBUTTON "&Down",IDC_COLORDOWN,99,141,25,12 + CONTROL "",IDC_OUTPUT_FORMAT_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,49,19,91,115 + CONTROL "",IDC_CHECK_FOLLOW_UPSTREAM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,29,8,10 + LTEXT "Follow preferred order of upstream filter",IDC_STATIC,168,22,68,25 + CONTROL "",IDC_INPUT_FORMAT_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | NOT WS_VISIBLE | WS_BORDER | WS_TABSTOP,11,21,12,115 END IDD_DVSGENERALPAGE DIALOGEX 0, 0, 247, 188 @@ -389,7 +391,7 @@ BEGIN RIGHTMARGIN, 239 VERTGUIDE, 41 VERTGUIDE, 118 - VERTGUIDE, 160 + VERTGUIDE, 146 TOPMARGIN, 7 BOTTOMMARGIN, 180 HORZGUIDE, 19 @@ -566,6 +568,8 @@ BEGIN IDS_ORGHEIGHT "Original height" IDS_RG_VMRZOOMENABLED "VMRZoomEnabled" IDS_RTM_SUBTITLESPEEDDIV "Subtitle Speeddiv" + IDS_RG_USE_UPSTREAM_PREFERRED_ORDER + "Use Upstream filter's preferred order" IDS_EXTTO169 "Extend to 16:9" IDS_RG_FORCERGB "ForceRGB" IDS_RG_ENABLEZPICON "EnableZPIcon" diff --git a/src/filters/transform/vsfilter/resource.h b/src/filters/transform/vsfilter/resource.h index b185188..27db837 100644 --- a/src/filters/transform/vsfilter/resource.h +++ b/src/filters/transform/vsfilter/resource.h @@ -55,6 +55,7 @@ #define IDS_RG_VMRZOOMENABLED 150 #define IDS_RTM_SUBTITLESPEEDDIV 151 #define IDS_RG_COLORFORMATS 152 +#define IDS_RG_USE_UPSTREAM_PREFERRED_ORDER 152 #define IDS_EXTTO169 153 #define IDS_RG_FORCERGB 154 #define IDS_RG_ENABLEZPICON 155 @@ -175,6 +176,7 @@ #define IDC_EDITOverlayNoBlurCache 325 #define IDC_SPINOverlayNoBlurCache 326 #define IDC_CACHES_INFO_BTN 327 +#define IDC_CHECK_FOLLOW_UPSTREAM 329 #define IDC_CACHE_OPTIONS 401 #define IDC_LABLE_PATH_CACHE 402 #define IDC_LABLE_OVERLAY_CACHE 403 @@ -209,7 +211,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 232 #define _APS_NEXT_COMMAND_VALUE 32770 -#define _APS_NEXT_CONTROL_VALUE 329 +#define _APS_NEXT_CONTROL_VALUE 330 #define _APS_NEXT_SYMED_VALUE 103 #endif #endif -- 2.11.4.GIT