[xiph-commits] r6948 -

illiminable at dactyl.lonelymoon.com illiminable
Fri Jul 2 08:43:47 PDT 2004


trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder
Message-ID: <20040702154347.9BBD89AAAD at dactyl.lonelymoon.com>

Author: illiminable
Date: Fri Jul  2 08:43:47 2004
New Revision: 6948

Modified:
trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/PropsTheoraEncoder.cpp
trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/PropsTheoraEncoder.h
trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/dsfTheoraEncoder.aps
trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/dsfTheoraEncoder.rc
trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/dsfTheoraEncoder.vcproj
trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/resource.h
Log:
* Completed minimal encoder property page for theora encode filter.

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/PropsTheoraEncoder.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/PropsTheoraEncoder.cpp	2004-07-02 15:31:11 UTC (rev 6947)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/PropsTheoraEncoder.cpp	2004-07-02 15:43:44 UTC (rev 6948)
@@ -6,11 +6,13 @@
,	mTheoraEncodeSettings(NULL)

{
+	debugLog.open("G:\\logs\\TheoProps.log", ios_base::out);
*outHR = S_OK;
}

PropsTheoraEncoder::~PropsTheoraEncoder(void)
{
+	debugLog.close();
}

CUnknown* PropsTheoraEncoder::CreateInstance(LPUNKNOWN inUnk, HRESULT* outHR)
@@ -18,21 +20,100 @@
return new PropsTheoraEncoder(inUnk, outHR);
}

+//LRESULT PropsTheoraEncoder::addNumberToCombo(int inComboID, int inNum) {
+//	char locStrBuff[16];
+//	itoa(inNum, (char*)&locStrBuff, 10);
+//	return SendDlgItemMessage(m_Dlg, IDC_COMBO_BITRATE, CB_ADDSTRING, NOT_USED, (LPARAM)&locStrBuff);
+//
+//}
+//
+//void PropsTheoraEncoder::SetupBitrateCombo() {
+//	addNumberToCombo(IDC_COMBO_BITRATE, 64000);
+//	addNumberToCombo(IDC_COMBO_BITRATE, 96000);
+//	addNumberToCombo(IDC_COMBO_BITRATE, 128000);
+//	addNumberToCombo(IDC_COMBO_BITRATE, 192000);
+//	addNumberToCombo(IDC_COMBO_BITRATE, 256000);
+//	addNumberToCombo(IDC_COMBO_BITRATE, 384000);
+//	addNumberToCombo(IDC_COMBO_BITRATE, 512000);
+//	addNumberToCombo(IDC_COMBO_BITRATE, 768000);
+//	addNumberToCombo(IDC_COMBO_BITRATE, 1024000);
+//	addNumberToCombo(IDC_COMBO_BITRATE, 1536000);
+//	addNumberToCombo(IDC_COMBO_BITRATE, 2000000);
+//
+//}
+//
+//void PropsTheoraEncoder::SetupKeyframeFreqCombo() {
+//
+//	addNumberToCombo(IDC_COMBO_LOG_KEYFRAME_FREQ, 1);
+//	addNumberToCombo(IDC_COMBO_LOG_KEYFRAME_FREQ, 2);
+//	addNumberToCombo(IDC_COMBO_LOG_KEYFRAME_FREQ, 3);
+//	addNumberToCombo(IDC_COMBO_LOG_KEYFRAME_FREQ, 4);
+//	addNumberToCombo(IDC_COMBO_LOG_KEYFRAME_FREQ, 5);
+//	addNumberToCombo(IDC_COMBO_LOG_KEYFRAME_FREQ, 6);
+//	addNumberToCombo(IDC_COMBO_LOG_KEYFRAME_FREQ, 7);
+//	addNumberToCombo(IDC_COMBO_LOG_KEYFRAME_FREQ, 8);
+//	addNumberToCombo(IDC_COMBO_LOG_KEYFRAME_FREQ, 9);
+//	addNumberToCombo(IDC_COMBO_LOG_KEYFRAME_FREQ, 10);
+//
+//}
+
+unsigned long PropsTheoraEncoder::log2(unsigned long inNum) {
+	unsigned long ret = 0;
+	while (inNum != 0) {
+		inNum>>=1;
+		ret++;
+	}
+	return ret - 1;
+}
+
+unsigned long PropsTheoraEncoder::pow2(unsigned long inNum) {
+	return 1 << (inNum);
+}
+
+HRESULT PropsTheoraEncoder::OnApplyChanges(void)
+{
+	if (mTheoraEncodeSettings == NULL) {
+		return E_POINTER;
+	}
+
+	mTheoraEncodeSettings->setQuality(SendDlgItemMessage(m_hwnd,IDC_SLIDER_QUALITY, TBM_GETPOS, NOT_USED, NOT_USED));
+	mTheoraEncodeSettings->setKeyframeFreq(pow2(SendDlgItemMessage(m_hwnd,IDC_SLIDER_LOG_KEYFRAME, TBM_GETPOS, NOT_USED, NOT_USED)));
+	mTheoraEncodeSettings->setTargetBitrate(SendDlgItemMessage(m_hwnd,IDC_SLIDER_BITRATE, TBM_GETPOS, NOT_USED, NOT_USED) * 1000);
+	SetClean();
+    return S_OK;
+}
+
HRESULT PropsTheoraEncoder::OnActivate(void)
{

char* locStrBuff = new char[16];

-    SendDlgItemMessage(m_Dlg, IDC_SLIDER_QUALITY, TBM_SETRANGE, 0, MAKELONG(0, 63));
+	//SetupBitrateCombo();
+	//SetupKeyframeFreqCombo();
+
+	//Set up the sliders
+    SendDlgItemMessage(m_Dlg, IDC_SLIDER_QUALITY, TBM_SETRANGE, TRUE, MAKELONG(0, 63));
SendDlgItemMessage(m_Dlg, IDC_SLIDER_QUALITY, TBM_SETTICFREQ, 1, 0);
SendDlgItemMessage(m_Dlg, IDC_SLIDER_QUALITY, TBM_SETPOS, 1, mTheoraEncodeSettings->quality());

-    itoa(mTheoraEncodeSettings->targetBitrate(), locStrBuff, 10);
+	SendDlgItemMessage(m_Dlg, IDC_SLIDER_LOG_KEYFRAME, TBM_SETRANGE, TRUE, MAKELONG(0, 6));
+    SendDlgItemMessage(m_Dlg, IDC_SLIDER_LOG_KEYFRAME, TBM_SETTICFREQ, 1, 0);
+    SendDlgItemMessage(m_Dlg, IDC_SLIDER_LOG_KEYFRAME, TBM_SETPOS, 1, log2(mTheoraEncodeSettings->keyframeFreq()));

-	SendDlgItemMessage(m_Dlg, IDC_COMBO_BITRATE, WM_SETTEXT, 0, (LPARAM)locStrBuff);
+	SendDlgItemMessage(m_Dlg, IDC_SLIDER_BITRATE, TBM_SETRANGE, TRUE, MAKELONG(64, 1984));
+    SendDlgItemMessage(m_Dlg, IDC_SLIDER_BITRATE, TBM_SETTICFREQ, 32, 0);
+    SendDlgItemMessage(m_Dlg, IDC_SLIDER_BITRATE, TBM_SETPOS, 1, mTheoraEncodeSettings->targetBitrate() / 1000);
+
+
+	itoa(mTheoraEncodeSettings->quality(), locStrBuff, 10);
+	SendDlgItemMessage(m_Dlg, IDC_LABEL_QUALITY, WM_SETTEXT, NOT_USED, (LPARAM)locStrBuff);
+
itoa(mTheoraEncodeSettings->keyframeFreq(), locStrBuff, 10);
-	SendDlgItemMessage(m_Dlg, IDC_COMBO_KEYFRAME_FREQ, WM_SETTEXT, 0, (LPARAM)locStrBuff);
+	SendDlgItemMessage(m_Dlg, IDC_LABEL_LOG_KEYFRAME, WM_SETTEXT,NOT_USED,  (LPARAM)locStrBuff);

+	itoa(mTheoraEncodeSettings->targetBitrate(), locStrBuff, 10);
+	SendDlgItemMessage(m_Dlg, IDC_LABEL_BITRATE, WM_SETTEXT,NOT_USED,  (LPARAM)locStrBuff);
+
delete locStrBuff;
return S_OK;
}
@@ -59,19 +140,50 @@
}
return S_OK;
}
+void PropsTheoraEncoder::SetDirty()
+{
+    m_bDirty = TRUE;
+    if (m_pPageSite)
+    {
+        m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);
+    }
+}

+void PropsTheoraEncoder::SetClean()
+{
+    m_bDirty = FALSE;
+    if (m_pPageSite)
+    {
+        m_pPageSite->OnStatusChange(PROPPAGESTATUS_CLEAN);
+    }
+}
INT_PTR PropsTheoraEncoder::OnReceiveMessage(HWND hwnd,  UINT uMsg, WPARAM wParam, LPARAM lParam)
{
-    switch (uMsg)
-    {
-    case WM_COMMAND:
-        if (LOWORD(wParam) == IDC_SLIDER_QUALITY)
-        {
-            UINT m_lNewVal = GetDlgItemInt(m_Dlg, IDC_SLIDER_QUALITY, 0, TRUE);
-            //SetDirty();
-            return (INT_PTR)TRUE;
-        }
-        break;
+	char locBuff[16];
+    switch (uMsg)    {
+		case WM_COMMAND:
+
+		case WM_HSCROLL:
+			if (HWND(lParam) == GetDlgItem(m_hwnd, IDC_SLIDER_QUALITY)) {
+				SetDirty();
+				itoa(SendDlgItemMessage(m_hwnd,IDC_SLIDER_QUALITY, TBM_GETPOS, NOT_USED, NOT_USED), (char*)&locBuff, 10);
+				SendDlgItemMessage(m_hwnd, IDC_LABEL_QUALITY, WM_SETTEXT, NOT_USED, (LPARAM)&locBuff);
+                 return (INT_PTR)TRUE;
+
+			} else if (HWND(lParam) == GetDlgItem(m_hwnd, IDC_SLIDER_BITRATE)) {
+				SetDirty();
+				itoa(SendDlgItemMessage(m_hwnd,IDC_SLIDER_BITRATE, TBM_GETPOS, NOT_USED, NOT_USED) * 1000, (char*)&locBuff, 10);
+				SendDlgItemMessage(m_hwnd, IDC_LABEL_BITRATE, WM_SETTEXT, NOT_USED, (LPARAM)&locBuff);
+                return (INT_PTR)TRUE;
+
+			} else if (HWND(lParam) == GetDlgItem(m_hwnd, IDC_SLIDER_LOG_KEYFRAME)) {
+				SetDirty();
+				itoa(pow2(SendDlgItemMessage(m_hwnd,IDC_SLIDER_LOG_KEYFRAME, TBM_GETPOS, NOT_USED, NOT_USED)), (char*)&locBuff, 10);
+				SendDlgItemMessage(m_hwnd, IDC_LABEL_LOG_KEYFRAME, WM_SETTEXT, NOT_USED, (LPARAM)&locBuff);
+                return (INT_PTR)TRUE;
+			}
+
+			break;
} // switch

// Did not handle the message.

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/PropsTheoraEncoder.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/PropsTheoraEncoder.h	2004-07-02 15:31:11 UTC (rev 6947)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/PropsTheoraEncoder.h	2004-07-02 15:43:44 UTC (rev 6948)
@@ -2,10 +2,15 @@
#include "resource.h"

#include <commctrl.h>
+//Debug
+#include <fstream>
+using namespace std;
+//
class PropsTheoraEncoder
:	public CBasePropertyPage
{
public:
+	static const UINT NOT_USED = 0;
PropsTheoraEncoder(LPUNKNOWN inUnk, HRESULT* outHR);
virtual ~PropsTheoraEncoder(void);

@@ -16,7 +21,25 @@
HRESULT OnConnect(IUnknown *pUnk);
HRESULT OnDisconnect(void);
INT_PTR OnReceiveMessage(HWND hwnd,  UINT uMsg, WPARAM wParam, LPARAM lParam);
+	HRESULT OnApplyChanges(void);

+
+
protected:
+
+	//
+	//void SetupBitrateCombo();
+	//void SetupKeyframeFreqCombo();
+	//LRESULT addNumberToCombo(int inComboID, int inNum);
+	unsigned long log2(unsigned long inNum);
+	unsigned long pow2(unsigned long inNum);
+	void SetDirty();
+	void SetClean();
+	//
ITheoraEncodeSettings* mTheoraEncodeSettings;
+
+	//Debug
+
+	fstream debugLog;
+	//
};

Modified: 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	2004-07-02 15:31:11 UTC (rev 6947)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/dsfTheoraEncoder.rc	2004-07-02 15:43:44 UTC (rev 6948)
@@ -60,7 +60,7 @@
LEFTMARGIN, 7
RIGHTMARGIN, 189
TOPMARGIN, 7
-        BOTTOMMARGIN, 120
+        BOTTOMMARGIN, 119
END
END
#endif    // APSTUDIO_INVOKED
@@ -71,70 +71,26 @@
// Dialog
//

-IDD_THEORA_ENCODE_SETTINGS DIALOGEX 0, 0, 196, 127
-STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_BORDER
+IDD_THEORA_ENCODE_SETTINGS DIALOGEX 0, 0, 196, 126
+STYLE DS_SETFONT | WS_CHILD | WS_BORDER
FONT 8, "MS Sans Serif", 400, 0, 0x0
BEGIN
-    COMBOBOX        IDC_COMBO_BITRATE,93,18,83,17,CBS_DROPDOWN | CBS_SORT |
-                    WS_VSCROLL | WS_TABSTOP
-    LTEXT           "Target Bitrate",IDC_STATIC_TBR,23,20,69,12
-    GROUPBOX        "Quality",IDC_GROUP_QUALITY,14,71,167,34
+    GROUPBOX        "Quality",IDC_GROUP_QUALITY,15,81,167,31
CONTROL         "",IDC_SLIDER_QUALITY,"msctls_trackbar32",TBS_AUTOTICKS |
-                    TBS_BOTH | WS_TABSTOP,19,86,159,12
-    LTEXT           "Keyframe Freq log2",IDC_STATIC,23,42,64,11
-    COMBOBOX        IDC_COMBO_KEYFRAME_FREQ,94,38,82,14,CBS_DROPDOWN |
-                    CBS_SORT | WS_VSCROLL | WS_TABSTOP
+                    TBS_BOTH | WS_TABSTOP,20,96,159,11
+    GROUPBOX        "log2(Keyframe Freq.)",IDC_GROUP_LOG_KEYFRAME,15,47,167,
+                    31
+    CONTROL         "",IDC_SLIDER_LOG_KEYFRAME,"msctls_trackbar32",
+                    TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,19,64,159,11
+    GROUPBOX        "Target Bitrate",IDC_GROUP_BITRATE,15,14,167,30
+    CONTROL         "",IDC_SLIDER_BITRATE,"msctls_trackbar32",TBS_AUTOTICKS |
+                    TBS_BOTH | WS_TABSTOP,22,30,158,11
+    LTEXT           "",IDC_LABEL_BITRATE,127,20,52,9,WS_BORDER,WS_EX_RIGHT
+    LTEXT           "",IDC_LABEL_LOG_KEYFRAME,127,53,52,9,WS_BORDER,
+                    WS_EX_RIGHT
+    LTEXT           "",IDC_LABEL_QUALITY,128,87,52,9,WS_BORDER,WS_EX_RIGHT
END

-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog Info
-//
-
-IDD_THEORA_ENCODE_SETTINGS DLGINIT
-BEGIN
-    IDC_COMBO_BITRATE, 0x403, 6, 0
-0x3631, 0x3030, 0x0030,
-    IDC_COMBO_BITRATE, 0x403, 6, 0
-0x3233, 0x3030, 0x0030,
-    IDC_COMBO_BITRATE, 0x403, 6, 0
-0x3436, 0x3030, 0x0030,
-    IDC_COMBO_BITRATE, 0x403, 7, 0
-0x3231, 0x3038, 0x3030, "\000"
-    IDC_COMBO_BITRATE, 0x403, 7, 0
-0x3532, 0x3036, 0x3030, "\000"
-    IDC_COMBO_BITRATE, 0x403, 7, 0
-0x3135, 0x3032, 0x3030, "\000"
-    IDC_COMBO_BITRATE, 0x403, 8, 0
-0x3031, 0x3432, 0x3030, 0x0030,
-    IDC_COMBO_BITRATE, 0x403, 8, 0
-0x3032, 0x3030, 0x3030, 0x0030,
-    IDC_COMBO_KEYFRAME_FREQ, 0x403, 2, 0
-0x0031,
-    IDC_COMBO_KEYFRAME_FREQ, 0x403, 2, 0
-0x0032,
-    IDC_COMBO_KEYFRAME_FREQ, 0x403, 2, 0
-0x0034,
-    IDC_COMBO_KEYFRAME_FREQ, 0x403, 2, 0
-0x0038,
-    IDC_COMBO_KEYFRAME_FREQ, 0x403, 3, 0
-0x3631, "\000"
-    IDC_COMBO_KEYFRAME_FREQ, 0x403, 3, 0
-0x3233, "\000"
-    IDC_COMBO_KEYFRAME_FREQ, 0x403, 3, 0
-0x3436, "\000"
-    IDC_COMBO_KEYFRAME_FREQ, 0x403, 4, 0
-0x3231, 0x0038,
-    IDC_COMBO_KEYFRAME_FREQ, 0x403, 4, 0
-0x3532, 0x0036,
-    IDC_COMBO_KEYFRAME_FREQ, 0x403, 4, 0
-0x3135, 0x0032,
-    IDC_COMBO_KEYFRAME_FREQ, 0x403, 5, 0
-0x3031, 0x3432, "\000"
-    0
-END
-
#endif    // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////


Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/dsfTheoraEncoder.vcproj
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/dsfTheoraEncoder.vcproj	2004-07-02 15:31:11 UTC (rev 6947)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/dsfTheoraEncoder.vcproj	2004-07-02 15:43:44 UTC (rev 6948)
@@ -20,7 +20,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\core\directshow\dsfAbstractVideoEncoder;&quot;C:\DXSDK\Samples\C++\DirectShow\BaseClasses&quot;;..\..\libs\libOOTheora;..\..\..\..\core\ogg\libOOOgg;..\..\..\..\core\ogg\libogg\include;..\..\libs\libtheora\include"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DSFTHEORAENCODER_EXPORTS;__cplusplus"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;DSFTHEORAENCODER_EXPORTS"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/resource.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/resource.h	2004-07-02 15:31:11 UTC (rev 6947)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/resource.h	2004-07-02 15:43:44 UTC (rev 6948)
@@ -4,11 +4,16 @@
//
#define IDD_THEORA_ENCODE_SETTINGS      102
#define IDS_THEORA_ENC_PROPS_STRING     103
-#define IDC_COMBO_BITRATE               1001
-#define IDC_STATIC_TBR                  1002
#define IDC_GROUP_QUALITY               1005
#define IDC_SLIDER_QUALITY              1006
-#define IDC_COMBO_KEYFRAME_FREQ         1011
+#define IDC_GROUP_LOG_KEYFRAME          1014
+#define IDC_SLIDER_LOG_KEYFRAME         1015
+#define IDC_GROUP_BITRATE               1016
+#define IDC_SLIDER_BITRATE              1017
+#define IDC_LABEL_BITRATE               1019
+#define IDC_LABEL_LOG_KEYFRAME          1020
+#define IDC_LABEL_BITRATE3              1021
+#define IDC_LABEL_QUALITY               1021

// Next default values for new objects
//
@@ -16,7 +21,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        104
#define _APS_NEXT_COMMAND_VALUE         40001
-#define _APS_NEXT_CONTROL_VALUE         1012
+#define _APS_NEXT_CONTROL_VALUE         1020
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif



More information about the commits mailing list