New API call isoburn_set_msc1()
This commit is contained in:
parent
6295344557
commit
e74c268e4b
@ -332,6 +332,7 @@ static int isoburn_welcome_media(struct isoburn **o, struct burn_drive *d,
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
ret= 1;
|
||||
ex:
|
||||
if(caps!=NULL)
|
||||
@ -1387,3 +1388,124 @@ void isoburn_toc_disc_free(struct isoburn_toc_disc *d)
|
||||
free((char *) d);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_get_track_lba(struct isoburn_toc_track *track, int *lba, int flag)
|
||||
{
|
||||
struct burn_toc_entry entry;
|
||||
|
||||
isoburn_toc_track_get_entry(track, &entry);
|
||||
if (entry.extensions_valid & 1)
|
||||
*lba= entry.start_lba;
|
||||
else
|
||||
*lba= burn_msf_to_lba(entry.pmin, entry.psec, entry.pframe);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
int isoburn_set_msc1(struct burn_drive *d, int adr_mode, char *adr_value,
|
||||
int flag)
|
||||
{
|
||||
int ret, num_sessions, num_tracks, adr_num, i, j, total_tracks;
|
||||
int lba, best_lba, size;
|
||||
char volid[33], msg[160];
|
||||
struct isoburn *o;
|
||||
struct isoburn_toc_disc *disc= NULL;
|
||||
struct isoburn_toc_session **sessions;
|
||||
struct isoburn_toc_track **tracks;
|
||||
static char mode_names[][20]= {"auto", "session", "track", "lba", "volid"};
|
||||
static int max_mode_names= 4;
|
||||
|
||||
ret= isoburn_find_emulator(&o, d, 0);
|
||||
if(ret<0)
|
||||
return(-1);
|
||||
if(o==NULL)
|
||||
return(-1);
|
||||
|
||||
adr_num= atoi(adr_value);
|
||||
if(adr_mode!=3) {
|
||||
disc= isoburn_toc_drive_get_disc(d);
|
||||
if(disc==NULL) {
|
||||
not_found:;
|
||||
if(adr_mode<0 || adr_mode>max_mode_names)
|
||||
goto unknown_mode;
|
||||
sprintf(msg, "Failed to find %s %s", mode_names[adr_mode],
|
||||
strlen(adr_value)<=80 ? adr_value : "-oversized-string-");
|
||||
burn_msgs_submit(0x00060000, msg, 0, "FAILURE", NULL);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
sessions= isoburn_toc_disc_get_sessions(disc, &num_sessions);
|
||||
if(sessions==NULL || num_sessions<=0)
|
||||
goto not_found;
|
||||
}
|
||||
if(adr_mode==0) {
|
||||
/* Set fabricated_msc1 to last session in TOC */
|
||||
tracks= isoburn_toc_session_get_tracks(sessions[num_sessions-1],
|
||||
&num_tracks);
|
||||
if(tracks==NULL || num_tracks<=0)
|
||||
goto not_found;
|
||||
isoburn_get_track_lba(tracks[0], &(o->fabricated_msc1), 0);
|
||||
|
||||
} else if(adr_mode==1) {
|
||||
/* Use adr_num as session index (first session is 1, not 0) */
|
||||
if(adr_num<1 || adr_num>num_sessions)
|
||||
goto not_found;
|
||||
tracks= isoburn_toc_session_get_tracks(sessions[adr_num-1], &num_tracks);
|
||||
if(tracks==NULL || num_tracks<=0)
|
||||
goto not_found;
|
||||
isoburn_get_track_lba(tracks[0], &(o->fabricated_msc1), 0);
|
||||
|
||||
} else if(adr_mode==2) {
|
||||
/* use adr_num as track index */
|
||||
total_tracks= 0;
|
||||
for(i=0; i<num_sessions; i++) {
|
||||
tracks= isoburn_toc_session_get_tracks(sessions[i], &num_tracks);
|
||||
if(tracks==NULL)
|
||||
continue;
|
||||
for(j= 0; j<num_tracks; j++) {
|
||||
total_tracks++;
|
||||
if(total_tracks==adr_num) {
|
||||
isoburn_get_track_lba(tracks[j], &(o->fabricated_msc1), 0);
|
||||
ret= 1; goto ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
goto not_found;
|
||||
|
||||
} else if(adr_mode==3) {
|
||||
o->fabricated_msc1= adr_num;
|
||||
|
||||
} else if(adr_mode==4) {
|
||||
/* search for volume id that is equal to adr_value */
|
||||
best_lba= -1;
|
||||
for(i=0; i<num_sessions; i++) {
|
||||
tracks= isoburn_toc_session_get_tracks(sessions[i], &num_tracks);
|
||||
if(tracks==NULL)
|
||||
continue;
|
||||
for(j= 0; j<num_tracks; j++) {
|
||||
isoburn_get_track_lba(tracks[0], &lba, 0);
|
||||
ret= isoburn_read_iso_head(d, lba, &size, volid, 1);
|
||||
if(ret<=0)
|
||||
continue;
|
||||
if(strcmp(volid, adr_value)!=0)
|
||||
continue;
|
||||
best_lba= lba;
|
||||
}
|
||||
}
|
||||
if(best_lba<0)
|
||||
goto not_found;
|
||||
o->fabricated_msc1= best_lba;
|
||||
|
||||
} else {
|
||||
unknown_mode:;
|
||||
sprintf(msg, "Program error: Unknown msc1 address mode %d", adr_mode);
|
||||
burn_msgs_submit(0x00060000, msg, 0, "FATAL", NULL);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
ret= 1;
|
||||
ex:;
|
||||
if(disc!=NULL)
|
||||
isoburn_toc_disc_free(disc);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
|
@ -385,6 +385,29 @@ int isoburn_disc_erasable(struct burn_drive *d);
|
||||
void isoburn_disc_erase(struct burn_drive *drive, int fast);
|
||||
|
||||
|
||||
/** Program isoburn_disc_get_msc1() to return a fabricated value.
|
||||
This makes only sense between aquiring the drive and reading the
|
||||
image. After isoburn_read_image() it will confuse the coordination
|
||||
of libisoburn and libisofs.
|
||||
Note: Sessions and tracks are counted beginning with 1, not with 0.
|
||||
@since 0.1.6
|
||||
@param drive The drive where msc1 is to be set
|
||||
@param adr_mode Determines how to interpret adr_value and to set msc1.
|
||||
If adr_value shall represent a number then decimal ASCII
|
||||
digits are expected.
|
||||
0= start lba of last session in TOC, ignore adr_value
|
||||
1= start lba of session number given by adr_value
|
||||
2= start lba of track given number by adr_value
|
||||
3= adr_value itself is the lba to be used
|
||||
4= start lba of last session with volume id
|
||||
given by adr_value
|
||||
@parm adr_value A string describing the value to be eventually used.
|
||||
@param flag Bitfield for control purposes. Unused yet. Submit 0.
|
||||
*/
|
||||
int isoburn_set_msc1(struct burn_drive *d, int adr_mode, char *adr_value,
|
||||
int flag);
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*
|
||||
|
||||
|
@ -1 +1 @@
|
||||
#define Xorriso_timestamP "2008.05.12.080812"
|
||||
#define Xorriso_timestamP "2008.05.12.081331"
|
||||
|
Loading…
Reference in New Issue
Block a user