[gtk-vnc] Introduce an interface for handling audio data



commit df194ea790a9d5b1c5873790964ee099843a4fa2
Author: Daniel P. Berrange <berrange redhat com>
Date:   Fri Dec 9 14:45:26 2011 +0000

    Introduce an interface for handling audio data
    
    Define a new interface VncAudio which is used to handle playback
    of audio data
    
    * src/Makefile.am, src/libgvnc_sym.version,
      src/vncaudio.c, src/vncaudio.h: Add interface for handling
      audio data

 src/Makefile.am         |    3 ++
 src/libgvnc_sym.version |    5 +++
 src/vncaudio.c          |   66 +++++++++++++++++++++++++++++++++++++++++++++++
 src/vncaudio.h          |   66 +++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 140 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 60c2cee..94df157 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -57,6 +57,7 @@ gvnc_include_HEADERS = \
 			vncpixelformat.h \
 			vncaudioformat.h \
 			vncaudiosample.h \
+			vncaudio.h \
 			vncframebuffer.h \
 			vncbaseframebuffer.h \
 			vnccursor.h \
@@ -72,6 +73,7 @@ libgvnc_1_0_la_SOURCES = \
 			vncpixelformat.h vncpixelformat.c \
 			vncaudioformat.h vncaudioformat.c \
 			vncaudiosample.h vncaudiosample.c \
+			vncaudio.h vncaudio.c \
 			vncframebuffer.h vncframebuffer.c \
 			vncbaseframebufferblt.h \
 			vncbaseframebuffer.h vncbaseframebuffer.c \
@@ -292,6 +294,7 @@ GVNC_INTROSPECTION_SRCS = \
 			$(srcdir)/vncpixelformat.h \
 			$(srcdir)/vncaudioformat.h $(srcdir)/vncaudioformat.c \
 			$(srcdir)/vncaudiosample.h $(srcdir)/vncaudiosample.c \
+			$(srcdir)/vncaudio.h $(srcdir)/vncaudio.c \
 			$(srcdir)/vncframebuffer.h $(srcdir)/vncframebuffer.c \
 			$(srcdir)/vncbaseframebuffer.h $(srcdir)/vncbaseframebuffer.c \
 			$(srcdir)/vnccolormap.h $(srcdir)/vnccolormap.c \
diff --git a/src/libgvnc_sym.version b/src/libgvnc_sym.version
index 649ca3a..7554e23 100644
--- a/src/libgvnc_sym.version
+++ b/src/libgvnc_sym.version
@@ -1,5 +1,10 @@
 {
     global:
+	vnc_audio_playback_start;
+	vnc_audio_playback_stop;
+	vnc_audio_playback_data;
+	vnc_audio_get_type;
+
 	vnc_audio_format_new;
 	vnc_audio_format_copy;
 	vnc_audio_format_free;
diff --git a/src/vncaudio.c b/src/vncaudio.c
new file mode 100644
index 0000000..3400762
--- /dev/null
+++ b/src/vncaudio.c
@@ -0,0 +1,66 @@
+/*
+ * GTK VNC Widget
+ *
+ * Copyright (C) 2010 Daniel P. Berrange <dan berrange com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.0 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#include <config.h>
+
+#include "vncaudio.h"
+
+
+void vnc_audio_playback_start(VncAudio *aud, VncAudioFormat *format)
+{
+	VNC_AUDIO_GET_INTERFACE(aud)->playback_start(aud, format);
+}
+
+void vnc_audio_playback_stop(VncAudio *aud)
+{
+	VNC_AUDIO_GET_INTERFACE(aud)->playback_stop(aud);
+}
+
+void vnc_audio_playback_data(VncAudio *aud, VncAudioSample *sample)
+{
+	VNC_AUDIO_GET_INTERFACE(aud)->playback_data(aud, sample);
+}
+
+
+GType
+vnc_audio_get_type (void)
+{
+	static GType audio_type = 0;
+
+	if (!audio_type) {
+		audio_type =
+			g_type_register_static_simple(G_TYPE_INTERFACE, "VncAudio",
+						      sizeof (VncAudioInterface),
+						      NULL, 0, NULL, 0);
+
+		g_type_interface_add_prerequisite (audio_type, G_TYPE_OBJECT);
+	}
+
+	return audio_type;
+}
+
+
+/*
+ * Local variables:
+ *  c-indent-level: 8
+ *  c-basic-offset: 8
+ *  tab-width: 8
+ * End:
+ */
diff --git a/src/vncaudio.h b/src/vncaudio.h
new file mode 100644
index 0000000..56d8d2e
--- /dev/null
+++ b/src/vncaudio.h
@@ -0,0 +1,66 @@
+/*
+ * GTK VNC Widget
+ *
+ * Copyright (C) 2010 Daniel P. Berrange <dan berrange com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.0 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#ifndef VNC_AUDIO_H
+#define VNC_AUDIO_H
+
+#include <glib-object.h>
+
+#include <vncaudioformat.h>
+#include <vncaudiosample.h>
+
+G_BEGIN_DECLS
+
+#define VNC_TYPE_AUDIO            (vnc_audio_get_type ())
+#define VNC_AUDIO(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), VNC_TYPE_AUDIO, VncAudio))
+#define VNC_IS_AUDIO(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VNC_TYPE_AUDIO))
+#define VNC_AUDIO_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), VNC_TYPE_AUDIO, VncAudioInterface))
+
+
+typedef struct _VncAudio VncAudio; /* Dummy object */
+typedef struct _VncAudioInterface VncAudioInterface;
+
+struct _VncAudioInterface {
+	GTypeInterface parent;
+
+	gboolean (*playback_start)(VncAudio *audio, VncAudioFormat *format);
+	gboolean (*playback_stop)(VncAudio *audio);
+	gboolean (*playback_data)(VncAudio *audio, VncAudioSample *sample);
+};
+
+GType vnc_audio_get_type(void) G_GNUC_CONST;
+
+void vnc_audio_playback_start(VncAudio *aud,
+			      VncAudioFormat *format);
+void vnc_audio_playback_stop(VncAudio *aud);
+void vnc_audio_playback_data(VncAudio *aud,
+			     VncAudioSample *sample);
+
+G_END_DECLS
+
+#endif /* VNC_AUDIO_H */
+
+/*
+ * Local variables:
+ *  c-indent-level: 8
+ *  c-basic-offset: 8
+ *  tab-width: 8
+ * End:
+ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]