"Fossies" - the Fresh Open Source Software Archive 
Member "xorriso-1.5.4/libburn/toc.c" (30 Jan 2021, 4030 Bytes) of package /linux/misc/xorriso-1.5.4.pl02.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "toc.c" see the
Fossies "Dox" file reference documentation.
1 /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
2
3 /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
4 Copyright (c) 2011 - 2011 Thomas Schmitt <scdbackup@gmx.net>
5 Provided under GPL version 2 or later.
6 */
7
8
9 #ifdef HAVE_CONFIG_H
10 #include "../config.h"
11 #endif
12
13 /* ts A61008 */
14 /* #include <a ssert.h> */
15
16 #include <string.h>
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include "toc.h"
20 #include "transport.h"
21 #include "libburn.h"
22 #include "sector.h"
23 #include "options.h"
24 #include "init.h"
25
26 #if 0
27 static void write_clonecd2(volatile struct toc *toc, int f);
28
29 static void write_clonecd2(volatile struct toc *toc, int f)
30 {
31 int i;
32
33 /* header */
34 dprintf(f, "[CloneCD]\r\n");
35 dprintf(f, "Version=2\r\n");
36 dprintf(f, "\r\n");
37
38 /* disc data */
39 dprintf(f, "[Disc]\r\n");
40
41 dprintf(f, "TocEntries=%d\r\n", toc->toc_entries);
42 dprintf(f, "Sessions=%d\r\n", toc->sessions);
43 dprintf(f, "DataTracksScrambled=%d\r\n", toc->datatracksscrambled);
44 dprintf(f, "CDTextLength=%d\r\n", toc->cdtextlength);
45 dprintf(f, "\r\n");
46
47 /* session data */
48 for (i = 0; i < toc->sessions; ++i) {
49 dprintf(f, "[Session %d]\r\n", i + 1);
50
51 {
52 int m;
53
54 switch (toc->session[i].track[0]->mode) {
55 case BURN_MODE_RAW_DATA:
56 case BURN_MODE_AUDIO:
57 m = 0;
58 break;
59 case BURN_MODE0:
60 m = 1;
61 break;
62 case BURN_MODE1:
63 case BURN_MODE2_FORMLESS:
64 case BURN_MODE2_FORM1:
65 case BURN_MODE2_FORM2:
66 case BURN_MODE_UNINITIALIZED:
67
68 /* ts A61008 : do this softly without Assert */
69
70 a ssert(0); /* unhandled! find out ccd's
71 value for these modes! */
72 }
73 dprintf(f, "PreGapMode=%d\r\n", m);
74 }
75 dprintf(f, "\r\n");
76 }
77
78 for (i = 0; i < toc->toc_entries; ++i) {
79 dprintf(f, "[Entry %d]\r\n", i);
80
81 dprintf(f, "Session=%d\r\n", toc->toc_entry[i].session);
82 dprintf(f, "Point=0x%02x\r\n", toc->toc_entry[i].point);
83 dprintf(f, "ADR=0x%02x\r\n", toc->toc_entry[i].adr);
84 dprintf(f, "Control=0x%02x\r\n", toc->toc_entry[i].control);
85 dprintf(f, "TrackNo=%d\r\n", toc->toc_entry[i].tno);
86 dprintf(f, "AMin=%d\r\n", toc->toc_entry[i].min);
87 dprintf(f, "ASec=%d\r\n", toc->toc_entry[i].sec);
88 dprintf(f, "AFrame=%d\r\n", toc->toc_entry[i].frame);
89 dprintf(f, "ALBA=%d\r\n",
90 burn_msf_to_lba(toc->toc_entry[i].min,
91 toc->toc_entry[i].sec,
92 toc->toc_entry[i].frame));
93 dprintf(f, "Zero=%d\r\n", toc->toc_entry[i].zero);
94 dprintf(f, "PMin=%d\r\n", toc->toc_entry[i].pmin);
95 dprintf(f, "PSec=%d\r\n", toc->toc_entry[i].psec);
96 dprintf(f, "PFrame=%d\r\n", toc->toc_entry[i].pframe);
97 dprintf(f, "PLBA=%d\r\n",
98 burn_msf_to_lba(toc->toc_entry[i].pmin,
99 toc->toc_entry[i].psec,
100 toc->toc_entry[i].pframe));
101 dprintf(f, "\r\n");
102 }
103 }
104 #endif
105
106 void toc_find_modes(struct burn_drive *d)
107 {
108 int i, j;
109 struct buffer *mem = NULL;
110 struct burn_toc_entry *e;
111
112 /* ts A70519 : the code which needs this does not work with GNU/Linux 2.4 USB
113 int lba;
114 struct burn_read_opts o;
115
116 o.raw = 1;
117 o.c2errors = 0;
118 o.subcodes_audio = 1;
119 o.subcodes_data = 1;
120 o.hardware_error_recovery = 1;
121 o.report_recovered_errors = 0;
122 o.transfer_damaged_blocks = 1;
123 o.hardware_error_retries = 1;
124 */
125
126 BURN_ALLOC_MEM_VOID(mem, struct buffer, 1);
127
128 mem->bytes = 0;
129 mem->sectors = 1;
130
131 for (i = 0; i < d->disc->sessions; i++)
132 for (j = 0; j < d->disc->session[i]->tracks; j++) {
133 struct burn_track *t = d->disc->session[i]->track[j];
134
135 e = t->entry;
136 /* XXX | in the subcodes if appropriate! */
137 if (e && !(e->control & 4)) {
138 t->mode = BURN_AUDIO;
139 } else {
140
141 t->mode = BURN_MODE1;
142 /* ts A70519 : this does not work with GNU/Linux 2.4 USB because one cannot
143 predict the exact dxfer_size without knowing the sector type.
144 if (!e)
145 lba = 0;
146 else
147 lba = burn_msf_to_lba(e->pmin, e->psec,
148 e->pframe);
149 mem->sectors = 1;
150
151 ts B21119 : Would now be d->read_cd() with
152 with sectype = 0 , mainch = 0xf8
153 d->read_sectors(d, lba, mem.sectors, &o, mem);
154
155 t->mode = sector_identify(mem->data);
156 */
157 }
158 }
159
160 ex:
161 BURN_FREE_MEM(mem);
162 }