From 6dc9ecbcad0d4da98351d2052e24f04692ae93e8 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sat, 9 Aug 2008 07:18:53 +0000 Subject: [PATCH] CD burn_toc_entries now bear extension_valid data --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/mmc.c | 6 ++++- libburn/structure.c | 50 +++++++++++++++++++++++++++++++++++-- libburn/structure.h | 4 +++ 4 files changed, 58 insertions(+), 4 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index d264dd1..ac2464e 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2008.08.05.175930" +#define Cdrskin_timestamP "2008.08.09.071742" diff --git a/libburn/mmc.c b/libburn/mmc.c index a163391..97f6f49 100644 --- a/libburn/mmc.c +++ b/libburn/mmc.c @@ -62,7 +62,7 @@ extern struct libdax_msgs *libdax_messenger; /* ts A80410 : <<< Dangerous experiment: Pretend that DVD-RAM is BD-RE # define Libburn_dvd_ram_as_bd_rE yes */ -/* ts A80509 : <<< Experiment: pretend that DVD-COM and CD-ROM are other media +/* ts A80509 : <<< Experiment: pretend that DVD-ROM and CD-ROM are other media like BD-ROM (0x40), BD-R seq (0x41), BD-R random (0x42) # define Libburn_rom_as_profilE 0x40 */ @@ -1293,6 +1293,10 @@ static int mmc_read_toc_al(struct burn_drive *d, int *alloc_len) if (d->status == BURN_DISC_UNREADY) d->status = BURN_DISC_FULL; toc_find_modes(d); + + /* A80808 */ + burn_disc_cd_toc_extensions(d->disc, 0); + return 1; } diff --git a/libburn/structure.c b/libburn/structure.c index 40897b9..12a634b 100644 --- a/libburn/structure.c +++ b/libburn/structure.c @@ -330,11 +330,19 @@ void burn_track_clear_isrc(struct burn_track *t) int burn_track_get_sectors(struct burn_track *t) { /* ts A70125 : was int */ - off_t size; + off_t size = 0; int sectors, seclen; seclen = burn_sector_length(t->mode); - size = t->offset + t->source->get_size(t->source) + t->tail; + if (t->source != NULL) /* ts A80808 : mending sigsegv */ + size = t->offset + t->source->get_size(t->source) + t->tail; + else if(t->entry != NULL) { + /* ts A80808 : all burn_toc_entry of track starts should now + have (extensions_valid & 1), even those from CD. + */ + if (t->entry->extensions_valid & 1) + size = ((off_t) t->entry->track_blocks) * (off_t) 2048; + } sectors = size / seclen; if (size % seclen) sectors++; @@ -468,6 +476,7 @@ int burn_session_get_sectors(struct burn_session *s) return sectors; } + int burn_disc_get_sectors(struct burn_disc *d) { int sectors = 0, i; @@ -515,3 +524,40 @@ int burn_session_get_hidefirst(struct burn_session *session) { return session->hidefirst; } + + +/* ts A80808 : Enhance CD toc to DVD toc */ +int burn_disc_cd_toc_extensions(struct burn_disc *d, int flag) +{ + int sidx, tidx; + struct burn_toc_entry *entry, *prev_entry; + + for (sidx = 0; sidx < d->sessions; sidx++) { + for (tidx = 0; tidx < d->session[sidx]->tracks + 1; tidx++) { + if (tidx < d->session[sidx]->tracks) + entry = d->session[sidx]->track[tidx]->entry; + else + entry = d->session[sidx]->leadout_entry; + entry->session_msb = 0; + entry->point_msb = 0; + entry->start_lba = burn_msf_to_lba(entry->pmin, + entry->psec, entry->pframe); + if (tidx > 0) { + prev_entry->track_blocks = + entry->start_lba + - prev_entry->start_lba; + prev_entry->extensions_valid |= 1; + } + if (tidx == d->session[sidx]->tracks) { + entry->session_msb = 0; + entry->point_msb = 0; + entry->track_blocks = 0; + entry->extensions_valid |= 1; + } + prev_entry = entry; + } + } + return 1; +} + + diff --git a/libburn/structure.h b/libburn/structure.h index 89f25d5..78de9dc 100644 --- a/libburn/structure.h +++ b/libburn/structure.h @@ -109,4 +109,8 @@ int burn_track_apply_fillup(struct burn_track *t, off_t max_size, int flag); off_t burn_track_get_default_size(struct burn_track *t); +/* ts A80808 : Enhance CD toc to DVD toc */ +int burn_disc_cd_toc_extensions(struct burn_disc *d, int flag); + + #endif /* BURN__STRUCTURE_H */