summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opierec/wavFile.cpp35
1 files changed, 20 insertions, 15 deletions
diff --git a/noncore/multimedia/opierec/wavFile.cpp b/noncore/multimedia/opierec/wavFile.cpp
index 7bfffb6..b177c91 100644
--- a/noncore/multimedia/opierec/wavFile.cpp
+++ b/noncore/multimedia/opierec/wavFile.cpp
@@ -26,5 +26,5 @@ WavFile::WavFile( QObject * parent,const QString &fileName, bool makeNwFile, int
: QObject( parent)
{
-qDebug("new wave file");
+//qDebug("new wave file");
bool b = makeNwFile;
wavSampleRate=sampleRate;
@@ -42,5 +42,5 @@ qDebug("new wave file");
bool WavFile::newFile() {
- qDebug("Set up new file");
+// qDebug("Set up new file");
Config cfg("OpieRec");
cfg.setGroup("Settings");
@@ -61,6 +61,7 @@ bool WavFile::newFile() {
currentFileName+=".wav";
- qDebug("set up file for recording: "+currentFileName);
- char *pointer;
+// qDebug("set up file for recording: "+currentFileName);
+ char pointer[] = "/tmp/opierec-XXXXXX";
+ int fd = 0;
if( currentFileName.find("/mnt",0,true) == -1
@@ -70,6 +71,10 @@ bool WavFile::newFile() {
useTmpFile = true;
- pointer=tmpnam(NULL);
- qDebug("Opening tmp file %s",pointer);
+ if(( fd = mkstemp( pointer)) < 0 ) {
+ perror("mkstemp failed");
+ return false;
+ }
+
+// qDebug("Opening tmp file %s",pointer);
track.setName( pointer);
@@ -102,5 +107,5 @@ void WavFile::closeFile() {
int WavFile::openFile(const QString &currentFileName) {
- qDebug("open play file "+currentFileName);
+// qDebug("open play file "+currentFileName);
closeFile();
@@ -127,9 +132,9 @@ bool WavFile::setWavHeader(int fd, wavhdr *hdr) {
if( wavFormat == WAVE_FORMAT_PCM) {
(*hdr).fmtTag = 1; // PCM
- qDebug("set header WAVE_FORMAT_PCM");
+// qDebug("set header WAVE_FORMAT_PCM");
}
else {
(*hdr).fmtTag = WAVE_FORMAT_DVI_ADPCM; //intel ADPCM
- qDebug("set header WAVE_FORMAT_DVI_ADPCM");
+ // qDebug("set header WAVE_FORMAT_DVI_ADPCM");
}
@@ -145,6 +150,6 @@ bool WavFile::setWavHeader(int fd, wavhdr *hdr) {
write( fd,hdr, sizeof(*hdr));
- qDebug("writing header: bitrate%d, samplerate %d, channels %d",
- wavResolution, wavSampleRate, wavChannels);
+// qDebug("writing header: bitrate%d, samplerate %d, channels %d",
+// wavResolution, wavSampleRate, wavChannels);
return true;
}
@@ -156,10 +161,10 @@ bool WavFile::adjustHeaders(int fd, int total) {
lseek( fd, 40, SEEK_SET);
write( fd, &total, sizeof(total));
- qDebug("adjusting header %d", total);
+// qDebug("adjusting header %d", total);
return true;
}
int WavFile::parseWavHeader(int fd) {
- qDebug("Parsing wav header");
+// qDebug("Parsing wav header");
char string[4];
int found;
@@ -259,6 +264,6 @@ int WavFile::parseWavHeader(int fd) {
} else {
wavNumberSamples = longdata;
- qDebug("file has length of %d \nlasting %d seconds", longdata,
- (( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)) );
+ qDebug("file has length of %d \nlasting %d seconds", (int)longdata,
+ (int)(( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)) );
// wavSeconds = (( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8));