New API call burn_disc_get_phys_format_info()

This commit is contained in:
Thomas Schmitt 2011-08-01 12:54:24 +00:00
parent 62944e3b21
commit 2e20a4f888
5 changed files with 89 additions and 1 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2011.07.31.083046"
#define Cdrskin_timestamP "2011.08.01.125405"

View File

@ -3226,6 +3226,23 @@ int burn_disc_get_bd_spare_info(struct burn_drive *d,
}
/* ts B10801 : API */
int burn_disc_get_phys_format_info(struct burn_drive *d, int *disk_category,
char **book_name, int *part_version, int *num_layers,
int *num_blocks, int flag)
{
int ret;
if (burn_drive_get_drive_role(d) != 1)
return 0;
*disk_category = *part_version = *num_layers = *num_blocks = 0;
ret = mmc_get_phys_format_info(d, disk_category, book_name,
part_version, num_layers, num_blocks, 0);
return ret;
}
/* ts B10525 : API */
int burn_disc_next_track_is_damaged(struct burn_drive *d, int flag)
{

View File

@ -1294,6 +1294,27 @@ int burn_disc_get_cd_info(struct burn_drive *d, char disc_type[80],
int burn_disc_get_bd_spare_info(struct burn_drive *d,
int *alloc_blocks, int *free_blocks, int flag);
/* ts B10801 */
/** Retrieve some media information which is mainly specific to media of
the DVD-R family: DVD-R , DVD-RW , DVD-R DL , HD DVD-R
Currently the information cannot be retrieved from other media types.
@param d The drive to query.
@param disk_category returns DVD Book to which the media complies
@param book_name returns a pointer to the book name of disk_category.
This memory is static. Do not alter or free it !
@param part_version returns the Media Version in the DVD Book
@param num_layers returns the number of media layers
@param num_blocks returns the number of blocks between pysical start
and physical end of the media
@param flag Bitfield for control purposes (unused yet, submit 0)
@return 1 = reply prarameters are valid,
<=0 = reply is invalid (e.g. because no DVD-R)
@since 1.1.2
*/
int burn_disc_get_phys_format_info(struct burn_drive *d, int *disk_category,
char **book_name, int *part_version, int *num_layers,
int *num_blocks, int flag);
/* ts A61110 */
/** Read start lba and Next Writeable Address of a track from media.
Usually a track lba is obtained from the result of burn_track_get_entry().

View File

@ -20,6 +20,7 @@ burn_disc_get_formats;
burn_disc_get_media_id;
burn_disc_get_msc1;
burn_disc_get_multi_caps;
burn_disc_get_phys_format_info;
burn_disc_get_profile;
burn_disc_get_sectors;
burn_disc_get_sessions;

View File

@ -4494,6 +4494,55 @@ ex:;
}
/* ts B10801
MMC-5, 6.23.3.2.1 Format Code 00h: Physical Format Information
6.23.3.2.16 Format Code 10h: Format Information of
Control Data Zone in the Lead-in
disk_category
*/
int mmc_get_phys_format_info(struct burn_drive *d, int *disk_category,
char **book_name, int *part_version, int *num_layers,
int *num_blocks, int flag)
{
int ret, reply_len, prf;
char *reply = NULL;
static char book_names[][16] = {
"DVD-ROM", "DVD-RAM", "DVD-R", "DVD-RW",
"HD DVD-ROM", "HD DVD-RAM", "HD DVD-R", "unknown",
"unknown", "DVD+RW", "DVD+R", "unknown", "unknown",
"unknown", "DVD+RW DL", "DVD+R DL", "unknown"
};
prf = d->current_profile;
if (!(prf == 0x11 || prf == 0x13 || prf == 0x14 || prf == 0x15 ||
prf == 0x51))
return 0; /* Not a [HD] DVD-R[W] loaded */
ret = mmc_read_disc_structure(d, 0, 0, 0x10, 12, &reply,
&reply_len, 0);
if (ret <= 0)
goto ex;
if(reply_len < 12) {
libdax_msgs_submit(libdax_messenger, -1, 0x00000002,
LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO,
"READ DISC STRUCTURE format 10h: Less than 12 bytes",
0, 0);
{ret = 0; goto ex;}
}
*disk_category = (reply[0] >> 4) & 0xf;
*book_name = book_names[*disk_category];
*part_version = reply[0] & 0xf;
*num_layers = ((reply[2] >> 5) & 0x3) + 1;
*num_blocks = ((reply[9] << 16) | (reply[10] << 8) | reply[11]) -
((reply[5] << 16) | (reply[6] << 8) | reply[7]) + 1;
ret = 1;
ex:;
if (reply != NULL)
free(reply);
return ret;
}
/* ts A61021 : the mmc specific part of sg.c:enumerate_common()
*/
int mmc_setup_drive(struct burn_drive *d)