1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 /*
3  * Libbrasero-misc
4  * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app@wanadoo.fr>
5  *
6  * Libbrasero-misc is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * The Libbrasero-misc authors hereby grant permission for non-GPL compatible
12  * GStreamer plugins to be used and distributed together with GStreamer
13  * and Libbrasero-misc. This permission is above and beyond the permissions granted
14  * by the GPL license by which Libbrasero-burn is covered. If you modify this code
15  * you may extend this exception to your version of the code, but you are not
16  * obligated to do so. If you do not wish to do so, delete this exception
17  * statement from your version.
18  *
19  * Libbrasero-misc is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU Library General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to:
26  * 	The Free Software Foundation, Inc.,
27  * 	51 Franklin Street, Fifth Floor
28  * 	Boston, MA  02110-1301, USA.
29  */
30 
31 #ifndef _METADATA_H
32 #define _METADATA_H
33 
34 #include <glib.h>
35 #include <glib-object.h>
36 #include <gio/gio.h>
37 
38 #include <gdk-pixbuf/gdk-pixbuf.h>
39 
40 #include <gst/gst.h>
41 
42 G_BEGIN_DECLS
43 
44 typedef enum {
45 	BRASERO_METADATA_FLAG_NONE			= 0,
46 	BRASERO_METADATA_FLAG_SILENCES			= 1 << 1,
47 	BRASERO_METADATA_FLAG_MISSING			= 1 << 2,
48 	BRASERO_METADATA_FLAG_THUMBNAIL			= 1 << 3
49 } BraseroMetadataFlag;
50 
51 #define BRASERO_TYPE_METADATA         (brasero_metadata_get_type ())
52 #define BRASERO_METADATA(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), BRASERO_TYPE_METADATA, BraseroMetadata))
53 #define BRASERO_METADATA_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), BRASERO_TYPE_METADATA, BraseroMetadataClass))
54 #define BRASERO_IS_METADATA(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), BRASERO_TYPE_METADATA))
55 #define BRASERO_IS_METADATA_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), BRASERO_TYPE_METADATA))
56 #define BRASERO_METADATA_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), BRASERO_TYPE_METADATA, BraseroMetadataClass))
57 
58 typedef struct {
59 	gint64 start;
60 	gint64 end;
61 } BraseroMetadataSilence;
62 
63 typedef struct {
64 	gchar *uri;
65 	gchar *type;
66 	gchar *title;
67 	gchar *artist;
68 	gchar *album;
69 	gchar *genre;
70 	gchar *composer;
71 	gchar *musicbrainz_id;
72 	gchar *isrc;
73 	guint64 len;
74 
75 	gint channels;
76 	gint rate;
77 
78 	GSList *silences;
79 
80 	GdkPixbuf *snapshot;
81 
82 	guint is_seekable:1;
83 	guint has_audio:1;
84 	guint has_video:1;
85 	guint has_dts:1;
86 } BraseroMetadataInfo;
87 
88 void
89 brasero_metadata_info_copy (BraseroMetadataInfo *dest,
90 			    BraseroMetadataInfo *src);
91 void
92 brasero_metadata_info_clear (BraseroMetadataInfo *info);
93 void
94 brasero_metadata_info_free (BraseroMetadataInfo *info);
95 
96 typedef struct _BraseroMetadataClass BraseroMetadataClass;
97 typedef struct _BraseroMetadata BraseroMetadata;
98 
99 struct _BraseroMetadataClass {
100 	GObjectClass parent_class;
101 
102 	void		(*completed)	(BraseroMetadata *meta,
103 					 const GError *error);
104 	void		(*progress)	(BraseroMetadata *meta,
105 					 gdouble progress);
106 
107 };
108 
109 struct _BraseroMetadata {
110 	GObject parent;
111 };
112 
113 GType brasero_metadata_get_type (void) G_GNUC_CONST;
114 
115 BraseroMetadata *brasero_metadata_new (void);
116 
117 gboolean
118 brasero_metadata_get_info_async (BraseroMetadata *metadata,
119 				 const gchar *uri,
120 				 BraseroMetadataFlag flags);
121 
122 void
123 brasero_metadata_cancel (BraseroMetadata *metadata);
124 
125 gboolean
126 brasero_metadata_set_uri (BraseroMetadata *metadata,
127 			  BraseroMetadataFlag flags,
128 			  const gchar *uri,
129 			  GError **error);
130 
131 void
132 brasero_metadata_wait (BraseroMetadata *metadata,
133 		       GCancellable *cancel);
134 void
135 brasero_metadata_increase_listener_number (BraseroMetadata *metadata);
136 
137 gboolean
138 brasero_metadata_decrease_listener_number (BraseroMetadata *metadata);
139 
140 const gchar *
141 brasero_metadata_get_uri (BraseroMetadata *metadata);
142 
143 BraseroMetadataFlag
144 brasero_metadata_get_flags (BraseroMetadata *metadata);
145 
146 gboolean
147 brasero_metadata_get_result (BraseroMetadata *metadata,
148 			     BraseroMetadataInfo *info,
149 			     GError **error);
150 
151 typedef int	(*BraseroMetadataGetXidCb)	(gpointer user_data);
152 
153 void
154 brasero_metadata_set_get_xid_callback (BraseroMetadata *metadata,
155                                        BraseroMetadataGetXidCb callback,
156                                        gpointer user_data);
157 G_END_DECLS
158 
159 #endif				/* METADATA_H */
160