New API call isoburn_conv_name_chars()
This commit is contained in:
parent
da50c59d27
commit
61244da0bf
@ -393,83 +393,22 @@ int isoburn_adjust_target_iso_head(struct isoburn *o,
|
||||
}
|
||||
|
||||
|
||||
/* @param flag bit0= modifying rather than growing
|
||||
bit1= prepare for early release of input drive:
|
||||
wait until input and then disable image data source
|
||||
/* @param out_o The output isoburn object may be NULL if no real write run is
|
||||
desired with opts.
|
||||
@param flag bit0= modifying rather than growing
|
||||
*/
|
||||
static
|
||||
int isoburn_prepare_disc_aux(struct burn_drive *in_d, struct burn_drive *out_d,
|
||||
struct burn_disc **disc,
|
||||
struct isoburn_imgen_opts *opts, int flag)
|
||||
int isoburn_make_iso_write_opts(struct isoburn *out_o,
|
||||
struct isoburn_imgen_opts *opts,
|
||||
int fifo_chunks,
|
||||
IsoWriteOpts *wopts,
|
||||
int flag)
|
||||
{
|
||||
struct burn_source *wsrc;
|
||||
struct burn_session *session;
|
||||
struct burn_track *track;
|
||||
struct isoburn *in_o, *out_o;
|
||||
IsoWriteOpts *wopts= NULL;
|
||||
enum burn_disc_status state;
|
||||
int ret, fifo_chunks, lba, nwa, i, new_img, early_indev_release, rec_mtime;
|
||||
uint32_t data_start= -1;
|
||||
size_t buffer_size= 0, buffer_free= 0;
|
||||
char *msg= NULL;
|
||||
|
||||
msg= calloc(1, 160);
|
||||
if(msg == NULL)
|
||||
{ret= -1; goto ex;}
|
||||
int ret, rec_mtime, new_img, lba, nwa, i;
|
||||
struct burn_drive *out_d;
|
||||
|
||||
new_img= flag&1;
|
||||
early_indev_release= flag&2;
|
||||
|
||||
ret= isoburn_find_emulator(&in_o, in_d, 0);
|
||||
if(ret<0 || in_o==NULL)
|
||||
{ret= -1; goto ex;}
|
||||
ret= isoburn_find_emulator(&out_o, out_d, 0);
|
||||
if(ret<0 || out_o==NULL)
|
||||
{ret= -1; goto ex;}
|
||||
/* early end will be registered as failure */
|
||||
in_o->wrote_well= out_o->wrote_well= 0;
|
||||
|
||||
if(new_img && early_indev_release) {
|
||||
isoburn_msgs_submit(in_o, 0x00060000,
|
||||
"Programming error: Wrong session setup: new_img && early_indev_release",
|
||||
0, "FATAL", 0);
|
||||
{ret= -4; goto ex;}
|
||||
}
|
||||
|
||||
out_o->do_tao = opts->do_tao;
|
||||
|
||||
state = isoburn_disc_get_status(in_d);
|
||||
if (state != BURN_DISC_BLANK && state != BURN_DISC_APPENDABLE &&
|
||||
state != BURN_DISC_FULL) {
|
||||
isoburn_msgs_submit(in_o, 0x00060000, "Unsuitable source media state",
|
||||
0, "FAILURE", 0);
|
||||
{ret= -2; goto ex;}
|
||||
}
|
||||
state = isoburn_disc_get_status(out_d);
|
||||
if (state != BURN_DISC_BLANK && state != BURN_DISC_APPENDABLE) {
|
||||
isoburn_msgs_submit(out_o, 0x00060000, "Unsuitable target media state",
|
||||
0, "FAILURE", 0);
|
||||
{ret= -2; goto ex;}
|
||||
}
|
||||
if (state != BURN_DISC_BLANK && opts->libjte_handle != NULL) {
|
||||
isoburn_msgs_submit(out_o, 0x00060000,
|
||||
"Jigdo Template Extraction works only on blank target media",
|
||||
0, "FAILURE", 0);
|
||||
{ret= -2; goto ex;}
|
||||
}
|
||||
|
||||
fifo_chunks= 32;
|
||||
if(opts->fifo_size >= 64*1024 && opts->fifo_size <= 1024.0 * 1024.0 * 1024.0){
|
||||
fifo_chunks= opts->fifo_size/2048;
|
||||
if(fifo_chunks*2048 < opts->fifo_size)
|
||||
fifo_chunks++;
|
||||
}
|
||||
|
||||
ret = iso_write_opts_new(&wopts, 0);
|
||||
if (ret < 0) {
|
||||
isoburn_report_iso_error(ret, "Cannot create iso_write_opts", 0, "FATAL",0);
|
||||
goto ex;
|
||||
}
|
||||
iso_write_opts_set_will_cancel(wopts, opts->will_cancel);
|
||||
iso_write_opts_set_iso_level(wopts, opts->level);
|
||||
iso_write_opts_set_rockridge(wopts, opts->rockridge);
|
||||
@ -540,39 +479,42 @@ int isoburn_prepare_disc_aux(struct burn_drive *in_d, struct burn_drive *out_d,
|
||||
iso_write_opts_attach_jte(wopts, opts->libjte_handle);
|
||||
iso_write_opts_set_hfsp_serial_number(wopts, opts->hfsp_serial_number);
|
||||
|
||||
ret= isoburn_adjust_target_iso_head(out_o, opts->partition_offset, 0);
|
||||
if(ret <= 0)
|
||||
{ret= -1; goto ex;}
|
||||
if(out_o->nwa < out_o->zero_nwa)
|
||||
out_o->zero_nwa= 0;
|
||||
if(opts->no_emul_toc || opts->libjte_handle != NULL) {
|
||||
if(out_o->nwa == out_o->zero_nwa &&
|
||||
out_o->zero_nwa == Libisoburn_overwriteable_starT
|
||||
+ opts->partition_offset
|
||||
&& out_o->emulation_mode == 1) {
|
||||
out_o->nwa= 0;
|
||||
if(out_o != NULL) {
|
||||
out_d= out_o->drive;
|
||||
ret= isoburn_adjust_target_iso_head(out_o, opts->partition_offset, 0);
|
||||
if(ret <= 0)
|
||||
{ret= -1; goto ex;}
|
||||
if(out_o->nwa < out_o->zero_nwa)
|
||||
out_o->zero_nwa= 0;
|
||||
out_o->min_start_byte= 0;
|
||||
if(opts->no_emul_toc || opts->libjte_handle != NULL) {
|
||||
if(out_o->nwa == out_o->zero_nwa &&
|
||||
out_o->zero_nwa == Libisoburn_overwriteable_starT
|
||||
+ opts->partition_offset
|
||||
&& out_o->emulation_mode == 1) {
|
||||
out_o->nwa= 0;
|
||||
out_o->zero_nwa= 0;
|
||||
out_o->min_start_byte= 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
ret = isoburn_disc_track_lba_nwa(out_d, NULL, 0, &lba, &nwa);
|
||||
opts->effective_lba= nwa;
|
||||
ret= isoburn_get_msc2(out_o, NULL, &nwa, 0);
|
||||
if (ret != 1) {
|
||||
isoburn_msgs_submit(out_o, 0x00060000,
|
||||
ret = isoburn_disc_track_lba_nwa(out_d, NULL, 0, &lba, &nwa);
|
||||
opts->effective_lba= nwa;
|
||||
ret= isoburn_get_msc2(out_o, NULL, &nwa, 0);
|
||||
if (ret != 1) {
|
||||
isoburn_msgs_submit(out_o, 0x00060000,
|
||||
"Cannot determine next writeable address", 0, "FAILURE", 0);
|
||||
|
||||
/* >>> NWA_V : If burn_next_track_damaged:
|
||||
??? Close track and session ?
|
||||
??? Issue a hint for a repair command ?
|
||||
*/;
|
||||
/* >>> NWA_V : If burn_next_track_damaged:
|
||||
??? Close track and session ?
|
||||
??? Issue a hint for a repair command ?
|
||||
*/;
|
||||
|
||||
{ret= -3; goto ex;}
|
||||
{ret= -3; goto ex;}
|
||||
}
|
||||
iso_write_opts_set_ms_block(wopts, nwa);
|
||||
iso_write_opts_set_appendable(wopts, !new_img);
|
||||
iso_write_opts_set_overwrite_buf(wopts,
|
||||
nwa>0 ? out_o->target_iso_head : NULL);
|
||||
}
|
||||
iso_write_opts_set_ms_block(wopts, nwa);
|
||||
iso_write_opts_set_appendable(wopts, !new_img);
|
||||
iso_write_opts_set_overwrite_buf(wopts,
|
||||
nwa>0 ? out_o->target_iso_head : NULL);
|
||||
iso_write_opts_set_part_offset(wopts, opts->partition_offset,
|
||||
opts->partition_secs_per_head,
|
||||
opts->partition_heads_per_cyl);
|
||||
@ -607,6 +549,93 @@ int isoburn_prepare_disc_aux(struct burn_drive *in_d, struct burn_drive *out_d,
|
||||
}
|
||||
iso_write_opts_set_disc_label(wopts, opts->ascii_disc_label);
|
||||
|
||||
ret= 1;
|
||||
ex:
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
/* @param flag bit0= modifying rather than growing
|
||||
bit1= prepare for early release of input drive:
|
||||
wait until input and then disable image data source
|
||||
*/
|
||||
static
|
||||
int isoburn_prepare_disc_aux(struct burn_drive *in_d, struct burn_drive *out_d,
|
||||
struct burn_disc **disc,
|
||||
struct isoburn_imgen_opts *opts, int flag)
|
||||
{
|
||||
struct burn_source *wsrc;
|
||||
struct burn_session *session;
|
||||
struct burn_track *track;
|
||||
struct isoburn *in_o, *out_o;
|
||||
IsoWriteOpts *wopts= NULL;
|
||||
enum burn_disc_status state;
|
||||
int ret, fifo_chunks, i, new_img, early_indev_release;
|
||||
uint32_t data_start= -1;
|
||||
size_t buffer_size= 0, buffer_free= 0;
|
||||
char *msg= NULL;
|
||||
|
||||
msg= calloc(1, 160);
|
||||
if(msg == NULL)
|
||||
{ret= -1; goto ex;}
|
||||
|
||||
new_img= flag&1;
|
||||
early_indev_release= flag&2;
|
||||
|
||||
ret= isoburn_find_emulator(&in_o, in_d, 0);
|
||||
if(ret<0 || in_o==NULL)
|
||||
{ret= -1; goto ex;}
|
||||
ret= isoburn_find_emulator(&out_o, out_d, 0);
|
||||
if(ret<0 || out_o==NULL)
|
||||
{ret= -1; goto ex;}
|
||||
/* early end will be registered as failure */
|
||||
in_o->wrote_well= out_o->wrote_well= 0;
|
||||
|
||||
if(new_img && early_indev_release) {
|
||||
isoburn_msgs_submit(in_o, 0x00060000,
|
||||
"Programming error: Wrong session setup: new_img && early_indev_release",
|
||||
0, "FATAL", 0);
|
||||
{ret= -4; goto ex;}
|
||||
}
|
||||
|
||||
out_o->do_tao = opts->do_tao;
|
||||
|
||||
state = isoburn_disc_get_status(in_d);
|
||||
if (state != BURN_DISC_BLANK && state != BURN_DISC_APPENDABLE &&
|
||||
state != BURN_DISC_FULL) {
|
||||
isoburn_msgs_submit(in_o, 0x00060000, "Unsuitable source media state",
|
||||
0, "FAILURE", 0);
|
||||
{ret= -2; goto ex;}
|
||||
}
|
||||
state = isoburn_disc_get_status(out_d);
|
||||
if (state != BURN_DISC_BLANK && state != BURN_DISC_APPENDABLE) {
|
||||
isoburn_msgs_submit(out_o, 0x00060000, "Unsuitable target media state",
|
||||
0, "FAILURE", 0);
|
||||
{ret= -2; goto ex;}
|
||||
}
|
||||
if (state != BURN_DISC_BLANK && opts->libjte_handle != NULL) {
|
||||
isoburn_msgs_submit(out_o, 0x00060000,
|
||||
"Jigdo Template Extraction works only on blank target media",
|
||||
0, "FAILURE", 0);
|
||||
{ret= -2; goto ex;}
|
||||
}
|
||||
|
||||
fifo_chunks= 32;
|
||||
if(opts->fifo_size >= 64*1024 && opts->fifo_size <= 1024.0 * 1024.0 * 1024.0){
|
||||
fifo_chunks= opts->fifo_size/2048;
|
||||
if(fifo_chunks*2048 < opts->fifo_size)
|
||||
fifo_chunks++;
|
||||
}
|
||||
|
||||
ret= iso_write_opts_new(&wopts, 0);
|
||||
if (ret < 0) {
|
||||
isoburn_report_iso_error(ret, "Cannot create iso_write_opts", 0, "FATAL",0);
|
||||
goto ex;
|
||||
}
|
||||
ret= isoburn_make_iso_write_opts(out_o, opts, fifo_chunks, wopts, flag & 1);
|
||||
if(ret < 0)
|
||||
goto ex;
|
||||
|
||||
ret = iso_image_create_burn_source(in_o->image, wopts, &wsrc);
|
||||
if (ret < 0) {
|
||||
isoburn_report_iso_error(ret, "Cannot create burn source", 0, "FAILURE", 0);
|
||||
@ -1727,3 +1756,24 @@ int isoburn_igopt_get_write_type(struct isoburn_imgen_opts *opts, int *do_tao)
|
||||
}
|
||||
|
||||
|
||||
int isoburn_conv_name_chars(struct isoburn_imgen_opts *opts,
|
||||
char *name, size_t name_len,
|
||||
char **result, size_t *result_len, int flag)
|
||||
{
|
||||
int ret;
|
||||
IsoWriteOpts *wopts= NULL;
|
||||
|
||||
ret = iso_write_opts_new(&wopts, 0);
|
||||
if (ret < 0) {
|
||||
isoburn_report_iso_error(ret, "Cannot create iso_write_opts", 0, "FATAL",0);
|
||||
goto ex;
|
||||
}
|
||||
ret= isoburn_make_iso_write_opts(NULL, opts, 0, wopts, 0);
|
||||
if(ret < 0)
|
||||
goto ex;
|
||||
ret= iso_conv_name_chars(wopts, name, name_len, result, result_len, flag);
|
||||
ex:;
|
||||
if(wopts != NULL)
|
||||
iso_write_opts_free(wopts);
|
||||
return(ret);
|
||||
}
|
||||
|
@ -1893,6 +1893,46 @@ int isoburn_igopt_set_write_type(struct isoburn_imgen_opts *opts, int do_tao);
|
||||
int isoburn_igopt_get_write_type(struct isoburn_imgen_opts *opts, int *do_tao);
|
||||
|
||||
|
||||
/** Frontend of libisofs call iso_conv_name_chars() controlled by
|
||||
struct isoburn_imgen_opts rather than IsoWriteOpts.
|
||||
See libisofs.h for a more detailed description.
|
||||
@since 1.3.6
|
||||
@param opts
|
||||
Defines options like output charset, UCS-2 versus UTF-16 for Joliet,
|
||||
and naming restrictions.
|
||||
@param name
|
||||
The input text which shall be converted.
|
||||
@param name_len
|
||||
The number of bytes in input text.
|
||||
@param result
|
||||
Will return the conversion result in case of success. Terminated by
|
||||
a trailing zero byte.
|
||||
Use free() to dispose it when no longer needed.
|
||||
@param result_len
|
||||
Will return the number of bytes in result (excluding trailing zero)
|
||||
@param flag
|
||||
Bitfield for control purposes.
|
||||
bit0-bit7= Name space
|
||||
0= generic (to_charset is valid,
|
||||
no reserved characters, no length limits)
|
||||
1= Rock Ridge (to_charset is valid)
|
||||
2= Joliet (to_charset gets overridden by UCS-2 or UTF-16)
|
||||
3= ECMA-119 (to_charset gets overridden by the
|
||||
dull ISO 9660 subset of ASCII)
|
||||
4= HFS+ (to_charset gets overridden by UTF-16BE)
|
||||
bit8= Treat input text as directory name
|
||||
(matters for Joliet and ECMA-119)
|
||||
bit9= Do not issue error messages
|
||||
bit15= Reverse operation (best to be done only with results of
|
||||
previous conversions)
|
||||
@return
|
||||
1 means success, <=0 means error
|
||||
*/
|
||||
int isoburn_conv_name_chars(struct isoburn_imgen_opts *opts,
|
||||
char *name, size_t name_len,
|
||||
char **result, size_t *result_len, int flag);
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* End of Options for image generation */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
@ -3,6 +3,7 @@ global:
|
||||
isoburn_activate_session;
|
||||
isoburn_attach_image;
|
||||
isoburn_attach_start_lba;
|
||||
isoburn_conv_name_chars;
|
||||
isoburn_cancel_prepared_write;
|
||||
isoburn_disc_available_space;
|
||||
isoburn_disc_erasable;
|
||||
|
@ -1 +1 @@
|
||||
#define Xorriso_timestamP "2013.12.18.074401"
|
||||
#define Xorriso_timestamP "2013.12.28.194725"
|
||||
|
Loading…
Reference in New Issue
Block a user