New inner function isoburn_set_start_byte()

This commit is contained in:
Thomas Schmitt 2007-09-11 17:44:25 +00:00
parent b2d6b39b72
commit 77e1d4042a
2 changed files with 52 additions and 23 deletions

View File

@ -259,10 +259,11 @@ int isoburn_disc_get_msc1(struct burn_drive *d, int *start_lba)
ret= isoburn_find_emulator(&o, d, 0);
if(ret<0)
return(0);
if(ret==0)
return(burn_disc_get_msc1(d, start_lba));
*start_lba= 0;
return(1);
if(ret>0) if(o->emulation_mode>0) {
*start_lba= 0;
return(1);
}
return(burn_disc_get_msc1(d, start_lba));
}
@ -276,11 +277,12 @@ int isoburn_disc_track_lba_nwa(struct burn_drive *d,
ret= isoburn_find_emulator(&o, d, 0);
if(ret<0)
return(0);
if(ret==0)
return(burn_disc_track_lba_nwa(d, opts, trackno, lba, nwa));
*lba= 0;
*nwa= o->nwa;
return(1);
if(ret>0) if(o->emulation_mode>0) {
*lba= 0;
*nwa= o->nwa;
return(1);
}
return(burn_disc_track_lba_nwa(d, opts, trackno, lba, nwa));
}
@ -343,29 +345,44 @@ int isoburn_needs_emulation(struct burn_drive *drive)
}
int isoburn_set_start_byte(struct isoburn *o, off_t value, int flag)
{
int ret;
struct burn_drive *drive = o->drive;
struct burn_multi_caps *caps= NULL;
ret= burn_disc_get_multi_caps(drive, BURN_WRITE_NONE, &caps, 0);
if(ret<=0)
goto ex;
if(!caps->start_adr)
{ret= 0; goto ex;}
o->min_start_byte= value;
if(value % caps->start_alignment)
value+= caps->start_alignment - (value % caps->start_alignment);
o->nwa= value/2048;
ret= 1;
ex:
if(caps!=NULL)
burn_disc_free_multi_caps(&caps);
return(ret);
}
void isoburn_write_opts_set_start_byte(struct burn_write_opts *opts,
off_t value)
{
int ret;
struct isoburn *o;
struct burn_drive *drive;
struct burn_multi_caps *caps= NULL;
drive= burn_write_opts_get_drive(opts);
ret= isoburn_find_emulator(&o, drive, 0);
if(ret<=0) /* no emulation, no burn_write_opts_set_start_byte() */
goto ex;
ret= burn_disc_get_multi_caps(drive, BURN_WRITE_NONE, &caps, 0);
return;
ret = isoburn_set_start_byte(o, value, 0);
if(ret<=0)
goto ex;
o->min_start_byte= value;
if(value % caps->start_alignment)
value+= caps->start_alignment - (value % caps->start_alignment);
o->nwa= value/2048;
burn_write_opts_set_start_byte(opts, value);
ex:
if(caps!=NULL)
burn_disc_free_multi_caps(&caps);
return;
burn_write_opts_set_start_byte(opts, ((off_t) o->nwa) * (off_t) 2048);
}

View File

@ -101,8 +101,8 @@ int isoburn_invalidate_iso(struct isoburn *o, int flag);
/* Calls from isofs_wrap.c into burn_wrap.c */
/** Get an eventual isoburn object which is wrapped around the drive.
@param pt Eventually contains a pointer to the found object.
Is allowed to contain NULL if return value is -1 or 0.
@param pt Eventually returns a pointer to the found object.
It is allowed to become NULL if return value is -1 or 0.
In this case, the drive is a genuine libburn drive
with no emulation activated by isoburn.
@param drive The drive to be searched for
@ -112,5 +112,17 @@ int isoburn_invalidate_iso(struct isoburn *o, int flag);
int isoburn_find_emulator(struct isoburn **pt,
struct burn_drive *drive, int flag);
/** Set the start address for an emulated add-on session. The value will
be rounded up to the alignment necessary for the media. The aligned
value will be divided by 2048 and then put into o->nwa .
@param o The isoburn object to be programmed.
@param value The start address in bytes
@param flag unused yet
@return <=0 is failure , >0 success
*/
int isoburn_set_start_byte(struct isoburn *o, off_t value, int flag);
#endif /* Isoburn_includeD */