Skip to content

Commit 6c1383c

Browse files
author
janhgm
committed
This release contains only a few small fixes.
* Region 'Window' and 'Select Screen' in case of multiple screens now calculate the pixels correct either. * Temporally and final files are now created in the directory you have specified in "Directory for recording" * Log file ....xnote.txt is renamed to ....txt and shows now besides xnote information also the version and release number of the executable. * Inside the code 'Playerplus.exe' is now invoked instead of 'Playplus.exe'. So it will startup. (My personal opinion; Don't use it at all. On can better use player.exe or use local player.)
1 parent 5b76cfa commit 6c1383c

File tree

3 files changed

+56
-12
lines changed

3 files changed

+56
-12
lines changed

CamStudio/CamLib/CamFile.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// n.b. Overloads DWORD GetTempPath(DWORD nBufferLength, LPTSTR lpBuffer)
99
// There is a conversion from LPTSTR to CString
1010
// TODO: Rename; this is needlessly dangerous
11+
// TODO GetTempFolder does not contain the temp folder but returns the udf target folder. Hence the function name is not correct..!
1112
/////////////////////////////////////////////////////////////////////////////
1213
CString GetTempFolder(int iAccess, const CString strFolder)
1314
{

CamStudio/Recorder/RecorderVersionReleaseInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
#define CURRENT_VERSION_NUMBER "2.6"
99
// Add ++ to releasenumber to indicate that executable is from revision xxx or higher
1010
// Update versionnumber and remove ++ when official Camstudio release will be created
11-
#define CURRENT_SVN_RELEASE_NUMBER "273"
11+
#define CURRENT_SVN_RELEASE_NUMBER "294"
1212

1313
#endif // !defined(_RECORDERVERSIONRELEASEINFO__INCLUDED_)

CamStudio/Recorder/RecorderView.cpp

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -989,12 +989,17 @@ LRESULT CRecorderView::OnUserGeneric (UINT /*wParam*/, LONG /*lParam*/)
989989

990990
// I believed that savedir would always be GetProgPath().
991991
// But this test below proved that that is not alway the case
992+
//TRACE("## CRecorderView::OnUserGeneric() cProgramOpts.m_strSpecifiedDir=[%s]\n",cProgramOpts.m_strSpecifiedDir );
992993
//TRACE("## CRecorderView::OnUserGeneric , savedir = [%s]\n", savedir );
993994
//TRACE("## CRecorderView::OnUserGeneric , GetProgPath= [%s]\n", GetProgPath() );
994995
//TRACE("## CRecorderView::OnUserGeneric , savedir = GetProgPath [%s]\n", (GetProgPath()==savedir) ? "EQUAL" : "DIFFERENT" );
995996

996997
if ((cProgramOpts.m_iRecordingMode == ModeAVI) && cProgramOpts.m_bAutoNaming) {
997-
strTargetDir = GetProgPath();
998+
999+
// Janhgm. Target dir where we want to get our final files is not always the location where we stored our Camstudio application..!
1000+
// strTargetDir = GetProgPath();
1001+
strTargetDir = GetTempFolder(cProgramOpts.m_iTempPathAccess, cProgramOpts.m_strSpecifiedDir);
1002+
9981003
// Use local copy of the timestamp string created when recording was started for autonaming.
9991004
strTargetBareFileName.SetString( cVideoOpts.m_cStartRecordingString.GetString() ); // "ccyymmdd-hhmm-ss" , Timestamp still used for default temp.avi output "temp-ccyymmdd-hhmm-ss.avi"
10001005
strTargetVideoExtension = ".avi";
@@ -1032,9 +1037,9 @@ LRESULT CRecorderView::OnUserGeneric (UINT /*wParam*/, LONG /*lParam*/)
10321037
// Create all the applicable targetfile names
10331038
strTargetVideoFile = strTargetDir + "\\" + strTargetBareFileName + strTargetVideoExtension; // strTargetVideoFile is the same string as strNewFile in previuosly approach
10341039
strTargetAudioFile = strTargetDir + "\\" + strTargetBareFileName + ".wav";
1035-
strTargetXnoteLogFile = strTargetDir + "\\" + strTargetBareFileName + ".xnote.txt";
1040+
strTargetXnoteLogFile = strTargetDir + "\\" + strTargetBareFileName + ".txt";
10361041

1037-
//TRACE("## 2a # strTargetDir :[%s]\n", strTargetDir);
1042+
//TRACE("## CRecorderView::OnUserGeneric 2a # strTargetDir :[%s]\n", strTargetDir);
10381043
//TRACE("## 2b # strTargetBareFileName :[%s]\n", strTargetBareFileName );
10391044
//TRACE("## 2c # strTargetVideoExtension :[%s]\n", strTargetVideoExtension );
10401045
//TRACE("## 3a # strTargetVideoFile :[%s]\n", strTargetVideoFile );
@@ -1302,10 +1307,17 @@ void CRecorderView::OnRecord()
13021307
// TODO, Possible memory leak, where is the delete operation of the new below done?
13031308
m_basicMsg = new CBasicMessage();
13041309
m_basicMsg->Create(CBasicMessage::IDD);
1305-
m_basicMsg->SetText(_T("Click on window to be captured."));
1310+
if ( cRegionOpts.m_iMouseCaptureMode == CAPTURE_WINDOW ) {
1311+
m_basicMsg->SetText(_T("Click on window to be captured."));
1312+
} else {
1313+
m_basicMsg->SetText(_T("Click on screen to be captured."));
1314+
}
13061315
m_basicMsg->ShowWindow(SW_SHOW);
13071316
//m_basicMsg.DoModal();
13081317
SetCapture();
1318+
//TRACE(_T("## CRecorderView::OnRecord CAPTURE_WINDOW / after / rc / T=%d, L=%d, B=%d, R=%d \n"), rc.top, rc.left, rc.bottom, rc.right );
1319+
//TRACE(_T("## CRecorderView::OnRecord CAPTURE_WINDOW / after / MinX=%d, MinY=%d, MaxX=%d, MaxY=%d \n"), minxScreen, minyScreen, maxxScreen, maxyScreen );
1320+
13091321
break;
13101322
}
13111323
// TRACE(_T("## CRecorderView::OnRecord / after / rc / T=%d, L=%d, B=%d, R=%d \n"), rc.top, rc.left, rc.bottom, rc.right );
@@ -3717,7 +3729,7 @@ UINT CRecorderView::RecordVideo()
37173729
cVideoOpts.m_cStartRecordingString.SetString(csStartTime);
37183730

37193731
strTempVideoAviFilePath.Format("%s\\%s-%s.%s", (LPCSTR)csTempFolder, TEMPFILETAGINDICATOR, (LPCSTR)csStartTime, "avi" );
3720-
// strTempXnoteLogFilePath.Format("%s\\%s-%s.%s", (LPCSTR)csTempFolder, TEMPFILETAGINDICATOR, (LPCSTR)csStartTime, "xnote.txt" );
3732+
// strTempXnoteLogFilePath.Format("%s\\%s-%s.%s", (LPCSTR)csTempFolder, TEMPFILETAGINDICATOR, (LPCSTR)csStartTime, "txt" );
37213733

37223734
//TRACE("## CRecorderView::RecordAVIThread First Temp.Avi file=[%s]\n", strTempVideoAviFilePath.GetString() );
37233735

@@ -3762,8 +3774,29 @@ bool CRecorderView::RecordVideo(CRect rectFrame, int fps, const char *szVideoFil
37623774

37633775
sVideoOpts SaveVideoOpts = cVideoOpts;
37643776

3765-
GetDocument()->FrameWidth(rectFrame.Width() + 1);
3766-
GetDocument()->FrameHeight(rectFrame.Height() + 1);
3777+
// And again CS is doing a recalculation to determine width and height.
3778+
// If sizing is determined with SetCapture() the dimensions are different as we getwith CRect(Top,Left,Bottom,Right)
3779+
// HIER_BEN_IK
3780+
// TRACE(_T("## CRecorderView::RecordVideo / cRegionOpts.m_iMouseCaptureMode =%d\n"), cRegionOpts.m_iMouseCaptureMode );
3781+
switch (cRegionOpts.m_iMouseCaptureMode)
3782+
{
3783+
case CAPTURE_WINDOW:
3784+
case CAPTURE_FULLSCREEN:
3785+
// For rects captured with SetCapture
3786+
//TRACE(_T("## CRecorderView::RecordVideo / cRegionOpts.m_iMouseCaptureMode =%d (Do nothing) \n"), cRegionOpts.m_iMouseCaptureMode );
3787+
GetDocument()->FrameWidth(rectFrame.Width() );
3788+
GetDocument()->FrameHeight(rectFrame.Height() );
3789+
break;
3790+
default:
3791+
// For rects defined with Rect(top,left,bottom,right)
3792+
//TRACE(_T("## CRecorderView::RecordVideo / cRegionOpts.m_iMouseCaptureMode =%d (increase width anf height with one) \n"), cRegionOpts.m_iMouseCaptureMode );
3793+
GetDocument()->FrameWidth(rectFrame.Width() + 1);
3794+
GetDocument()->FrameHeight(rectFrame.Height() + 1);
3795+
break;
3796+
}
3797+
//TRACE(_T("## CRecorderView::RecordVideo / rectFrame / T=%d, L=%d, B=%d, R=%d / W=%d, H=%d\n"), rectFrame.top, rectFrame.left, rectFrame.bottom, rectFrame.right , rectFrame.Width(), rectFrame.Height() );
3798+
//TRACE(_T("## CRecorderView::RecordVideo / GetDocument / W=%d, H=%d\n"), GetDocument()->FrameWidth(), GetDocument()->FrameHeight() );
3799+
37673800
nTotalBytesWrittenSoFar = 0;
37683801

37693802
////////////////////////////////////////////////
@@ -3981,9 +4014,15 @@ bool CRecorderView::RecordVideo(CRect rectFrame, int fps, const char *szVideoFil
39814014

39824015
//////////////////////////////////////////////
39834016
// Xnote or MotionDetection log file
4017+
// Store some Camstudio info as well.
39844018
//////////////////////////////////////////////
39854019
OpenStreamXnoteLogFile();
39864020

4021+
// Document which version and release of Camstudio is used.
4022+
char cTmp[128] = "";
4023+
sprintf( cTmp, "<recorder><version>%s<\\version><release>%s<\\release><\\recorder>\n", CURRENT_VERSION_NUMBER, CURRENT_SVN_RELEASE_NUMBER );
4024+
WriteLineToXnoteLogFile( cTmp );
4025+
39874026
if (cVideoOpts.m_iShiftType == AUDIOFIRST) {
39884027
Sleep(cVideoOpts.m_iTimeShift);
39894028
}
@@ -4320,7 +4359,7 @@ bool CRecorderView::RecordVideo(CRect rectFrame, int fps, const char *szVideoFil
43204359
}
43214360

43224361
//////////////////////////////////////////////
4323-
// Close XNote or MotionDetection log file
4362+
// Close Camstudio, XNote or MotionDetection log file
43244363
//////////////////////////////////////////////
43254364
CloseStreamXnoteLogFile();
43264365

@@ -4443,7 +4482,7 @@ bool CRecorderView::RunViewer(const CString& strNewFile)
44434482
} else if (cProgramOpts.m_iLaunchPlayer == CAM2_PLAYER) {
44444483
CString AppDir = GetProgPath();
44454484
CString launchPath;
4446-
CString exefileName("\\Playplus.exe ");
4485+
CString exefileName("\\Playerplus.exe "); // Changed from Playplus.exe to Playerplus.exe
44474486
launchPath = AppDir + exefileName + strNewFile;
44484487
if (WinExec(launchPath,SW_SHOW) < HINSTANCE_ERROR) {
44494488
//MessageBox("Error launching avi player!","Note",MB_OK | MB_ICONEXCLAMATION);
@@ -5108,7 +5147,11 @@ void WriteLineToXnoteLogFile( char* pStr )
51085147
void GetTempXnoteLogPath()
51095148
{
51105149
CString csTempFolder(GetTempFolder(cProgramOpts.m_iTempPathAccess, cProgramOpts.m_strSpecifiedDir));
5111-
strTempXnoteLogFilePath.Format("%s\\%s-%s.%s", (LPCSTR)csTempFolder, TEMPFILETAGINDICATOR, (LPCSTR)cVideoOpts.m_cStartRecordingString , "xnote.txt" );
5150+
// TODO csTempFolder does not contain the temp folder but returns the target folder. Hence the function name is not correct..!
5151+
// TRACE( _T("## RecorderView.cpp GetTempXnoteLogPath() / m_iTempPathAccess=[%d] m_strSpecifiedDir=[%s] csTempFolder=[%s]\n"),cProgramOpts.m_iTempPathAccess, cProgramOpts.m_strSpecifiedDir, csTempFolder );
5152+
5153+
strTempXnoteLogFilePath.Format("%s\\%s-%s.%s", (LPCSTR)csTempFolder, TEMPFILETAGINDICATOR, (LPCSTR)cVideoOpts.m_cStartRecordingString , "txt" );
5154+
// TRACE( _T("## GetTempXnoteLogPath() / strTempXnoteLogFilePath=[%s] \n"), strTempXnoteLogFilePath.GetString() );
51125155

51135156
//Test the validity of writing to this file (Using the old way with FILE instead of ofstream)
51145157
int fileverified = 0;
@@ -5128,7 +5171,7 @@ void GetTempXnoteLogPath()
51285171
sprintf(numstr,"%d",randnum);
51295172

51305173
CString cnumstr(numstr);
5131-
strTempXnoteLogFilePath.Format("%s\\%s-%s-%s.%s", (LPCSTR)csTempFolder, TEMPFILETAGINDICATOR, (LPCSTR)cVideoOpts.m_cStartRecordingString , cnumstr , "xnote.txt" );
5174+
strTempXnoteLogFilePath.Format("%s\\%s-%s-%s.%s", (LPCSTR)csTempFolder, TEMPFILETAGINDICATOR, (LPCSTR)cVideoOpts.m_cStartRecordingString , cnumstr , "txt" );
51325175
}
51335176
}
51345177
}

0 commit comments

Comments
 (0)