New API function burn_drive_get_best_speed()
This commit is contained in:
parent
f7c7e61aa0
commit
374b08090c
@ -1 +1 @@
|
||||
#define Cdrskin_timestamP "2007.07.12.171832"
|
||||
#define Cdrskin_timestamP "2007.07.14.111614"
|
||||
|
@ -1614,6 +1614,49 @@ int burn_drive_get_speedlist(struct burn_drive *d,
|
||||
}
|
||||
|
||||
|
||||
/* ts A70713 : API function */
|
||||
int burn_drive_get_best_speed(struct burn_drive *d, int speed_goal,
|
||||
struct burn_speed_descriptor **best_descr, int flag)
|
||||
{
|
||||
struct burn_speed_descriptor *sd;
|
||||
int best_speed = 0, best_lba = 0, source= 2, speed;
|
||||
|
||||
if (flag & 2)
|
||||
source = -1;
|
||||
|
||||
*best_descr = NULL;
|
||||
for (sd = d->mdata->speed_descriptors; sd != NULL; sd = sd->next) {
|
||||
if ((source >= 0 && sd->source != source) ||
|
||||
sd->write_speed <= 0)
|
||||
continue;
|
||||
if (flag & 1)
|
||||
speed = sd->read_speed;
|
||||
else
|
||||
speed = sd->write_speed;
|
||||
if (speed_goal <= 0) {
|
||||
if ((source == 2 && sd->end_lba > best_lba) ||
|
||||
((source !=2 || sd->end_lba == best_lba) &&
|
||||
speed > best_speed)) {
|
||||
best_lba = sd->end_lba;
|
||||
best_speed = speed;
|
||||
*best_descr = sd;
|
||||
}
|
||||
} else if (speed <= speed_goal) {
|
||||
if (speed > best_speed) {
|
||||
best_speed = speed;
|
||||
*best_descr = sd;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (d->current_is_cd_profile && *best_descr == NULL && ! (flag & 2))
|
||||
/* Mode page 2Ah is deprecated in MMC-5 although all known
|
||||
burners still support it with CD media. */
|
||||
return burn_drive_get_best_speed(d, speed_goal, best_descr,
|
||||
flag | 2);
|
||||
return (*best_descr != NULL);
|
||||
}
|
||||
|
||||
|
||||
/* ts A61226 : API function */
|
||||
int burn_drive_free_speedlist(struct burn_speed_descriptor **speed_list)
|
||||
{
|
||||
|
@ -1555,6 +1555,24 @@ int burn_drive_get_read_speed(struct burn_drive *d);
|
||||
int burn_drive_get_speedlist(struct burn_drive *d,
|
||||
struct burn_speed_descriptor **speed_list);
|
||||
|
||||
/* ts A70713 */
|
||||
/** Look up the fastest speed descriptor which is not faster than the given
|
||||
speed_goal. If it is 0, then the fastest one is chosen among the
|
||||
descriptors with the highest end_lba. Parameter flag decides wether the
|
||||
speed goal means write speed or read speed.
|
||||
@param d Drive to query
|
||||
@param speed_goal Upper limit for speed, 0=search for maximum speed
|
||||
@param best_descr Result of the search, NULL if no match
|
||||
@param flag Bitfield for control purposes
|
||||
bit0= look for best read speed rather than write speed
|
||||
bit1= look for any source type (else look for source==2 first
|
||||
and for any other source type only with CD media)
|
||||
@return >0 indicates a valid best_descr, 0 = no valid best_descr
|
||||
*/
|
||||
int burn_drive_get_best_speed(struct burn_drive *d, int speed_goal,
|
||||
struct burn_speed_descriptor **best_descr, int flag);
|
||||
|
||||
|
||||
/* ts A61226 */
|
||||
/** Dispose a speed descriptor list copy which was obtained by
|
||||
burn_drive_get_speedlist().
|
||||
|
Loading…
Reference in New Issue
Block a user