1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 /*
3  * Libbrasero-media
4  * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app@wanadoo.fr>
5  *
6  * Libbrasero-media 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-media authors hereby grant permission for non-GPL compatible
12  * GStreamer plugins to be used and distributed together with GStreamer
13  * and Libbrasero-media. This permission is above and beyond the permissions granted
14  * by the GPL license by which Libbrasero-media 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-media 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 #include <glib.h>
32 
33 #ifndef BURN_VOLUME_H
34 #define BURN_VOLUME_H
35 
36 G_BEGIN_DECLS
37 
38 #include "burn-volume-source.h"
39 
40 struct _BraseroVolDesc {
41 	guchar type;
42 	gchar id			[5];
43 	guchar version;
44 };
45 typedef struct _BraseroVolDesc BraseroVolDesc;
46 
47 struct _BraseroVolFileExtent {
48 	guint block;
49 	guint size;
50 };
51 typedef struct _BraseroVolFileExtent BraseroVolFileExtent;
52 
53 typedef struct _BraseroVolFile BraseroVolFile;
54 struct _BraseroVolFile {
55 	BraseroVolFile *parent;
56 
57 	gchar *name;
58 	gchar *rr_name;
59 
60 	union {
61 
62 	struct {
63 		GSList *extents;
64 		guint64 size_bytes;
65 	} file;
66 
67 	struct {
68 		GList *children;
69 		guint address;
70 	} dir;
71 
72 	} specific;
73 
74 	guint isdir:1;
75 	guint isdir_loaded:1;
76 
77 	/* mainly used internally */
78 	guint has_RR:1;
79 	guint relocated:1;
80 };
81 
82 gboolean
83 brasero_volume_is_valid (BraseroVolSrc *src,
84 			 GError **error);
85 
86 gboolean
87 brasero_volume_get_size (BraseroVolSrc *src,
88 			 gint64 block,
89 			 gint64 *nb_blocks,
90 			 GError **error);
91 
92 BraseroVolFile *
93 brasero_volume_get_files (BraseroVolSrc *src,
94 			  gint64 block,
95 			  gchar **label,
96 			  gint64 *nb_blocks,
97 			  gint64 *data_blocks,
98 			  GError **error);
99 
100 BraseroVolFile *
101 brasero_volume_get_file (BraseroVolSrc *src,
102 			 const gchar *path,
103 			 gint64 volume_start_block,
104 			 GError **error);
105 
106 GList *
107 brasero_volume_load_directory_contents (BraseroVolSrc *vol,
108 					gint64 session_block,
109 					gint64 block,
110 					GError **error);
111 
112 
113 #define BRASERO_VOLUME_FILE_NAME(file)			((file)->rr_name?(file)->rr_name:(file)->name)
114 #define BRASERO_VOLUME_FILE_SIZE(file)			((file)->isdir?0:(file)->specific.file.size_bytes)
115 
116 void
117 brasero_volume_file_free (BraseroVolFile *file);
118 
119 gchar *
120 brasero_volume_file_to_path (BraseroVolFile *file);
121 
122 BraseroVolFile *
123 brasero_volume_file_from_path (const gchar *ptr,
124 			       BraseroVolFile *parent);
125 
126 gint64
127 brasero_volume_file_size (BraseroVolFile *file);
128 
129 BraseroVolFile *
130 brasero_volume_file_merge (BraseroVolFile *file1,
131 			   BraseroVolFile *file2);
132 
133 G_END_DECLS
134 
135 #endif /* BURN_VOLUME_H */
136