New API call burn_disc_get_bd_spare_info()

This commit is contained in:
Thomas Schmitt 2010-09-24 09:07:05 +00:00
parent 38c029d5e3
commit f14b66a09b
6 changed files with 75 additions and 4 deletions

View File

@ -1,3 +1,9 @@
SVN trunk (to become libburn-0.8.8.pl00.tar.gz)
===============================================================================
* New API call burn_offst_source_new()
* New API call burn_disc_get_bd_spare_info()
libburn-0.8.6.pl00.tar.gz Fri Sep 17 2010 libburn-0.8.6.pl00.tar.gz Fri Sep 17 2010
=============================================================================== ===============================================================================
* Lifted test reservation on DVD-R DL media. * Lifted test reservation on DVD-R DL media.

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2010.09.22.180921" #define Cdrskin_timestamP "2010.09.24.090631"

View File

@ -2836,3 +2836,18 @@ int burn_disc_get_cd_info(struct burn_drive *d, char disc_type[80],
*valid = d->disc_info_valid; *valid = d->disc_info_valid;
return 1; return 1;
} }
/* ts B00924 : API */
int burn_disc_get_bd_spare_info(struct burn_drive *d,
int *alloc_blocks, int *free_blocks, int flag)
{
int ret;
if (burn_drive_get_drive_role(d) != 1)
return 0;
*alloc_blocks = *free_blocks = 0;
ret = mmc_get_bd_spare_info(d, alloc_blocks, free_blocks, 0);
return ret;
}

View File

@ -1237,12 +1237,29 @@ char *burn_guess_cd_manufacturer(int m_li, int s_li, int f_li,
bit5= Disc is nominally erasable (Erasable bit) bit5= Disc is nominally erasable (Erasable bit)
This will be set with overwriteable media which This will be set with overwriteable media which
libburn normally considers to be unerasable blank. libburn normally considers to be unerasable blank.
@return 1 success, <= 0 an error occured
@since 0.7.2 @since 0.7.2
*/ */
int burn_disc_get_cd_info(struct burn_drive *d, char disc_type[80], int burn_disc_get_cd_info(struct burn_drive *d, char disc_type[80],
unsigned int *disc_id, char bar_code[9], int *app_code, unsigned int *disc_id, char bar_code[9], int *app_code,
int *valid); int *valid);
/* ts B00924 */
/** Read the current usage of the eventual BD Spare Area. This area gets
reserved on BD media during formatting. During writing it is used to
host replacements of blocks which failed the checkread immediately after
writing.
This call applies only to recordable BD media. I.e. profiles 0x41 to 0x43.
@param d The drive to query.
@param alloc_blocks Returns the number of blocks reserved as Spare Area
@param free_blocks Returns the number of yet unused blocks in that area
@param flag Bitfield for control purposes (unused yet, submit 0)
@return 1 = reply prarameters are valid,
<=0 = reply is invalid (e.g. because no BD profile)
@since 0.8.8
*/
int burn_disc_get_bd_spare_info(struct burn_drive *d,
int *alloc_blocks, int *free_blocks, int flag);
/* ts A61110 */ /* ts A61110 */
/** Read start lba and Next Writeable Address of a track from media. /** Read start lba and Next Writeable Address of a track from media.
@ -1907,7 +1924,8 @@ struct burn_source *burn_fd_source_new(int datafd, int subfd, off_t size);
has ended its work. Best is to keep them all until all tracks has ended its work. Best is to keep them all until all tracks
are done. are done.
@param inp The burn_source object from which to read stream data @param inp The burn_source object from which to read stream data.
E.g. created by burn_file_source_new().
@param prev The eventual offset source object which shall read data from @param prev The eventual offset source object which shall read data from
inp before the new offset source will begin its own work. inp before the new offset source will begin its own work.
This must either be a result of burn_offst_source_new() or This must either be a result of burn_offst_source_new() or
@ -1916,7 +1934,8 @@ struct burn_source *burn_fd_source_new(int datafd, int subfd, off_t size);
consumer. inp bytes may get skipped to reach this address. consumer. inp bytes may get skipped to reach this address.
@param size The number of bytes to be delivered to the consumer. @param size The number of bytes to be delivered to the consumer.
@param flag Bitfield for control purposes (unused yet, submit 0). @param flag Bitfield for control purposes (unused yet, submit 0).
@return Pointer to a burn_source object, NULL indicates failure @return Pointer to a burn_source object, later to be freed by
burn_source_free(). NULL indicates failure.
@since 0.8.8 @since 0.8.8
*/ */
struct burn_source *burn_offst_source_new( struct burn_source *burn_offst_source_new(

View File

@ -3876,6 +3876,11 @@ int mmc_compose_mode_page_5(struct burn_drive *d,
pd[4] = spc_block_type(o->block_type); pd[4] = spc_block_type(o->block_type);
/*
fprintf(stderr, "libburn_EXPERIMENTAL: block_type = %d, pd[4]= %u\n",
o->block_type, (unsigned int) pd[4]);
*/
/* ts A61104 */ /* ts A61104 */
if(!(o->control&4)) /* audio (MMC-1 table 61) */ if(!(o->control&4)) /* audio (MMC-1 table 61) */
if(o->write_type == BURN_WRITE_TAO) if(o->write_type == BURN_WRITE_TAO)
@ -4127,7 +4132,7 @@ static int mmc_set_product_id(char *reply,
/* ts A90903 */ /* ts A90903 */
/* MMC backend of API call burn_get_media_product_id() /* MMC backend of API call burn_disc_get_media_id()
See also doc/mediainfo.txt See also doc/mediainfo.txt
@param flag Bitfield for control purposes @param flag Bitfield for control purposes
bit0= do not escape " _/" (not suitable for bit0= do not escape " _/" (not suitable for
@ -4314,6 +4319,29 @@ ex:;
} }
/* ts B00924
MMC-5, 6.23.3.3.4 Format Code 0Ah: Spare Area Information
*/
int mmc_get_bd_spare_info(struct burn_drive *d,
int *alloc_blocks, int *free_blocks, int flag)
{
int ret, reply_len;
char *reply = NULL;
ret = mmc_read_disc_structure(d, 1, 0, 0x0a, 12, &reply,
&reply_len, 0);
if (ret <= 0)
goto ex;
*alloc_blocks = mmc_four_char_to_int((unsigned char *) reply + 8);
*free_blocks = mmc_four_char_to_int((unsigned char *) reply + 4);
ret = 1;
ex:;
if (reply != NULL)
free(reply);
return ret;
}
/* ts A61021 : the mmc specific part of sg.c:enumerate_common() /* ts A61021 : the mmc specific part of sg.c:enumerate_common()
*/ */
int mmc_setup_drive(struct burn_drive *d) int mmc_setup_drive(struct burn_drive *d)

View File

@ -106,5 +106,8 @@ int mmc_function_spy(struct burn_drive *d, char * text);
/* ts A91118 */ /* ts A91118 */
int mmc_start_if_needed(struct burn_drive *d, int flag); int mmc_start_if_needed(struct burn_drive *d, int flag);
/* ts B00924 */
int mmc_get_bd_spare_info(struct burn_drive *d,
int *alloc_blocks, int *free_blocks, int flag);
#endif /*__MMC*/ #endif /*__MMC*/