[gtk-vnc] Introduce a basic data type for audio formats



commit 821f705dbe344abe7d6e82e8ce8a62d7207d2e28
Author: Daniel P. Berrange <berrange redhat com>
Date:   Fri Dec 9 14:40:01 2011 +0000

    Introduce a basic data type for audio formats
    
    To avoid having to pass around all the parameters individually,
    introduce a boxed data type for audio formats
    
    * src/Makefile.am, src/libgvnc_sym.version,
      src/vncaudioformat.c, src/vncaudioformat.h: Boxed type for
      audio formats

 src/Makefile.am         |    3 ++
 src/libgvnc_sym.version |    5 +++
 src/vncaudioformat.c    |   71 +++++++++++++++++++++++++++++++++++++++++++++++
 src/vncaudioformat.h    |   64 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 143 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index c5834cb..a81ddbb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -55,6 +55,7 @@ gvnc_includedir = $(includedir)/gvnc-1.0/
 gvnc_include_HEADERS = \
 			gvnc.h \
 			vncpixelformat.h \
+			vncaudioformat.h \
 			vncframebuffer.h \
 			vncbaseframebuffer.h \
 			vnccursor.h \
@@ -68,6 +69,7 @@ libgvnc_1_0_la_SOURCES = \
 			d3des.h d3des.c \
 			dh.h dh.c \
 			vncpixelformat.h vncpixelformat.c \
+			vncaudioformat.h vncaudioformat.c \
 			vncframebuffer.h vncframebuffer.c \
 			vncbaseframebufferblt.h \
 			vncbaseframebuffer.h vncbaseframebuffer.c \
@@ -286,6 +288,7 @@ if WITH_GOBJECT_INTROSPECTION
 
 GVNC_INTROSPECTION_SRCS = \
 			$(srcdir)/vncpixelformat.h \
+			$(srcdir)/vncaudioformat.h $(srcdir)/vncaudioformat.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 4e54d7c..2d7c8d0 100644
--- a/src/libgvnc_sym.version
+++ b/src/libgvnc_sym.version
@@ -1,5 +1,10 @@
 {
     global:
+	vnc_audio_format_new;
+	vnc_audio_format_copy;
+	vnc_audio_format_free;
+	vnc_audio_format_get_type;
+
 	vnc_cursor_get_type;
 	vnc_cursor_new;
 	vnc_cursor_get_data;
diff --git a/src/vncaudioformat.c b/src/vncaudioformat.c
new file mode 100644
index 0000000..8efd2b7
--- /dev/null
+++ b/src/vncaudioformat.c
@@ -0,0 +1,71 @@
+/*
+ * 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 "vncaudioformat.h"
+
+GType vnc_audio_format_get_type(void)
+{
+	static GType audio_format_type = 0;
+
+	if (G_UNLIKELY(audio_format_type == 0)) {
+		audio_format_type = g_boxed_type_register_static
+			("VncAudioFormat",
+			 (GBoxedCopyFunc)vnc_audio_format_copy,
+			 (GBoxedFreeFunc)vnc_audio_format_free);
+	}
+
+	return audio_format_type;
+}
+
+
+VncAudioFormat *vnc_audio_format_new(void)
+{
+	VncAudioFormat *format;
+
+	format = g_slice_new0(VncAudioFormat);
+
+	return format;
+}
+
+
+VncAudioFormat *vnc_audio_format_copy(VncAudioFormat *srcFormat)
+{
+	VncAudioFormat *format;
+
+	format = g_slice_dup(VncAudioFormat, srcFormat);
+
+	return format;
+}
+
+
+void vnc_audio_format_free(VncAudioFormat *format)
+{
+	g_slice_free(VncAudioFormat, format);
+}
+
+/*
+ * Local variables:
+ *  c-indent-level: 8
+ *  c-basic-offset: 8
+ *  tab-width: 8
+ * End:
+ */
diff --git a/src/vncaudioformat.h b/src/vncaudioformat.h
new file mode 100644
index 0000000..bbf741e
--- /dev/null
+++ b/src/vncaudioformat.h
@@ -0,0 +1,64 @@
+/*
+ * 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_FORMAT_H
+#define VNC_AUDIO_FORMAT_H
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define VNC_TYPE_AUDIO_FORMAT            (vnc_audio_format_get_type ())
+
+typedef struct _VncAudioFormat VncAudioFormat;
+
+struct _VncAudioFormat {
+	guint8 format;
+	guint8 nchannels;
+	guint32 frequency;
+};
+
+typedef enum {
+	VNC_AUDIO_FORMAT_RAW_U8,
+	VNC_AUDIO_FORMAT_RAW_S8,
+	VNC_AUDIO_FORMAT_RAW_U16,
+	VNC_AUDIO_FORMAT_RAW_S16,
+	VNC_AUDIO_FORMAT_RAW_U32,
+	VNC_AUDIO_FORMAT_RAW_S32,
+} VncAudioFormatType;
+
+GType vnc_audio_format_get_type(void);
+
+VncAudioFormat *vnc_audio_format_new(void);
+VncAudioFormat *vnc_audio_format_copy(VncAudioFormat *format);
+void vnc_audio_format_free(VncAudioFormat *format);
+
+G_END_DECLS
+
+#endif /* VNC_AUDIO_FORMAT_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]