[xiph-commits] r11872 - in trunk/oggdsf/src/lib/codecs: theora/filters/dsfTheoraEncoder vorbis/filters/dsfVorbisEncoder

illiminable at svn.xiph.org illiminable at svn.xiph.org
Sun Oct 1 06:44:05 PDT 2006


Author: illiminable
Date: 2006-10-01 06:43:45 -0700 (Sun, 01 Oct 2006)
New Revision: 11872

Modified:
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/PropsTheoraEncoder.cpp
   trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/PropsVorbisEncoder.cpp
   trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/PropsVorbisEncoder.h
   trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeFilter.cpp
   trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeFilter.h
   trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/dsfVorbisEncoder.aps
   trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/dsfVorbisEncoder.rc
   trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/resource.h
Log:
* Properties page for encoding vvorbis. Allows quality mode, or basic managed (target/min/max). Kind of crappy looking still.
* Add a missing default:break; into the theora property page message loop

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/PropsTheoraEncoder.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/PropsTheoraEncoder.cpp	2006-10-01 08:03:18 UTC (rev 11871)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/PropsTheoraEncoder.cpp	2006-10-01 13:43:45 UTC (rev 11872)
@@ -407,6 +407,8 @@
             }
 
 			break;
+        default:
+            break;
 
          
     } // switch

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/PropsVorbisEncoder.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/PropsVorbisEncoder.cpp	2006-10-01 08:03:18 UTC (rev 11871)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/PropsVorbisEncoder.cpp	2006-10-01 13:43:45 UTC (rev 11872)
@@ -22,8 +22,87 @@
 HRESULT PropsVorbisEncoder::OnActivate(void)
 {
     //TODO::: Setup everything
+    wchar_t* locStrBuff = new wchar_t[16];
+
+    VorbisEncodeSettings locSettings = mVorbisEncodeSettings->getEncoderSettings();
+
+    SendDlgItemMessage(m_Dlg, IDC_SLIDER_QUALITY, TBM_SETRANGE, TRUE, MAKELONG(0, 99));
+    SendDlgItemMessage(m_Dlg, IDC_SLIDER_QUALITY, TBM_SETTICFREQ, 1, 0);
+    SendDlgItemMessage(m_Dlg, IDC_SLIDER_QUALITY, TBM_SETPOS, 1, locSettings.mQuality);
+
+    SendDlgItemMessage(m_Dlg, IDC_SLIDER_TARGET_BITRATE, TBM_SETRANGE, TRUE, MAKELONG(16, 1024));
+    SendDlgItemMessage(m_Dlg, IDC_SLIDER_TARGET_BITRATE, TBM_SETTICFREQ, 16, 0);
+    SendDlgItemMessage(m_Dlg, IDC_SLIDER_TARGET_BITRATE, TBM_SETPOS, 1, locSettings.mBitrate);
+
+    SendDlgItemMessage(m_Dlg, IDC_SLIDER_MIN_BITRATE, TBM_SETRANGE, TRUE, MAKELONG(16, 1024));
+    SendDlgItemMessage(m_Dlg, IDC_SLIDER_MIN_BITRATE, TBM_SETTICFREQ, 16, 0);
+    SendDlgItemMessage(m_Dlg, IDC_SLIDER_MIN_BITRATE, TBM_SETPOS, 1, locSettings.mMinBitrate);
+
+    SendDlgItemMessage(m_Dlg, IDC_SLIDER_MAX_BITRATE, TBM_SETRANGE, TRUE, MAKELONG(16, 1024));
+    SendDlgItemMessage(m_Dlg, IDC_SLIDER_MAX_BITRATE, TBM_SETTICFREQ, 16, 0);
+    SendDlgItemMessage(m_Dlg, IDC_SLIDER_MAX_BITRATE, TBM_SETPOS, 1, locSettings.mMaxBitrate);
+
+   //Fill out the labels
+    _itow(locSettings.mQuality, locStrBuff, 10);
+    SendDlgItemMessage(m_Dlg, IDC_LABEL_Q_VALUE, WM_SETTEXT, 0, (LPARAM)locStrBuff);
+
+    _itow(locSettings.mBitrate, locStrBuff, 10);
+    SendDlgItemMessage(m_Dlg, IDC_LABEL_TARGET_BITRATE, WM_SETTEXT, 0, (LPARAM)locStrBuff);
+
+    _itow(locSettings.mMinBitrate, locStrBuff, 10);
+    SendDlgItemMessage(m_Dlg, IDC_LABEL_MIN_BITRATE, WM_SETTEXT, 0, (LPARAM)locStrBuff);
+
+    _itow(locSettings.mMaxBitrate, locStrBuff, 10);
+    SendDlgItemMessage(m_Dlg, IDC_LABEL_MAX_BITRATE, WM_SETTEXT, 0, (LPARAM)locStrBuff);
+
+    SendDlgItemMessage(m_Dlg, IDC_CHECK_Q_MODE, BM_SETCHECK, (WPARAM)(locSettings.mIsQualitySet ? BST_CHECKED : BST_UNCHECKED), 0);
+    setUsingQualityMode(locSettings.mIsQualitySet);
+
+    delete[] locStrBuff;
+
+
+
+
+
     return S_OK;
 }
+
+void PropsVorbisEncoder::setUsingQualityMode(bool inIsUsingQualityMode)
+{
+    if (inIsUsingQualityMode) {
+        EnableWindow(GetDlgItem(m_hwnd, IDC_SLIDER_QUALITY), TRUE);
+        EnableWindow(GetDlgItem(m_hwnd, IDC_LABEL_Q_VALUE), TRUE);
+        EnableWindow(GetDlgItem(m_hwnd, IDC_STATIC_Q_VALUE), TRUE);
+
+        EnableWindow(GetDlgItem(m_hwnd, IDC_SLIDER_TARGET_BITRATE), FALSE);
+        EnableWindow(GetDlgItem(m_hwnd, IDC_LABEL_TARGET_BITRATE), FALSE);
+        EnableWindow(GetDlgItem(m_hwnd, IDC_STATIC_TARGET_BITRATE), FALSE);
+
+        EnableWindow(GetDlgItem(m_hwnd, IDC_SLIDER_MIN_BITRATE), FALSE);
+        EnableWindow(GetDlgItem(m_hwnd, IDC_LABEL_MIN_BITRATE), FALSE);
+        EnableWindow(GetDlgItem(m_hwnd, IDC_STATIC_MIN_BITRATE), FALSE);
+
+        EnableWindow(GetDlgItem(m_hwnd, IDC_SLIDER_MAX_BITRATE), FALSE);
+        EnableWindow(GetDlgItem(m_hwnd, IDC_LABEL_MAX_BITRATE), FALSE);
+        EnableWindow(GetDlgItem(m_hwnd, IDC_STATIC_MAX_BITRATE), FALSE);
+    } else {
+        EnableWindow(GetDlgItem(m_hwnd, IDC_SLIDER_QUALITY), FALSE);
+        EnableWindow(GetDlgItem(m_hwnd, IDC_LABEL_Q_VALUE), FALSE);
+        EnableWindow(GetDlgItem(m_hwnd, IDC_STATIC_Q_VALUE), FALSE);
+
+        EnableWindow(GetDlgItem(m_hwnd, IDC_SLIDER_TARGET_BITRATE), TRUE);
+        EnableWindow(GetDlgItem(m_hwnd, IDC_LABEL_TARGET_BITRATE), TRUE);
+        EnableWindow(GetDlgItem(m_hwnd, IDC_STATIC_TARGET_BITRATE), TRUE);
+
+        EnableWindow(GetDlgItem(m_hwnd, IDC_SLIDER_MIN_BITRATE), TRUE);
+        EnableWindow(GetDlgItem(m_hwnd, IDC_LABEL_MIN_BITRATE), TRUE);
+        EnableWindow(GetDlgItem(m_hwnd, IDC_STATIC_MIN_BITRATE), TRUE);
+
+        EnableWindow(GetDlgItem(m_hwnd, IDC_SLIDER_MAX_BITRATE), TRUE);
+        EnableWindow(GetDlgItem(m_hwnd, IDC_LABEL_MAX_BITRATE), TRUE);
+        EnableWindow(GetDlgItem(m_hwnd, IDC_STATIC_MAX_BITRATE), TRUE);
+    }
+}
 HRESULT PropsVorbisEncoder::OnConnect(IUnknown *pUnk)
 {
 	if (mVorbisEncodeSettings != NULL) {
@@ -46,6 +125,56 @@
 }
 INT_PTR PropsVorbisEncoder::OnReceiveMessage(HWND hwnd,  UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
+	wchar_t locBuff[16];
+    
+    switch (uMsg)    {
+		case WM_COMMAND:
+            //TODO::: Need to check the high wparam ??
+            if (HIWORD(wParam) == BN_CLICKED) {
+                if (HWND(lParam) == GetDlgItem(m_hwnd, IDC_CHECK_Q_MODE)) {
+                    SetDirty();
+                    setUsingQualityMode(SendDlgItemMessage(m_hwnd,IDC_CHECK_Q_MODE, BM_GETCHECK, NOT_USED, NOT_USED));
+                }
+            }
+            break;
+		case WM_HSCROLL:
+			if (HWND(lParam) == GetDlgItem(m_hwnd, IDC_SLIDER_QUALITY)) {
+				SetDirty();
+				_itow(SendDlgItemMessage(m_hwnd,IDC_SLIDER_QUALITY, TBM_GETPOS, 0, 0), locBuff, 10);
+				SendDlgItemMessage(m_hwnd, IDC_LABEL_Q_VALUE, WM_SETTEXT, 0, (LPARAM)&locBuff);
+
+
+                return (INT_PTR)TRUE;
+            } else if (HWND(lParam) == GetDlgItem(m_hwnd, IDC_SLIDER_TARGET_BITRATE)) {
+				SetDirty();
+				_itow(SendDlgItemMessage(m_hwnd,IDC_SLIDER_TARGET_BITRATE, TBM_GETPOS, 0, 0), locBuff, 10);
+				SendDlgItemMessage(m_hwnd, IDC_LABEL_TARGET_BITRATE, WM_SETTEXT, 0, (LPARAM)&locBuff);
+
+
+                return (INT_PTR)TRUE;
+
+            } else if (HWND(lParam) == GetDlgItem(m_hwnd, IDC_SLIDER_MIN_BITRATE)) {
+				SetDirty();
+				_itow(SendDlgItemMessage(m_hwnd,IDC_SLIDER_MIN_BITRATE, TBM_GETPOS, 0, 0), locBuff, 10);
+				SendDlgItemMessage(m_hwnd, IDC_LABEL_MIN_BITRATE, WM_SETTEXT, 0, (LPARAM)&locBuff);
+
+
+                return (INT_PTR)TRUE;
+
+            } else if (HWND(lParam) == GetDlgItem(m_hwnd, IDC_SLIDER_MAX_BITRATE)) {
+				SetDirty();
+				_itow(SendDlgItemMessage(m_hwnd,IDC_SLIDER_MAX_BITRATE, TBM_GETPOS, 0, 0), locBuff, 10);
+				SendDlgItemMessage(m_hwnd, IDC_LABEL_MAX_BITRATE, WM_SETTEXT, 0, (LPARAM)&locBuff);
+
+
+                return (INT_PTR)TRUE;
+
+            }
+            break;
+        default:
+            break;
+    }
+
     // Did not handle the message.
     return CBasePropertyPage::OnReceiveMessage(hwnd, uMsg, wParam, lParam);
 }
@@ -56,6 +185,16 @@
 	}
     //TODO::: Apply the settings.
 
+    if (SendDlgItemMessage(m_hwnd,IDC_CHECK_Q_MODE, BM_GETCHECK, 0, 0)) {
+        mVorbisEncodeSettings->setQuality(SendDlgItemMessage(m_hwnd,IDC_SLIDER_QUALITY, TBM_GETPOS, 0, 0));
+
+    } else {
+        mVorbisEncodeSettings->setManaged(      SendDlgItemMessage(m_hwnd,IDC_SLIDER_TARGET_BITRATE, TBM_GETPOS, 0, 0) * 1000
+                                            ,   SendDlgItemMessage(m_hwnd,IDC_SLIDER_MIN_BITRATE, TBM_GETPOS, 0, 0) * 1000
+                                            ,   SendDlgItemMessage(m_hwnd,IDC_SLIDER_MAX_BITRATE, TBM_GETPOS, 0, 0) * 1000);
+
+    }
+
 	SetClean();
     return S_OK;
 }

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/PropsVorbisEncoder.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/PropsVorbisEncoder.h	2006-10-01 08:03:18 UTC (rev 11871)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/PropsVorbisEncoder.h	2006-10-01 13:43:45 UTC (rev 11872)
@@ -24,5 +24,6 @@
 	void SetDirty();
 	void SetClean();
 
+    void setUsingQualityMode(bool inIsUsingQualityMode);
     IVorbisEncodeSettings* mVorbisEncodeSettings;
 };

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeFilter.cpp	2006-10-01 08:03:18 UTC (rev 11871)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeFilter.cpp	2006-10-01 13:43:45 UTC (rev 11872)
@@ -42,6 +42,13 @@
 	    VorbisEncodeFilter::CreateInstance,	    // Method to create an instance of MyComponent
         NULL,									// Initialization function
         NULL									// Set-up information (for filters)
+    },
+    { 
+		L"Vorbis Encode Properties",						// Name
+	    &CLSID_PropsVorbisEncoder,            // CLSID
+	    PropsVorbisEncoder::CreateInstance,	// Method to create an instance of MyComponent
+        NULL,									// Initialization function
+        NULL									// Set-up information (for filters)
     }
 
 };

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeFilter.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeFilter.h	2006-10-01 08:03:18 UTC (rev 11871)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeFilter.h	2006-10-01 13:43:45 UTC (rev 11872)
@@ -34,6 +34,7 @@
 //Local Includes
 #include "vorbisencoderdllstuff.h"
 #include "IVorbisEncodeSettings.h"
+#include "PropsVorbisEncoder.h"
 
 //External Includes
 #include "AbstractTransformFilter.h"

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/dsfVorbisEncoder.aps
===================================================================
(Binary files differ)

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/dsfVorbisEncoder.rc
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/dsfVorbisEncoder.rc	2006-10-01 08:03:18 UTC (rev 11871)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/dsfVorbisEncoder.rc	2006-10-01 13:43:45 UTC (rev 11872)
@@ -56,7 +56,20 @@
 STYLE DS_SETFONT | WS_CHILD | WS_BORDER
 FONT 8, "MS Sans Serif", 400, 0, 0x0
 BEGIN
-    LTEXT           "TODO: layout property page",IDC_STATIC,60,73,90,8
+    CONTROL         "",IDC_SLIDER_QUALITY,"msctls_trackbar32",TBS_NOTICKS | WS_TABSTOP,4,31,202,11
+    LTEXT           "",IDC_LABEL_Q_VALUE,147,19,52,9,WS_BORDER
+    GROUPBOX        "Quality",IDC_GROUP_QUALITY,4,7,202,122
+    RTEXT           "Q-Value",IDC_STATIC_Q_VALUE,90,19,52,9
+    CONTROL         "Use Q-Mode",IDC_CHECK_Q_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,16,65,12
+    CONTROL         "",IDC_SLIDER_TARGET_BITRATE,"msctls_trackbar32",TBS_NOTICKS | WS_TABSTOP,4,57,202,11
+    CONTROL         "",IDC_SLIDER_MIN_BITRATE,"msctls_trackbar32",TBS_NOTICKS | WS_TABSTOP,4,82,202,11
+    CONTROL         "",IDC_SLIDER_MAX_BITRATE,"msctls_trackbar32",TBS_NOTICKS | WS_TABSTOP,4,106,202,11
+    LTEXT           "",IDC_LABEL_TARGET_BITRATE,147,42,52,9,WS_BORDER
+    LTEXT           "",IDC_LABEL_MIN_BITRATE,147,70,52,9,WS_BORDER
+    LTEXT           "",IDC_LABEL_MAX_BITRATE,147,95,52,9,WS_BORDER
+    RTEXT           "Target Bitrate",IDC_STATIC_TARGET_BITRATE,90,42,52,9
+    RTEXT           "Min. Bitrate",IDC_STATIC_MIN_BITRATE,91,70,52,9
+    RTEXT           "Max. Bitrate",IDC_STATIC_MAX_BITRATE,90,94,52,9
 END
 
 
@@ -70,8 +83,8 @@
 BEGIN
     IDD_VORBIS_ENCODE_SETTINGS, DIALOG
     BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 203
+        LEFTMARGIN, 4
+        RIGHTMARGIN, 206
         TOPMARGIN, 7
         BOTTOMMARGIN, 147
     END

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/resource.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/resource.h	2006-10-01 08:03:18 UTC (rev 11871)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/resource.h	2006-10-01 13:43:45 UTC (rev 11872)
@@ -4,6 +4,21 @@
 //
 #define IDS_VORBIS_ENC_PROPS_STRING     101
 #define IDD_VORBIS_ENCODE_SETTINGS      106
+#define IDC_SLIDER_QUALITY              1001
+#define IDC_GROUP_QUALITY               1002
+#define IDC_LABEL_Q_VALUE               1003
+#define IDC_STATIC_Q_VALUE              1004
+#define IDC_CHECK_Q_MODE                1005
+#define IDC_SLIDER_TARGET_BITRATE       1006
+#define IDC_SLIDER_MIN_BITRATE          1007
+#define IDC_SLIDER_QUALITY4             1008
+#define IDC_SLIDER_MAX_BITRATE          1008
+#define IDC_LABEL_TARGET_BITRATE        1009
+#define IDC_LABEL_MIN_BITRATE           1010
+#define IDC_LABEL_MAX_BITRATE           1011
+#define IDC_STATIC_TARGET_BITRATE       1012
+#define IDC_STATIC_MIN_BITRATE          1013
+#define IDC_STATIC_MAX_BITRATE          1014
 
 // Next default values for new objects
 // 
@@ -11,7 +26,7 @@
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE        102
 #define _APS_NEXT_COMMAND_VALUE         40001
-#define _APS_NEXT_CONTROL_VALUE         1001
+#define _APS_NEXT_CONTROL_VALUE         1006
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif



More information about the commits mailing list