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 #ifndef _BURN_VOLUME_SOURCE_H
32 #define _BURN_VOLUME_SOURCE_H
33 
34 #include <glib.h>
35 
36 #include "scsi-device.h"
37 
38 G_BEGIN_DECLS
39 
40 typedef struct _BraseroVolSrc BraseroVolSrc;
41 
42 typedef gboolean (*BraseroVolSrcReadFunc)	(BraseroVolSrc *src,
43 						 gchar *buffer,
44 						 guint size,
45 						 GError **error);
46 typedef gint64	 (*BraseroVolSrcSeekFunc)	(BraseroVolSrc *src,
47 						 guint block,
48 						 gint whence,
49 						 GError **error);
50 struct _BraseroVolSrc {
51 	BraseroVolSrcReadFunc read;
52 	BraseroVolSrcSeekFunc seek;
53 	guint64 position;
54 	gpointer data;
55 	guint data_mode;
56 	guint ref;
57 };
58 
59 #define BRASERO_VOL_SRC_SEEK(vol_MACRO, block_MACRO, whence_MACRO, error_MACRO)	\
60 	vol_MACRO->seek (vol_MACRO, block_MACRO, whence_MACRO, error_MACRO)
61 
62 #define BRASERO_VOL_SRC_READ(vol_MACRO, buffer_MACRO, num_MACRO, error_MACRO)	\
63 	vol_MACRO->read (vol_MACRO, buffer_MACRO, num_MACRO, error_MACRO)
64 
65 
66 BraseroVolSrc *
67 brasero_volume_source_open_device_handle (BraseroDeviceHandle *handle,
68 					  GError **error);
69 BraseroVolSrc *
70 brasero_volume_source_open_file (const gchar *path,
71 				 GError **error);
72 BraseroVolSrc *
73 brasero_volume_source_open_fd (int fd,
74 			       GError **error);
75 
76 void
77 brasero_volume_source_ref (BraseroVolSrc *vol);
78 
79 void
80 brasero_volume_source_close (BraseroVolSrc *src);
81 
82 G_END_DECLS
83 
84 #endif /* BURN_VOLUME_SOURCE_H */
85 
86 
87