summaryrefslogtreecommitdiffstats
path: root/client/audio_channels.h
diff options
context:
space:
mode:
authorYaniv Kamay <ykamay@redhat.com>2009-09-19 21:25:46 +0300
committerYaniv Kamay <ykamay@redhat.com>2009-10-14 15:06:41 +0200
commitc1b79eb035fa158fb2ac3bc8e559809611070016 (patch)
tree3348dd749a700dedf87c9b16fe8be77c62928df8 /client/audio_channels.h
downloadspice-c1b79eb035fa158fb2ac3bc8e559809611070016.tar.gz
spice-c1b79eb035fa158fb2ac3bc8e559809611070016.tar.xz
spice-c1b79eb035fa158fb2ac3bc8e559809611070016.zip
fresh start
Diffstat (limited to 'client/audio_channels.h')
-rw-r--r--client/audio_channels.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/client/audio_channels.h b/client/audio_channels.h
new file mode 100644
index 00000000..76150782
--- /dev/null
+++ b/client/audio_channels.h
@@ -0,0 +1,101 @@
+/*
+ Copyright (C) 2009 Red Hat, Inc.
+
+ 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.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _H_AUDIO_CHANNELS
+#define _H_AUDIO_CHANNELS
+
+#include <celt051/celt.h>
+
+#include "red_channel.h"
+#include "debug.h"
+
+class ChannelFactory;
+
+class WavePlaybackAbstract;
+class WaveRecordAbstract;
+class RecordSamplesMessage;
+
+class PlaybackChannel: public RedChannel {
+public:
+ PlaybackChannel(RedClient& client, uint32_t id);
+ ~PlaybackChannel(void);
+ bool abort(void);
+
+ static ChannelFactory& Factory();
+
+private:
+ void handle_mode(RedPeer::InMessage* message);
+ void handle_start(RedPeer::InMessage* message);
+ void handle_stop(RedPeer::InMessage* message);
+ void handle_raw_data(RedPeer::InMessage* message);
+ void handle_celt_data(RedPeer::InMessage* message);
+ void null_handler(RedPeer::InMessage* message);
+ void disable();
+
+ void set_data_handler();
+
+private:
+ WavePlaybackAbstract* _wave_player;
+ uint32_t _mode;
+ uint32_t _frame_bytes;
+ CELTMode *_celt_mode;
+ CELTDecoder *_celt_decoder;
+ bool _playing;
+ uint32_t _frame_count;
+};
+
+class RecordChannel: public RedChannel, private Platform::RecordClinet {
+public:
+ RecordChannel(RedClient& client, uint32_t id);
+ ~RecordChannel(void);
+
+ bool abort(void);
+
+ static ChannelFactory& Factory();
+
+private:
+ void handle_start(RedPeer::InMessage* message);
+ void handle_stop(RedPeer::InMessage* message);
+
+ virtual void on_connect();
+
+ virtual void add_evnet_sorce(EventsLoop::File& evnet_sorce);
+ virtual void remove_evnet_sorce(EventsLoop::File& evnet_sorce);
+ virtual void add_evnet_sorce(EventsLoop::Trigger& evnet_sorce);
+ virtual void remove_evnet_sorce(EventsLoop::Trigger& evnet_sorce);
+ virtual void push_frame(uint8_t *frame);
+
+ void send_start_mark();
+ void release_message(RecordSamplesMessage *message);
+ RecordSamplesMessage * get_message();
+
+private:
+ WaveRecordAbstract* _wave_recorder;
+ Mutex _messages_lock;
+ std::list<RecordSamplesMessage *> _messages;
+ int _mode;
+ CELTMode *_celt_mode;
+ CELTEncoder *_celt_encoder;
+ uint32_t _frame_bytes;
+
+ static int data_mode;
+
+ friend class RecordSamplesMessage;
+};
+
+#endif
+