Pacifier for isoburn_read_image()
This commit is contained in:
@ -100,6 +100,12 @@ IsoImage *isoburn_get_attached_image(struct burn_drive *d)
|
||||
}
|
||||
|
||||
|
||||
static void isoburn_idle_free_function(void *ignored)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* API function. See libisoburn.h
|
||||
*/
|
||||
int isoburn_read_image(struct burn_drive *d,
|
||||
@ -195,7 +201,14 @@ int isoburn_read_image(struct burn_drive *d,
|
||||
iso_read_opts_set_default_gid(ropts, read_opts->gid);
|
||||
iso_read_opts_set_input_charset(ropts, read_opts->input_charset);
|
||||
ds = isoburn_data_source_new(d);
|
||||
iso_image_attach_data(o->image, o->read_pacifier_handle,
|
||||
isoburn_idle_free_function);
|
||||
if(o->read_pacifier_handle==NULL)
|
||||
iso_tree_set_report_callback(o->image, NULL);
|
||||
else
|
||||
iso_tree_set_report_callback(o->image, o->read_pacifier);
|
||||
ret = iso_image_import(o->image, ds, ropts, &features);
|
||||
iso_tree_set_report_callback(o->image, NULL);
|
||||
iso_read_opts_free(ropts);
|
||||
iso_data_source_unref(ds);
|
||||
if (ret < 0) {
|
||||
@ -203,12 +216,10 @@ int isoburn_read_image(struct burn_drive *d,
|
||||
return ret;
|
||||
}
|
||||
/* Important: do not return until free(features) */
|
||||
|
||||
if (image!=NULL) {
|
||||
*image = o->image;
|
||||
iso_image_ref(*image); /*protects object from premature free*/
|
||||
}
|
||||
|
||||
read_opts->hasRR = iso_read_image_features_has_rockridge(features);
|
||||
read_opts->hasJoliet = iso_read_image_features_has_joliet(features);
|
||||
read_opts->hasIso1999 = iso_read_image_features_has_iso1999(features);
|
||||
@ -368,3 +379,20 @@ int isoburn_invalidate_iso(struct isoburn *o, int flag)
|
||||
return isoburn_activate_session(o->drive);
|
||||
}
|
||||
|
||||
|
||||
/* API @since 0.1.0 */
|
||||
int isoburn_set_read_pacifier(struct burn_drive *drive,
|
||||
int (*read_pacifier)(IsoImage*, IsoFileSource*),
|
||||
void *read_handle)
|
||||
{
|
||||
int ret;
|
||||
struct isoburn *o;
|
||||
|
||||
ret = isoburn_find_emulator(&o, drive, 0);
|
||||
if(ret < 0 || o == NULL)
|
||||
return -1;
|
||||
o->read_pacifier_handle= read_handle;
|
||||
o->read_pacifier= read_pacifier;
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user