summaryrefslogtreecommitdiffstats
path: root/plugins/recording/recording.h
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2022-05-30 19:40:31 +0900
committerMichele Calgaro <[email protected]>2022-05-31 01:17:58 +0900
commitd95a4fea540b371fa86493d069fdbd54f33c5b40 (patch)
tree079b038ab559439eb7ded40a07bd79fd92926b3b /plugins/recording/recording.h
parente54890e0480e5adee69f5220a7c6dd072bbd75ea (diff)
downloadtderadio-d95a4fea540b371fa86493d069fdbd54f33c5b40.tar.gz
tderadio-d95a4fea540b371fa86493d069fdbd54f33c5b40.zip
Standardize folder structure.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'plugins/recording/recording.h')
-rw-r--r--plugins/recording/recording.h149
1 files changed, 149 insertions, 0 deletions
diff --git a/plugins/recording/recording.h b/plugins/recording/recording.h
new file mode 100644
index 0000000..7d48331
--- /dev/null
+++ b/plugins/recording/recording.h
@@ -0,0 +1,149 @@
+/***************************************************************************
+ recording.h - description
+ -------------------
+ begin : Mi Aug 27 2003
+ copyright : (C) 2003 by Martin Witte
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KRADIO_RECORDING_H
+#define KRADIO_RECORDING_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include <tqobject.h>
+#include <tqstring.h>
+#include <tqmap.h>
+
+#include "../../src/include/plugins.h"
+#include "../../src/include/timecontrol_interfaces.h"
+#include "../../src/include/soundstreamclient_interfaces.h"
+
+#include "recording-config.h"
+#include "reccfg_interfaces.h"
+#include "encoder.h"
+
+class RadioStation;
+class StationList;
+class TQSocketNotifier;
+class RecordingEncoding;
+class FileRingBuffer;
+
+class Recording : public TQObject,
+ public PluginBase,
+ public ISoundStreamClient,
+ public IRecCfg
+{
+Q_OBJECT
+
+public:
+ Recording(const TQString &name);
+ ~Recording();
+
+ virtual TQString pluginClassName() const { return "Recording"; }
+
+ virtual const TQString &name() const { return PluginBase::name(); }
+ virtual TQString &name() { return PluginBase::name(); }
+
+ virtual bool connectI(Interface *i);
+ virtual bool disconnectI(Interface *i);
+
+
+ bool isRecording () const;
+
+
+ // PluginBase
+
+public:
+ virtual void saveState (TDEConfig *) const;
+ virtual void restoreState (TDEConfig *);
+
+ virtual ConfigPageInfo createConfigurationPage();
+ virtual AboutPageInfo createAboutPage();
+
+protected:
+
+// IRecCfg
+
+ bool setEncoderBuffer (size_t BufferSize, size_t BufferCount);
+ bool setSoundFormat (const SoundFormat &sf);
+ bool setMP3Quality (int q);
+ bool setOggQuality (float q);
+ bool setRecordingDirectory(const TQString &dir);
+ bool setOutputFormat (RecordingConfig::OutputFormat of);
+ bool setPreRecording (bool enable, int seconds);
+ bool setRecordingConfig (const RecordingConfig &cfg);
+
+ void getEncoderBuffer(size_t &BufferSize, size_t &BufferCount) const;
+ const SoundFormat &getSoundFormat () const;
+ int getMP3Quality () const;
+ float getOggQuality () const;
+ const TQString &getRecordingDirectory() const;
+ RecordingConfig::OutputFormat getOutputFormat() const;
+ bool getPreRecording(int &seconds) const;
+ const RecordingConfig &getRecordingConfig() const;
+
+// ISoundStreamClient
+
+ void noticeConnectedI (ISoundStreamServer *s, bool pointer_valid);
+
+ bool startPlayback(SoundStreamID id);
+ bool stopPlayback(SoundStreamID id);
+
+ bool startRecording(SoundStreamID id);
+ bool startRecordingWithFormat(SoundStreamID id, const SoundFormat &sf, SoundFormat &real_format);
+ bool noticeSoundStreamData(SoundStreamID id, const SoundFormat &sf, const char *data, size_t size, size_t &consumed_size, const SoundMetaData &md);
+ bool stopRecording(SoundStreamID id);
+ bool isRecordingRunning(SoundStreamID id, bool &b, SoundFormat &sf) const;
+
+ bool getSoundStreamDescription(SoundStreamID id, TQString &descr) const;
+ bool getSoundStreamRadioStation(SoundStreamID id, const RadioStation *&rs) const;
+
+ bool noticeSoundStreamClosed(SoundStreamID id);
+ bool noticeSoundStreamChanged(SoundStreamID id);
+
+ bool enumerateSoundStreams(TQMap<TQString, SoundStreamID> &list) const;
+
+protected slots:
+
+ bool event(TQEvent *e);
+
+protected:
+
+ bool startEncoder(SoundStreamID ssid, const RecordingConfig &cfg);
+ void stopEncoder(SoundStreamID ssid);
+
+protected:
+
+ RecordingConfig m_config;
+ TQMap<SoundStreamID, FileRingBuffer*> m_PreRecordingBuffers;
+
+ TQMap<SoundStreamID, RecordingEncoding*> m_EncodingThreads;
+ TQMap<SoundStreamID, SoundStreamID> m_RawStreams2EncodedStreams;
+ TQMap<SoundStreamID, SoundStreamID> m_EncodedStreams2RawStreams;
+};
+
+/* PreRecording Notes: listen for startplayback, stopplayback, closestream
+ manage map streamid => buffer
+ set each started stream into capture mode
+ put data into ringbuffers
+ on capture start, feed everything into the encoder buffer,
+ if encoderbuffer < prerecbuffer =>
+ put as much as possible into encoder
+ put new audio data into ring buffer
+
+*/
+
+#endif