[xiph-commits] r16905 - trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder

cristianadam at svn.xiph.org cristianadam at svn.xiph.org
Wed Feb 17 10:06:33 PST 2010


Author: cristianadam
Date: 2010-02-17 10:06:33 -0800 (Wed, 17 Feb 2010)
New Revision: 16905

Removed:
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/dsfTheoraEncoder.aps
Modified:
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/ITheoraEncodeSettings.h
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/PropsTheoraEncoder.cpp
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeFilter.cpp
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeFilter.h
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.h
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/dsfTheoraEncoder.rc
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/resource.h
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/theoraencoderdllstuff.cpp
Log:
Replaced auto detection mechanism for vertical image flip with get/set methods in ITheoraEncodeSettings interface and in encoder property page.

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/ITheoraEncodeSettings.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/ITheoraEncodeSettings.h	2010-02-16 05:27:05 UTC (rev 16904)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/ITheoraEncodeSettings.h	2010-02-17 18:06:33 UTC (rev 16905)
@@ -39,7 +39,8 @@
     virtual STDMETHODIMP_(bool) setKeyframeFreqMin(unsigned long inKeyframeFreqMin) PURE;
     virtual STDMETHODIMP_(bool) setKeyframeAutoThreshold(long inKeyframeAutoThreshold) PURE;
 
-
+    virtual STDMETHODIMP_(void) setFlipImageVerticaly(bool flipImageVerticaly) PURE;
+    virtual STDMETHODIMP_(bool) getFlipImageVerticaly() PURE;
 };
 
 #ifdef __cplusplus

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/PropsTheoraEncoder.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/PropsTheoraEncoder.cpp	2010-02-16 05:27:05 UTC (rev 16904)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/PropsTheoraEncoder.cpp	2010-02-17 18:06:33 UTC (rev 16905)
@@ -3,7 +3,7 @@
 
 PropsTheoraEncoder::PropsTheoraEncoder(     LPUNKNOWN inUnk
                                         ,   HRESULT* outHR)
-	:	CBasePropertyPage(      NAME("illiminable Theora Encoder")
+	:	CBasePropertyPage(      NAME("Xiph.Org Theora Encoder")
                             ,   inUnk
                             ,   IDD_THEORA_ENCODE_SETTINGS
                             ,   IDS_THEORA_ENC_PROPS_STRING)
@@ -87,6 +87,12 @@
         mTheoraEncodeSettings->setAllowDroppedFrames(false);
     }
 
+    if (SendDlgItemMessage(m_hwnd,IDC_FLIP_VERTICAL_IMAGE, BM_GETCHECK, NOT_USED, NOT_USED)) {
+        mTheoraEncodeSettings->setFlipImageVerticaly(true);
+    } else {
+        mTheoraEncodeSettings->setFlipImageVerticaly(false);
+    }
+
     mTheoraEncodeSettings->setNoiseSensitivity(SendDlgItemMessage(m_hwnd,IDC_LIST_NOISE_SENS, LB_GETCURSEL, NOT_USED, NOT_USED));
     mTheoraEncodeSettings->setSharpness(SendDlgItemMessage(m_hwnd,IDC_LIST_SHARPNESS, LB_GETCURSEL, NOT_USED, NOT_USED));
 
@@ -201,6 +207,7 @@
         SendDlgItemMessage(m_Dlg, IDC_CHECK_ALLOW_DROP_FRAMES, BM_SETCHECK, (WPARAM)(mTheoraEncodeSettings->allowDroppedFrames() ? BST_CHECKED : BST_UNCHECKED), NOT_USED);
         SendDlgItemMessage(m_Dlg, IDC_CHECK_QUICK_MODE, BM_SETCHECK, (WPARAM)(mTheoraEncodeSettings->isUsingQuickMode() ? BST_CHECKED : BST_UNCHECKED), NOT_USED);
         SendDlgItemMessage(m_Dlg, IDC_FIXED_KFI_CHECK, BM_SETCHECK, (WPARAM)(mTheoraEncodeSettings->isFixedKeyframeInterval() ? BST_CHECKED : BST_UNCHECKED), NOT_USED);
+        SendDlgItemMessage(m_Dlg, IDC_FLIP_VERTICAL_IMAGE, BM_SETCHECK, (WPARAM)(mTheoraEncodeSettings->getFlipImageVerticaly() ? BST_CHECKED : BST_UNCHECKED), NOT_USED);
 
         //TODO::: Disable
         setDialogQualityModeView(mTheoraEncodeSettings->isUsingQualityMode());
@@ -354,6 +361,11 @@
                 } else if (HWND(lParam) == GetDlgItem(m_hwnd, IDC_CHECK_QUALITY_MODE)) {
                     SetDirty();
                     setDialogQualityModeView(SendDlgItemMessage(m_hwnd,IDC_CHECK_QUALITY_MODE, BM_GETCHECK, NOT_USED, NOT_USED));
+                } else if (HWND(lParam) == GetDlgItem(m_hwnd, IDC_FLIP_VERTICAL_IMAGE)) {
+                    SetDirty();
+                    if (SendDlgItemMessage(m_hwnd,IDC_FLIP_VERTICAL_IMAGE, BM_GETCHECK, NOT_USED, NOT_USED)) {
+                        //Do we even need to catch this one?
+                    }
                 }
             } else if (HIWORD(wParam) == LBN_SELCHANGE) {
                 if (HWND(lParam) == GetDlgItem(m_hwnd, IDC_LIST_SHARPNESS)) {

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeFilter.cpp	2010-02-16 05:27:05 UTC (rev 16904)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeFilter.cpp	2010-02-17 18:06:33 UTC (rev 16905)
@@ -82,7 +82,7 @@
 }
 
 TheoraEncodeFilter::TheoraEncodeFilter(void)
-	:	AbstractTransformFilter(NAME("Theora Encoder"), CLSID_TheoraEncodeFilter)
+	:	AbstractTransformFilter(NAME("Xiph.Org Theora Encoder"), CLSID_TheoraEncodeFilter)
     ,   mUsingQualityMode(true)
 {
 	bool locWasConstructed = ConstructPins();
@@ -391,4 +391,26 @@
     
     return S_OK;
 
-}
\ No newline at end of file
+}
+
+void TheoraEncodeFilter::setFlipImageVerticaly(bool flipImageVerticaly)
+{
+    if (!mInputPin)
+    {
+        return;
+    }
+
+    TheoraEncodeInputPin* inputPin = static_cast<TheoraEncodeInputPin*>(mInputPin);
+    inputPin->SetFlipImageVerticaly(flipImageVerticaly);
+}
+
+bool TheoraEncodeFilter::getFlipImageVerticaly()
+{
+    if (!mInputPin)
+    {
+        return false;
+    }
+
+    TheoraEncodeInputPin* inputPin = static_cast<TheoraEncodeInputPin*>(mInputPin);
+    return inputPin->GetFlipImageVerticaly();
+}

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeFilter.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeFilter.h	2010-02-16 05:27:05 UTC (rev 16904)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeFilter.h	2010-02-17 18:06:33 UTC (rev 16905)
@@ -96,8 +96,9 @@
     virtual STDMETHODIMP_(bool) setKeyframeFreqMin(unsigned long inKeyframeFreqMin);
     virtual STDMETHODIMP_(bool) setKeyframeAutoThreshold(long inKeyframeAutoThreshold);
 	//
+    virtual STDMETHODIMP_(void) setFlipImageVerticaly(bool flipVerticalImage);
+    virtual STDMETHODIMP_(bool) getFlipImageVerticaly();
 
-
 	
 	//SpecifyPropertyPages Implementation
 	STDMETHODIMP GetPages(CAUUID* outPropPages);

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp	2010-02-16 05:27:05 UTC (rev 16904)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp	2010-02-17 18:06:33 UTC (rev 16905)
@@ -47,7 +47,7 @@
 	,	m_uptoFrame(0)
 	,	m_hasBegun(false)
 	,	m_numFrames(0)
-    ,   m_isImageFlipped(false)
+    ,   m_flipImageVerticaly(false)
 
 {
 	//debugLog.open("g:\\logs\\theoencfiltinput.log", ios_base::out);
@@ -654,7 +654,7 @@
 
     long stride = 0;
 
-    if (m_isImageFlipped)
+    if (m_flipImageVerticaly)
     {
         stride = m_width * 3;
         pSource = inBuf;
@@ -731,7 +731,7 @@
 
     long stride = 0;
 
-    if (m_isImageFlipped)
+    if (m_flipImageVerticaly)
     {
         stride = m_width * 4;
         pSource = inBuf;
@@ -1424,11 +1424,6 @@
 			m_averageTimePerFrame = videoFormat->AvgTimePerFrame;
 			m_width = videoFormat->bmiHeader.biWidth;
             m_height = std::abs(videoFormat->bmiHeader.biHeight);
-
-            if (videoFormat->bmiHeader.biHeight > 0)
-            {
-                m_isImageFlipped = true;
-            }
 		}
 		else if (inMediaType->formattype == FORMAT_VideoInfo)
 		{
@@ -1437,11 +1432,6 @@
 			m_averageTimePerFrame = videoFormat->AvgTimePerFrame;
 			m_width = videoFormat->bmiHeader.biWidth;
             m_height = std::abs(videoFormat->bmiHeader.biHeight);
-
-            if (videoFormat->bmiHeader.biHeight > 0)
-            {
-                m_isImageFlipped = true;
-            }
 		}
 
 		if (m_averageTimePerFrame == 0)
@@ -1466,3 +1456,13 @@
 {
 	return &m_theoraInfo;
 }
+
+bool TheoraEncodeInputPin::GetFlipImageVerticaly() const
+{
+    return m_flipImageVerticaly;
+}
+
+void TheoraEncodeInputPin::SetFlipImageVerticaly( bool val )
+{
+    m_flipImageVerticaly = val;
+}

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.h	2010-02-16 05:27:05 UTC (rev 16904)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.h	2010-02-17 18:06:33 UTC (rev 16905)
@@ -57,6 +57,9 @@
 
 	theora_info* theoraInfo();
 
+    bool GetFlipImageVerticaly() const;
+    void SetFlipImageVerticaly(bool val);
+
 protected:
 
 	//PURE VIRTUALS
@@ -97,8 +100,7 @@
 
 	bool m_hasBegun;
 
-    bool m_isImageFlipped;
-
+    bool m_flipImageVerticaly;
 	/* To adapt theora frame rate to variable directshow clock */
 	unsigned __int64 m_numFrames;
 

Deleted: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/dsfTheoraEncoder.aps
===================================================================
(Binary files differ)

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/dsfTheoraEncoder.rc
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/dsfTheoraEncoder.rc	2010-02-16 05:27:05 UTC (rev 16904)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/dsfTheoraEncoder.rc	2010-02-17 18:06:33 UTC (rev 16905)
@@ -58,9 +58,9 @@
     IDD_THEORA_ENCODE_SETTINGS, DIALOG
     BEGIN
         LEFTMARGIN, 2
-        RIGHTMARGIN, 206
+        RIGHTMARGIN, 246
         TOPMARGIN, 2
-        BOTTOMMARGIN, 269
+        BOTTOMMARGIN, 292
     END
 END
 #endif    // APSTUDIO_INVOKED
@@ -71,13 +71,13 @@
 // Dialog
 //
 
-IDD_THEORA_ENCODE_SETTINGS DIALOGEX 0, 0, 209, 274
-STYLE DS_SETFONT | WS_CHILD | WS_BORDER
+IDD_THEORA_ENCODE_SETTINGS DIALOGEX 0, 0, 249, 297
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_BORDER
 FONT 8, "MS Shell Dlg", 400, 0, 0x0
 BEGIN
-    GROUPBOX        "Quality Settings",IDC_GROUP_QUALITY,2,2,204,90
+    GROUPBOX        "Quality Settings",IDC_GROUP_QUALITY,2,2,244,90
     CONTROL         "",IDC_SLIDER_QUALITY,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,13,26,184,11
-    GROUPBOX        "Keyframe Settings",IDC_GROUP_KEYFRAME,2,94,204,96
+    GROUPBOX        "Keyframe Settings",IDC_GROUP_KEYFRAME,2,94,244,96
     CONTROL         "",IDC_SLIDER_LOG_KEYFRAME,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,13,112,184,11
     CONTROL         "",IDC_SLIDER_BITRATE,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,14,52,183,11
     LTEXT           "",IDC_LABEL_BITRATE,145,41,52,9,WS_BORDER,WS_EX_RIGHT
@@ -93,8 +93,8 @@
     RTEXT           "Target Bitrate",IDC_STATIC_BITRATE,84,41,56,10
     RTEXT           "Q-Value",IDC_STATIC_Q_VALUE,102,15,41,10
     CONTROL         "Allow Dropped Frames",IDC_CHECK_ALLOW_DROP_FRAMES,
-                    "Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,113,249,93,9
-    GROUPBOX        "Advanced Settings",IDC_GROUP_QUALITY2,2,191,204,71
+                    "Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,153,249,93,9
+    GROUPBOX        "Advanced Settings",IDC_GROUP_QUALITY2,2,191,244,71
     RTEXT           "Max. Interval",IDC_STATIC_KF_MAX,96,102,48,10
     RTEXT           "Min. Interval",IDC_STATIC_KFI_MIN,103,142,41,10
     RTEXT           "Threshold",IDC_STATIC_KFI_THRESHOLD,89,167,56,10
@@ -105,6 +105,8 @@
     LTEXT           "",IDC_LABEL_BITRATE_KEYFRAME,144,69,52,9,WS_BORDER,WS_EX_RIGHT
     RTEXT           "Keyframe Data Bitrate",IDC_STATIC_BITRATE_KEYFRAME,53,68,87,10
     CONTROL         "Quick Mode",IDC_CHECK_QUICK_MODE,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,14,249,83,9
+    GROUPBOX        "Misc",IDC_STATIC,2,264,244,28
+    CONTROL         "Flip Image Verticaly",IDC_FLIP_VERTICAL_IMAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,277,232,11
 END
 
 #endif    // English (U.S.) resources

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/resource.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/resource.h	2010-02-16 05:27:05 UTC (rev 16904)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/resource.h	2010-02-17 18:06:33 UTC (rev 16905)
@@ -37,6 +37,8 @@
 #define IDC_CHECK_QUALITY_MODE          1038
 #define IDC_STATIC_BITRATE_KEYFRAME     1039
 #define IDC_CHECK_QUICK_MODE            1040
+#define IDC_FLIP_VERTICAL_IMAGE         1042
+#define IDC_STATIC                      -1
 
 // Next default values for new objects
 // 
@@ -44,7 +46,7 @@
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE        104
 #define _APS_NEXT_COMMAND_VALUE         40001
-#define _APS_NEXT_CONTROL_VALUE         1041
+#define _APS_NEXT_CONTROL_VALUE         1043
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/theoraencoderdllstuff.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/theoraencoderdllstuff.cpp	2010-02-16 05:27:05 UTC (rev 16904)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/theoraencoderdllstuff.cpp	2010-02-17 18:06:33 UTC (rev 16905)
@@ -58,7 +58,7 @@
 
 	hr = locFilterMapper->RegisterFilter(
 		CLSID_TheoraEncodeFilter,						// Filter CLSID. 
-		L"Theora Encode Filter",							// Filter name.
+		L"Xiph.Org Theora Encoder",							// Filter name.
         NULL,										// Device moniker. 
         &CLSID_LegacyAmFilterCategory,				// Direct Show general category
         NULL,							// Instance data. ???????



More information about the commits mailing list