summaryrefslogtreecommitdiffstats
path: root/kradio3/plugins/recording/recording.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kradio3/plugins/recording/recording.cpp')
-rw-r--r--kradio3/plugins/recording/recording.cpp116
1 files changed, 58 insertions, 58 deletions
diff --git a/kradio3/plugins/recording/recording.cpp b/kradio3/plugins/recording/recording.cpp
index b2222ab..b85b22b 100644
--- a/kradio3/plugins/recording/recording.cpp
+++ b/kradio3/plugins/recording/recording.cpp
@@ -29,9 +29,9 @@
#include "encoder_ogg.h"
#include "encoder_pcm.h"
-#include <qevent.h>
-#include <qapplication.h>
-#include <qregexp.h>
+#include <tqevent.h>
+#include <tqapplication.h>
+#include <tqregexp.h>
#include <kconfig.h>
#include <kdeversion.h>
@@ -49,8 +49,8 @@ PLUGIN_LIBRARY_FUNCTIONS2(
///////////////////////////////////////////////////////////////////////
-Recording::Recording(const QString &name)
- : QObject(NULL, NULL),
+Recording::Recording(const TQString &name)
+ : TQObject(NULL, NULL),
PluginBase(name, i18n("KRadio Recording Plugin")),
m_config()
{
@@ -59,8 +59,8 @@ Recording::Recording(const QString &name)
Recording::~Recording()
{
- QMapIterator<SoundStreamID, RecordingEncoding*> it = m_EncodingThreads.begin();
- QMapIterator<SoundStreamID, RecordingEncoding*> end = m_EncodingThreads.end();
+ TQMapIterator<SoundStreamID, RecordingEncoding*> it = m_EncodingThreads.begin();
+ TQMapIterator<SoundStreamID, RecordingEncoding*> end = m_EncodingThreads.end();
for (; it != end; ++it) {
sendStopRecording(it.key());
}
@@ -108,14 +108,14 @@ void Recording::noticeConnectedI (ISoundStreamServer *s, bool pointer_valid)
void Recording::saveState (KConfig *c) const
{
- c->setGroup(QString("recording-") + PluginBase::name());
+ c->setGroup(TQString("recording-") + PluginBase::name());
m_config.saveConfig(c);
}
void Recording::restoreState (KConfig *c)
{
- c->setGroup(QString("recording-") + PluginBase::name());
+ c->setGroup(TQString("recording-") + PluginBase::name());
RecordingConfig cfg;
cfg.restoreConfig(c);
setRecordingConfig(cfg);
@@ -198,7 +198,7 @@ bool Recording::setOggQuality (float q)
return true;
}
-bool Recording::setRecordingDirectory(const QString &dir)
+bool Recording::setRecordingDirectory(const TQString &dir)
{
if (m_config.m_Directory != dir) {
m_config.m_Directory = dir;
@@ -223,17 +223,17 @@ bool Recording::setPreRecording (bool enable, int seconds)
m_config.m_PreRecordingSeconds = seconds;
if (enable) {
- for (QMapIterator<SoundStreamID,FileRingBuffer*> it = m_PreRecordingBuffers.begin(); it != m_PreRecordingBuffers.end(); ++it) {
+ for (TQMapIterator<SoundStreamID,FileRingBuffer*> it = m_PreRecordingBuffers.begin(); it != m_PreRecordingBuffers.end(); ++it) {
if (*it != NULL) {
delete *it;
}
- *it = new FileRingBuffer(m_config.m_Directory + "/kradio-prerecord-"+QString::number(it.key().getID()), m_config.m_PreRecordingSeconds * m_config.m_SoundFormat.m_SampleRate * m_config.m_SoundFormat.frameSize());
+ *it = new FileRingBuffer(m_config.m_Directory + "/kradio-prerecord-"+TQString::number(it.key().getID()), m_config.m_PreRecordingSeconds * m_config.m_SoundFormat.m_SampleRate * m_config.m_SoundFormat.frameSize());
SoundFormat sf = m_config.m_SoundFormat;
sendStartCaptureWithFormat(it.key(), sf, sf, false);
}
}
else {
- for (QMapIterator<SoundStreamID,FileRingBuffer*> it = m_PreRecordingBuffers.begin(); it != m_PreRecordingBuffers.end(); ++it) {
+ for (TQMapIterator<SoundStreamID,FileRingBuffer*> it = m_PreRecordingBuffers.begin(); it != m_PreRecordingBuffers.end(); ++it) {
if (*it != NULL) {
sendStopCapture(it.key());
delete *it;
@@ -268,7 +268,7 @@ float Recording::getOggQuality () const
return m_config.m_oggQuality;
}
-const QString &Recording::getRecordingDirectory() const
+const TQString &Recording::getRecordingDirectory() const
{
return m_config.m_Directory;
}
@@ -310,11 +310,11 @@ bool Recording::setRecordingConfig(const RecordingConfig &c)
// ISoundStreamClient
bool Recording::startPlayback(SoundStreamID id)
{
- if (m_PreRecordingBuffers.contains(id))
+ if (m_PreRecordingBuffers.tqcontains(id))
delete m_PreRecordingBuffers[id];
m_PreRecordingBuffers[id] = NULL;
if (m_config.m_PreRecordingEnable) {
- m_PreRecordingBuffers[id] = new FileRingBuffer(m_config.m_Directory + "/kradio-prerecord-"+QString::number(id.getID()), m_config.m_PreRecordingSeconds * m_config.m_SoundFormat.m_SampleRate * m_config.m_SoundFormat.frameSize());
+ m_PreRecordingBuffers[id] = new FileRingBuffer(m_config.m_Directory + "/kradio-prerecord-"+TQString::number(id.getID()), m_config.m_PreRecordingSeconds * m_config.m_SoundFormat.m_SampleRate * m_config.m_SoundFormat.frameSize());
SoundFormat sf = m_config.m_SoundFormat;
sendStartCaptureWithFormat(id, sf, sf, false);
}
@@ -323,7 +323,7 @@ bool Recording::startPlayback(SoundStreamID id)
bool Recording::stopPlayback(SoundStreamID id)
{
- if (m_PreRecordingBuffers.contains(id)) {
+ if (m_PreRecordingBuffers.tqcontains(id)) {
if (m_PreRecordingBuffers[id])
delete m_PreRecordingBuffers[id];
m_PreRecordingBuffers.remove(id);
@@ -377,17 +377,17 @@ bool Recording::startRecordingWithFormat(SoundStreamID id, const SoundFormat &sf
bool Recording::stopRecording(SoundStreamID id)
{
- if (m_EncodingThreads.contains(id)) {
+ if (m_EncodingThreads.tqcontains(id)) {
sendStopCapture(id);
if (m_config.m_PreRecordingEnable) {
- if (!m_PreRecordingBuffers.contains(id)) {
+ if (!m_PreRecordingBuffers.tqcontains(id)) {
if (m_PreRecordingBuffers[id] != NULL) {
delete m_PreRecordingBuffers[id];
}
bool b = false;
queryIsPlaybackRunning(id, b);
if (b) {
- m_PreRecordingBuffers[id] = new FileRingBuffer(m_config.m_Directory + "/kradio-prerecord-"+QString::number(id.getID()), m_config.m_PreRecordingSeconds * m_config.m_SoundFormat.m_SampleRate * m_config.m_SoundFormat.frameSize());
+ m_PreRecordingBuffers[id] = new FileRingBuffer(m_config.m_Directory + "/kradio-prerecord-"+TQString::number(id.getID()), m_config.m_PreRecordingSeconds * m_config.m_SoundFormat.m_SampleRate * m_config.m_SoundFormat.frameSize());
} else {
m_PreRecordingBuffers[id] = NULL;
}
@@ -406,7 +406,7 @@ bool Recording::noticeSoundStreamData(SoundStreamID id,
const SoundMetaData &md
)
{
- if (m_PreRecordingBuffers.contains(id) && m_PreRecordingBuffers[id] != NULL) {
+ if (m_PreRecordingBuffers.tqcontains(id) && m_PreRecordingBuffers[id] != NULL) {
FileRingBuffer &fbuf = *m_PreRecordingBuffers[id];
if (fbuf.getFreeSize() < size) {
@@ -427,13 +427,13 @@ bool Recording::noticeSoundStreamData(SoundStreamID id,
// fbuf.addData((char*)tmp, sizeof(tmp));
// //END DEBUG
- if (m_EncodingThreads.contains(id)) {
+ if (m_EncodingThreads.tqcontains(id)) {
- //logDebug("recording packet: " + QString::number(size));
+ //logDebug("recording packet: " + TQString::number(size));
RecordingEncoding *thread = m_EncodingThreads[id];
- //logDebug("noticeSoundStreamData thread = " + QString::number((long long)thread, 16));
+ //logDebug("noticeSoundStreamData thread = " + TQString::number((long long)thread, 16));
size_t remSize = fbuf.getFillSize();
@@ -464,13 +464,13 @@ bool Recording::noticeSoundStreamData(SoundStreamID id,
return true;
}
- else if (m_EncodingThreads.contains(id)) {
+ else if (m_EncodingThreads.tqcontains(id)) {
- //logDebug("recording packet: " + QString::number(size));
+ //logDebug("recording packet: " + TQString::number(size));
RecordingEncoding *thread = m_EncodingThreads[id];
- //logDebug("noticeSoundStreamData thread = " + QString::number((long long)thread, 16));
+ //logDebug("noticeSoundStreamData thread = " + TQString::number((long long)thread, 16));
size_t remSize = size;
const char *remData = data;
@@ -479,7 +479,7 @@ bool Recording::noticeSoundStreamData(SoundStreamID id,
size_t bufferSize = remSize;
char *buf = thread->lockInputBuffer(bufferSize);
if (!buf) {
- logWarning(i18n("Encoder input buffer overflow (buffer configuration problem?). Skipped %1 input bytes").arg(QString::number(remSize)));
+ logWarning(i18n("Encoder input buffer overflow (buffer configuration problem?). Skipped %1 input bytes").tqarg(TQString::number(remSize)));
break;
}
if (bufferSize > remSize) {
@@ -503,14 +503,14 @@ bool Recording::noticeSoundStreamData(SoundStreamID id,
bool Recording::startEncoder(SoundStreamID ssid, const RecordingConfig &cfg)
{
- if (m_EncodingThreads.contains(ssid))
+ if (m_EncodingThreads.tqcontains(ssid))
return false;
SoundStreamID encID = createNewSoundStream(ssid, false);
m_RawStreams2EncodedStreams[ssid] = encID;
m_EncodedStreams2RawStreams[encID] = ssid;
- QString ext = ".wav";
+ TQString ext = ".wav";
switch (m_config.m_OutputFormat) {
case RecordingConfig::outputWAV: ext = ".wav"; break;
case RecordingConfig::outputAIFF: ext = ".aiff"; break;
@@ -526,16 +526,16 @@ bool Recording::startEncoder(SoundStreamID ssid, const RecordingConfig &cfg)
}
const RadioStation *rs = NULL;
querySoundStreamRadioStation(ssid, rs);
- QString station = rs ? rs->name() + "-" : "";
- station.replace(QRegExp("[/*?]"), "_");
+ TQString station = rs ? rs->name() + "-" : "";
+ station.tqreplace(TQRegExp("[/*?]"), "_");
- QDate date = QDate::currentDate();
- QTime time = QTime::currentTime();
- QString sdate;
+ TQDate date = TQDate::tqcurrentDate();
+ TQTime time = TQTime::currentTime();
+ TQString sdate;
sdate.sprintf("%d.%d.%d.%d.%d",date.year(),date.month(),date.day(),time.hour(),time.minute());
- QString output = m_config.m_Directory
+ TQString output = m_config.m_Directory
+ "/kradio-recording-"
+ station
+ sdate
@@ -570,7 +570,7 @@ bool Recording::startEncoder(SoundStreamID ssid, const RecordingConfig &cfg)
// store thread even if it has indicated an error
m_EncodingThreads[ssid] = thread;
- //logDebug("startEncoder thread = " + QString::number((long long)thread, 16));
+ //logDebug("startEncoder thread = " + TQString::number((long long)thread, 16));
notifySoundStreamCreated(encID);
return !thread->error();
@@ -579,14 +579,14 @@ bool Recording::startEncoder(SoundStreamID ssid, const RecordingConfig &cfg)
void Recording::stopEncoder(SoundStreamID id)
{
- if (m_EncodingThreads.contains(id)) {
+ if (m_EncodingThreads.tqcontains(id)) {
RecordingEncoding *thread = m_EncodingThreads[id];
thread->setDone();
- //logDebug("stopEncoder thread = " + QString::number((long long)thread, 16));
- //logDebug("stopEncoder thread error = " + QString::number(thread->error(), 16));
+ //logDebug("stopEncoder thread = " + TQString::number((long long)thread, 16));
+ //logDebug("stopEncoder thread error = " + TQString::number(thread->error(), 16));
#if (KDE_VERSION_MAJOR >= 3) && (KDE_VERSION_MINOR >= 1)
// FIXME: set a timer and do waiting "in background"
@@ -604,7 +604,7 @@ void Recording::stopEncoder(SoundStreamID id)
//m_context.setError();
logError(thread->errorString());
} else {
- //Q_UINT64 size = thread->encodedSize();
+ //TQ_UINT64 size = thread->encodedSize();
//m_context.setEncodedSize(low, high);
//notifyRecordingContextChanged(m_context);
}
@@ -621,24 +621,24 @@ void Recording::stopEncoder(SoundStreamID id)
}
-bool Recording::event(QEvent *_e)
+bool Recording::event(TQEvent *_e)
{
if (SoundStreamEvent::isSoundStreamEvent(_e)) {
SoundStreamEvent *e = static_cast<SoundStreamEvent*>(_e);
SoundStreamID id = e->getSoundStreamID();
- if (m_EncodingThreads.contains(id)) {
+ if (m_EncodingThreads.tqcontains(id)) {
RecordingEncoding *thread = m_EncodingThreads[id];
- //logDebug("Recording::event: thread = " + QString::number((long long)thread, 16));
+ //logDebug("Recording::event: thread = " + TQString::number((long long)thread, 16));
if (thread->error()) {
logError(thread->errorString());
//m_context.setError();
stopEncoder(id);
} else {
- //Q_UINT64 size = thread->encodedSize();
+ //TQ_UINT64 size = thread->encodedSize();
//m_context.setEncodedSize(low, high);
//notifyRecordingContextChanged(m_context);
if (e->type() == EncodingTerminated) {
@@ -649,21 +649,21 @@ bool Recording::event(QEvent *_e)
notifySoundStreamData(m_RawStreams2EncodedStreams[id], thread->config().m_SoundFormat,
step->data(), step->size(), consumed_size, step->metaData());
if (consumed_size != SIZE_T_DONT_CARE && consumed_size < step->size()) {
- logError(i18n("Recording::notifySoundStreamData(encoded data): Receivers skipped %1 Bytes").arg(step->size() - consumed_size));
+ logError(i18n("Recording::notifySoundStreamData(encoded data): Receivers skipped %1 Bytes").tqarg(step->size() - consumed_size));
}
}
}
}
return true;
} else {
- return QObject::event(_e);
+ return TQObject::event(_e);
}
}
-bool Recording::getSoundStreamDescription(SoundStreamID id, QString &descr) const
+bool Recording::getSoundStreamDescription(SoundStreamID id, TQString &descr) const
{
- if (m_EncodedStreams2RawStreams.contains(id)) {
+ if (m_EncodedStreams2RawStreams.tqcontains(id)) {
if (querySoundStreamDescription(m_EncodedStreams2RawStreams[id], descr)) {
descr = name() + " - " + descr;
return true;
@@ -675,7 +675,7 @@ bool Recording::getSoundStreamDescription(SoundStreamID id, QString &descr) cons
bool Recording::getSoundStreamRadioStation(SoundStreamID id, const RadioStation *&rs) const
{
- if (m_EncodedStreams2RawStreams.contains(id)) {
+ if (m_EncodedStreams2RawStreams.tqcontains(id)) {
if (querySoundStreamRadioStation(m_EncodedStreams2RawStreams[id], rs)) {
return true;
}
@@ -684,11 +684,11 @@ bool Recording::getSoundStreamRadioStation(SoundStreamID id, const RadioStation
}
-bool Recording::enumerateSoundStreams(QMap<QString, SoundStreamID> &list) const
+bool Recording::enumerateSoundStreams(TQMap<TQString, SoundStreamID> &list) const
{
- QMapConstIterator<SoundStreamID,SoundStreamID> end = m_RawStreams2EncodedStreams.end();
- for (QMapConstIterator<SoundStreamID,SoundStreamID> it = m_RawStreams2EncodedStreams.begin(); it != end; ++it) {
- QString tmp = QString::null;
+ TQMapConstIterator<SoundStreamID,SoundStreamID> end = m_RawStreams2EncodedStreams.end();
+ for (TQMapConstIterator<SoundStreamID,SoundStreamID> it = m_RawStreams2EncodedStreams.begin(); it != end; ++it) {
+ TQString tmp = TQString();
getSoundStreamDescription(*it, tmp);
list[tmp] = *it;
}
@@ -698,7 +698,7 @@ bool Recording::enumerateSoundStreams(QMap<QString, SoundStreamID> &list) const
bool Recording::noticeSoundStreamChanged(SoundStreamID id)
{
- if (m_RawStreams2EncodedStreams.contains(id)) {
+ if (m_RawStreams2EncodedStreams.tqcontains(id)) {
notifySoundStreamChanged(m_RawStreams2EncodedStreams[id]);
return true;
}
@@ -708,7 +708,7 @@ bool Recording::noticeSoundStreamChanged(SoundStreamID id)
bool Recording::isRecordingRunning(SoundStreamID id, bool &b, SoundFormat &sf) const
{
- if (m_EncodingThreads.contains(id)) {
+ if (m_EncodingThreads.tqcontains(id)) {
b = m_EncodingThreads[id]->running();
sf = getSoundFormat();
return true;
@@ -719,13 +719,13 @@ bool Recording::isRecordingRunning(SoundStreamID id, bool &b, SoundFormat &sf) c
bool Recording::noticeSoundStreamClosed(SoundStreamID id)
{
- if (m_PreRecordingBuffers.contains(id)) {
+ if (m_PreRecordingBuffers.tqcontains(id)) {
if (m_PreRecordingBuffers[id])
delete m_PreRecordingBuffers[id];
m_PreRecordingBuffers.remove(id);
}
- if (m_EncodingThreads.contains(id)) {
+ if (m_EncodingThreads.tqcontains(id)) {
sendStopRecording(id);
return true;
}