evolution-3.6.4/modules/audio-inline/e-mail-parser-audio-inline.c

No issues found

Incomplete coverage

Tool Failure ID Location Function Message Data
clang-analyzer no-output-found e-mail-parser-audio-inline.c Message(text='Unable to locate XML output from invoke-clang-analyzer') None
clang-analyzer no-output-found e-mail-parser-audio-inline.c Message(text='Unable to locate XML output from invoke-clang-analyzer') None
Failure running clang-analyzer ('no-output-found')
Message
Unable to locate XML output from invoke-clang-analyzer
Failure running clang-analyzer ('no-output-found')
Message
Unable to locate XML output from invoke-clang-analyzer
  1 /*
  2  * e-mail-parser-audio-inline.c
  3  *
  4  * This program is free software; you can redistribute it and/or
  5  * modify it under the terms of the GNU Lesser General Public
  6  * License as published by the Free Software Foundation; either
  7  * version 2 of the License, or (at your option) version 3.
  8  *
  9  * This program is distributed in the hope that it will be useful,
 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 12  * Lesser General Public License for more details.
 13  *
 14  * You should have received a copy of the GNU Lesser General Public
 15  * License along with the program; if not, see <http://www.gnu.org/licenses/>
 16  */
 17 
 18 #ifdef HAVE_CONFIG_H
 19 #include <config.h>
 20 #endif
 21 
 22 #include <string.h>
 23 #include <gtk/gtk.h>
 24 #include <glib.h>
 25 #include <glib/gi18n.h>
 26 #include <glib/gstdio.h>
 27 
 28 #include "e-mail-parser-audio-inline.h"
 29 #include "e-mail-part-audio-inline.h"
 30 
 31 #include <camel/camel.h>
 32 
 33 #include <em-format/e-mail-extension-registry.h>
 34 #include <em-format/e-mail-parser-extension.h>
 35 #include <em-format/e-mail-part.h>
 36 
 37 #include <libebackend/libebackend.h>
 38 
 39 #define d(x)
 40 
 41 typedef struct _EMailParserInlineAudio {
 42 	EExtension parent;
 43 } EMailParserAudioInline;
 44 
 45 typedef struct _EMailParserAudioInlineClass {
 46 	EExtensionClass parent_class;
 47 } EMailParserAudioInlineClass;
 48 
 49 GType e_mail_parser_audio_inline_get_type (void);
 50 static void e_mail_parser_mail_extension_interface_init (EMailExtensionInterface *iface);
 51 static void e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface);
 52 
 53 G_DEFINE_DYNAMIC_TYPE_EXTENDED (
 54 	EMailParserAudioInline,
 55 	e_mail_parser_audio_inline,
 56 	E_TYPE_EXTENSION,
 57 	0,
 58 	G_IMPLEMENT_INTERFACE_DYNAMIC (
 59 		E_TYPE_MAIL_EXTENSION,
 60 		e_mail_parser_mail_extension_interface_init)
 61 	G_IMPLEMENT_INTERFACE_DYNAMIC (
 62 		E_TYPE_MAIL_PARSER_EXTENSION,
 63 		e_mail_parser_parser_extension_interface_init));
 64 
 65 static const gchar * parser_mime_types[] = { "audio/ac3", "audio/x-ac3",
 66 					    "audio/basic", "audio/mpeg",
 67 					    "audio/x-mpeg", "audio/mpeg3",
 68 					    "audio/x-mpeg3", "audio/mp3",
 69 					    "audio/x-mp3", "audio/mp4",
 70 					    "audio/flac", "audio/x-flac",
 71 					    "audio/mod", "audio/x-mod",
 72 					    "audio/x-wav", "audio/microsoft-wav",
 73 					    "audio/x-wma", "audio/x-ms-wma",
 74 					    "application/ogg", "application/x-ogg",
 75 					    NULL };
 76 
 77 static void
 78 mail_part_audio_inline_free (EMailPart *mail_part)
 79 {
 80 	EMailPartAudioInline *ai_part = (EMailPartAudioInline *) mail_part;
 81 
 82 	g_clear_object (&ai_part->play_button);
 83 	g_clear_object (&ai_part->pause_button);
 84 	g_clear_object (&ai_part->stop_button);
 85 
 86 	if (ai_part->filename) {
 87 		g_unlink (ai_part->filename);
 88 		g_free (ai_part->filename);
 89 		ai_part->filename = NULL;
 90 	}
 91 
 92 	if (ai_part->bus_id) {
 93 		g_source_remove (ai_part->bus_id);
 94 		ai_part->bus_id = 0;
 95 	}
 96 
 97 	if (ai_part->playbin) {
 98 		gst_element_set_state (ai_part->playbin, GST_STATE_NULL);
 99 		gst_object_unref (ai_part->playbin);
100 		ai_part->playbin = NULL;
101 	}
102 }
103 
104 static GSList *
105 empe_audio_inline_parse (EMailParserExtension *extension,
106                          EMailParser *parser,
107                          CamelMimePart *part,
108                          GString *part_id,
109                          GCancellable *cancellable)
110 {
111 	EMailPartAudioInline *mail_part;
112 	gint len;
113 
114 	len = part_id->len;
115 	g_string_append (part_id, ".org-gnome-audio-inline-button-panel");
116 
117 	d (printf ("audio inline formatter: format classid %s\n", part_id->str));
118 
119 	mail_part = (EMailPartAudioInline *) e_mail_part_subclass_new (
120 			part, part_id->str, sizeof (EMailPartAudioInline),
121 			(GFreeFunc) mail_part_audio_inline_free);
122 	mail_part->parent.mime_type = camel_content_type_simple (
123 			camel_mime_part_get_content_type (part));
124 	mail_part->parent.is_attachment = TRUE;
125 	g_string_truncate (part_id, len);
126 
127 	return e_mail_parser_wrap_as_attachment (
128 			parser, part, g_slist_append (NULL, mail_part),
129 			part_id, cancellable);
130 }
131 
132 static guint32
133 empe_audio_inline_get_flags (EMailParserExtension *extension)
134 {
135 	return E_MAIL_PARSER_EXTENSION_INLINE_DISPOSITION;
136 }
137 
138 static const gchar **
139 empe_mime_types (EMailExtension *extension)
140 {
141 	return parser_mime_types;
142 }
143 
144 void
145 e_mail_parser_audio_inline_type_register (GTypeModule *type_module)
146 {
147 	e_mail_parser_audio_inline_register_type (type_module);
148 }
149 
150 static void
151 e_mail_parser_mail_extension_interface_init (EMailExtensionInterface *iface)
152 {
153 	iface->mime_types = empe_mime_types;
154 }
155 
156 static void
157 e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface)
158 {
159 	iface->parse = empe_audio_inline_parse;
160 	iface->get_flags = empe_audio_inline_get_flags;
161 }
162 
163 static void
164 e_mail_parser_audio_inline_constructed (GObject *object)
165 {
166 	EExtensible *extensible;
167 	EMailExtensionRegistry *reg;
168 
169 	extensible = e_extension_get_extensible (E_EXTENSION (object));
170 	reg = E_MAIL_EXTENSION_REGISTRY (extensible);
171 
172 	e_mail_extension_registry_add_extension (reg, E_MAIL_EXTENSION (object));
173 }
174 
175 static void
176 e_mail_parser_audio_inline_class_init (EMailParserAudioInlineClass *class)
177 {
178 	GObjectClass *object_class;
179 	EExtensionClass *extension_class;
180 
181 	object_class = G_OBJECT_CLASS (class);
182 	object_class->constructed = e_mail_parser_audio_inline_constructed;
183 
184 	extension_class = E_EXTENSION_CLASS (class);
185 	extension_class->extensible_type = E_TYPE_MAIL_PARSER_EXTENSION_REGISTRY;
186 }
187 
188 static void
189 e_mail_parser_audio_inline_class_finalize (EMailParserAudioInlineClass *class)
190 {
191 
192 }
193 
194 static void
195 e_mail_parser_audio_inline_init (EMailParserAudioInline *self)
196 {
197 }