1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 /*
3  * Libbrasero-burn
4  * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app@wanadoo.fr>
5  *
6  * Libbrasero-burn 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-burn authors hereby grant permission for non-GPL compatible
12  * GStreamer plugins to be used and distributed together with GStreamer
13  * and Libbrasero-burn. 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-burn 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 BURN_SESSION_H
32 #define BURN_SESSION_H
33 
34 #include <glib.h>
35 #include <glib-object.h>
36 
37 #include <brasero-drive.h>
38 
39 #include <brasero-error.h>
40 #include <brasero-status.h>
41 #include <brasero-track.h>
42 
43 G_BEGIN_DECLS
44 
45 #define BRASERO_TYPE_BURN_SESSION         (brasero_burn_session_get_type ())
46 #define BRASERO_BURN_SESSION(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), BRASERO_TYPE_BURN_SESSION, BraseroBurnSession))
47 #define BRASERO_BURN_SESSION_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), BRASERO_TYPE_BURN_SESSION, BraseroBurnSessionClass))
48 #define BRASERO_IS_BURN_SESSION(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), BRASERO_TYPE_BURN_SESSION))
49 #define BRASERO_IS_BURN_SESSION_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), BRASERO_TYPE_BURN_SESSION))
50 #define BRASERO_BURN_SESSION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), BRASERO_TYPE_BURN_SESSION, BraseroBurnSessionClass))
51 
52 typedef struct _BraseroBurnSession BraseroBurnSession;
53 typedef struct _BraseroBurnSessionClass BraseroBurnSessionClass;
54 
55 struct _BraseroBurnSession {
56 	GObject parent;
57 };
58 
59 struct _BraseroBurnSessionClass {
60 	GObjectClass parent_class;
61 
62 	/** Virtual functions **/
63 	BraseroBurnResult	(*set_output_image)	(BraseroBurnSession *session,
64 							 BraseroImageFormat format,
65 							 const gchar *image,
66 							 const gchar *toc);
67 	BraseroBurnResult	(*get_output_path)	(BraseroBurnSession *session,
68 							 gchar **image,
69 							 gchar **toc);
70 	BraseroImageFormat	(*get_output_format)	(BraseroBurnSession *session);
71 
72 	/** Signals **/
73 	void			(*tag_changed)		(BraseroBurnSession *session,
74 					                 const gchar *tag);
75 	void			(*track_added)		(BraseroBurnSession *session,
76 							 BraseroTrack *track);
77 	void			(*track_removed)	(BraseroBurnSession *session,
78 							 BraseroTrack *track,
79 							 guint former_position);
80 	void			(*track_changed)	(BraseroBurnSession *session,
81 							 BraseroTrack *track);
82 	void			(*output_changed)	(BraseroBurnSession *session,
83 							 BraseroMedium *former_medium);
84 };
85 
86 GType brasero_burn_session_get_type (void);
87 
88 BraseroBurnSession *brasero_burn_session_new (void);
89 
90 
91 /**
92  * Used to manage tracks for input
93  */
94 
95 BraseroBurnResult
96 brasero_burn_session_add_track (BraseroBurnSession *session,
97 				BraseroTrack *new_track,
98 				BraseroTrack *sibling);
99 
100 BraseroBurnResult
101 brasero_burn_session_move_track (BraseroBurnSession *session,
102 				 BraseroTrack *track,
103 				 BraseroTrack *sibling);
104 
105 BraseroBurnResult
106 brasero_burn_session_remove_track (BraseroBurnSession *session,
107 				   BraseroTrack *track);
108 
109 GSList *
110 brasero_burn_session_get_tracks (BraseroBurnSession *session);
111 
112 /**
113  * Get some information about the session
114  */
115 
116 BraseroBurnResult
117 brasero_burn_session_get_status (BraseroBurnSession *session,
118 				 BraseroStatus *status);
119 
120 BraseroBurnResult
121 brasero_burn_session_get_size (BraseroBurnSession *session,
122 			       goffset *blocks,
123 			       goffset *bytes);
124 
125 BraseroBurnResult
126 brasero_burn_session_get_input_type (BraseroBurnSession *session,
127 				     BraseroTrackType *type);
128 
129 /**
130  * This is to set additional arbitrary information
131  */
132 
133 BraseroBurnResult
134 brasero_burn_session_tag_lookup (BraseroBurnSession *session,
135 				 const gchar *tag,
136 				 GValue **value);
137 
138 BraseroBurnResult
139 brasero_burn_session_tag_add (BraseroBurnSession *session,
140 			      const gchar *tag,
141 			      GValue *value);
142 
143 BraseroBurnResult
144 brasero_burn_session_tag_remove (BraseroBurnSession *session,
145 				 const gchar *tag);
146 
147 BraseroBurnResult
148 brasero_burn_session_tag_add_int (BraseroBurnSession *self,
149                                   const gchar *tag,
150                                   gint value);
151 gint
152 brasero_burn_session_tag_lookup_int (BraseroBurnSession *self,
153                                      const gchar *tag);
154 
155 /**
156  * Destination
157  */
158 BraseroBurnResult
159 brasero_burn_session_get_output_type (BraseroBurnSession *self,
160                                       BraseroTrackType *output);
161 
162 BraseroDrive *
163 brasero_burn_session_get_burner (BraseroBurnSession *session);
164 
165 void
166 brasero_burn_session_set_burner (BraseroBurnSession *session,
167 				 BraseroDrive *drive);
168 
169 BraseroBurnResult
170 brasero_burn_session_set_image_output_full (BraseroBurnSession *session,
171 					    BraseroImageFormat format,
172 					    const gchar *image,
173 					    const gchar *toc);
174 
175 BraseroBurnResult
176 brasero_burn_session_get_output (BraseroBurnSession *session,
177 				 gchar **image,
178 				 gchar **toc);
179 
180 BraseroBurnResult
181 brasero_burn_session_set_image_output_format (BraseroBurnSession *self,
182 					    BraseroImageFormat format);
183 
184 BraseroImageFormat
185 brasero_burn_session_get_output_format (BraseroBurnSession *session);
186 
187 const gchar *
188 brasero_burn_session_get_label (BraseroBurnSession *session);
189 
190 void
191 brasero_burn_session_set_label (BraseroBurnSession *session,
192 				const gchar *label);
193 
194 BraseroBurnResult
195 brasero_burn_session_set_rate (BraseroBurnSession *session,
196 			       guint64 rate);
197 
198 guint64
199 brasero_burn_session_get_rate (BraseroBurnSession *session);
200 
201 /**
202  * Session flags
203  */
204 
205 void
206 brasero_burn_session_set_flags (BraseroBurnSession *session,
207 			        BraseroBurnFlag flags);
208 
209 void
210 brasero_burn_session_add_flag (BraseroBurnSession *session,
211 			       BraseroBurnFlag flags);
212 
213 void
214 brasero_burn_session_remove_flag (BraseroBurnSession *session,
215 				  BraseroBurnFlag flags);
216 
217 BraseroBurnFlag
218 brasero_burn_session_get_flags (BraseroBurnSession *session);
219 
220 
221 /**
222  * Used to deal with the temporary files (mostly used by plugins)
223  */
224 
225 BraseroBurnResult
226 brasero_burn_session_set_tmpdir (BraseroBurnSession *session,
227 				 const gchar *path);
228 const gchar *
229 brasero_burn_session_get_tmpdir (BraseroBurnSession *session);
230 
231 /**
232  * Test the supported or compulsory flags for a given session
233  */
234 
235 BraseroBurnResult
236 brasero_burn_session_get_burn_flags (BraseroBurnSession *session,
237 				     BraseroBurnFlag *supported,
238 				     BraseroBurnFlag *compulsory);
239 
240 BraseroBurnResult
241 brasero_burn_session_get_blank_flags (BraseroBurnSession *session,
242 				      BraseroBurnFlag *supported,
243 				      BraseroBurnFlag *compulsory);
244 
245 /**
246  * Used to test the possibilities offered for a given session
247  */
248 
249 void
250 brasero_burn_session_set_strict_support (BraseroBurnSession *session,
251                                          gboolean strict_check);
252 
253 gboolean
254 brasero_burn_session_get_strict_support (BraseroBurnSession *session);
255 
256 BraseroBurnResult
257 brasero_burn_session_can_blank (BraseroBurnSession *session);
258 
259 BraseroBurnResult
260 brasero_burn_session_can_burn (BraseroBurnSession *session,
261                                gboolean check_flags);
262 
263 typedef BraseroBurnResult	(* BraseroForeachPluginErrorCb)	(BraseroPluginErrorType type,
264 		                                                 const gchar *detail,
265 		                                                 gpointer user_data);
266 
267 BraseroBurnResult
268 brasero_session_foreach_plugin_error (BraseroBurnSession *session,
269                                       BraseroForeachPluginErrorCb callback,
270                                       gpointer user_data);
271 
272 BraseroBurnResult
273 brasero_burn_session_input_supported (BraseroBurnSession *session,
274 				      BraseroTrackType *input,
275                                       gboolean check_flags);
276 
277 BraseroBurnResult
278 brasero_burn_session_output_supported (BraseroBurnSession *session,
279 				       BraseroTrackType *output);
280 
281 BraseroMedia
282 brasero_burn_session_get_required_media_type (BraseroBurnSession *session);
283 
284 guint
285 brasero_burn_session_get_possible_output_formats (BraseroBurnSession *session,
286 						  BraseroImageFormat *formats);
287 
288 BraseroImageFormat
289 brasero_burn_session_get_default_output_format (BraseroBurnSession *session);
290 
291 
292 G_END_DECLS
293 
294 #endif /* BURN_SESSION_H */
295