Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
1e70d8cc
Commit
1e70d8cc
authored
Feb 06, 2009
by
alexandresavard
Browse files
Now recording in HOME folder
parent
b4784ab7
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/call.cpp
View file @
1e70d8cc
...
...
@@ -36,39 +36,11 @@ Call::Call(const CallID& id, Call::CallType type)
,
_peerName
()
,
_peerNumber
()
{
time_t
rawtime
;
struct
tm
*
timeinfo
;
rawtime
=
std
::
time
(
NULL
);
timeinfo
=
localtime
(
&
rawtime
);
std
::
stringstream
out
;
out
<<
timeinfo
->
tm_year
+
1900
;
if
(
timeinfo
->
tm_mon
<
9
)
// january is 01, not 1
out
<<
0
;
out
<<
timeinfo
->
tm_mon
+
1
;
if
(
timeinfo
->
tm_mday
<
10
)
// 01 02 03, not 1 2 3
out
<<
0
;
out
<<
timeinfo
->
tm_mday
;
if
(
timeinfo
->
tm_hour
<
10
)
// 01 02 03, not 1 2 3
out
<<
0
;
out
<<
timeinfo
->
tm_hour
;
if
(
timeinfo
->
tm_min
<
10
)
// 01 02 03, not 1 2 3
out
<<
0
;
out
<<
timeinfo
->
tm_min
;
if
(
timeinfo
->
tm_sec
<
10
)
// 01 02 03, not 1 2 3
out
<<
0
;
out
<<
timeinfo
->
tm_sec
;
_filename
=
out
.
str
();
printf
(
"Call::constructor filename for this call %s
\n
"
,
_filename
.
c_str
());
FILE_TYPE
fileType
=
FILE_WAV
;
SOUND_FORMAT
soundFormat
=
INT16
;
recAudio
.
setRecordingOption
(
_filename
.
c_str
(),
fileType
,
soundFormat
,
44100
);
recAudio
.
setRecordingOption
(
fileType
,
soundFormat
,
44100
);
_debug
(
"CALL::Constructor for this clss is called
\n
"
);
}
...
...
src/plug-in/audiorecorder/audiorecord.cpp
View file @
1e70d8cc
...
...
@@ -29,6 +29,8 @@ AudioRecord::AudioRecord(){
recordingEnabled_
=
false
;
fp
=
0
;
createFilename
();
}
...
...
@@ -36,9 +38,7 @@ void AudioRecord::setSndSamplingRate(int smplRate){
sndSmplRate_
=
smplRate
;
}
void
AudioRecord
::
setRecordingOption
(
std
::
string
name
,
FILE_TYPE
type
,
SOUND_FORMAT
format
,
int
sndSmplRate
){
strncpy
(
fileName_
,
name
.
c_str
(),
8192
);
void
AudioRecord
::
setRecordingOption
(
FILE_TYPE
type
,
SOUND_FORMAT
format
,
int
sndSmplRate
){
fileType_
=
type
;
sndFormat_
=
format
;
...
...
@@ -61,10 +61,22 @@ void AudioRecord::setRecordingOption(std::string name, FILE_TYPE type, SOUND_FOR
void
AudioRecord
::
openFile
(){
_debug
(
"AudioRecord::openFile()
\n
"
);
savePath_
=
getenv
(
"HOME"
);
std
::
string
fName
(
fileName_
);
savePath_
+=
"/"
;
savePath_
.
append
(
fName
);
bool
result
=
false
;
_debug
(
"AudioRecord::openFile()
\n
"
);
if
(
isFileExist
())
{
_debug
(
"AudioRecord::Filename does not exist, creating one
\n
"
);
byteCounter_
=
0
;
...
...
@@ -160,9 +172,47 @@ void AudioRecord::stopRecording() {
}
void
AudioRecord
::
createFilename
(){
time_t
rawtime
;
struct
tm
*
timeinfo
;
rawtime
=
time
(
NULL
);
timeinfo
=
localtime
(
&
rawtime
);
stringstream
out
;
// DATE
out
<<
timeinfo
->
tm_year
+
1900
;
if
(
timeinfo
->
tm_mon
<
9
)
// january is 01, not 1
out
<<
0
;
out
<<
timeinfo
->
tm_mon
+
1
;
if
(
timeinfo
->
tm_mday
<
10
)
// 01 02 03, not 1 2 3
out
<<
0
;
out
<<
timeinfo
->
tm_mday
;
out
<<
'-'
;
// hour
if
(
timeinfo
->
tm_hour
<
10
)
// 01 02 03, not 1 2 3
out
<<
0
;
out
<<
timeinfo
->
tm_hour
;
if
(
timeinfo
->
tm_min
<
10
)
// 01 02 03, not 1 2 3
out
<<
0
;
out
<<
timeinfo
->
tm_min
;
if
(
timeinfo
->
tm_sec
<
10
)
// 01 02 03, not 1 2 3
out
<<
0
;
out
<<
timeinfo
->
tm_sec
;
// fileName_ = out.str();
strncpy
(
fileName_
,
out
.
str
().
c_str
(),
8192
);
printf
(
"AudioRecord::createFilename::filename for this call %s
\n
"
,
fileName_
);
}
bool
AudioRecord
::
setRawFile
()
{
fp
=
fopen
(
fileName_
,
"wb"
);
fp
=
fopen
(
savePath_
.
c_str
()
,
"wb"
);
if
(
!
fp
)
{
_debug
(
"AudioRecord::setRawFile() : could not create RAW file!
\n
"
);
return
false
;
...
...
@@ -180,7 +230,7 @@ bool AudioRecord::setRawFile() {
bool
AudioRecord
::
setWavFile
()
{
fp
=
fopen
(
fileName_
,
"wb"
);
fp
=
fopen
(
savePath_
.
c_str
()
,
"wb"
);
if
(
!
fp
)
{
_debug
(
"AudioRecord::setWavFile() : could not create WAV file.
\n
"
);
return
false
;
...
...
src/plug-in/audiorecorder/audiorecord.h
View file @
1e70d8cc
...
...
@@ -21,6 +21,8 @@
#include <iostream>
#include <string.h>
#include <sndfile.h>
#include <stdlib.h>
#include <sstream>
#include "global.h"
#include "plug-in/plugin.h"
...
...
@@ -55,7 +57,7 @@ public:
void
setSndSamplingRate
(
int
smplRate
);
void
setRecordingOption
(
std
::
string
name
,
FILE_TYPE
type
,
SOUND_FORMAT
format
,
int
sndSmplRate
);
void
setRecordingOption
(
FILE_TYPE
type
,
SOUND_FORMAT
format
,
int
sndSmplRate
);
/**
* Check if no otehr file is opened, then create a new one
...
...
@@ -113,6 +115,11 @@ public:
protected:
/**
* Create name file according to current date
*/
void
createFilename
();
/**
* Set the header for raw files
*/
...
...
@@ -188,5 +195,10 @@ protected:
*/
char
fileName_
[
8192
];
/**
* Path for this recording
*/
std
::
string
savePath_
;
};
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment