Beispiel #1
0
/**
 * Construct an isofs image from an existing sector source.
 */
IsoImage *iso_image_new_from_source( sector_source_t source, cdrom_lba_t start, ERROR *err )
{
    IsoImage *iso = NULL;
    IsoReadOpts *opts;
    IsoDataSource *src;

    int status = iso_image_new(NULL, &iso);
    if( status != 1 )
        return NULL;

    status = iso_read_opts_new(&opts,0);
    if( status != 1 ) {
        iso_image_unref( iso );
        return NULL;
    }

    iso_read_opts_set_start_block(opts, start);
    src = iso_data_source_new(source);
    status = iso_image_import(iso, src, opts, NULL);
    iso_data_source_unref(src);
    iso_read_opts_free(opts);
    if( status != 1 ) {
        iso_image_unref(iso);
        return NULL;
    }
    return iso;
}
Beispiel #2
0
IsoImageFilesystem *iso_filesystem_new_from_source( sector_source_t source, cdrom_lba_t start, ERROR *err )
{
    IsoImageFilesystem *iso = NULL;
    IsoReadOpts *opts;
    IsoDataSource *src;

    int status = iso_read_opts_new(&opts,0);
    if( status != 1 ) {
        iso_error_convert(status, err);
        return NULL;
    }

    iso_read_opts_set_start_block(opts, start);
    src = iso_data_source_new(source);
    status = iso_image_filesystem_new(src, opts, 0x1FFFFF, &iso);
    iso_data_source_unref(src);
    iso_read_opts_free(opts);
    if( status != 1 ) {
        iso_error_convert(status, err);
        return NULL;
    }
    return iso;

}
Beispiel #3
0
GtkTreeStore * read_cd ( char *dev,int block )
{
	TrackData *cd_data=main_app->cd_data;
	int result;
	IsoImageFilesystem *fs;
	IsoDataSource *src;
	IsoFileSource *root;
	IsoReadOpts *ropts;


	iso_init();
	iso_set_msgs_severities ( "NEVER", "ALL", "" );

	result = iso_data_source_new_from_file ( dev, &src );
	if ( result < 0 )
	{
		printf ( "Error creating data source\n" );
		show_error("Error creating data source ");
		return NULL;
	}

	result = iso_read_opts_new ( &ropts, 0 );



	iso_read_opts_set_start_block ( ropts,cd_data[ block].track_start );

	if ( result < 0 )
	{
		fprintf ( stderr, "Error creating read options\n" );
		show_error("Error creating read options ");
		return NULL;
	}
	result = iso_image_filesystem_new ( src, ropts, 1, &fs );
	iso_read_opts_free ( ropts );
	if ( result < 0 )
	{
		printf ( "Error creating filesystem\n" );
		show_error("Error creating filesystem");
		return NULL;
	}
	GtkListStore  *store;
	GtkTreeIter    iter;
	GString *string=g_string_new("");
	store = gtk_list_store_new ( 2, G_TYPE_STRING ,G_TYPE_STRING );


	g_string_printf(string,"%ld * 2kB",cd_data[ block].track_start);
	gtk_list_store_append ( store, &iter );
	gtk_list_store_set ( store, &iter, 0, "Track Start",1,string->str,-1 );

	g_string_printf(string,"%ld * 2kB",cd_data[ block].track_end);
	gtk_list_store_append ( store, &iter );
	gtk_list_store_set ( store, &iter, 0, "Track End",1,string->str,-1 );

	g_string_printf(string,"%ld * 2kB",cd_data[ block].track_size);
	gtk_list_store_append ( store, &iter );
	gtk_list_store_set ( store, &iter, 0, "Track Size",1,string->str,-1 );

	gtk_list_store_append ( store, &iter );
	gtk_list_store_set ( store, &iter, 0, "Vol. id: ",1,iso_image_fs_get_volume_id ( fs ),-1 );
	gtk_list_store_append ( store, &iter );
	gtk_list_store_set ( store, &iter, 0, "Publisher ",1,iso_image_fs_get_publisher_id ( fs ),-1 );
	gtk_list_store_append ( store, &iter );
	gtk_list_store_set ( store, &iter, 0, "Data preparer ",1,iso_image_fs_get_data_preparer_id ( fs ),-1 );
	gtk_list_store_append ( store, &iter );
	gtk_list_store_set ( store, &iter, 0, "System ",1,iso_image_fs_get_system_id ( fs ),-1 );
	gtk_list_store_append ( store, &iter );
	gtk_list_store_set ( store, &iter, 0, "Application ",1,iso_image_fs_get_application_id ( fs ),-1 );
	gtk_list_store_append ( store, &iter );
	gtk_list_store_set ( store, &iter, 0, "Copyright ",1,iso_image_fs_get_copyright_file_id ( fs ),-1 );
	gtk_list_store_append ( store, &iter );
	gtk_list_store_set ( store, &iter, 0, "Abstract ",1,iso_image_fs_get_abstract_file_id ( fs ),-1 );
	gtk_list_store_append ( store, &iter );
	gtk_list_store_set ( store, &iter, 0, "Biblio ",1,iso_image_fs_get_biblio_file_id ( fs ),-1 );
	cd_data[ block].track_info=store;


	result = fs->get_root ( fs, &root );
	if ( result < 0 )
	{
		printf ( "Can't get root %d\n", result );
		show_error("Can't get root ");
		return NULL;
	}
	GtkTreeIter root_iter;
	GtkTreeStore * tree_store  ;
	tree_store  = gtk_tree_store_new ( 1,G_TYPE_STRING );
	root_iter.stamp=0;

	create_tree ( root, tree_store,root_iter );
	iso_file_source_unref ( root );

	fs->close ( fs );
	iso_filesystem_unref ( ( IsoFilesystem* ) fs );
	iso_data_source_unref ( src );
	iso_finish();
	return tree_store;
}