[evolution] Remove audio-inline module.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Remove audio-inline module.
- Date: Thu, 5 Dec 2013 17:09:17 +0000 (UTC)
commit 45a31136e917d8d763dfb56dda7dcf486c2ed242
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Dec 5 11:37:32 2013 -0500
Remove audio-inline module.
Drop our explicit gstreamer requirement and merge audio support directly
into libevolution-mail-formatter. We now use the HTML5 <audio> tag and
let WebKit show much nicer playback controls, with volume and seeking.
configure.ac | 32 --
em-format/Makefile.am | 4 +
em-format/e-mail-formatter-audio.c | 155 +++++++++
em-format/e-mail-formatter.c | 2 +
.../e-mail-parser-audio.c | 41 +--
em-format/e-mail-parser.c | 2 +
em-format/e-mail-part-audio.c | 85 +++++
.../audio-inline => em-format}/e-mail-part-audio.h | 10 -
modules/Makefile.am | 5 -
modules/audio-inline/Makefile.am | 34 --
modules/audio-inline/e-mail-formatter-audio.c | 338 --------------------
modules/audio-inline/e-mail-formatter-audio.h | 30 --
modules/audio-inline/e-mail-parser-audio.h | 30 --
modules/audio-inline/e-mail-part-audio.c | 142 --------
.../audio-inline/evolution-module-audio-inline.c | 54 ---
15 files changed, 256 insertions(+), 708 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a3ae349..427e8f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1188,37 +1188,6 @@ dnl They must be explicitly disabled if the libraries are not present.
dnl ******************************************************************
dnl **************************************************
-dnl audio-inline plugin requires gstreamer-1.0 or 0.10
-dnl **************************************************
-AC_ARG_ENABLE([audio-inline],
- [AS_HELP_STRING([--enable-audio-inline],
- [Enable audio-inline plugin @<:@default=yes@:>@])],
- [enable_audio_inline="$enableval"], [enable_audio_inline=yes])
-
-if test "x$enable_audio_inline" = "xyes"; then
- PKG_CHECK_MODULES([GSTREAMER], [gstreamer-1.0], have_gst=yes,
- [PKG_CHECK_MODULES([GSTREAMER], [gstreamer-0.10], have_gst=yes, have_gst=no)],
- have_gst=no)
- AC_SUBST(GSTREAMER_CFLAGS)
- AC_SUBST(GSTREAMER_LIBS)
-
- if test "x$have_gst" = "xyes"; then
- AC_DEFINE(ENABLE_AUDIO_INLINE, 1, [Define to add support for inlining audio attachments])
- else
- AC_MSG_ERROR([
-
- gstreamer-1.0 or 0.10 not found.
-
- If you want to disable support for playing audio attachments,
- please append --disable-audio-inline to configure.
-
- ])
- fi
-fi
-
-AM_CONDITIONAL([ENABLE_AUDIO_INLINE], [test "x$enable_audio_inline" = "xyes"])
-
-dnl **************************************************
dnl text-highlight plugins requires highlight utility
dnl **************************************************
AC_ARG_ENABLE([text-highlight],
@@ -1519,7 +1488,6 @@ mail/importers/Makefile
maint/Makefile
modules/Makefile
modules/addressbook/Makefile
-modules/audio-inline/Makefile
modules/backup-restore/Makefile
modules/bogofilter/Makefile
modules/book-config-google/Makefile
diff --git a/em-format/Makefile.am b/em-format/Makefile.am
index 2983eb0..69da12d 100644
--- a/em-format/Makefile.am
+++ b/em-format/Makefile.am
@@ -35,6 +35,7 @@ evolution_mail_formatter_include_HEADERS = \
e-mail-part.h \
e-mail-part-attachment.h \
e-mail-part-attachment-bar.h \
+ e-mail-part-audio.h \
e-mail-part-headers.h \
e-mail-part-image.h \
e-mail-part-list.h \
@@ -68,6 +69,7 @@ libevolution_mail_formatter_la_SOURCES = \
e-mail-formatter-utils.c \
e-mail-formatter-attachment.c \
e-mail-formatter-attachment-bar.c \
+ e-mail-formatter-audio.c \
e-mail-formatter-enumtypes.c \
e-mail-formatter-error.c \
e-mail-formatter-extension.c \
@@ -90,6 +92,7 @@ libevolution_mail_formatter_la_SOURCES = \
e-mail-parser.c \
e-mail-parser-application-mbox.c \
e-mail-parser-attachment-bar.c \
+ e-mail-parser-audio.c \
e-mail-parser-headers.c \
e-mail-parser-image.c \
e-mail-parser-inlinepgp-encrypted.c \
@@ -113,6 +116,7 @@ libevolution_mail_formatter_la_SOURCES = \
e-mail-part.c \
e-mail-part-attachment.c \
e-mail-part-attachment-bar.c \
+ e-mail-part-audio.c \
e-mail-part-headers.c \
e-mail-part-image.c \
e-mail-part-list.c \
diff --git a/em-format/e-mail-formatter-audio.c b/em-format/e-mail-formatter-audio.c
new file mode 100644
index 0000000..e36cc06
--- /dev/null
+++ b/em-format/e-mail-formatter-audio.c
@@ -0,0 +1,155 @@
+/*
+ * e-mail-formatter-audio.c
+ *
+ * This program 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 of the License, or (at your option) version 3.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include <camel/camel.h>
+
+#include "e-mail-formatter-extension.h"
+#include "e-mail-formatter.h"
+#include "e-mail-part-audio.h"
+
+#define d(x)
+
+typedef EMailFormatterExtension EMailFormatterAudio;
+typedef EMailFormatterExtensionClass EMailFormatterAudioClass;
+
+GType e_mail_formatter_audio_get_type (void);
+
+G_DEFINE_TYPE (
+ EMailFormatterAudio,
+ e_mail_formatter_audio,
+ E_TYPE_MAIL_FORMATTER_EXTENSION)
+
+static const gchar *formatter_mime_types[] = {
+ "application/vnd.evolution.widget.audio",
+ "audio/ac3",
+ "audio/x-ac3",
+ "audio/basic",
+ "audio/mpeg",
+ "audio/x-mpeg",
+ "audio/mpeg3",
+ "audio/x-mpeg3",
+ "audio/mp3",
+ "audio/x-mp3",
+ "audio/mp4",
+ "audio/flac",
+ "audio/x-flac",
+ "audio/mod",
+ "audio/x-mod",
+ "audio/x-wav",
+ "audio/microsoft-wav",
+ "audio/x-wma",
+ "audio/x-ms-wma",
+ "audio/ogg",
+ "audio/x-vorbis+ogg",
+ "application/ogg",
+ "application/x-ogg",
+ NULL
+};
+
+static gboolean
+mail_formatter_audio_format (EMailFormatterExtension *extension,
+ EMailFormatter *formatter,
+ EMailFormatterContext *context,
+ EMailPart *part,
+ CamelStream *stream,
+ GCancellable *cancellable)
+{
+ CamelMimePart *mime_part;
+ CamelDataWrapper *content;
+ CamelTransferEncoding encoding;
+ CamelStream *mem_stream;
+ GByteArray *byte_array;
+ const gchar *mime_type;
+ gchar *html;
+ GError *local_error = NULL;
+
+ mime_part = e_mail_part_ref_mime_part (part);
+ encoding = camel_mime_part_get_encoding (mime_part);
+ content = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
+
+ mime_type = e_mail_part_get_mime_type (part);
+ if (mime_type == NULL)
+ mime_type = "audio/*";
+
+ mem_stream = camel_stream_mem_new ();
+ byte_array = camel_stream_mem_get_byte_array (
+ CAMEL_STREAM_MEM (mem_stream));
+
+ if (encoding == CAMEL_TRANSFER_ENCODING_BASE64) {
+ camel_data_wrapper_write_to_stream_sync (
+ content, mem_stream, cancellable, &local_error);
+
+ html = g_strdup_printf (
+ "<audio controls>"
+ "<source src=\"data:%s;base64,%s\"/>"
+ "</audio>",
+ mime_type, (gchar *) byte_array->data);
+
+ } else {
+ gchar *base64;
+
+ camel_data_wrapper_decode_to_stream_sync (
+ content, mem_stream, cancellable, &local_error);
+
+ base64 = g_base64_encode (
+ (guchar *) byte_array->data, byte_array->len);
+ html = g_strdup_printf (
+ "<audio controls>"
+ "<source src=\"data:%s;base64,%s\"/>"
+ "</audio>",
+ mime_type, base64);
+ g_free (base64);
+ }
+
+ /* XXX Should show the error message in the UI somehow. */
+ if (local_error != NULL) {
+ g_warning ("%s: %s", G_STRFUNC, local_error->message);
+ g_error_free (local_error);
+ }
+
+ camel_stream_write_string (stream, html, NULL, NULL);
+
+ g_free (html);
+
+ g_object_unref (mime_part);
+ g_object_unref (mem_stream);
+
+ return TRUE;
+}
+
+static void
+e_mail_formatter_audio_class_init (EMailFormatterExtensionClass *class)
+{
+ class->display_name = _("Audio Player");
+ class->description = _("Play the attachment in embedded audio player");
+ class->mime_types = formatter_mime_types;
+ class->priority = G_PRIORITY_LOW;
+ class->format = mail_formatter_audio_format;
+}
+
+static void
+e_mail_formatter_audio_init (EMailFormatterExtension *extension)
+{
+}
+
diff --git a/em-format/e-mail-formatter.c b/em-format/e-mail-formatter.c
index 2f201dd..41bd7fd 100644
--- a/em-format/e-mail-formatter.c
+++ b/em-format/e-mail-formatter.c
@@ -62,6 +62,7 @@ struct _AsyncContext {
/* internal formatter extensions */
GType e_mail_formatter_attachment_get_type (void);
GType e_mail_formatter_attachment_bar_get_type (void);
+GType e_mail_formatter_audio_get_type (void);
GType e_mail_formatter_error_get_type (void);
GType e_mail_formatter_headers_get_type (void);
GType e_mail_formatter_image_get_type (void);
@@ -534,6 +535,7 @@ e_mail_formatter_base_init (EMailFormatterClass *class)
/* Register internal extensions. */
g_type_ensure (e_mail_formatter_attachment_get_type ());
g_type_ensure (e_mail_formatter_attachment_bar_get_type ());
+ g_type_ensure (e_mail_formatter_audio_get_type ());
g_type_ensure (e_mail_formatter_error_get_type ());
g_type_ensure (e_mail_formatter_headers_get_type ());
g_type_ensure (e_mail_formatter_image_get_type ());
diff --git a/modules/audio-inline/e-mail-parser-audio.c b/em-format/e-mail-parser-audio.c
similarity index 77%
rename from modules/audio-inline/e-mail-parser-audio.c
rename to em-format/e-mail-parser-audio.c
index 9fed607..c5e351e 100644
--- a/modules/audio-inline/e-mail-parser-audio.c
+++ b/em-format/e-mail-parser-audio.c
@@ -20,32 +20,21 @@
#endif
#include <string.h>
-#include <gtk/gtk.h>
-#include <glib.h>
-#include <glib/gi18n.h>
-
-#include "e-mail-parser-audio.h"
-#include "e-mail-part-audio.h"
+#include <glib/gi18n-lib.h>
#include <camel/camel.h>
-#include <em-format/e-mail-extension-registry.h>
-#include <em-format/e-mail-parser-extension.h>
-#include <em-format/e-mail-part.h>
-
-#include <libebackend/libebackend.h>
-
-#define d(x)
+#include "e-mail-extension-registry.h"
+#include "e-mail-parser-extension.h"
+#include "e-mail-part-audio.h"
+#include "e-mail-part.h"
typedef EMailParserExtension EMailParserAudio;
typedef EMailParserExtensionClass EMailParserAudioClass;
-typedef EExtension EMailParserAudioLoader;
-typedef EExtensionClass EMailParserAudioLoaderClass;
-
GType e_mail_parser_audio_get_type (void);
-G_DEFINE_DYNAMIC_TYPE (
+G_DEFINE_TYPE (
EMailParserAudio,
e_mail_parser_audio,
E_TYPE_MAIL_PARSER_EXTENSION)
@@ -89,12 +78,10 @@ mail_parser_audio_parse (EMailParserExtension *extension,
gint len;
len = part_id->len;
- g_string_append (part_id, ".org-gnome-audio-button-panel");
+ g_string_append (part_id, ".audio");
camel_mime_part_set_disposition (part, "inline");
- d (printf ("audio formatter: format classid %s\n", part_id->str));
-
mail_part = e_mail_part_audio_new (part, part_id->str);
g_string_truncate (part_id, len);
@@ -113,24 +100,12 @@ static void
e_mail_parser_audio_class_init (EMailParserExtensionClass *class)
{
class->mime_types = parser_mime_types;
+ class->priority = G_PRIORITY_LOW;
class->flags = E_MAIL_PARSER_EXTENSION_INLINE_DISPOSITION;
class->parse = mail_parser_audio_parse;
}
static void
-e_mail_parser_audio_class_finalize (EMailParserExtensionClass *class)
-{
-
-}
-
-static void
e_mail_parser_audio_init (EMailParserExtension *extension)
{
}
-
-void
-e_mail_parser_audio_type_register (GTypeModule *type_module)
-{
- e_mail_parser_audio_register_type (type_module);
-}
-
diff --git a/em-format/e-mail-parser.c b/em-format/e-mail-parser.c
index 57c362e..f90f4d3 100644
--- a/em-format/e-mail-parser.c
+++ b/em-format/e-mail-parser.c
@@ -51,6 +51,7 @@ enum {
/* internal parser extensions */
GType e_mail_parser_application_mbox_get_type (void);
GType e_mail_parser_attachment_bar_get_type (void);
+GType e_mail_parser_audio_get_type (void);
GType e_mail_parser_headers_get_type (void);
GType e_mail_parser_message_get_type (void);
GType e_mail_parser_secure_button_get_type (void);
@@ -206,6 +207,7 @@ e_mail_parser_base_init (EMailParserClass *class)
/* Register internal extensions. */
g_type_ensure (e_mail_parser_application_mbox_get_type ());
g_type_ensure (e_mail_parser_attachment_bar_get_type ());
+ g_type_ensure (e_mail_parser_audio_get_type ());
g_type_ensure (e_mail_parser_headers_get_type ());
g_type_ensure (e_mail_parser_message_get_type ());
g_type_ensure (e_mail_parser_secure_button_get_type ());
diff --git a/em-format/e-mail-part-audio.c b/em-format/e-mail-part-audio.c
new file mode 100644
index 0000000..f8ba9ab
--- /dev/null
+++ b/em-format/e-mail-part-audio.c
@@ -0,0 +1,85 @@
+/*
+ * e-mail-part-audio.c
+ *
+ * This program 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 of the License, or (at your option) version 3.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include "e-mail-part-audio.h"
+
+#define E_MAIL_PART_AUDIO_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_PART_AUDIO, EMailPartAudioPrivate))
+
+G_DEFINE_TYPE (
+ EMailPartAudio,
+ e_mail_part_audio,
+ E_TYPE_MAIL_PART)
+
+static void
+mail_part_audio_constructed (GObject *object)
+{
+ EMailPart *part;
+ CamelMimePart *mime_part;
+ CamelContentType *content_type;
+
+ part = E_MAIL_PART (object);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (e_mail_part_audio_parent_class)->constructed (object);
+
+ e_mail_part_set_is_attachment (part, TRUE);
+
+ mime_part = e_mail_part_ref_mime_part (part);
+
+ content_type = camel_mime_part_get_content_type (mime_part);
+
+ if (content_type != NULL) {
+ gchar *mime_type;
+
+ mime_type = camel_content_type_simple (content_type);
+ e_mail_part_set_mime_type (part, mime_type);
+ g_free (mime_type);
+ } else {
+ e_mail_part_set_mime_type (part, "audio/*");
+ }
+
+ g_object_unref (mime_part);
+}
+
+static void
+e_mail_part_audio_class_init (EMailPartAudioClass *class)
+{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = mail_part_audio_constructed;
+}
+
+static void
+e_mail_part_audio_init (EMailPartAudio *part)
+{
+}
+
+EMailPart *
+e_mail_part_audio_new (CamelMimePart *mime_part,
+ const gchar *id)
+{
+ g_return_val_if_fail (id != NULL, NULL);
+
+ return g_object_new (
+ E_TYPE_MAIL_PART_AUDIO,
+ "id", id, "mime-part", mime_part, NULL);
+}
+
diff --git a/modules/audio-inline/e-mail-part-audio.h b/em-format/e-mail-part-audio.h
similarity index 88%
rename from modules/audio-inline/e-mail-part-audio.h
rename to em-format/e-mail-part-audio.h
index 42459e0..4aeea05 100644
--- a/modules/audio-inline/e-mail-part-audio.h
+++ b/em-format/e-mail-part-audio.h
@@ -20,7 +20,6 @@
#define E_MAIL_PART_AUDIO_H
#include <em-format/e-mail-part.h>
-#include <gst/gst.h>
/* Standard GObject macros */
#define E_TYPE_MAIL_PART_AUDIO \
@@ -50,14 +49,6 @@ typedef struct _EMailPartAudioPrivate EMailPartAudioPrivate;
struct _EMailPartAudio {
EMailPart parent;
EMailPartAudioPrivate *priv;
-
- gchar *filename;
- GstElement *playbin;
- gulong bus_id;
- GstState target_state;
- GtkWidget *play_button;
- GtkWidget *pause_button;
- GtkWidget *stop_button;
};
struct _EMailPartAudioClass {
@@ -65,7 +56,6 @@ struct _EMailPartAudioClass {
};
GType e_mail_part_audio_get_type (void) G_GNUC_CONST;
-void e_mail_part_audio_type_register (GTypeModule *type_module);
EMailPart * e_mail_part_audio_new (CamelMimePart *mime_part,
const gchar *id);
diff --git a/modules/Makefile.am b/modules/Makefile.am
index d08372d..ac6655f 100644
--- a/modules/Makefile.am
+++ b/modules/Makefile.am
@@ -18,10 +18,6 @@ if ENABLE_TNEF
TNEF_ATTACHMENT_DIR = tnef-attachment
endif
-if ENABLE_AUDIO_INLINE
-AUDIO_INLINE_DIR = audio-inline
-endif
-
if ENABLE_TEXT_HIGHLIGHT
TEXT_HIGHLIGHT_DIR = text-highlight
endif
@@ -59,7 +55,6 @@ SUBDIRS = \
$(BOGOFILTER_DIR) \
$(SPAMASSASSIN_DIR) \
$(TNEF_ATTACHMENT_DIR) \
- $(AUDIO_INLINE_DIR) \
$(TEXT_HIGHLIGHT_DIR)
-include $(top_srcdir)/git.mk
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]