libburn  1.3.4
libburn.h
Go to the documentation of this file.
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) 2006 - 2013 Thomas Schmitt <scdbackup@gmx.net>
5  Provided under GPL version 2 or later.
6 
7  This is the official API definition of libburn.
8 
9 */
10 /* Important: If you add a public API function then add its name to file
11  libburn/libburn.ver
12 */
13 
14 
15 #ifndef LIBBURN_H
16 #define LIBBURN_H
17 
18 /*
19 
20 Applications must use 64 bit off_t. E.g. by defining
21  #define _LARGEFILE_SOURCE
22  #define _FILE_OFFSET_BITS 64
23 or take special precautions to interface with the library by 64 bit integers
24 where this .h files prescribe off_t.
25 
26 To prevent 64 bit file i/o in the library would keep the application from
27 processing tracks of more than 2 GB size.
28 
29 */
30 #include <sys/types.h>
31 
32 #ifndef DOXYGEN
33 
34 #if defined(__cplusplus)
35 #define BURN_BEGIN_DECLS \
36  namespace burn { \
37  extern "C" {
38 #define BURN_END_DECLS \
39  } \
40  }
41 #else
42 #define BURN_BEGIN_DECLS
43 #define BURN_END_DECLS
44 #endif
45 
46 BURN_BEGIN_DECLS
47 
48 #endif
49 
50 /** References a physical drive in the system */
51 struct burn_drive;
52 
53 /** References a whole disc */
54 struct burn_disc;
55 
56 /** References a single session on a disc */
57 struct burn_session;
58 
59 /** References a single track on a disc */
60 struct burn_track;
61 
62 /* ts A61111 */
63 /** References a set of write parameters */
64 struct burn_write_opts;
65 
66 /** Session format for normal audio or data discs */
67 #define BURN_CDROM 0
68 /** Session format for obsolete CD-I discs */
69 #define BURN_CDI 0x10
70 /** Session format for CDROM-XA discs */
71 #define BURN_CDXA 0x20
72 
73 #define BURN_POS_END 100
74 
75 /** Mask for mode bits */
76 #define BURN_MODE_BITS 127
77 
78 /** Track mode - mode 0 data
79  0 bytes of user data. it's all 0s. mode 0. get it? HAH
80 */
81 #define BURN_MODE0 (1 << 0)
82 /** Track mode - mode "raw" - all 2352 bytes supplied by app
83  FOR DATA TRACKS ONLY!
84 */
85 #define BURN_MODE_RAW (1 << 1)
86 /** Track mode - mode 1 data
87  2048 bytes user data, and all the LEC money can buy
88 */
89 #define BURN_MODE1 (1 << 2)
90 /** Track mode - mode 2 data
91  defaults to formless, 2336 bytes of user data, unprotected
92  | with a data form if required.
93 */
94 #define BURN_MODE2 (1 << 3)
95 /** Track mode modifier - Form 1, | with MODE2 for reasonable results
96  2048 bytes of user data, 4 bytes of subheader
97 */
98 #define BURN_FORM1 (1 << 4)
99 /** Track mode modifier - Form 2, | with MODE2 for reasonable results
100  lots of user data. not much LEC.
101 */
102 #define BURN_FORM2 (1 << 5)
103 /** Track mode - audio
104  2352 bytes per sector. may be | with 4ch or preemphasis.
105  NOT TO BE CONFUSED WITH BURN_MODE_RAW
106  Audio data must be 44100Hz 16bit stereo with no riff or other header at
107  beginning. Extra header data will cause pops or clicks. Audio data should
108  also be in little-endian byte order. Big-endian audio data causes static.
109 */
110 #define BURN_AUDIO (1 << 6)
111 /** Track mode modifier - 4 channel audio. */
112 #define BURN_4CH (1 << 7)
113 /** Track mode modifier - Digital copy permitted, can be set on any track.*/
114 #define BURN_COPY (1 << 8)
115 /** Track mode modifier - 50/15uS pre-emphasis */
116 #define BURN_PREEMPHASIS (1 << 9)
117 /** Input mode modifier - subcodes present packed 16 */
118 #define BURN_SUBCODE_P16 (1 << 10)
119 /** Input mode modifier - subcodes present packed 96 */
120 #define BURN_SUBCODE_P96 (1 << 11)
121 /** Input mode modifier - subcodes present raw 96 */
122 #define BURN_SUBCODE_R96 (1 << 12)
123 
124 /* ts B11230 */
125 /** Track mode modifier - Serial Copy Management System, SAO only
126  If this is set and BURN_COPY is not set, then copying the emerging
127  track will be forbidden.
128  @since 1.2.0
129 */
130 #define BURN_SCMS (1 << 13)
131 
132 
133 /** Possible disc writing style/modes */
135 {
136  /** Packet writing.
137  currently unsupported, (for DVD Incremental Streaming use TAO)
138  */
140 
141  /** With CD: Track At Once recording
142  2s gaps between tracks, no fonky lead-ins
143 
144  With sequential DVD-R[W]: Incremental Streaming
145  With DVD+R and BD-R: Track of open size
146  With DVD-RAM, DVD+RW, BD-RE: Random Writeable (used sequentially)
147  With overwriteable DVD-RW: Rigid Restricted Overwrite
148  */
150 
151  /** With CD: Session At Once
152  Block type MUST be BURN_BLOCK_SAO
153  ts A70122: Currently not capable of mixing data and audio tracks.
154 
155  With sequential DVD-R[W]: Disc-at-once, DAO
156  Single session, single track, fixed size mandatory, (-dvd-compat)
157  With other DVD or BD media: same as BURN_WRITE_TAO but may demand
158  that track size is known in advance.
159  */
161 
162  /** With CD: Raw disc at once recording.
163  all subcodes must be provided by lib or user
164  only raw block types are supported
165  With DVD and BD media: not supported.
166 
167  ts A90901: This had been disabled because its implementation
168  relied on code from cdrdao which is not understood
169  currently.
170  A burn run will abort with "FATAL" error message
171  if this mode is attempted.
172  @since 0.7.2
173  ts A91016: Re-implemented according to ECMA-130 Annex A and B.
174  Now understood, explained and not stemming from cdrdao.
175  @since 0.7.4
176  */
178 
179  /** In replies this indicates that not any writing will work.
180  As parameter for inquiries it indicates that no particular write
181  mode shall is specified.
182  Do not use for setting a write mode for burning. It will not work.
183  */
185 };
186 
187 /** Data format to send to the drive */
189 {
190  /** sync, headers, edc/ecc provided by lib/user */
192  /** sync, headers, edc/ecc and p/q subs provided by lib/user */
194  /** sync, headers, edc/ecc and packed p-w subs provided by lib/user */
196  /** sync, headers, edc/ecc and raw p-w subs provided by lib/user */
198  /** only 2048 bytes of user data provided by lib/user */
200  /** 2336 bytes of user data provided by lib/user */
202  /** 2048 bytes of user data provided by lib/user
203  subheader provided in write parameters
204  are we ever going to support this shit? I vote no.
205  (supposed to be supported on all drives...)
206  */
208  /** 2048 bytes of data + 8 byte subheader provided by lib/user
209  hey, this is also dumb
210  */
212  /** 2324 bytes of data provided by lib/user
213  subheader provided in write parameters
214  no sir, I don't like it.
215  */
217  /** 2332 bytes of data supplied by lib/user
218  8 bytes sub header provided in write parameters
219  this is the second least suck mode2, and is mandatory for
220  all drives to support.
221  */
223  /** SAO block sizes are based on cue sheet, so use this. */
225 };
226 
227 /** Possible status of the drive in regard to the disc in it. */
229 {
230  /** The current status is not yet known */
232 
233  /** The drive holds a blank disc. It is ready for writing from scratch.
234  Unused multi-session media:
235  CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, BD-R
236  Blanked multi-session media (i.e. treated by burn_disc_erase())
237  CD-RW, DVD-RW
238  Overwriteable media with or without valid data
239  DVD-RAM, DVD+RW, formatted DVD-RW, BD-RE
240  */
242 
243  /** There is no disc at all in the drive */
245 
246  /** There is an incomplete disc in the drive. It is ready for appending
247  another session.
248  Written but not yet closed multi-session media
249  CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, BD-R
250  */
252 
253  /** There is a disc with data on it in the drive. It is usable only for
254  reading.
255  Written and closed multi-session media
256  CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, BD-R
257  Read-Only media
258  CD-ROM, DVD-ROM, BD-ROM
259  Note that many DVD-ROM drives report any written media
260  as Read-Only media and not by their real media types.
261  */
263 
264  /* ts A61007 */
265  /* @since 0.2.4 */
266  /** The drive was not grabbed when the status was inquired */
268 
269  /* ts A61020 */
270  /* @since 0.2.6 */
271  /** The media seems to be unsuitable for reading and for writing */
273 };
274 
275 
276 /** Possible data source return values */
278 {
279  /** The source is ok */
281  /** The source is at end of file */
283  /** The source is unusable */
285 };
286 
287 
288 /** Possible busy states for a drive */
290 {
291  /** The drive is not in an operation */
293  /** The library is spawning the processes to handle a pending
294  operation (A read/write/etc is about to start but hasn't quite
295  yet) */
297  /** The drive is reading data from a disc */
299  /** The drive is writing data to a disc */
301  /** The drive is writing Lead-In */
303  /** The drive is writing Lead-Out */
305  /** The drive is erasing a disc */
307  /** The drive is being grabbed */
309 
310  /* ts A61102 */
311  /* @since 0.2.6 */
312  /** The drive gets written zeroes before the track payload data */
314  /** The drive is told to close a track (TAO only) */
316  /** The drive is told to close a session (TAO only) */
318 
319  /* ts A61223 */
320  /* @since 0.3.0 */
321  /** The drive is formatting media */
323 
324  /* ts A70822 */
325  /* @since 0.4.0 */
326  /** The drive is busy in synchronous read (if you see this then it
327  has been interrupted) */
329  /** The drive is busy in synchronous write (if you see this then it
330  has been interrupted) */
332 
333 };
334 
335 
336 /** Information about a track on a disc - this is from the q sub channel of the
337  lead-in area of a disc. The documentation here is very terse.
338  See a document such as mmc3 for proper information.
339 
340  CAUTION : This structure is prone to future extension !
341 
342  Do not restrict your application to unsigned char with any counter like
343  "session", "point", "pmin", ...
344  Do not rely on the current size of a burn_toc_entry.
345 
346 */
348 {
349  /** Session the track is in */
350  unsigned char session;
351  /** Type of data. for this struct to be valid, it must be 1 */
352  unsigned char adr;
353  /** Type of data in the track */
354  unsigned char control;
355  /** Zero. Always. Really. */
356  unsigned char tno;
357  /** Track number or special information */
358  unsigned char point;
359  unsigned char min;
360  unsigned char sec;
361  unsigned char frame;
362  unsigned char zero;
363  /** Track start time minutes for normal tracks */
364  unsigned char pmin;
365  /** Track start time seconds for normal tracks */
366  unsigned char psec;
367  /** Track start time frames for normal tracks */
368  unsigned char pframe;
369 
370  /* Indicates whether extension data are valid and eventually override
371  older elements in this structure:
372  bit0= DVD extension is valid @since 0.3.2
373  @since 0.5.2 : DVD extensions are made valid for CD too
374  bit1= LRA extension is valid @since 0.7.2
375  bit2= Track status bits extension is valid @since 1.2.8
376  */
377  unsigned char extensions_valid;
378 
379  /* ts A70201 : DVD extension. extensions_valid:bit0
380  If invalid the members are guaranteed to be 0. */
381  /* @since 0.3.2 */
382  /* Tracks and session numbers are 16 bit. Here are the high bytes. */
383  unsigned char session_msb;
384  unsigned char point_msb;
385  /* pmin, psec, and pframe may be too small if DVD extension is valid */
386  int start_lba;
387  /* min, sec, and frame may be too small if DVD extension is valid */
389 
390  /* ts A90909 : LRA extension. extensions_valid:bit1 */
391  /* @since 0.7.2 */
392  /* MMC-5 6.27.3.18 : The Last Recorded Address is valid for DVD-R,
393  DVD-R DL when LJRS = 00b, DVD-RW, HD DVD-R, and BD-R.
394  This would mean profiles: 0x11, 0x15, 0x13, 0x14, 0x51, 0x41, 0x42
395  */
397 
398  /* ts B30112 : Track status bits extension. extensions_valid:bit2 */
399  /* @since 1.2.8 */
400  /* Names as of READ TRACK INFORMATION, MMC-5 6.27.3 :
401  bit0 - bit3 = Track Mode
402  bit4 = Copy
403  bit5 = Damage
404  bit6 - bit7 = LJRS
405  bit8 - bit11 = Data Mode
406  bit12 = FP
407  bit13 = Packet/Inc
408  bit14 = Blank
409  bit15 = RT
410  bit16 = NWA_V
411  bit17 = LRA_V
412  */
414 
415 };
416 
417 
418 /** Data source interface for tracks.
419  This allows to use arbitrary program code as provider of track input data.
420 
421  Objects compliant to this interface are either provided by the application
422  or by API calls of libburn: burn_fd_source_new() , burn_file_source_new(),
423  and burn_fifo_source_new().
424 
425  The API calls allow to use any file object as data source. Consider to feed
426  an eventual custom data stream asynchronously into a pipe(2) and to let
427  libburn handle the rest.
428  In this case the following rule applies:
429  Call burn_source_free() exactly once for every source obtained from
430  libburn API. You MUST NOT otherwise use or manipulate its components.
431 
432  In general, burn_source objects can be freed as soon as they are attached
433  to track objects. The track objects will keep them alive and dispose them
434  when they are no longer needed. With a fifo burn_source it makes sense to
435  keep the own reference for inquiring its state while burning is in
436  progress.
437 
438  ---
439 
440  The following description of burn_source applies only to application
441  implemented burn_source objects. You need not to know it for API provided
442  ones.
443 
444  If you really implement an own passive data producer by this interface,
445  then beware: it can do anything and it can spoil everything.
446 
447  In this case the functions (*read), (*get_size), (*set_size), (*free_data)
448  MUST be implemented by the application and attached to the object at
449  creation time.
450  Function (*read_sub) is allowed to be NULL or it MUST be implemented and
451  attached.
452 
453  burn_source.refcount MUST be handled properly: If not exactly as many
454  references are freed as have been obtained, then either memory leaks or
455  corrupted memory are the consequence.
456  All objects which are referred to by *data must be kept existent until
457  (*free_data) is called via burn_source_free() by the last referer.
458 */
459 struct burn_source {
460 
461  /** Reference count for the data source. MUST be 1 when a new source
462  is created and thus the first reference is handed out. Increment
463  it to take more references for yourself. Use burn_source_free()
464  to destroy your references to it. */
465  int refcount;
466 
467 
468  /** Read data from the source. Semantics like with read(2), but MUST
469  either deliver the full buffer as defined by size or MUST deliver
470  EOF (return 0) or failure (return -1) at this call or at the
471  next following call. I.e. the only incomplete buffer may be the
472  last one from that source.
473  libburn will read a single sector by each call to (*read).
474  The size of a sector depends on BURN_MODE_*. The known range is
475  2048 to 2352.
476 
477  If this call is reading from a pipe then it will learn
478  about the end of data only when that pipe gets closed on the
479  feeder side. So if the track size is not fixed or if the pipe
480  delivers less than the predicted amount or if the size is not
481  block aligned, then burning will halt until the input process
482  closes the pipe.
483 
484  IMPORTANT:
485  If this function pointer is NULL, then the struct burn_source is of
486  version >= 1 and the job of .(*read)() is done by .(*read_xt)().
487  See below, member .version.
488  */
489  int (*read)(struct burn_source *, unsigned char *buffer, int size);
490 
491 
492  /** Read subchannel data from the source (NULL if lib generated)
493  WARNING: This is an obscure feature with CD raw write modes.
494  Unless you checked the libburn code for correctness in that aspect
495  you should not rely on raw writing with own subchannels.
496  ADVICE: Set this pointer to NULL.
497  */
498  int (*read_sub)(struct burn_source *, unsigned char *buffer, int size);
499 
500 
501  /** Get the size of the source's data. Return 0 means unpredictable
502  size. If application provided (*get_size) allows return 0, then
503  the application MUST provide a fully functional (*set_size).
504  */
505  off_t (*get_size)(struct burn_source *);
506 
507 
508  /* ts A70125 : BROKE BINARY BACKWARD COMPATIBILITY AT libburn-0.3.1. */
509  /* @since 0.3.2 */
510  /** Program the reply of (*get_size) to a fixed value. It is advised
511  to implement this by a attribute off_t fixed_size; in *data .
512  The read() function does not have to take into respect this fake
513  setting. It is rather a note of libburn to itself. Eventually
514  necessary truncation or padding is done in libburn. Truncation
515  is usually considered a misburn. Padding is considered ok.
516 
517  libburn is supposed to work even if (*get_size) ignores the
518  setting by (*set_size). But your application will not be able to
519  enforce fixed track sizes by burn_track_set_size() and possibly
520  even padding might be left out.
521  */
522  int (*set_size)(struct burn_source *source, off_t size);
523 
524 
525  /** Clean up the source specific data. This function will be called
526  once by burn_source_free() when the last referer disposes the
527  source.
528  */
529  void (*free_data)(struct burn_source *);
530 
531 
532  /** Next source, for when a source runs dry and padding is disabled
533  WARNING: This is an obscure feature. Set to NULL at creation and
534  from then on leave untouched and uninterpreted.
535  */
536  struct burn_source *next;
537 
538 
539  /** Source specific data. Here the various source classes express their
540  specific properties and the instance objects store their individual
541  management data.
542  E.g. data could point to a struct like this:
543  struct app_burn_source
544  {
545  struct my_app *app_handle;
546  ... other individual source parameters ...
547  off_t fixed_size;
548  };
549 
550  Function (*free_data) has to be prepared to clean up and free
551  the struct.
552  */
553  void *data;
554 
555 
556  /* ts A71222 : Supposed to be binary backwards compatible extension. */
557  /* @since 0.4.2 */
558  /** Valid only if above member .(*read)() is NULL. This indicates a
559  version of struct burn_source younger than 0.
560  From then on, member .version tells which further members exist
561  in the memory layout of struct burn_source. libburn will only touch
562  those announced extensions.
563 
564  Versions:
565  0 has .(*read)() != NULL, not even .version is present.
566  1 has .version, .(*read_xt)(), .(*cancel)()
567  */
568  int version;
569 
570  /** This substitutes for (*read)() in versions above 0. */
571  int (*read_xt)(struct burn_source *, unsigned char *buffer, int size);
572 
573  /** Informs the burn_source that the consumer of data prematurely
574  ended reading. This call may or may not be issued by libburn
575  before (*free_data)() is called.
576  */
577  int (*cancel)(struct burn_source *source);
578 };
579 
580 
581 /** Information on a drive in the system */
583 {
584  /** Name of the vendor of the drive */
585  char vendor[9];
586  /** Name of the drive */
587  char product[17];
588  /** Revision of the drive */
589  char revision[5];
590 
591  /** Invalid: Was: "Location of the drive in the filesystem." */
592  /** This string has no meaning any more. Once it stored the drive
593  device file address. Now always use function burn_drive_d_get_adr()
594  to inquire a device file address. ^^^^^ ALWAYS ^^^^^^^*/
595  char location[17];
596 
597  /** Can the drive read DVD-RAM discs */
598  unsigned int read_dvdram:1;
599  /** Can the drive read DVD-R discs */
600  unsigned int read_dvdr:1;
601  /** Can the drive read DVD-ROM discs */
602  unsigned int read_dvdrom:1;
603  /** Can the drive read CD-R discs */
604  unsigned int read_cdr:1;
605  /** Can the drive read CD-RW discs */
606  unsigned int read_cdrw:1;
607 
608  /** Can the drive write DVD-RAM discs */
609  unsigned int write_dvdram:1;
610  /** Can the drive write DVD-R discs */
611  unsigned int write_dvdr:1;
612  /** Can the drive write CD-R discs */
613  unsigned int write_cdr:1;
614  /** Can the drive write CD-RW discs */
615  unsigned int write_cdrw:1;
616 
617  /** Can the drive simulate a write */
618  unsigned int write_simulate:1;
619 
620  /** Can the drive report C2 errors */
621  unsigned int c2_errors:1;
622 
623  /** The size of the drive's buffer (in kilobytes) */
625  /**
626  * The supported block types in tao mode.
627  * They should be tested with the desired block type.
628  * See also burn_block_types.
629  */
631  /**
632  * The supported block types in sao mode.
633  * They should be tested with the desired block type.
634  * See also burn_block_types.
635  */
637  /**
638  * The supported block types in raw mode.
639  * They should be tested with the desired block type.
640  * See also burn_block_types.
641  */
643  /**
644  * The supported block types in packet mode.
645  * They should be tested with the desired block type.
646  * See also burn_block_types.
647  */
649 
650  /** The value by which this drive can be indexed when using functions
651  in the library. This is the value to pass to all libbburn functions
652  that operate on a drive. */
653  struct burn_drive *drive;
654 };
655 
656 
657 /** Operation progress report. All values are 0 based indices.
658  * */
660  /** The total number of sessions */
661  int sessions;
662  /** Current session.*/
663  int session;
664  /** The total number of tracks */
665  int tracks;
666  /** Current track. */
667  int track;
668  /** The total number of indices */
669  int indices;
670  /** Curent index. */
671  int index;
672  /** The starting logical block address */
674  /** On write: The number of sectors.
675  On blank: 0x10000 as upper limit for relative progress steps */
676  int sectors;
677  /** On write: The current sector being processed.
678  On blank: Relative progress steps 0 to 0x10000 */
679  int sector;
680 
681  /* ts A61023 */
682  /* @since 0.2.6 */
683  /** The capacity of the drive buffer */
684  unsigned buffer_capacity;
685  /** The free space in the drive buffer (might be slightly outdated) */
687 
688  /* ts A61119 */
689  /* @since 0.2.6 */
690  /** The number of bytes sent to the drive buffer */
692  /** The minimum number of bytes stored in buffer during write.
693  (Caution: Before surely one buffer size of bytes was processed,
694  this value is 0xffffffff.)
695  */
696  unsigned buffer_min_fill;
697 };
698 
699 
700 /* ts A61226 */
701 /* @since 0.3.0 */
702 /** Description of a speed capability as reported by the drive in conjunction
703  with eventually loaded media. There can be more than one such object per
704  drive. So they are chained via .next and .prev , where NULL marks the end
705  of the chain. This list is set up by burn_drive_scan() and gets updated
706  by burn_drive_grab().
707  A copy may be obtained by burn_drive_get_speedlist() and disposed by
708  burn_drive_free_speedlist().
709  For technical background info see SCSI specs MMC and SPC:
710  mode page 2Ah (from SPC 5Ah MODE SENSE) , mmc3r10g.pdf , 6.3.11 Table 364
711  ACh GET PERFORMANCE, Type 03h , mmc5r03c.pdf , 6.8.5.3 Table 312
712 */
714 
715  /** Where this info comes from :
716  0 = misc , 1 = mode page 2Ah , 2 = ACh GET PERFORMANCE */
717  int source;
718 
719  /** The media type that was current at the time of report
720  -2 = state unknown, -1 = no media was loaded , else see
721  burn_disc_get_profile() */
723  char profile_name[80];
724 
725  /** The attributed capacity of appropriate media in logical block units
726  i.e. 2352 raw bytes or 2048 data bytes. -1 = capacity unknown. */
727  int end_lba;
728 
729  /** Speed is given in 1000 bytes/s , 0 = invalid. The numbers
730  are supposed to be usable with burn_drive_set_speed() */
733 
734  /** Expert info from ACh GET PERFORMANCE and/or mode page 2Ah.
735  Expect values other than 0 or 1 to get a meaning in future.*/
736  /* Rotational control: 0 = CLV/default , 1 = CAV */
737  int wrc;
738  /* 1 = drive promises reported performance over full media */
739  int exact;
740  /* 1 = suitable for mixture of read and write */
741  int mrw;
742 
743  /** List chaining. Use .next until NULL to iterate over the list */
746 };
747 
748 
749 /** Initialize the library.
750  This must be called before using any other functions in the library. It
751  may be called more than once with no effect.
752  It is possible to 'restart' the library by shutting it down and
753  re-initializing it. Once this was necessary if you follow the older and
754  more general way of accessing a drive via burn_drive_scan() and
755  burn_drive_grab(). See burn_drive_scan_and_grab() with its strong
756  urges and its explanations.
757  @return Nonzero if the library was able to initialize; zero if
758  initialization failed.
759 */
760 int burn_initialize(void);
761 
762 /** Shutdown the library.
763  This should be called before exiting your application. Make sure that all
764  drives you have grabbed are released <i>before</i> calling this.
765 */
766 void burn_finish(void);
767 
768 
769 /* ts A61002 */
770 /** Abort any running drive operation and eventually call burn_finish().
771 
772  You MUST shut down the busy drives if an aborting event occurs during a
773  burn run. For that you may call this function either from your own signal
774  handling code or indirectly by activating the built-in signal handling:
775  burn_set_signal_handling("my_app_name : ", NULL, 0);
776  Else you may eventually call burn_drive_cancel() on the active drives and
777  wait for them to assume state BURN_DRIVE_IDLE.
778  @param patience Maximum number of seconds to wait for drives to
779  finish.
780  @since 0.7.8 :
781  If this is -1, then only the cancel operations will
782  be performed and no burn_finish() will happen.
783  @param pacifier_func If not NULL: a function to produce appeasing messages.
784  See burn_abort_pacifier() for an example.
785  @param handle Opaque handle to be used with pacifier_func
786  @return 1 ok, all went well
787  0 had to leave a drive in unclean state
788  <0 severe error, do no use libburn again
789  @since 0.2.6
790 */
791 int burn_abort(int patience,
792  int (*pacifier_func)(void *handle, int patience, int elapsed),
793  void *handle);
794 
795 /** A pacifier function suitable for burn_abort.
796  @param handle If not NULL, a pointer to a text suitable for printf("%s")
797  @param patience Maximum number of seconds to wait
798  @param elapsed Elapsed number of seconds
799 */
800 int burn_abort_pacifier(void *handle, int patience, int elapsed);
801 
802 
803 /** ts A61006 : This is for development only. Not suitable for applications.
804  Set the verbosity level of the library. The default value is 0, which means
805  that nothing is output on stderr. The more you increase this, the more
806  debug output should be displayed on stderr for you.
807  @param level The verbosity level desired. 0 for nothing, higher positive
808  values for more information output.
809 */
810 void burn_set_verbosity(int level);
811 
812 /* ts A91111 */
813 /** Enable resp. disable logging of SCSI commands.
814  This call can be made at any time - even before burn_initialize().
815  It is in effect for all active drives and currently not very thread
816  safe for multiple drives.
817  @param flag Bitfield for control purposes. The default is 0.
818  bit0= log to file /tmp/libburn_sg_command_log
819  bit1= log to stderr
820  bit2= flush output after each line
821  @since 0.7.4
822 */
823 void burn_set_scsi_logging(int flag);
824 
825 /* ts A60813 */
826 /** Set parameters for behavior on opening device files. To be called early
827  after burn_initialize() and before any bus scan. But not mandatory at all.
828  Parameter value 1 enables a feature, 0 disables.
829  Default is (1,0,0). Have a good reason before you change it.
830  @param exclusive
831  0 = no attempt to make drive access exclusive.
832  1 = Try to open only devices which are not marked as busy
833  and try to mark them busy if opened sucessfully. (O_EXCL
834  on GNU/Linux , flock(LOCK_EX) on FreeBSD.)
835  2 = in case of a SCSI device, also try to open exclusively
836  the matching /dev/sr, /dev/scd and /dev/st .
837  One may select a device SCSI file family by adding
838  0 = default family
839  4 = /dev/sr%d
840  8 = /dev/scd%d
841  16 = /dev/sg%d
842  Do not use other values !
843  Add 32 to demand on GNU/Linux an exclusive lock by
844  fcntl(,F_SETLK,) after open() has succeeded.
845  @param blocking Try to wait for drives which do not open immediately but
846  also do not return an error as well. (O_NONBLOCK)
847  This might stall indefinitely with /dev/hdX hard disks.
848  @param abort_on_busy Unconditionally abort process when a non blocking
849  exclusive opening attempt indicates a busy drive.
850  Use this only after thorough tests with your app.
851  @since 0.2.2
852 */
853 void burn_preset_device_open(int exclusive, int blocking, int abort_on_busy);
854 
855 
856 /* ts A70223 */
857 /** Allows the use of media types which are implemented in libburn but not yet
858  tested. The list of those untested profiles is subject to change.
859  - Currently no media types are under test reservation -
860  If you really test such media, then please report the outcome on
861  libburn-hackers@pykix.org
862  If ever then this call should be done soon after burn_initialize() before
863  any drive scanning.
864  @param yes 1=allow all implemented profiles, 0=only tested media (default)
865  @since 0.3.4
866 */
867 void burn_allow_untested_profiles(int yes);
868 
869 
870 /* ts A60823 */
871 /** Aquire a drive with known device file address.
872 
873  This is the sysadmin friendly way to open one drive and to leave all
874  others untouched. It bundles the following API calls to form a
875  non-obtrusive way to use libburn:
876  burn_drive_add_whitelist() , burn_drive_scan() , burn_drive_grab()
877  You are *strongly urged* to use this call whenever you know the drive
878  address in advance.
879 
880  If not, then you have to use directly above calls. In that case, you are
881  *strongly urged* to drop any unintended drive which will be exclusively
882  occupied and not closed by burn_drive_scan().
883  This can be done by shutting down the library including a call to
884  burn_finish(). You may later start a new libburn session and should then
885  use the function described here with an address obtained after
886  burn_drive_scan() via burn_drive_d_get_adr(drive_infos[driveno].drive,adr).
887  Another way is to drop the unwanted drives by burn_drive_info_forget().
888 
889  Operating on multiple drives:
890 
891  Different than with burn_drive_scan() it is allowed to call
892  burn_drive_scan_and_grab() without giving up any other scanned drives. So
893  this call can be used to get a collection of more than one aquired drives.
894  The attempt to aquire the same drive twice will fail, though.
895 
896  Pseudo-drives:
897 
898  burn_drive_scan_and_grab() is able to aquire virtual drives which will
899  accept options much like a MMC burner drive. Many of those options will not
900  cause any effect, though. The address of a pseudo-drive begins with
901  prefix "stdio:" followed by a path.
902  Examples: "stdio:/tmp/pseudo_drive" , "stdio:/dev/null" , "stdio:-"
903 
904  If the path is empty, the result is a null-drive = drive role 0.
905  It pretends to have loaded no media and supports no reading or writing.
906 
907  If the path leads to an existing regular file, or to a not yet existing
908  file, or to an existing block device, then the result is a random access
909  stdio-drive capable of reading and writing = drive role 2.
910 
911  If the path leads to an existing file of any type other than directory,
912  then the result is a sequential write-only stdio-drive = drive role 3.
913 
914  The special address form "stdio:/dev/fd/{number}" is interpreted literally
915  as reference to open file descriptor {number}. This address form coincides
916  with real files on some systems, but it is in fact hardcoded in libburn.
917  Special address "stdio:-" means stdout = "stdio:/dev/fd/1".
918  The role of such a drive is determined by the file type obtained via
919  fstat({number}).
920 
921  Roles 2 and 3 perform all their eventual data transfer activities on a file
922  via standard i/o functions open(2), lseek(2), read(2), write(2), close(2).
923  The media profile is reported as 0xffff. Write space information from those
924  media is not necessarily realistic.
925 
926  The capabilities of role 2 resemble DVD-RAM but it can simulate writing.
927  If the path does not exist in the filesystem yet, it is attempted to create
928  it as a regular file as soon as write operations are started.
929 
930  The capabilities of role 3 resemble a blank DVD-R. Nevertheless each
931  burn_disc_write() run may only write a single track.
932 
933  One may distinguish pseudo-drives from MMC drives by call
934  burn_drive_get_drive_role().
935 
936  @param drive_infos On success returns a one element array with the drive
937  (cdrom/burner). Thus use with driveno 0 only. On failure
938  the array has no valid elements at all.
939  The returned array should be freed via burn_drive_info_free()
940  when it is no longer needed.
941  This is a result from call burn_drive_scan(). See there.
942  Use with driveno 0 only.
943  @param adr The device file address of the desired drive. Either once
944  obtained by burn_drive_d_get_adr() or composed skillfully by
945  application resp. its user. E.g. "/dev/sr0".
946  Consider to preprocess it by burn_drive_convert_fs_adr().
947  @param load Nonzero to make the drive attempt to load a disc (close its
948  tray door, etc).
949  @return 1 = success , 0 = drive not found , -1 = other error
950  @since 0.2.2
951 */
952 int burn_drive_scan_and_grab(struct burn_drive_info *drive_infos[],
953  char* adr, int load);
954 
955 
956 /* ts A51221 */
957 /* @since 0.2.2 */
958 /** Maximum number of particularly permissible drive addresses */
959 #define BURN_DRIVE_WHITELIST_LEN 255
960 
961 /** Add a device to the list of permissible drives. As soon as some entry is in
962  the whitelist all non-listed drives are banned from scanning.
963  @return 1 success, <=0 failure
964  @since 0.2.2
965 */
966 int burn_drive_add_whitelist(char *device_address);
967 
968 /** Remove all drives from whitelist. This enables all possible drives. */
969 void burn_drive_clear_whitelist(void);
970 
971 
972 /** Scan for drives. This function MUST be called until it returns nonzero.
973  In case of re-scanning:
974  All pointers to struct burn_drive and all struct burn_drive_info arrays
975  are invalidated by using this function. Do NOT store drive pointers across
976  calls to this function !
977  To avoid invalid pointers one MUST free all burn_drive_info arrays
978  by burn_drive_info_free() before calling burn_drive_scan() a second time.
979  If there are drives left, then burn_drive_scan() will refuse to work.
980 
981  After this call all drives depicted by the returned array are subject
982  to eventual (O_EXCL) locking. See burn_preset_device_open(). This state
983  ends either with burn_drive_info_forget() or with burn_drive_release().
984  It is unfriendly to other processes on the system to hold drives locked
985  which one does not definitely plan to use soon.
986  @param drive_infos Returns an array of drive info items (cdroms/burners).
987  The returned array must be freed by burn_drive_info_free()
988  before burn_finish(), and also before calling this function
989  burn_drive_scan() again.
990  @param n_drives Returns the number of drive items in drive_infos.
991  @return 0 while scanning is not complete
992  >0 when it is finished sucessfully,
993  <0 when finished but failed.
994 */
995 int burn_drive_scan(struct burn_drive_info *drive_infos[],
996  unsigned int *n_drives);
997 
998 /* ts A60904 : ticket 62, contribution by elmom */
999 /** Release memory about a single drive and any exclusive lock on it.
1000  Become unable to inquire or grab it. Expect FATAL consequences if you try.
1001  @param drive_info pointer to a single element out of the array
1002  obtained from burn_drive_scan() : &(drive_infos[driveno])
1003  @param force controls degree of permissible drive usage at the moment this
1004  function is called, and the amount of automatically provided
1005  drive shutdown :
1006  0= drive must be ungrabbed and BURN_DRIVE_IDLE
1007  1= try to release drive resp. accept BURN_DRIVE_GRABBING
1008  Use these two only. Further values are to be defined.
1009  @return 1 on success, 2 if drive was already forgotten,
1010  0 if not permissible, <0 on other failures,
1011  @since 0.2.2
1012 */
1013 int burn_drive_info_forget(struct burn_drive_info *drive_info, int force);
1014 
1015 
1016 /** When no longer needed, free a whole burn_drive_info array which was
1017  returned by burn_drive_scan().
1018  For freeing single drive array elements use burn_drive_info_forget().
1019 */
1020 void burn_drive_info_free(struct burn_drive_info drive_infos[]);
1021 
1022 
1023 /* ts A60823 */
1024 /* @since 0.2.2 */
1025 /** Maximum length+1 to expect with a drive device file address string */
1026 #define BURN_DRIVE_ADR_LEN 1024
1027 
1028 /* ts A70906 */
1029 /** Inquire the device file address of the given drive.
1030  @param drive The drive to inquire.
1031  @param adr An application provided array of at least BURN_DRIVE_ADR_LEN
1032  characters size. The device file address gets copied to it.
1033  @return >0 success , <=0 error (due to libburn internal problem)
1034  @since 0.4.0
1035 */
1036 int burn_drive_d_get_adr(struct burn_drive *drive, char adr[]);
1037 
1038 /* A60823 */
1039 /** Inquire the device file address of a drive via a given drive_info object.
1040  (Note: This is a legacy call.)
1041  @param drive_info The drive to inquire.Usually some &(drive_infos[driveno])
1042  @param adr An application provided array of at least BURN_DRIVE_ADR_LEN
1043  characters size. The device file address gets copied to it.
1044  @return >0 success , <=0 error (due to libburn internal problem)
1045  @since 0.2.6
1046 */
1047 int burn_drive_get_adr(struct burn_drive_info *drive_info, char adr[]);
1048 
1049 
1050 /* ts A60922 ticket 33 */
1051 /** Evaluate whether the given address would be a drive device file address
1052  which could be listed by a run of burn_drive_scan(). No check is made
1053  whether a device file with this address exists or whether it leads
1054  to a usable MMC drive.
1055  @return 1 means yes, 0 means no
1056  @since 0.2.6
1057 */
1058 int burn_drive_is_enumerable_adr(char *adr);
1059 
1060 /* ts A60922 ticket 33 */
1061 /** Try to convert a given existing filesystem address into a drive device file
1062  address. This succeeds with symbolic links or if a hint about the drive's
1063  system address can be read from the filesystem object and a matching drive
1064  is found.
1065  @param path The address of an existing file system object
1066  @param adr An application provided array of at least BURN_DRIVE_ADR_LEN
1067  characters size. The device file address gets copied to it.
1068  @return 1 = success , 0 = failure , -1 = severe error
1069  @since 0.2.6
1070 */
1071 int burn_drive_convert_fs_adr(char *path, char adr[]);
1072 
1073 /* ts A60923 */
1074 /** Try to convert a given SCSI address of bus,host,channel,target,lun into
1075  a drive device file address. If a SCSI address component parameter is < 0
1076  then it is not decisive and the first enumerated address which matches
1077  the >= 0 parameters is taken as result.
1078  Note: bus and (host,channel) are supposed to be redundant.
1079  @param bus_no "Bus Number" (something like a virtual controller)
1080  @param host_no "Host Number" (something like half a virtual controller)
1081  @param channel_no "Channel Number" (other half of "Host Number")
1082  @param target_no "Target Number" or "SCSI Id" (a device)
1083  @param lun_no "Logical Unit Number" (a sub device)
1084  @param adr An application provided array of at least BURN_DRIVE_ADR_LEN
1085  characters size. The device file address gets copied to it.
1086  @return 1 = success , 0 = failure , -1 = severe error
1087  @since 0.2.6
1088 */
1089 int burn_drive_convert_scsi_adr(int bus_no, int host_no, int channel_no,
1090  int target_no, int lun_no, char adr[]);
1091 
1092 /* ts B10728 */
1093 /** Try to convert a given drive device file address into the address of a
1094  symbolic link that points to this drive address.
1095  Modern GNU/Linux systems may shuffle drive addresses from boot to boot.
1096  The udev daemon is supposed to create links which always point to the
1097  same drive, regardless of its system address.
1098  This call tries to find such links.
1099  @param dev_adr Should contain a drive address as returned by
1100  burn_drive_scan().
1101  @param link_adr An application provided array of at least
1102  BURN_DRIVE_ADR_LEN characters size. The found link
1103  address gets copied to it.
1104  @param dir_adr The address of the directory where to look for links.
1105  Normally: "/dev"
1106  @param templ An array of pointers to name templates, which
1107  links have to match. A symbolic link in dir_adr matches
1108  a name template if it begins by that text. E.g.
1109  link address "/dev/dvdrw1" matches template "dvdrw".
1110  If templ is NULL, then the default array gets used:
1111  {"dvdrw", "cdrw", "dvd", "cdrom", "cd"}
1112  If several links would match, then a link will win,
1113  which matches the template with the lowest array index.
1114  Among these candidates, the one with the lowest strcmp()
1115  rank will be chosen as link_adr.
1116  @param num_templ Number of array elements in templ.
1117  @param flag Bitfield for control purposes. Unused yet. Submit 0.
1118  @return <0 severe error, 0 failed to search, 2 nothing found
1119  1 success, link_adr is valid
1120  @since 1.1.4
1121 */
1122 int burn_lookup_device_link(char *dev_adr, char link_adr[],
1123  char *dir_adr, char **templ, int num_templ, int flag);
1124 
1125 /* ts A60923 - A61005 */
1126 /** Try to obtain bus,host,channel,target,lun from path. If there is an SCSI
1127  address at all, then this call should succeed with a drive device file
1128  address obtained via burn_drive_d_get_adr(). It is also supposed to
1129  succeed with any device file of a (possibly emulated) SCSI device.
1130  @return 1 = success , 0 = failure , -1 = severe error
1131  @since 0.2.6
1132 */
1133 int burn_drive_obtain_scsi_adr(char *path, int *bus_no, int *host_no,
1134  int *channel_no, int *target_no, int *lun_no);
1135 
1136 /** Grab a drive. This must be done before the drive can be used (for reading,
1137  writing, etc).
1138  @param drive The drive to grab. This is found in a returned
1139  burn_drive_info struct.
1140  @param load Nonzero to make the drive attempt to load a disc (close its
1141  tray door, etc).
1142  @return 1 if it was possible to grab the drive, else 0
1143 */
1144 int burn_drive_grab(struct burn_drive *drive, int load);
1145 
1146 /* ts B00114 */
1147 /* Probe available CD write modes and block types. In earlier versions this
1148  was done unconditionally on drive examination or aquiration. But it is
1149  lengthy and obtrusive, up to spoiling burn runs on the examined drives.
1150  So now this probing is omitted by default. All drives which announce to be
1151  capable of CD or DVD writing, get blindly attributed the capability for
1152  SAO and TAO. Applications which are interested in RAW modes or want to
1153  rely on the traditional write mode information, may use this call.
1154  @param drive_info drive object to be inquired
1155  @return >0 indicates success, <=0 means failure
1156  @since 0.7.6
1157 */
1158 int burn_drive_probe_cd_write_modes(struct burn_drive_info *drive_info);
1159 
1160 /* ts A90824 */
1161 /** Calm down or alert a drive. Some drives stay alert after reading for
1162  quite some time. This saves time with the startup for the next read
1163  operation but also causes noise and consumes extra energy. It makes
1164  sense to calm down the drive if no read operation is expected for the
1165  next few seconds. The drive will get alert automatically if operations
1166  are required.
1167  @param d The drive to influence.
1168  @param flag Bitfield for control purposes
1169  bit0= become alert (else start snoozing)
1170  This is not mandatory to allow further drive operations
1171  @return 1= success , 0= drive role not suitable for calming
1172  @since 0.7.0
1173 */
1174 int burn_drive_snooze(struct burn_drive *d, int flag);
1175 
1176 
1177 /** Re-assess drive and media status. This should be done after a drive
1178  underwent a status change and shall be further used without intermediate
1179  burn_drive_release(), burn_drive_grab(). E.g. after blanking or burning.
1180  @param d The already grabbed drive to re-assess.
1181  @param flag Unused yet. Submit 0.
1182  @return 1 success , <= 0 could not determine drive and media state
1183  @since 1.1.8
1184 */
1185 int burn_drive_re_assess(struct burn_drive *d, int flag);
1186 
1187 
1188 /** Release a drive. This should not be done until the drive is no longer
1189  busy (see burn_drive_get_status).
1190  @param drive The drive to release.
1191  @param eject Nonzero to make the drive eject the disc in it.
1192 */
1193 void burn_drive_release(struct burn_drive *drive, int eject);
1194 
1195 
1196 /* ts A70918 */
1197 /** Like burn_drive_release() but keeping the drive tray closed and its
1198  eject button disabled. This physically locked drive state will last until
1199  the drive is grabbed again and released via burn_drive_release().
1200  Programs like eject, cdrecord, growisofs will break that ban too.
1201  @param d The drive to release and leave locked.
1202  @param flag Bitfield for control purposes (unused yet, submit 0)
1203  @return 1 means success, <=0 means failure
1204  @since 0.4.0
1205 */
1206 int burn_drive_leave_locked(struct burn_drive *d, int flag);
1207 
1208 
1209 /** Returns what kind of disc a drive is holding. This function may need to be
1210  called more than once to get a proper status from it. See burn_disc_status
1211  for details.
1212  @param drive The drive to query for a disc.
1213  @return The status of the drive, or what kind of disc is in it.
1214  Note: BURN_DISC_UNGRABBED indicates wrong API usage
1215 */
1216 enum burn_disc_status burn_disc_get_status(struct burn_drive *drive);
1217 
1218 
1219 /* ts A61020 */
1220 /** WARNING: This revives an old bug-like behavior that might be dangerous.
1221  Sets the drive status to BURN_DISC_BLANK if it is BURN_DISC_UNREADY
1222  or BURN_DISC_UNSUITABLE. Thus marking media as writable which actually
1223  failed to declare themselves either blank or (partially) filled.
1224  @return 1 drive status has been set , 0 = unsuitable drive status
1225  @since 0.2.6
1226 */
1227 int burn_disc_pretend_blank(struct burn_drive *drive);
1228 
1229 
1230 /* ts A61106 */
1231 /** WARNING: This overrides the safety measures against unsuitable media.
1232  Sets the drive status to BURN_DISC_FULL if it is BURN_DISC_UNREADY
1233  or BURN_DISC_UNSUITABLE. Thus marking media as blankable which actually
1234  failed to declare themselves either blank or (partially) filled.
1235  @since 0.2.6
1236 */
1237 int burn_disc_pretend_full(struct burn_drive *drive);
1238 
1239 
1240 /* ts B31110 */
1241 /** WARNING: This overrides the safety measures against unsuitable media.
1242  Sets the drive status to BURN_DISC_FULL unconditionally.
1243  @since 1.3.4
1244 */
1245 int burn_disc_pretend_full_uncond(struct burn_drive *drive);
1246 
1247 
1248 /* ts A61021 */
1249 /** Reads ATIP information from inserted media. To be obtained via
1250  burn_drive_get_write_speed(), burn_drive_get_min_write_speed(),
1251  burn_drive_get_start_end_lba(). The drive must be grabbed for this call.
1252  @param drive The drive to query.
1253  @return 1=sucess, 0=no valid ATIP info read, -1 severe error
1254  @since 0.2.6
1255 */
1256 int burn_disc_read_atip(struct burn_drive *drive);
1257 
1258 
1259 /* ts A61020 */
1260 /** Returns start and end lba of the media which is currently inserted
1261  in the given drive. The drive has to be grabbed to have hope for reply.
1262  Shortcomming (not a feature): unless burn_disc_read_atip() was called
1263  only blank media will return valid info.
1264  @param drive The drive to query.
1265  @param start_lba Returns the start lba value
1266  @param end_lba Returns the end lba value
1267  @param flag Bitfield for control purposes (unused yet, submit 0)
1268  @return 1 if lba values are valid , 0 if invalid
1269  @since 0.2.6
1270 */
1271 int burn_drive_get_start_end_lba(struct burn_drive *drive,
1272  int *start_lba, int *end_lba, int flag);
1273 
1274 
1275 /* ts A90902 */
1276 /** Guess the manufacturer name of CD media from the ATIP addresses of lead-in
1277  and lead-out. (Currently only lead-in is interpreted. Lead-out may in
1278  future be used to identify the media type in more detail.)
1279  The parameters of this call should be obtained by burn_disc_read_atip(d),
1280  burn_drive_get_start_end_lba(d, &start_lba, &end_lba, 0),
1281  burn_lba_to_msf(start_lba, &m_li, &s_li, &f_li) and
1282  burn_lba_to_msf(end_lba, &m_lo, &s_lo, &f_lo).
1283  @param m_li "minute" part of ATIP lead-in resp. start_lba
1284  @param s_li "second" of lead-in resp. start_lba
1285  @param f_li "frame" of lead-in
1286  @param m_lo "minute" part of ATIP lead-out
1287  @param s_lo "second" of lead-out
1288  @param f_lo "frame" of lead-out
1289  @param flag Bitfield for control purposes,
1290  bit0= append a text "(aka ...)" to reply if other brands or
1291  vendor names are known.
1292  @return Printable text or NULL on memory shortage.
1293  Dispose by free() when no longer needed.
1294  @since 0.7.2
1295 */
1296 char *burn_guess_cd_manufacturer(int m_li, int s_li, int f_li,
1297  int m_lo, int s_lo, int f_lo, int flag);
1298 
1299 /* ts A90909 */
1300 /** Retrieve some media information which is mainly specific to CD. For other
1301  media only the bits in reply parameter valid are supposed to be meaningful.
1302  @param d The drive to query.
1303  @param disc_type A string saying either "CD-DA or CD-ROM", or "CD-I",
1304  or ""CD-ROM XA", or "undefined".
1305  @param disc_id A 32 bit number read from the media. (Meaning unclear yet)
1306  @param bar_code 8 hex digits from a barcode on media read by the drive
1307  (if the drive has a bar code reader built in).
1308  @param app_code The Host Application Code which must be set in the Write
1309  Parameters Page if the media is not unrestricted (URU==0).
1310  @param valid Replies bits which indicate the validity of other reply
1311  parameters or the state of certain CD info bits:
1312  bit0= disc_type is valid
1313  bit1= disc_id is valid
1314  bit2= bar_code is valid
1315  bit3= disc_app_code is valid
1316  bit4= Disc is unrestricted (URU bit, 51h READ DISC INFO)
1317  This seems to be broken with my drives. The bit is
1318  0 and the validity bit for disc_app_code is 0 too.
1319  bit5= Disc is nominally erasable (Erasable bit)
1320  This will be set with overwriteable media which
1321  libburn normally considers to be unerasable blank.
1322  @return 1 success, <= 0 an error occured
1323  @since 0.7.2
1324 */
1325 int burn_disc_get_cd_info(struct burn_drive *d, char disc_type[80],
1326  unsigned int *disc_id, char bar_code[9], int *app_code,
1327  int *valid);
1328 
1329 /* ts B11201 */
1330 /** Read the array of CD-TEXT packs from the Lead-in of an audio CD.
1331  Each pack consists of 18 bytes, of which 4 are header. 12 bytes are pieces
1332  of 0-terminated texts or binary data. 2 bytes hold a CRC.
1333  For a description of the format of the array, see file doc/cdtext.txt.
1334  @param d The drive to query.
1335  @param text_packs Will point to an allocated memory buffer with CD-TEXT.
1336  It will only contain text packs, and not be prepended
1337  by the TOC header of four bytes, which gets stored with
1338  file cdtext.dat by cdrecord -vv -toc. (The first two of
1339  these bytes are supposed to hold the number of CD-TEXT
1340  bytes + 2. The other two bytes are supposed to be 0.)
1341  Dispose this buffer by free(), when no longer needed.
1342  @param num_packs Will tell the number of text packs, i.e. the number of
1343  bytes in text_packs divided by 18.
1344  @param flag Bitfield for control purposes,
1345  Unused yet. Submit 0.
1346  @return 1 success, 0= no CD-TEXT found, < 0 an error occured
1347  @since 1.2.0
1348 */
1349 int burn_disc_get_leadin_text(struct burn_drive *d,
1350  unsigned char **text_packs, int *num_packs,
1351  int flag);
1352 
1353 /* ts B00924 */
1354 /** Read the current usage of the eventual BD Spare Area. This area gets
1355  reserved on BD media during formatting. During writing it is used to
1356  host replacements of blocks which failed the checkread immediately after
1357  writing.
1358  This call applies only to recordable BD media. I.e. profiles 0x41 to 0x43.
1359  @param d The drive to query.
1360  @param alloc_blocks Returns the number of blocks reserved as Spare Area
1361  @param free_blocks Returns the number of yet unused blocks in that area
1362  @param flag Bitfield for control purposes (unused yet, submit 0)
1363  @return 1 = reply prarameters are valid,
1364  <=0 = reply is invalid (e.g. because no BD profile)
1365  @since 0.8.8
1366 */
1367 int burn_disc_get_bd_spare_info(struct burn_drive *d,
1368  int *alloc_blocks, int *free_blocks, int flag);
1369 
1370 /* ts B10801 */
1371 /** Retrieve some media information which is mainly specific to media of
1372  the DVD-R family: DVD-R , DVD-RW , DVD-R DL , HD DVD-R
1373  Currently the information cannot be retrieved from other media types.
1374  @param d The drive to query.
1375  @param disk_category returns DVD Book to which the media complies
1376  @param book_name returns a pointer to the book name of disk_category.
1377  This memory is static. Do not alter or free it !
1378  @param part_version returns the Media Version in the DVD Book
1379  @param num_layers returns the number of media layers
1380  @param num_blocks returns the number of blocks between pysical start
1381  and physical end of the media
1382  @param flag Bitfield for control purposes (unused yet, submit 0)
1383  @return 1 = reply prarameters are valid,
1384  <=0 = reply is invalid (e.g. because no DVD-R)
1385  @since 1.1.4
1386 */
1387 int burn_disc_get_phys_format_info(struct burn_drive *d, int *disk_category,
1388  char **book_name, int *part_version, int *num_layers,
1389  int *num_blocks, int flag);
1390 
1391 /* ts A61110 */
1392 /** Read start lba and Next Writeable Address of a track from media.
1393  Usually a track lba is obtained from the result of burn_track_get_entry().
1394  This call retrieves an updated lba, eventual nwa, and can address the
1395  invisible track to come.
1396  The drive must be grabbed for this call. One may not issue this call
1397  during ongoing burn_disc_write() or burn_disc_erase().
1398  @param d The drive to query.
1399  @param o If not NULL: write parameters to be set on drive before query
1400  @param trackno 0=next track to come, >0 number of existing track
1401  The first existing track on a CD may have a number higher
1402  than 1. Use burn_session_get_start_tno() to inquire this
1403  start number.
1404  @param lba return value: start lba
1405  @param nwa return value: Next Writeable Address
1406  @return 1=nwa is valid , 0=nwa is not valid , -1=error
1407  @since 0.2.6
1408 */
1409 int burn_disc_track_lba_nwa(struct burn_drive *d, struct burn_write_opts *o,
1410  int trackno, int *lba, int *nwa);
1411 
1412 /* ts B10525 */
1413 /** Tells whether a previous attempt to determine the Next Writeable Address
1414  of the upcomming track reveiled that the READ TRACK INFORMATION Damage Bit
1415  is set for this track, resp. that no valid writable address is available.
1416  See MMC-5 6.27.3.7 Damage Bit, 6.27.3.11 NWA_V (NWA valid)
1417  @param d The drive to query.
1418  @param flag Bitfield for control purposes (unused yet, submit 0)
1419  @return 0= Looks ok: Damage Bit is not set, NWA_V is set
1420  1= Damaged and theoretically writable (NWA_V is set)
1421  2= Not writable: NWA_V is not set
1422  3= Damaged and not writable (NWA_V is not set),
1423  @since 1.1.0
1424 */
1425 int burn_disc_next_track_is_damaged(struct burn_drive *d, int flag);
1426 
1427 /* ts B10527 */
1428 /** Try to close the last track and session of media which have bit0 set in
1429  the return value of call burn_disc_next_track_is_damaged().
1430  Whether it helps depends much on the reason why the media is reported
1431  as damaged by the drive.
1432  This call works only for profiles 0x09 CD-R, 0x0a CD-RW, 0x11 DVD-R,
1433  0x14 DVD-RW sequential, 0x1b DVD+R, 0x2b DVD+R DL, 0x41 BD-R sequential.
1434  Note: After writing it is advised to give up the drive and to grab it again
1435  in order to learn about its view on the new media state.
1436  @param o Write options created by burn_write_opts_new() and
1437  manipulated by burn_write_opts_set_multi().
1438  burn_write_opts_set_write_type() should be set to
1439  BURN_WRITE_TAO, burn_write_opts_set_simulate() should be
1440  set to 0.
1441  @param flag Bitfield for control purposes
1442  bit0= force close, even if no damage was seen
1443  @return <=0 media not marked as damaged, or media type not suitable,
1444  or closing attempted but failed
1445  1= attempt finished without error indication
1446  @since 1.1.0
1447 */
1448 int burn_disc_close_damaged(struct burn_write_opts *o, int flag);
1449 
1450 
1451 /* ts A70131 */
1452 /** Read start lba of the first track in the last complete session.
1453  This is the first parameter of mkisofs option -C. The second parameter
1454  is nwa as obtained by burn_disc_track_lba_nwa() with trackno 0.
1455  @param d The drive to query.
1456  @param start_lba returns the start address of that track
1457  @return <= 0 : failure, 1 = ok
1458  @since 0.3.2
1459 */
1460 int burn_disc_get_msc1(struct burn_drive *d, int *start_lba);
1461 
1462 
1463 /* ts A70213 */
1464 /** Return the best possible estimation of the currently available capacity of
1465  the media. This might depend on particular write option settings. For
1466  inquiring the space with such a set of options, the drive has to be
1467  grabbed and BURN_DRIVE_IDLE. If not, then one will only get a canned value
1468  from the most recent automatic inquiry (e.g. during last drive grabbing).
1469  An eventual start address from burn_write_opts_set_start_byte() will be
1470  subtracted from the obtained capacity estimation. Negative results get
1471  defaulted to 0.
1472  If the drive is actually a file in a large filesystem or a large block
1473  device, then the capacity is curbed to a maximum of 0x7ffffff0 blocks
1474  = 4 TB - 32 KB.
1475  @param d The drive to query.
1476  @param o If not NULL: write parameters to be set on drive before query
1477  @return number of most probably available free bytes
1478  @since 0.3.4
1479 */
1480 off_t burn_disc_available_space(struct burn_drive *d,
1481  struct burn_write_opts *o);
1482 
1483 /* ts A61202 */
1484 /** Tells the MMC Profile identifier of the loaded media. The drive must be
1485  grabbed in order to get a non-zero result.
1486  libburn currently writes only to profiles
1487  0x09 "CD-R"
1488  0x0a "CD-RW"
1489  0x11 "DVD-R sequential recording"
1490  0x12 "DVD-RAM"
1491  0x13 "DVD-RW restricted overwrite"
1492  0x14 "DVD-RW sequential recording",
1493  0x15 "DVD-R/DL sequential recording",
1494  0x1a "DVD+RW"
1495  0x1b "DVD+R",
1496  0x2b "DVD+R/DL",
1497  0x41 "BD-R sequential recording",
1498  0x43 "BD-RE",
1499  0xffff "stdio file"
1500  Note: 0xffff is not a MMC profile but a libburn invention.
1501  Read-only are the profiles
1502  0x08 "CD-ROM",
1503  0x10 "DVD-ROM",
1504  0x40 "BD-ROM",
1505  Read-only for now is this BD-R profile (testers wanted)
1506  0x42 "BD-R random recording"
1507  Empty drives are supposed to report
1508  0x00 ""
1509  @param d The drive where the media is inserted.
1510  @param pno Profile Number. See also mmc5r03c.pdf, table 89
1511  @param name Profile Name (see above list, unknown profiles have empty name)
1512  @return 1 profile is valid, 0 no profile info available
1513  @since 0.3.0
1514 */
1515 int burn_disc_get_profile(struct burn_drive *d, int *pno, char name[80]);
1516 
1517 
1518 /* ts A90903 : API */
1519 /** Obtain product id and standards defined media codes.
1520  The product id is a printable string which is supposed to be the same
1521  for identical media but should vary with non-identical media. Some media
1522  do not allow to obtain such an id at all.
1523  The pair (profile_number, product_id) should be the best id to identify
1524  media with identical product specifications.
1525  The reply parameters media_code1 and media_code2 can be used with
1526  burn_guess_manufacturer()
1527  The reply parameters have to be disposed by free() when no longer needed.
1528  @param d The drive where the media is inserted.
1529  @param product_id Reply: Printable text depicting manufacturer and
1530  eventually media id.
1531  @param media_code1 Reply: The eventual manufacturer identification as read
1532  from DVD/BD media or a text "XXmYYsZZf" from CD media
1533  ATIP lead-in.
1534  @param media_code2 The eventual media id as read from DVD+/BD media or a
1535  text "XXmYYsZZf" from CD ATIP lead-out.
1536  @param book_type Book type text for DVD and BD.
1537  Caution: is NULL with CD, even if return value says ok.
1538  @param flag Bitfield for control purposes
1539  bit0= do not escape " _/" (not suitable for
1540  burn_guess_manufacturer())
1541  @return 1= ok, product_id and media codes are valid,
1542  0= no product id_available, reply parameters are NULL
1543  <0= error
1544  @since 0.7.2
1545 */
1546 int burn_disc_get_media_id(struct burn_drive *d,
1547  char **product_id, char **media_code1, char **media_code2,
1548  char **book_type, int flag);
1549 
1550 
1551 /* ts A90904 */
1552 /** Guess the name of a manufacturer by profile number, manufacturer code
1553  and media code. The profile number can be obtained by
1554  burn_disc_get_profile(), the other two parameters can be obtained as
1555  media_code1 and media_code2 by burn_get_media_product_id().
1556  @param profile_no Profile number (submit -1 if not known)
1557  @param manuf_code Manufacturer code from media (e.g. "RICOHJPN")
1558  @param media_code Media ID code from media (e.g. "W11")
1559  @param flag Bitfield for control purposes, submit 0
1560  @return Printable text or NULL on memory shortage.
1561  If the text begins with "Unknown " then no item of the
1562  manufacturer list matched the codes.
1563  Dispose by free() when no longer needed.
1564  @since 0.7.2
1565 */
1566 char *burn_guess_manufacturer(int profile_no,
1567  char *manuf_code, char *media_code, int flag);
1568 
1569 
1570 /** Tells whether a disc can be erased or not
1571  @param d The drive to inquire.
1572  @return Non-zero means erasable
1573 */
1574 int burn_disc_erasable(struct burn_drive *d);
1575 
1576 /** Returns the progress and status of a drive.
1577  @param drive The drive to query busy state for.
1578  @param p Returns the progress of the operation, NULL if you don't care
1579  @return the current status of the drive. See also burn_drive_status.
1580 */
1581 enum burn_drive_status burn_drive_get_status(struct burn_drive *drive,
1582  struct burn_progress *p);
1583 
1584 /** Creates a write_opts struct for burning to the specified drive.
1585  The returned object must later be freed with burn_write_opts_free().
1586  @param drive The drive to write with
1587  @return The write_opts, NULL on error
1588 */
1589 struct burn_write_opts *burn_write_opts_new(struct burn_drive *drive);
1590 
1591 
1592 /* ts A70901 */
1593 /** Inquires the drive associated with a burn_write_opts object.
1594  @param opts object to inquire
1595  @return pointer to drive
1596  @since 0.4.0
1597 */
1598 struct burn_drive *burn_write_opts_get_drive(struct burn_write_opts *opts);
1599 
1600 
1601 /** Frees a write_opts struct created with burn_write_opts_new
1602  @param opts write_opts to free
1603 */
1604 void burn_write_opts_free(struct burn_write_opts *opts);
1605 
1606 /** Creates a read_opts struct for reading from the specified drive
1607  must be freed with burn_read_opts_free
1608  @param drive The drive to read from
1609  @return The read_opts
1610 */
1611 struct burn_read_opts *burn_read_opts_new(struct burn_drive *drive);
1612 
1613 /** Frees a read_opts struct created with burn_read_opts_new
1614  @param opts write_opts to free
1615 */
1616 void burn_read_opts_free(struct burn_read_opts *opts);
1617 
1618 /** Erase a disc in the drive. The drive must be grabbed successfully BEFORE
1619  calling this functions. Always ensure that the drive reports a status of
1620  BURN_DISC_FULL before calling this function. An erase operation is not
1621  cancellable, as control of the operation is passed wholly to the drive and
1622  there is no way to interrupt it safely.
1623  @param drive The drive with which to erase a disc.
1624  Only drive roles 1 (MMC) and 5 (stdio random write-only)
1625  support erasing.
1626  @param fast Nonzero to do a fast erase, where only the disc's headers are
1627  erased; zero to erase the entire disc.
1628  With DVD-RW, fast blanking yields media capable only of DAO.
1629 */
1630 void burn_disc_erase(struct burn_drive *drive, int fast);
1631 
1632 
1633 /* ts A70101 - A70417 */
1634 /** Format media for use with libburn. This currently applies to DVD-RW
1635  in state "Sequential Recording" (profile 0014h) which get formatted to
1636  state "Restricted Overwrite" (profile 0013h). DVD+RW can be "de-iced"
1637  by setting bit2 of flag. DVD-RAM and BD-RE may get formatted initially
1638  or re-formatted to adjust their Defect Managment.
1639  This function usually returns while the drive is still in the process
1640  of formatting. The formatting is done, when burn_drive_get_status()
1641  returns BURN_DRIVE_IDLE. This may be immediately after return or may
1642  need several thousand seconds to occur.
1643  @param drive The drive with the disc to format.
1644  @param size The size in bytes to be used with the format command. It should
1645  be divisible by 32*1024. The effect of this parameter may
1646  depend on the media profile and on parameter flag.
1647  @param flag Bitfield for control purposes:
1648  bit0= after formatting, write the given number of zero-bytes
1649  to the media and eventually perform preliminary closing.
1650  bit1+2: size mode
1651  0 = use parameter size as far as it makes sense
1652  1 = insist in size 0 even if there is a better default known
1653  (on DVD-RAM or BD-R identical to size mode 0,
1654  i.e. they never get formatted with payload size 0)
1655  2 = without bit7: format to maximum available size
1656  with bit7 : take size from indexed format descriptor
1657  3 = without bit7: format to default size
1658  with bit7 : take size from indexed format descriptor
1659  bit3= -reserved-
1660  bit4= enforce re-format of (partly) formatted media
1661  bit5= try to disable eventual defect management
1662  bit6= try to avoid lengthy media certification
1663  bit7, bit8 to bit15 =
1664  bit7 enables MMC expert application mode (else libburn
1665  tries to choose a suitable format type):
1666  If it is set then bit8 to bit15 contain the index of
1667  the format to use. See burn_disc_get_formats(),
1668  burn_disc_get_format_descr().
1669  Acceptable types are: 0x00, 0x01, 0x10, 0x11, 0x13,
1670  0x15, 0x26, 0x30, 0x31, 0x32.
1671  If bit7 is set, then bit4 is set automatically.
1672  bit16= enable POW on blank BD-R
1673  @since 0.3.0
1674 */
1675 void burn_disc_format(struct burn_drive *drive, off_t size, int flag);
1676 
1677 
1678 /* ts A70112 */
1679 /* @since 0.3.0 */
1680 /** Possible formatting status values */
1681 #define BURN_FORMAT_IS_UNFORMATTED 1
1682 #define BURN_FORMAT_IS_FORMATTED 2
1683 #define BURN_FORMAT_IS_UNKNOWN 3
1684 
1685 /* ts A70112 */
1686 /** Inquire the formatting status, the associated sizes and the number of
1687  available formats. The info is media specific and stems from MMC command
1688  23h READ FORMAT CAPACITY. See mmc5r03c.pdf 6.24 for background details.
1689  Media type can be determined via burn_disc_get_profile().
1690  @param drive The drive with the disc to format.
1691  @param status The current formatting status of the inserted media.
1692  See BURN_FORMAT_IS_* macros. Note: "unknown" is the
1693  legal status for quick formatted, yet unwritten DVD-RW.
1694  @param size The size in bytes associated with status.
1695  unformatted: the maximum achievable size of the media
1696  formatted: the currently formatted capacity
1697  unknown: maximum capacity of drive or of media
1698  @param bl_sas Additional info "Block Length/Spare Area Size".
1699  Expected to be constantly 2048 for non-BD media.
1700  @param num_formats The number of available formats. To be used with
1701  burn_disc_get_format_descr() to obtain such a format
1702  and eventually with burn_disc_format() to select one.
1703  @return 1 reply is valid , <=0 failure
1704  @since 0.3.0
1705 */
1706 int burn_disc_get_formats(struct burn_drive *drive, int *status, off_t *size,
1707  unsigned *bl_sas, int *num_formats);
1708 
1709 /* ts A70112 */
1710 /** Inquire parameters of an available media format.
1711  @param drive The drive with the disc to format.
1712  @param index The index of the format item. Beginning with 0 up to reply
1713  parameter from burn_disc_get_formats() : num_formats - 1
1714  @param type The format type. See mmc5r03c.pdf, 6.5, 04h FORMAT UNIT.
1715  0x00=full, 0x10=CD-RW/DVD-RW full, 0x11=CD-RW/DVD-RW grow,
1716  0x15=DVD-RW quick, 0x13=DVD-RW quick grow,
1717  0x26=DVD+RW background, 0x30=BD-RE with spare areas,
1718  0x31=BD-RE without spare areas
1719  @param size The maximum size in bytes achievable with this format.
1720  @param tdp Type Dependent Parameter. See mmc5r03c.pdf.
1721  @return 1 reply is valid , <=0 failure
1722  @since 0.3.0
1723 */
1724 int burn_disc_get_format_descr(struct burn_drive *drive, int index,
1725  int *type, off_t *size, unsigned *tdp);
1726 
1727 
1728 
1729 /* ts A61109 : this was and is defunct */
1730 /** Read a disc from the drive and write it to an fd pair. The drive must be
1731  grabbed successfully BEFORE calling this function. Always ensure that the
1732  drive reports a status of BURN_DISC_FULL before calling this function.
1733  @param drive The drive from which to read a disc.
1734  @param o The options for the read operation.
1735 */
1736 void burn_disc_read(struct burn_drive *drive, const struct burn_read_opts *o);
1737 
1738 
1739 
1740 /* ts A70222 */
1741 /* @since 0.3.4 */
1742 /** The length of a rejection reasons string for burn_precheck_write() and
1743  burn_write_opts_auto_write_type() .
1744 */
1745 #define BURN_REASONS_LEN 4096
1746 
1747 
1748 /* ts A70219 */
1749 /** Examines a completed setup for burn_disc_write() whether it is permissible
1750  with drive and media. This function is called by burn_disc_write() but
1751  an application might be interested in this check in advance.
1752  @param o The options for the writing operation.
1753  @param disc The descrition of the disc to be created
1754  @param reasons Eventually returns a list of rejection reason statements
1755  @param silent 1= do not issue error messages , 0= report problems
1756  @return 1 ok, -1= no recordable media detected, 0= other failure
1757  @since 0.3.4
1758 */
1759 int burn_precheck_write(struct burn_write_opts *o, struct burn_disc *disc,
1760  char reasons[BURN_REASONS_LEN], int silent);
1761 
1762 
1763 /** Write a disc in the drive. The drive must be grabbed successfully before
1764  calling this function. Always ensure that the drive reports a status of
1765  BURN_DISC_BLANK ot BURN_DISC_APPENDABLE before calling this function.
1766  Note: write_type BURN_WRITE_SAO is currently not capable of writing a mix
1767  of data and audio tracks. You must use BURN_WRITE_TAO for such sessions.
1768  To be set by burn_write_opts_set_write_type().
1769  Note: This function is not suitable for overwriting data in the middle of
1770  a valid data area because it is allowed to append trailing data.
1771  For exact random access overwriting use burn_random_access_write().
1772  Note: After writing it is advised to give up the drive and to grab it again
1773  in order to learn about its view on the new media state.
1774  Note: Before mounting the written media it might be necessary to eject
1775  and reload in order to allow the operating system to notice the new
1776  media state.
1777  @param o The options for the writing operation.
1778  @param disc The struct burn_disc * that described the disc to be created
1779 */
1780 void burn_disc_write(struct burn_write_opts *o, struct burn_disc *disc);
1781 
1782 
1783 /* ts A90227 */
1784 /** Control stream recording during the write run and eventually set the start
1785  LBA for stream recording.
1786  Stream recording is set from struct burn_write_opts when the write run
1787  gets started. See burn_write_opts_set_stream_recording().
1788  The call described here can be used later to override this setting and
1789  to program automatic switching at a given LBA. It also affects subsequent
1790  calls to burn_random_access_write().
1791  @param drive The drive which performs the write operation.
1792  @param recmode -1= disable stream recording
1793  0= leave setting as is
1794  1= enable stream recording
1795  @param start The LBA where actual stream recording shall start.
1796  (0 means unconditional stream recording)
1797  @param flag Bitfield for control purposes (unused yet, submit 0).
1798  @return 1=success , <=0 failure
1799  @since 0.6.4
1800 */
1801 int burn_drive_set_stream_recording(struct burn_drive *drive, int recmode,
1802  int start, int flag);
1803 
1804 /** Cancel an operation on a drive.
1805  This will only work when the drive's busy state is BURN_DRIVE_READING or
1806  BURN_DRIVE_WRITING.
1807  @param drive The drive on which to cancel the current operation.
1808 */
1809 void burn_drive_cancel(struct burn_drive *drive);
1810 
1811 
1812 /* ts A61223 */
1813 /** Inquire whether the most recent asynchronous media job was successful.
1814  This applies to burn_disc_erase(), burn_disc_format(), burn_disc_write().
1815  Reasons for non-success may be: rejection of burn parameters, abort due to
1816  fatal errors during write, blank or format, a call to burn_drive_cancel()
1817  by the application thread.
1818  @param d The drive to inquire.
1819  @return 1=burn seems to have went well, 0=burn failed
1820  @since 0.2.6
1821 */
1822 int burn_drive_wrote_well(struct burn_drive *d);
1823 
1824 
1825 /* ts B31023 */
1826 /** Inquire whether a write error occured which is suspected to have happened
1827  due to a false report about DVD-RW capability to be written in write type
1828  BURN_WRITE_TAO.
1829  @param d The drive to inquire.
1830  @return 1= it seems that BURN_WRITE_TAO on DVD-RW caused error,
1831  0= it does not seem so
1832  @since 1.3.4
1833 */
1834 int burn_drive_was_feat21_failure(struct burn_drive *d);
1835 
1836 
1837 /** Convert a minute-second-frame (MSF) value to sector count
1838  @param m Minute component
1839  @param s Second component
1840  @param f Frame component
1841  @return The sector count
1842 */
1843 int burn_msf_to_sectors(int m, int s, int f);
1844 
1845 /** Convert a sector count to minute-second-frame (MSF)
1846  @param sectors The sector count
1847  @param m Returns the minute component
1848  @param s Returns the second component
1849  @param f Returns the frame component
1850 */
1851 void burn_sectors_to_msf(int sectors, int *m, int *s, int *f);
1852 
1853 /** Convert a minute-second-frame (MSF) value to an lba
1854  @param m Minute component
1855  @param s Second component
1856  @param f Frame component
1857  @return The lba
1858 */
1859 int burn_msf_to_lba(int m, int s, int f);
1860 
1861 /** Convert an lba to minute-second-frame (MSF)
1862  @param lba The lba
1863  @param m Returns the minute component
1864  @param s Returns the second component
1865  @param f Returns the frame component
1866 */
1867 void burn_lba_to_msf(int lba, int *m, int *s, int *f);
1868 
1869 /** Create a new disc
1870  @return Pointer to a burn_disc object or NULL on failure.
1871 */
1872 struct burn_disc *burn_disc_create(void);
1873 
1874 /** Delete disc and decrease the reference count on all its sessions
1875  @param d The disc to be freed
1876 */
1877 void burn_disc_free(struct burn_disc *d);
1878 
1879 /** Create a new session
1880  @return Pointer to a burn_session object or NULL on failure.
1881  */
1882 struct burn_session *burn_session_create(void);
1883 
1884 /** Free a session (and decrease reference count on all tracks inside)
1885  @param s Session to be freed
1886 */
1887 void burn_session_free(struct burn_session *s);
1888 
1889 /** Add a session to a disc at a specific position, increasing the
1890  sessions's reference count.
1891  @param d Disc to add the session to
1892  @param s Session to add to the disc
1893  @param pos position to add at (BURN_POS_END is "at the end")
1894  @return 0 for failure, 1 for success
1895 */
1896 int burn_disc_add_session(struct burn_disc *d, struct burn_session *s,
1897  unsigned int pos);
1898 
1899 /** Remove a session from a disc
1900  @param d Disc to remove session from
1901  @param s Session pointer to find and remove
1902 */
1903 int burn_disc_remove_session(struct burn_disc *d, struct burn_session *s);
1904 
1905 
1906 /* ts B11219 */
1907 /** Read a CDRWIN cue sheet file and equip the session object by tracks and
1908  CD-TEXT according to the content of the file.
1909  For a description of CDRWIN file format see
1910  http://digitalx.org/cue-sheet/syntax/
1911  Fully supported commands are:
1912  CATALOG , CDTEXTFILE , FLAGS , INDEX , ISRC , PERFORMER ,
1913  POSTGAP , PREGAP , REM , SONGWRITER , TITLE
1914  Further supported commands introduced by cdrecord (usage like PERFORMER):
1915  ARRANGER , COMPOSER , MESSAGE
1916  Partly supported commands are:
1917  FILE which supports only types BINARY , MOTOROLA , WAVE
1918  TRACK which supports only datatypes AUDIO , MODE1/2048
1919  Unsupported types of FILE or TRACK lead to failure of the call.
1920  libburn does not yet support mixing of AUDIO and MODE1/2048. So this call
1921  will fail if such a mix is found.
1922  CD-TEXT information is allowed only if all tracks are of datatype AUDIO.
1923  Empty lines and lines which start by '#' are ignored.
1924  @param session Session where to attach tracks. It must not yet have
1925  tracks or else this call will fail.
1926  @param path Filesystem address of the CDRWIN cue sheet file.
1927  Normally with suffix .cue
1928  @param fifo_size Number of bytes in fifo. This will be rounded up by
1929  the block size of the track mode. <= 0 means no fifo.
1930  @param fifo Returns a reference to the burn_source object that
1931  was installed as fifo between FILE and the track
1932  burn sources. One may use this to inquire the fifo
1933  state. Dispose it by burn_source_free() when no longer
1934  needed. It is permissible to pass this parameter to
1935  libburn as NULL, in order to immediately drop ownership
1936  on the fifo.
1937  @param text_packs Returns pre-formatted CD-TEXT packs resulting from
1938  cue sheet command CDTEXTFILE. To be used with call
1939  burn_write_opts_set_leadin_text().
1940  It is permissible to pass this parameter to libburn
1941  as NULL, in order to disable CDTEXTFILE.
1942  @param num_packs Returns the number of 18 byte records in text_packs.
1943  @param flag Bitfield for control purposes.
1944  bit0= Do not attach CD-TEXT information to session and
1945  tracks. Do not load text_packs.
1946  bit1= Do not use media catalog string of session or ISRC
1947  strings of tracks for writing to Q sub-channel.
1948  @return > 0 indicates success, <= 0 indicates failure
1949  @since 1.2.0
1950 */
1951 int burn_session_by_cue_file(struct burn_session *session,
1952  char *path, int fifo_size, struct burn_source **fifo,
1953  unsigned char **text_packs, int *num_packs, int flag);
1954 
1955 
1956 /** Create a track */
1957 struct burn_track *burn_track_create(void);
1958 
1959 /** Free a track
1960  @param t Track to free
1961 */
1962 void burn_track_free(struct burn_track *t);
1963 
1964 /** Add a track to a session at specified position
1965  @param s Session to add to
1966  @param t Track to insert in session
1967  @param pos position to add at (BURN_POS_END is "at the end")
1968  @return 0 for failure, 1 for success
1969 */
1970 int burn_session_add_track(struct burn_session *s, struct burn_track *t,
1971  unsigned int pos);
1972 
1973 /** Remove a track from a session
1974  @param s Session to remove track from
1975  @param t Track pointer to find and remove
1976  @return 0 for failure, 1 for success
1977 */
1978 int burn_session_remove_track(struct burn_session *s, struct burn_track *t);
1979 
1980 
1981 /* ts B20107 */
1982 /** Set the number which shall be written as CD track number with the first
1983  track of the session. The following tracks will then get written with
1984  consecutive CD track numbers. The resulting number of the last track
1985  must not exceed 99. The lowest possible start number is 1, which is also
1986  the default. This setting applies only to CD SAO writing.
1987  @param session The session to be manipulated
1988  @param tno A number between 1 and 99
1989  @param flag Bitfield for control purposes. Unused yet. Submit 0.
1990  @return > 0 indicates success, <= 0 indicates failure
1991  @since 1.2.0
1992 */
1993 int burn_session_set_start_tno(struct burn_session *session, int tno,
1994  int flag);
1995 
1996 /* ts B20108 */
1997 /** Inquire the CD track start number, as set by default or by
1998  burn_session_set_start_tno().
1999  @param session The session to be inquired
2000  @param flag Bitfield for control purposes. Unused yet. Submit 0.
2001  @return > 0 is the currently set CD track start number
2002  <= 0 indicates failure
2003  @since 1.2.0
2004 */
2005 int burn_session_get_start_tno(struct burn_session *session, int flag);
2006 
2007 
2008 
2009 /* ts B11206 */
2010 /** Set the Character Codes, the Copyright bytes, and the Language Codes
2011  for CD-TEXT blocks 0 to 7. They will be used in the block summaries
2012  of text packs which get generated from text or binary data submitted
2013  by burn_session_set_cdtext() and burn_track_set_cdtext().
2014  Character Code value can be
2015  0x00 = ISO-8859-1
2016  0x01 = 7 bit ASCII
2017  0x80 = MS-JIS (japanesei Kanji, double byte characters)
2018  Copyright byte value can be
2019  0x00 = not copyrighted
2020  0x03 = copyrighted
2021  Language Code value will typically be 0x09 = English or 0x69 = Japanese.
2022  See below macros BURN_CDTEXT_LANGUAGES_0X00 and BURN_CDTEXT_LANGUAGES_0X45,
2023  but be aware that many of these codes have never been seen on CD, and that
2024  many of them do not have a character representation among the above
2025  Character Codes.
2026  Default is 0x09 = English for block 0 and 0x00 = Unknown for block 1 to 7.
2027  Copyright and Character Code are 0x00 for all blocks by default.
2028  See also file doc/cdtext.txt, "Format of a CD-TEXT packs array",
2029  "Pack type 0x8f".
2030 
2031  Parameter value -1 leaves the current setting of the session parameter
2032  unchanged.
2033  @param s Session where to change settings
2034  @param char_codes Character Codes for block 0 to 7
2035  @param copyrights Copyright bytes for block 0 to 7
2036  @param languages Language Codes for block 0 to 7
2037  @param flag Bitfiled for control purposes. Unused yet. Submit 0.
2038  @return <=0 failure, > 0 success
2039  @since 1.2.0
2040 */
2041 int burn_session_set_cdtext_par(struct burn_session *s,
2042  int char_codes[8], int copyrights[8],
2043  int languages[8], int flag);
2044 
2045 /** This is the first list of languages sorted by their Language codes,
2046  which start at 0x00. They stem from from EBU Tech 3264, appendix 3.
2047  E.g. language 0x00 is "Unknown", 0x08 is "German", 0x10 is "Frisian",
2048  0x18 is "Latvian", 0x20 is "Polish", 0x28 is "Swedish", 0x2b is "Wallon".
2049  See also file doc/cdtext.txt.
2050  @since 1.2.0
2051 */
2052 #define BURN_CDTEXT_LANGUAGES_0X00 \
2053  "Unknown", "Albanian", "Breton", "Catalan", \
2054  "Croatian", "Welsh", "Czech", "Danish", \
2055  "German", "English", "Spanish", "Esperanto", \
2056  "Estonian", "Basque", "Faroese", "French", \
2057  "Frisian", "Irish", "Gaelic", "Galician", \
2058  "Icelandic", "Italian", "Lappish", "Latin", \
2059  "Latvian", "Luxembourgian", "Lithuanian", "Hungarian", \
2060  "Maltese", "Dutch", "Norwegian", "Occitan", \
2061  "Polish", "Portuguese", "Romanian", "Romansh", \
2062  "Serbian", "Slovak", "Slovenian", "Finnish", \
2063  "Swedish", "Turkish", "Flemish", "Wallon"
2064 
2065 /** This is the second list of languages sorted by their Language codes,
2066  which start at 0x45. They stem from from EBU Tech 3264, appendix 3.
2067  E.g. language 0x45 is "Zulu", 0x50 is "Sranan Tongo", 0x58 is "Pushtu",
2068  0x60 is "Moldavian", 0x68 is "Kannada", 0x70 is "Greek", 0x78 is "Bengali",
2069  0x7f is "Amharic".
2070  See also file doc/cdtext.txt.
2071  @since 1.2.0
2072 */
2073 #define BURN_CDTEXT_LANGUAGES_0X45 \
2074  "Zulu", "Vietnamese", "Uzbek", \
2075  "Urdu", "Ukrainian", "Thai", "Telugu", \
2076  "Tatar", "Tamil", "Tadzhik", "Swahili", \
2077  "Sranan Tongo", "Somali", "Sinhalese", "Shona", \
2078  "Serbo-croat", "Ruthenian", "Russian", "Quechua", \
2079  "Pushtu", "Punjabi", "Persian", "Papamiento", \
2080  "Oriya", "Nepali", "Ndebele", "Marathi", \
2081  "Moldavian", "Malaysian", "Malagasay", "Macedonian", \
2082  "Laotian", "Korean", "Khmer", "Kazakh", \
2083  "Kannada", "Japanese", "Indonesian", "Hindi", \
2084  "Hebrew", "Hausa", "Gurani", "Gujurati", \
2085  "Greek", "Georgian", "Fulani", "Dari", \
2086  "Churash", "Chinese", "Burmese", "Bulgarian", \
2087  "Bengali", "Bielorussian", "Bambora", "Azerbaijani", \
2088  "Assamese", "Armenian", "Arabic", "Amharic"
2089 
2090 /* This is the list of empty languages names between 0x30 and 0x44.
2091  Together the three macros fill an array of 128 char pointers.
2092  static char *languages[] = {
2093  BURN_CDTEXT_LANGUAGES_0X00,
2094  BURN_CDTEXT_FILLER,
2095  BURN_CDTEXT_LANGUAGES_0X45
2096  };
2097 */
2098 #define BURN_CDTEXT_FILLER \
2099  "", "", "", "", \
2100  "", "", "", "", \
2101  "", "", "", "", \
2102  "", "", "", "", \
2103  "", "", "", "", \
2104  "", "", "", "", \
2105  ""
2106 
2107 /* ts B11206 */
2108 /** Obtain the current settings as of burn_session_set_cdtext_par() resp.
2109  by default.
2110  @param s Session which to inquire
2111  @param char_codes Will return Character Codes for block 0 to 7
2112  @param copyrights Will return Copyright bytes for block 0 to 7
2113  @param block_languages Will return Language Codes for block 0 to 7
2114  @param flag Bitfiled for control purposes. Unused yet. Submit 0.
2115  @return <=0 failure, reply invalid, > 0 success, reply valid
2116  @since 1.2.0
2117 */
2118 int burn_session_get_cdtext_par(struct burn_session *s,
2119  int char_codes[8], int copyrights[8],
2120  int block_languages[8], int flag);
2121 
2122 
2123 /* ts B11206 */
2124 /** Attach text or binary data as CD-TEXT attributes to a session.
2125  They can be used to generate CD-TEXT packs by burn_cdtext_from_session()
2126  or to write CD-TEXT packs into the lead-in of a CD SAO session.
2127  The latter happens only if no array of CD-TEXT packs is attached to
2128  the write options by burn_write_opts_set_leadin_text().
2129  For details of the CD-TEXT format and of the payload content, see file
2130  doc/cdtext.txt .
2131  @param s Session where to attach CD-TEXT attribute
2132  @param block Number of the language block in which the attribute
2133  shall appear. Possible values: 0 to 7.
2134  @param pack_type Pack type number. 0x80 to 0x8e. Used if pack_type_name
2135  is NULL or empty text. Else submit 0 and a name.
2136  Pack type 0x8f is generated automatically and may not
2137  be set by applications.
2138  @param pack_type_name The pack type by name. Defined names are:
2139  0x80 = "TITLE" 0x81 = "PERFORMER"
2140  0x82 = "SONGWRITER" 0x83 = "COMPOSER"
2141  0x84 = "ARRANGER" 0x85 = "MESSAGE"
2142  0x86 = "DISCID" 0x87 = "GENRE"
2143  0x88 = "TOC" 0x89 = "TOC2"
2144  0x8d = "CLOSED" 0x8e = "UPC_ISRC"
2145  Names are recognized uppercase and lowercase.
2146  @param payload Text or binary bytes. The data will be copied to
2147  session-internal memory.
2148  Pack types 0x80 to 0x85 contain 0-terminated cleartext
2149  encoded according to the block's Character Code.
2150  If double byte characters are used, then two 0-bytes
2151  terminate the cleartext.
2152  Pack type 0x86 is 0-terminated ASCII cleartext.
2153  Pack type 0x87 consists of two byte big-endian
2154  Genre code (see below BURN_CDTEXT_GENRE_LIST), and
2155  0-terminated ASCII cleartext of genre description.
2156  Pack type 0x88 mirrors the session table-of-content.
2157  Pack type 0x89 is not understood yet.
2158  Pack types 0x8a to 0x8c are reserved.
2159  Pack type 0x8d contains ISO-8859-1 cleartext which is
2160  not to be shown by commercial audio CD players.
2161  Pack type 0x8e is ASCII cleartext with UPC/EAN code.
2162  @param length Number of bytes in payload. Including terminating
2163  0-bytes.
2164  @param flag Bitfield for control purposes.
2165  bit0= payload contains double byte characters
2166  (with character code 0x80 MS-JIS japanese Kanji)
2167  @return > 0 indicates success , <= 0 is failure
2168  @since 1.2.0
2169 */
2170 int burn_session_set_cdtext(struct burn_session *s, int block,
2171  int pack_type, char *pack_type_name,
2172  unsigned char *payload, int length, int flag);
2173 
2174 
2175 /** This is the list of Genres sorted by their Genre codes.
2176  E.g. genre code 0x0000 is "No Used", 0x0008 is "Dance, 0x0010 is "Musical",
2177  0x0018 is "Rhythm & Blues", 0x001b is "World Music".
2178  See also file doc/cdtext.txt.
2179  @since 1.2.0
2180 */
2181 #define BURN_CDTEXT_GENRE_LIST \
2182  "Not Used", "Not Defined", "Adult Contemporary", "Alternative Rock", \
2183  "Childrens Music", "Classical", "Contemporary Christian", "Country", \
2184  "Dance", "Easy Listening", "Erotic", "Folk", \
2185  "Gospel", "Hip Hop", "Jazz", "Latin", \
2186  "Musical", "New Age", "Opera", "Operetta", \
2187  "Pop Music", "Rap", "Reggae", "Rock Music", \
2188  "Rhythm & Blues", "Sound Effects", "Spoken Word", "World Music"
2189 
2190 /* The number of genre names in BURN_CDTEXT_GENRE_LIST.
2191 */
2192 #define BURN_CDTEXT_NUM_GENRES 28
2193 
2194 
2195 /* ts B11206 */
2196 /** Obtain a CD-TEXT attribute that was set by burn_session_set_cdtext()
2197  @param s Session to inquire
2198  @param block Number of the language block to inquire.
2199  @param pack_type Pack type number to inquire. Used if pack_type_name
2200  is NULL or empty text. Else submit 0 and a name.
2201  Pack type 0x8f is generated automatically and may not
2202  be inquire in advance. Use burn_cdtext_from_session()
2203  to generate all packs including type 0x8f packs.
2204  @param pack_type_name The pack type by name.
2205  See above burn_session_set_cdtext().
2206  @param payload Will return a pointer to text or binary bytes.
2207  Not a copy of data. Do not free() this address.
2208  If no text attribute is attached for pack type and
2209  block, then payload is returned as NULL. The return
2210  value will not indicate error in this case.
2211  @param length Will return the number of bytes pointed to by payload.
2212  Including terminating 0-bytes.
2213  @param flag Bitfield for control purposes. Unused yet. Submit 0.
2214  @return 1 single byte char, 2 double byte char, <=0 error
2215  @since 1.2.0
2216 */
2217 int burn_session_get_cdtext(struct burn_session *s, int block,
2218  int pack_type, char *pack_type_name,
2219  unsigned char **payload, int *length, int flag);
2220 
2221 
2222 /* ts B11215 */
2223 /** Read a Sony CD-TEXT Input Sheet Version 0.7T file and attach its text
2224  attributes to the given session and its tracks for the given CD-TEXT
2225  block number. This overrides previous settings made by
2226  burn_session_set_cdtext(), burn_track_set_cdtext(), burn_track_set_isrc(),
2227  burn_session_set_start_tno(). It can later be overridden by said function
2228  calls.
2229  The media catalog number from purpose specifier "UPC / EAN" gets into
2230  effect only if burn_write_opts_set_has_mediacatalog() is set to 0.
2231  The format of a v07t sheet file is documented in doc/cdtext.txt.
2232  @param session Session where to attach CD-TEXT attributes
2233  @param path Local filesystem address of the sheet file which
2234  shall be read and interpreted.
2235  @param block Number of the language block in which the attributes
2236  shall appear. Possible values: 0 to 7.
2237  @param flag Bitfield for control purposes.
2238  bit0= Permission to read multiple blocks from the
2239  given sheet file. Each block is supposed to begin
2240  by a line "Input Sheet Version = 0.7T". Therefore
2241  this permission is only valid if the input file
2242  begins by such a line.
2243  @since 1.3.2
2244  bit1= Do not use media catalog string of session or ISRC
2245  strings of tracks for writing to Q sub-channel.
2246  @since 1.2.0
2247  @return > 0 indicates success and the number of interpreted
2248  blocks (1 if not flag bit0 is set).
2249  <= 0 indicates failure
2250  @since 1.2.0
2251 */
2252 int burn_session_input_sheet_v07t(struct burn_session *session,
2253  char *path, int block, int flag);
2254 
2255 
2256 /* ts B11210 */
2257 /** Produce an array of CD-TEXT packs that could be submitted to
2258  burn_write_opts_set_leadin_text(), or stored as *.cdt file,
2259  or submitted to burn_make_input_sheet_v07t().
2260  For a description of the format of the array, see file doc/cdtext.txt.
2261  The input data stem from burn_session_set_cdtext_par(),
2262  burn_session_set_cdtext(), and burn_track_set_cdtext().
2263  @param s Session from which to produce CD-TEXT packs.
2264  @param text_packs Will return the buffer with the CD-TEXT packs.
2265  Dispose by free() when no longer needed.
2266  @param num_packs Will return the number of 18 byte text packs.
2267  @param flag Bitfield for control purposes.
2268  bit0= do not return generated CD-TEXT packs,
2269  but check whether production would work and
2270  indicate the number of packs by the call return
2271  value. This happens also if
2272  (text_packs == NULL || num_packs == NULL).
2273  @return Without flag bit0: > 0 is success, <= 0 failure
2274  With flag bit0: > 0 is number of packs,
2275  0 means no packs will be generated,
2276  < 0 means failure
2277  @since 1.2.0
2278 */
2279 int burn_cdtext_from_session(struct burn_session *s,
2280  unsigned char **text_packs, int *num_packs,
2281  int flag);
2282 
2283 
2284 /* ts B30519 */
2285 /** Convert an array of CD-TEXT packs into the text format of
2286  Sony CD-TEXT Input Sheet Version 0.7T .
2287 
2288  @param text_packs Array of bytes which form CD-TEXT packs of 18 bytes
2289  each. For a description of the format of the array,
2290  see file doc/cdtext.txt.
2291  No header of 4 bytes must be prepended which would
2292  tell the number of pack bytes + 2.
2293  This parameter may be NULL if the currently attached
2294  array of packs shall be removed.
2295  @param num_packs The number of 18 byte packs in text_packs.
2296  @param start_tno The start number of track counting, if known from
2297  CD table-of-content or other sources.
2298  Submit 0 to enable the attempt to read it and the
2299  track_count from pack type 0x8f.
2300  @param track_count The number of tracks, if known from CD table-of-content
2301  or orther sources.
2302  @param result Will return the buffer with Sheet text.
2303  Dispose by free() when no longer needed.
2304  It will be filled by the text for the v07t sheet file
2305  plus a trailing 0-byte. (Be aware that double-byte
2306  characters might contain 0-bytes, too.)
2307  Each CD-TEXT language block starts by the line
2308  "Input Sheet Version = 0.7T"
2309  and a "Remarks" line that tells the block number.
2310  @param char_code Returns the character code of the pack array:
2311  0x00 = ISO-8859-1
2312  0x01 = 7 bit ASCII
2313  0x80 = MS-JIS (japanese Kanji, double byte characters)
2314  The presence of a code value that is not in this list
2315  will cause this function to fail.
2316  @param flag Bitfield for control purposes. Unused yet. Submit 0.
2317  @return > 0 tells the number of valid text bytes in result.
2318  This does not include the trailing 0-byte.
2319  <= 0 indicates failure.
2320  @since 1.3.2
2321 */
2322 int burn_make_input_sheet_v07t(unsigned char *text_packs, int num_packs,
2323  int start_tno, int track_count,
2324  char **result, int *char_code, int flag);
2325 
2326 
2327 /* ts B11206 */
2328 /** Remove all CD-TEXT attributes of the given block from the session.
2329  They were attached by burn_session_set_cdtext().
2330  @param s Session where to remove the CD-TEXT attribute
2331  @param block Number of the language block in which the attribute
2332  shall appear. Possible values: 0 to 7.
2333  -1 causes text packs of all blocks to be removed.
2334  @return > 0 is success, <= 0 failure
2335  @since 1.2.0
2336 */
2337 int burn_session_dispose_cdtext(struct burn_session *s, int block);
2338 
2339 
2340 /* ts B11221*/
2341 /** Read an array of CD-TEXT packs from a file. This array should be suitable
2342  for burn_write_opts_set_leadin_text().
2343  The function tolerates and removes 4-byte headers as produced by
2344  cdrecord -vv -toc, if this header tells the correct number of bytes which
2345  matches the file size. If no 4-byte header is present, then the function
2346  tolerates and removes a trailing 0-byte as of Sony specs.
2347  @param path Filesystem address of the CD-TEXT pack file.
2348  Normally with suffix .cdt or .dat
2349  @param text_packs Will return the buffer with the CD-TEXT packs.
2350  Dispose by free() when no longer needed.
2351  @param num_packs Will return the number of 18 byte text packs.
2352  @param flag Bitfield for control purposes. Unused yet.Submit 0.
2353  @return 0 is success, <= 0 failure
2354  @since 1.2.0
2355 */
2356 int burn_cdtext_from_packfile(char *path, unsigned char **text_packs,
2357  int *num_packs, int flag);
2358 
2359 
2360 /** Define the data in a track
2361  @param t the track to define
2362  @param offset The lib will write this many 0s before start of data
2363  @param tail The number of extra 0s to write after data
2364  @param pad 1 means the lib should pad the last sector with 0s if the
2365  track isn't exactly sector sized. (otherwise the lib will
2366  begin reading from the next track)
2367  @param mode data format (bitfield)
2368 */
2369 void burn_track_define_data(struct burn_track *t, int offset, int tail,
2370  int pad, int mode);
2371 
2372 
2373 /* ts B11206 */
2374 /** Attach text or binary data as CD-TEXT attributes to a track.
2375  The payload will be used to generate CD-TEXT packs by
2376  burn_cdtext_from_session() or to write CD-TEXT packs into the lead-in
2377  of a CD SAO session. This happens if the CD-TEXT attribute of the session
2378  gets generated, which has the same block number and pack type. In this
2379  case, each track should have such a CD-TEXT attribute, too.
2380  See burn_session_set_cdtext().
2381  Be cautious not to exceed the maximum number of 253 payload packs per
2382  language block. Use burn_cdtext_from_session() to learn whether a valid
2383  array of CD-TEXT packs can be generated from your attributes.
2384  @param t Track where to attach CD-TEXT attribute.
2385  @param block Number of the language block in which the attribute
2386  shall appear. Possible values: 0 to 7.
2387  @param pack_type Pack type number. 0x80 to 0x85 or 0x8e. Used if
2388  pack_type_name is NULL or empty text. Else submit 0
2389  and a name.
2390  @param pack_type_name The pack type by name. Applicable names are:
2391  0x80 = "TITLE" 0x81 = "PERFORMER"
2392  0x82 = "SONGWRITER" 0x83 = "COMPOSER"
2393  0x84 = "ARRANGER" 0x85 = "MESSAGE"
2394  0x8e = "UPC_ISRC"
2395  @param payload 0-terminated cleartext. If double byte characters
2396  are used, then two 0-bytes terminate the cleartext.
2397  @param length Number of bytes in payload. Including terminating
2398  0-bytes.
2399  @param flag Bitfield for control purposes.
2400  bit0= payload contains double byte characters
2401  (with character code 0x80 MS-JIS japanese Kanji)
2402  @return > 0 indicates success , <= 0 is failure
2403  @since 1.2.0
2404 */
2405 int burn_track_set_cdtext(struct burn_track *t, int block,
2406  int pack_type, char *pack_type_name,
2407  unsigned char *payload, int length, int flag);
2408 
2409 /* ts B11206 */
2410 /** Obtain a CD-TEXT attribute that was set by burn_track_set_cdtext().
2411  @param t Track to inquire
2412  @param block Number of the language block to inquire.
2413  @param pack_type Pack type number to inquire. Used if pack_type_name
2414  is NULL or empty text. Else submit 0 and a name.
2415  @param pack_type_name The pack type by name.
2416  See above burn_track_set_cdtext().
2417  @param payload Will return a pointer to text bytes.
2418  Not a copy of data. Do not free() this address.
2419  If no text attribute is attached for pack type and
2420  block, then payload is returned as NULL. The return
2421  value will not indicate error in this case.
2422  @param length Will return the number of bytes pointed to by payload.
2423  Including terminating 0-bytes.
2424  @param flag Bitfield for control purposes. Unused yet. Submit 0.
2425  @return 1=single byte char , 2= double byte char , <=0 error
2426  @since 1.2.0
2427 */
2428 int burn_track_get_cdtext(struct burn_track *t, int block,
2429  int pack_type, char *pack_type_name,
2430  unsigned char **payload, int *length, int flag);
2431 
2432 /* ts B11206 */
2433 /** Remove all CD-TEXT attributes of the given block from the track.
2434  They were attached by burn_track_set_cdtext().
2435  @param t Track where to remove the CD-TEXT attribute.
2436  @param block Number of the language block in which the attribute
2437  shall appear. Possible values: 0 to 7.
2438  -1 causes text packs of all blocks to be removed.
2439  @return > 0 is success, <= 0 failure
2440  @since 1.2.0
2441 */
2442 int burn_track_dispose_cdtext(struct burn_track *t, int block);
2443 
2444 
2445 /* ts A90910 */
2446 /** Activates CD XA compatibility modes.
2447  libburn currently writes data only in CD mode 1. Some programs insist in
2448  sending data with additional management bytes. These bytes have to be
2449  stripped in order to make the input suitable for BURN_MODE1.
2450  @param t The track to manipulate
2451  @param value 0= no conversion
2452  1= strip 8 byte sector headers of CD-ROM XA mode 2 form 1
2453  see MMC-5 4.2.3.8.5.3 Block Format for Mode 2 form 1 Data
2454  all other values are reserved
2455  @return 1=success , 0=unacceptable value
2456  @since 0.7.2
2457 */
2458 int burn_track_set_cdxa_conv(struct burn_track *t, int value);
2459 
2460 
2461 /** Set the ISRC details for a track. When writing to CD media, ISRC will get
2462  written into the Q sub-channel.
2463  @param t The track to change
2464  @param country the 2 char country code. Each character must be
2465  only numbers or letters.
2466  @param owner 3 char owner code. Each character must be only numbers
2467  or letters.
2468  @param year 2 digit year. A number in 0-99 (Yep, not Y2K friendly).
2469  @param serial 5 digit serial number. A number in 0-99999.
2470 */
2471 void burn_track_set_isrc(struct burn_track *t, char *country, char *owner,
2472  unsigned char year, unsigned int serial);
2473 
2474 /* ts B11226 */
2475 /** Set the composed ISRC string for a track. This is an alternative to
2476  burn_track_set_isrc().
2477  @param t The track to be manipulated
2478  @param isrc 12 characters which are composed from ISRC details.
2479  Format is CCOOOYYSSSSS, terminated by a 0-byte:
2480  Country, Owner, Year(decimal digits), Serial(decimal digits).
2481  @param flag Bitfield for control purposes. Unused yet. Submit 0.
2482  @return > 0 indicates success, <= 0 means failure
2483  @since 1.2.0
2484 */
2485 int burn_track_set_isrc_string(struct burn_track *t, char isrc[13], int flag);
2486 
2487 /** Disable ISRC parameters for a track
2488  @param t The track to change
2489 */
2490 void burn_track_clear_isrc(struct burn_track *t);
2491 
2492 
2493 /* ts B20103 */
2494 /** Define an index start address within a track. The index numbers inside a
2495  track have to form sequence starting at 0 or 1 with no gaps up to the
2496  highest number used. They affect only writing of CD SAO sessions.
2497  The first index start address of a track must be 0.
2498  Blocks between index 0 and index 1 are considered to be located before the
2499  track start as of the table-of-content.
2500  @param t The track to be manipulated
2501  @param index_number A number between 0 and 99
2502  @param relative_lba The start address relative to the start of the
2503  burn_source of the track. It will get mapped to the
2504  appropriate absolute block address.
2505  @param flag Bitfield for control purposes. Unused yet. Submit 0.
2506  @return > 0 indicates success, <= 0 means failure
2507  @since 1.2.0
2508 */
2509 int burn_track_set_index(struct burn_track *t, int index_number,
2510  unsigned int relative_lba, int flag);
2511 
2512 /* ts B20103 */
2513 /** Remove all index start addresses and reset to the default indexing of
2514  CD SAO sessions. This means index 0 of track 1 reaches from LBA -150
2515  to LBA -1. Index 1 of track 1 reaches from LBA 0 to track end. Index 1
2516  of track 2 follows immediately. The same happens for all further tracks
2517  after the end of their predecessor.
2518  @param t The track to be manipulated
2519  @param flag Bitfield for control purposes. Unused yet. Submit 0.
2520  @return > 0 indicates success, <= 0 means failure
2521  @since 1.2.0
2522 */
2523 int burn_track_clear_indice(struct burn_track *t, int flag);
2524 
2525 
2526 /* ts B20110 */
2527 /** Define whether a pre-gap shall be written before the track and how many
2528  sectors this pre-gap shall have. A pre-gap is written in the range of track
2529  index 0 and contains zeros resp. silence. No bytes from the track source
2530  will be read for writing the pre-gap.
2531  This setting affects only CD SAO write runs.
2532  The first track automatically gets a pre-gap of at least 150 sectors. Its
2533  size may be enlarged by this call. Further pre-gaps are demanded by MMC
2534  for tracks which follow tracks of a different mode. (But Mode mixing in
2535  CD SAO sessions is currently not supported by libburn.)
2536  @param t The track to change
2537  @param size Number of sectors in the pre-gap.
2538  -1 disables pre-gap, except for the first track.
2539  libburn allows 0, but MMC does not propose this.
2540  @param flag Bitfield for control purposes. Unused yet. Submit 0.
2541  @return > 0 indicates success, <= 0 means failure
2542  @since 1.2.0
2543 */
2544 int burn_track_set_pregap_size(struct burn_track *t, int size, int flag);
2545 
2546 /* ts B20111 */
2547 /** Define whether a post-gap shall be written at the end of the track and
2548  how many sectors this gap shall have. A post-gap occupies the range of
2549  an additional index of the track. It contains zeros. No bytes from the
2550  track source will be read for writing the post-gap.
2551  This setting affects only CD SAO write runs.
2552  MMC prescribes to add a post-gap to a data track which is followed by
2553  a non-data track. (But libburn does not yet support mixed mode CD SAO
2554  sessions.)
2555  @param t The track to change
2556  @param size Number of sectors in the post-gap.
2557  -1 disables post-gap.
2558  libburn allows 0, but MMC does not propose this.
2559  @param flag Bitfield for control purposes. Unused yet. Submit 0.
2560  @return > 0 indicates success, <= 0 means failure
2561  @since 1.2.0
2562 */
2563 int burn_track_set_postgap_size(struct burn_track *t, int size, int flag);
2564 
2565 
2566 /* ts A61024 */
2567 /** Define whether a track shall swap bytes of its input stream.
2568  @param t The track to change
2569  @param swap_source_bytes 0=do not swap, 1=swap byte pairs
2570  @return 1=success , 0=unacceptable value
2571  @since 0.2.6
2572 */
2573 int burn_track_set_byte_swap(struct burn_track *t, int swap_source_bytes);
2574 
2575 
2576 /** Hide the first track in the "pre gap" of the disc
2577  @param s session to change
2578  @param onoff 1 to enable hiding, 0 to disable
2579 */
2580 void burn_session_hide_first_track(struct burn_session *s, int onoff);
2581 
2582 /** Get the drive's disc struct - free when done
2583  @param d drive to query
2584  @return the disc struct or NULL on failure
2585 */
2586 struct burn_disc *burn_drive_get_disc(struct burn_drive *d);
2587 
2588 /** Set the track's data source
2589  @param t The track to set the data source for
2590  @param s The data source to use for the contents of the track
2591  @return An error code stating if the source is ready for use for
2592  writing the track, or if an error occured
2593 
2594 */
2595 enum burn_source_status burn_track_set_source(struct burn_track *t,
2596  struct burn_source *s);
2597 
2598 
2599 /* ts A70218 */
2600 /** Set a default track size to be used only if the track turns out to be of
2601  unpredictable length and if the effective write type demands a fixed size.
2602  This can be useful to enable write types CD SAO or DVD DAO together with
2603  a track source like stdin. If the track source delivers fewer bytes than
2604  announced then the track will be padded up with zeros.
2605  @param t The track to change
2606  @param size The size to set
2607  @return 0=failure 1=sucess
2608  @since 0.3.4
2609 */
2610 int burn_track_set_default_size(struct burn_track *t, off_t size);
2611 
2612 /** Free a burn_source (decrease its refcount and maybe free it)
2613  @param s Source to free
2614 */
2615 void burn_source_free(struct burn_source *s);
2616 
2617 /** Creates a data source for an image file (and maybe subcode file)
2618  @param path The file address for the main channel payload.
2619  @param subpath Eventual address for subchannel data. Only used in exotic
2620  raw write modes. Submit NULL for normal tasks.
2621  @return Pointer to a burn_source object, NULL indicates failure
2622 */
2623 struct burn_source *burn_file_source_new(const char *path,
2624  const char *subpath);
2625 
2626 
2627 /* ts A91122 : An interface to open(O_DIRECT) or similar OS tricks. */
2628 
2629 /** Opens a file with eventual acceleration preparations which may depend
2630  on the operating system and on compile time options of libburn.
2631  You may use this call instead of open(2) for opening file descriptors
2632  which shall be handed to burn_fd_source_new().
2633  This should only be done for tracks with BURN_BLOCK_MODE1 (2048 bytes
2634  per block).
2635 
2636  If you use this call then you MUST allocate the buffers which you use
2637  with read(2) by call burn_os_alloc_buffer(). Read sizes MUST be a multiple
2638  of a safe buffer amount. Else you risk that track data get altered during
2639  transmission.
2640  burn_disk_write() will allocate a suitable read/write buffer for its own
2641  operations. A fifo created by burn_fifo_source_new() will allocate
2642  suitable memory for its buffer if called with flag bit0 and a multiple
2643  of a safe buffer amount.
2644  @param path The file address to open
2645  @param open_flags The flags as of man 2 open. Normally just O_RDONLY.
2646  @param flag Bitfield for control purposes (unused yet, submit 0).
2647  @return A file descriptor as of open(2). Finally to be disposed
2648  by close(2).
2649  -1 indicates failure.
2650  @since 0.7.4
2651 */
2652 int burn_os_open_track_src(char *path, int open_flags, int flag);
2653 
2654 /** Allocate a memory area that is suitable for reading with a file descriptor
2655  opened by burn_os_open_track_src().
2656  @param amount Number of bytes to allocate. This should be a multiple
2657  of the operating system's i/o block size. 32 KB is
2658  guaranteed by libburn to be safe.
2659  @param flag Bitfield for control purposes (unused yet, submit 0).
2660  @return The address of the allocated memory, or NULL on failure.
2661  A non-NULL return value has finally to be disposed via
2662  burn_os_free_buffer().
2663  @since 0.7.4
2664 */
2665 void *burn_os_alloc_buffer(size_t amount, int flag);
2666 
2667 /** Dispose a memory area which was obtained by burn_os_alloc_buffer(),
2668  @param buffer Memory address to be freed.
2669  @param amount The number of bytes which was allocated at that
2670  address.
2671  @param flag Bitfield for control purposes (unused yet, submit 0).
2672  @return 1 success , <=0 failure
2673  @since 0.7.4
2674 */
2675 int burn_os_free_buffer(void *buffer, size_t amount, int flag);
2676 
2677 
2678 /** Creates a data source for an image file (a track) from an open
2679  readable filedescriptor, an eventually open readable subcodes file
2680  descriptor and eventually a fixed size in bytes.
2681  @param datafd The source of data.
2682  @param subfd The eventual source of subchannel data. Only used in exotic
2683  raw write modes. Submit -1 for normal tasks.
2684  @param size The eventual fixed size of eventually both fds.
2685  If this value is 0, the size will be determined from datafd.
2686  @return Pointer to a burn_source object, NULL indicates failure
2687 */
2688 struct burn_source *burn_fd_source_new(int datafd, int subfd, off_t size);
2689 
2690 
2691 /* ts B00922 */
2692 /** Creates an offset source which shall provide a byte interval of a stream
2693  to its consumer. It is supposed to be chain-linked with other offset
2694  sources which serve neighboring consumers. The chronological sequence
2695  of consumers and the sequence of offset sources must match. The intervals
2696  of the sources must not overlap.
2697 
2698  A chain of these burn_source objects may be used to feed multiple tracks
2699  from one single stream of input bytes.
2700  Each of the offset sources will skip the bytes up to its start address and
2701  provide the prescribed number of bytes to the track. Skipping takes into
2702  respect the bytes which have been processed by eventual predecessors in the
2703  chain.
2704  Important: It is not allowed to free an offset source before its successor
2705  has ended its work. Best is to keep them all until all tracks
2706  are done.
2707 
2708  @param inp The burn_source object from which to read stream data.
2709  E.g. created by burn_file_source_new().
2710  @param prev The eventual offset source object which shall read data from
2711  inp before the new offset source will begin its own work.
2712  This must either be a result of burn_offst_source_new() or
2713  it must be NULL.
2714  @param start The byte address where to start reading bytes for the
2715  consumer. inp bytes may get skipped to reach this address.
2716  @param size The number of bytes to be delivered to the consumer.
2717  If size is <= 0 then it may be set later by a call of method
2718  set_size(). If it is >= 0, then it can only be changed if
2719  flag bit0 was set with burn_offst_source_new().
2720  @param flag Bitfield for control purposes
2721  bit0 = Prevent set_size() from overriding interval sizes > 0.
2722  If such a size is already set, then the new one will
2723  only affect the reply of get_size().
2724  See also above struct burn_source.
2725  @since 1.2.0
2726  @return Pointer to a burn_source object, later to be freed by
2727  burn_source_free(). NULL indicates failure.
2728  @since 0.8.8
2729 */
2731  struct burn_source *inp, struct burn_source *prev,
2732  off_t start, off_t size, int flag);
2733 
2734 /* ts A70930 */
2735 /** Creates a fifo which acts as proxy for an already existing data source.
2736  The fifo provides a ring buffer which shall smoothen the data stream
2737  between burn_source and writer thread. Each fifo serves only for one
2738  data source. It may be attached to one track as its only data source
2739  by burn_track_set_source(), or it may be used as input for other burn
2740  sources.
2741  A fifo starts its life in "standby" mode with no buffer space allocated.
2742  As soon as its consumer requires bytes, the fifo establishes a worker
2743  thread and allocates its buffer. After input has ended and all buffer
2744  content is consumed, the buffer space gets freed and the worker thread
2745  ends. This happens asynchronously. So expect two buffers and worker threads
2746  to exist for a short time between tracks. Be modest in your size demands if
2747  multiple tracks are to be expected.
2748  @param inp The burn_source for which the fifo shall act as proxy.
2749  It can be disposed by burn_source_free() immediately
2750  after this call.
2751  @param chunksize The size in bytes of a chunk.
2752  Use 2048 for sources suitable for BURN_BLOCK_MODE1,
2753  2352 for sources which deliver for BURN_BLOCK_AUDIO,
2754  2056 for sources which shall get treated by
2755  burn_track_set_cdxa_conv(track, 1).
2756  Some variations of burn_source might work only with
2757  a particular chunksize. E.g. libisofs demands 2048.
2758  @param chunks The number of chunks to be allocated in ring buffer.
2759  This value must be >= 2.
2760  @param flag Bitfield for control purposes:
2761  bit0= The read method of inp is capable of delivering
2762  arbitrary amounts of data per call. Not only one
2763  sector.
2764  Suitable for inp from burn_file_source_new()
2765  and burn_fd_source_new() if not the fd has
2766  exotic limitations on read size.
2767  You MUST use this on inp which uses an fd opened
2768  with burn_os_open_track_src().
2769  Better do not use with other inp types.
2770  @since 0.7.4
2771  @return A pointer to the newly created burn_source.
2772  Later both burn_sources, inp and the returned fifo, have
2773  to be disposed by calling burn_source_free() for each.
2774  inp can be freed immediately, the returned fifo may be
2775  kept as handle for burn_fifo_inquire_status().
2776  @since 0.4.0
2777 */
2778 struct burn_source *burn_fifo_source_new(struct burn_source *inp,
2779  int chunksize, int chunks, int flag);
2780 
2781 /* ts A71003 */
2782 /** Inquires state and fill parameters of a fifo burn_source which was created
2783  by burn_fifo_source_new() . Do not use with other burn_source variants.
2784  @param fifo The fifo object to inquire
2785  @param size The total size of the fifo
2786  @param free_bytes The current free capacity of the fifo
2787  @param status_text Returns a pointer to a constant text, see below
2788  @return <0 reply invalid, >=0 fifo status code:
2789  bit0+1=input status, bit2=consumption status, i.e:
2790  0="standby" : data processing not started yet
2791  1="active" : input and consumption are active
2792  2="ending" : input has ended without error
2793  3="failing" : input had error and ended,
2794  4="unused" : ( consumption has ended before processing start )
2795  5="abandoned" : consumption has ended prematurely
2796  6="ended" : consumption has ended without input error
2797  7="aborted" : consumption has ended after input error
2798  @since 0.4.0
2799 */
2800 int burn_fifo_inquire_status(struct burn_source *fifo, int *size,
2801  int *free_bytes, char **status_text);
2802 
2803 /* ts A91125 */
2804 /** Inquire various counters which reflect the fifo operation.
2805  @param fifo The fifo object to inquire
2806  @param total_min_fill The minimum number of bytes in the fifo. Beginning
2807  from the moment when fifo consumption is enabled.
2808  @param interval_min_fill The minimum byte number beginning from the moment
2809  when fifo consumption is enabled or from the
2810  most recent moment when burn_fifo_next_interval()
2811  was called.
2812  @param put_counter The number of data transactions into the fifo.
2813  @param get_counter The number of data transactions out of the fifo.
2814  @param empty_counter The number of times the fifo was empty.
2815  @param full_counter The number of times the fifo was full.
2816  @since 0.7.4
2817 */
2818 void burn_fifo_get_statistics(struct burn_source *fifo,
2819  int *total_min_fill, int *interval_min_fill,
2820  int *put_counter, int *get_counter,
2821  int *empty_counter, int *full_counter);
2822 
2823 /* ts A91125 */
2824 /** Inquire the fifo minimum fill counter for intervals and reset that counter.
2825  @param fifo The fifo object to inquire
2826  @param interval_min_fill The minimum number of bytes in the fifo. Beginning
2827  from the moment when fifo consumption is enabled
2828  or from the most recent moment when
2829  burn_fifo_next_interval() was called.
2830  @since 0.7.4
2831 */
2832 void burn_fifo_next_interval(struct burn_source *fifo, int *interval_min_fill);
2833 
2834 /* ts A80713 */
2835 /** Obtain a preview of the first input data of a fifo which was created
2836  by burn_fifo_source_new(). The data will later be delivered normally to
2837  the consumer track of the fifo.
2838  bufsize may not be larger than the fifo size (chunk_size * chunks) - 32k.
2839  This call will succeed only if data consumption by the track has not
2840  started yet, i.e. best before the call to burn_disc_write().
2841  It will start the worker thread of the fifo with the expectable side
2842  effects on the external data source. Then it waits either until enough
2843  data have arrived or until it becomes clear that this will not happen.
2844  The call may be repeated with increased bufsize. It will always yield
2845  the bytes beginning from the first one in the fifo.
2846  @param fifo The fifo object to inquire resp. start
2847  @param buf Pointer to memory of at least bufsize bytes where to
2848  deliver the peeked data.
2849  @param bufsize Number of bytes to peek from the start of the fifo data
2850  @param flag Bitfield for control purposes (unused yet, submit 0).
2851  @return <0 on severe error, 0 if not enough data, 1 if bufsize bytes read
2852  @since 0.5.0
2853 */
2854 int burn_fifo_peek_data(struct burn_source *fifo, char *buf, int bufsize,
2855  int flag);
2856 
2857 /* ts A91125 */
2858 /** Start the fifo worker thread and wait either until the requested number
2859  of bytes have arrived or until it becomes clear that this will not happen.
2860  Filling will go on asynchronously after burn_fifo_fill() returned.
2861  This call and burn_fifo_peek_data() do not disturb each other.
2862  @param fifo The fifo object to start
2863  @param fill Number of bytes desired. Expect to get return 1 if
2864  at least fifo size - 32k were read.
2865  @param flag Bitfield for control purposes.
2866  bit0= fill fifo to maximum size
2867  @return <0 on severe error, 0 if not enough data,
2868  1 if desired amount or fifo full
2869  @since 0.7.4
2870 */
2871 int burn_fifo_fill(struct burn_source *fifo, int fill, int flag);
2872 
2873 
2874 /* ts A70328 */
2875 /** Sets a fixed track size after the data source object has already been
2876  created.
2877  @param t The track to operate on
2878  @param size the number of bytes to use as track size
2879  @return <=0 indicates failure , >0 success
2880  @since 0.3.6
2881 */
2882 int burn_track_set_size(struct burn_track *t, off_t size);
2883 
2884 
2885 /** Tells how many sectors a track will have on disc, resp. already has on
2886  disc. This includes offset, payload, tail, and post-gap, but not pre-gap.
2887  The result is NOT RELIABLE with tracks of undefined length
2888 */
2889 int burn_track_get_sectors(struct burn_track *);
2890 
2891 
2892 /* ts A61101 */
2893 /** Tells how many source bytes have been read and how many data bytes have
2894  been written by the track during burn.
2895  @param t The track to inquire
2896  @param read_bytes Number of bytes read from the track source
2897  @param written_bytes Number of bytes written to track
2898  @since 0.2.6
2899 */
2900 int burn_track_get_counters(struct burn_track *t,
2901  off_t *read_bytes, off_t *written_bytes);
2902 
2903 
2904 /** Sets drive read and write speed
2905  Note: "k" is 1000, not 1024. 1xCD = 176.4 k/s, 1xDVD = 1385 k/s.
2906  Fractional speeds should be rounded up. Like 4xCD = 706.
2907  @param d The drive to set speed for
2908  @param read Read speed in k/s (0 is max, -1 is min).
2909  @param write Write speed in k/s (0 is max, -1 is min).
2910 */
2911 void burn_drive_set_speed(struct burn_drive *d, int read, int write);
2912 
2913 
2914 /* ts A70711 */
2915 /** Controls the behavior with writing when the drive buffer is suspected to
2916  be full. To check and wait for enough free buffer space before writing
2917  will move the task of waiting from the operating system's device driver
2918  to libburn. While writing is going on and waiting is enabled, any write
2919  operation will be checked whether it will fill the drive buffer up to
2920  more than max_percent. If so, then waiting will happen until the buffer
2921  fill is predicted with at most min_percent.
2922  Thus: if min_percent < max_percent then transfer rate will oscillate.
2923  This may allow the driver to operate on other devices, e.g. a disk from
2924  which to read the input for writing. On the other hand, this checking might
2925  reduce maximum throughput to the drive or even get misled by faulty buffer
2926  fill replies from the drive.
2927  If a setting parameter is < 0, then this setting will stay unchanged
2928  by the call.
2929  Known burner or media specific pitfalls:
2930  To have max_percent larger than the burner's best reported buffer fill has
2931  the same effect as min_percent==max_percent. Some burners do not report
2932  their full buffer with all media types. Some are not suitable because
2933  they report their buffer fill with delay.
2934  @param d The drive to control
2935  @param enable 0= disable , 1= enable waiting , (-1 = do not change setting)
2936  @param min_usec Shortest possible sleeping period (given in micro seconds)
2937  @param max_usec Longest possible sleeping period (given in micro seconds)
2938  @param timeout_sec If a single write has to wait longer than this number
2939  of seconds, then waiting gets disabled and mindless
2940  writing starts. A value of 0 disables this timeout.
2941  @param min_percent Minimum of desired buffer oscillation: 25 to 100
2942  @param max_percent Maximum of desired buffer oscillation: 25 to 100
2943  @return 1=success , 0=failure
2944  @since 0.3.8
2945 */
2946 int burn_drive_set_buffer_waiting(struct burn_drive *d, int enable,
2947  int min_usec, int max_usec, int timeout_sec,
2948  int min_percent, int max_percent);
2949 
2950 
2951 /* these are for my [Derek Foreman's ?] debugging, they will disappear */
2952 /* ts B11012 :
2953  Of course, API symbols will not disappear. But these functions are of
2954  few use, as they only print DEBUG messages.
2955 */
2956 void burn_structure_print_disc(struct burn_disc *d);
2957 void burn_structure_print_session(struct burn_session *s);
2958 void burn_structure_print_track(struct burn_track *t);
2959 
2960 /** Sets the write type for the write_opts struct.
2961  Note: write_type BURN_WRITE_SAO is currently not capable of writing a mix
2962  of data and audio tracks. You must use BURN_WRITE_TAO for such sessions.
2963  @param opts The write opts to change
2964  @param write_type The write type to use
2965  @param block_type The block type to use
2966  @return Returns 1 on success and 0 on failure.
2967 */
2968 int burn_write_opts_set_write_type(struct burn_write_opts *opts,
2969  enum burn_write_types write_type,
2970  int block_type);
2971 
2972 
2973 /* ts A70207 */
2974 /** As an alternative to burn_write_opts_set_write_type() this function tries
2975  to find a suitable write type and block type for a given write job
2976  described by opts and disc. To be used after all other setups have been
2977  made, i.e. immediately before burn_disc_write().
2978  @param opts The nearly complete write opts to change
2979  @param disc The already composed session and track model
2980  @param reasons This text string collects reasons for decision resp. failure
2981  @param flag Bitfield for control purposes:
2982  bit0= do not choose type but check the one that is already set
2983  bit1= do not issue error messages via burn_msgs queue
2984  (is automatically set with bit0)
2985  @return Chosen write type. BURN_WRITE_NONE on failure.
2986  @since 0.3.2
2987 */
2989  struct burn_write_opts *opts, struct burn_disc *disc,
2990  char reasons[BURN_REASONS_LEN], int flag);
2991 
2992 
2993 /** Supplies toc entries for writing - not normally required for cd mastering
2994  @param opts The write opts to change
2995  @param count The number of entries
2996  @param toc_entries
2997 */
2998 void burn_write_opts_set_toc_entries(struct burn_write_opts *opts,
2999  int count,
3000  struct burn_toc_entry *toc_entries);
3001 
3002 /** Sets the session format for a disc
3003  @param opts The write opts to change
3004  @param format The session format to set
3005 */
3006 void burn_write_opts_set_format(struct burn_write_opts *opts, int format);
3007 
3008 /** Sets the simulate value for the write_opts struct .
3009  This corresponds to the Test Write bit in MMC mode page 05h. Several media
3010  types do not support this. See struct burn_multi_caps.might_simulate for
3011  actual availability of this feature.
3012  If the media is suitable, the drive will perform burn_disc_write() as a
3013  simulation instead of effective write operations. This means that the
3014  media content and burn_disc_get_status() stay unchanged.
3015  Note: With stdio-drives, the target file gets eventually created, opened,
3016  lseeked, and closed, but not written. So there are effects on it.
3017  Warning: Call burn_random_access_write() will never do simulation because
3018  it does not get any burn_write_opts.
3019  @param opts The write opts to change
3020  @param sim Non-zero enables simulation, 0 enables real writing
3021  @return Returns 1 on success and 0 on failure.
3022 */
3023 int burn_write_opts_set_simulate(struct burn_write_opts *opts, int sim);
3024 
3025 /** Controls buffer underrun prevention. This is only needed with CD media
3026  and possibly with old DVD-R drives. All other media types are not
3027  vulnerable to burn failure due to buffer underrun.
3028  @param opts The write opts to change
3029  @param underrun_proof if non-zero, buffer underrun protection is enabled
3030  @return Returns 1 if the drive announces to be capable of underrun
3031  prevention,
3032  Returns 0 if not.
3033 */
3034 int burn_write_opts_set_underrun_proof(struct burn_write_opts *opts,
3035  int underrun_proof);
3036 
3037 /** Sets whether to use opc or not with the write_opts struct
3038  @param opts The write opts to change
3039  @param opc If non-zero, optical power calibration will be performed at
3040  start of burn
3041 
3042 */
3043 void burn_write_opts_set_perform_opc(struct burn_write_opts *opts, int opc);
3044 
3045 
3046 /** The Q sub-channel of a CD may contain a Media Catalog Number of 13 decimal
3047  digits. This call sets the string of digits, but does not yet activate it
3048  for writing.
3049  @param opts The write opts to change
3050  @param mediacatalog The 13 decimal digits as ASCII bytes. I.e. '0' = 0x30.
3051 */
3052 void burn_write_opts_set_mediacatalog(struct burn_write_opts *opts,
3053  unsigned char mediacatalog[13]);
3054 
3055 /** This call activates the Media Catalog Number for writing. The digits of
3056  that number have to be set by call burn_write_opts_set_mediacatalog().
3057  @param opts The write opts to change
3058  @param has_mediacatalog 1= activate writing of catalog to Q sub-channel
3059  0= deactivate it
3060 */
3061 void burn_write_opts_set_has_mediacatalog(struct burn_write_opts *opts,
3062  int has_mediacatalog);
3063 
3064 
3065 /* ts A61106 */
3066 /** Sets the multi flag which eventually marks the emerging session as not
3067  being the last one and thus creating a BURN_DISC_APPENDABLE media.
3068  Note: DVD-R[W] in write mode BURN_WRITE_SAO are not capable of this.
3069  DVD-R DL are not capable of this at all.
3070  libburn will refuse to write if burn_write_opts_set_multi() is
3071  enabled under such conditions.
3072  @param opts The option object to be manipulated
3073  @param multi 1=media will be appendable, 0=media will be closed (default)
3074  @since 0.2.6
3075 */
3076 void burn_write_opts_set_multi(struct burn_write_opts *opts, int multi);
3077 
3078 
3079 /* ts B31024 */
3080 /** Set the severity to be used with write error messages which are potentially
3081  caused by not using write type BURN_WRITE_SAO on fast blanked DVD-RW.
3082 
3083  Normally the call burn_write_opts_auto_write_type() can prevent such
3084  errors by looking for MMC feature 21h "Incremental Streaming Writable"
3085  which anounnces the capability for BURN_WRITE_TAO and multi session.
3086  Regrettable many drives announce feature 21h even if they only can do
3087  BURN_WRITE_SAO. This mistake becomes obvious by an early write error.
3088 
3089  If you plan to call burn_drive_was_feat21_failure() and to repeat the
3090  burn attempt with BURN_WRITE_SAO, then set the severity of the error
3091  message low enough, so that the application does not see reason to abort.
3092 
3093  @param opts The option object to be manipulated
3094  @param severity Severity as with burn_msgs_set_severities().
3095  "ALL" or empty text means the default severity that
3096  is attributed to other kinds of write errors.
3097 */
3098 void burn_write_opts_set_fail21h_sev(struct burn_write_opts *opts,
3099  char *severity);
3100 
3101 /* ts B11204 */
3102 /** Submit an array of CD-TEXT packs which shall be written to the Lead-in
3103  of a SAO write run on CD.
3104  @param opts The option object to be manipulated
3105  @param text_packs Array of bytes which form CD-TEXT packs of 18 bytes
3106  each. For a description of the format of the array,
3107  see file doc/cdtext.txt.
3108  No header of 4 bytes must be prepended which would
3109  tell the number of pack bytes + 2.
3110  This parameter may be NULL if the currently attached
3111  array of packs shall be removed.
3112  @param num_packs The number of 18 byte packs in text_packs.
3113  This parameter may be 0 if the currently attached
3114  array of packs shall be removed.
3115  @param flag Bitfield for control purposes.
3116  bit0= do not verify checksums
3117  bit1= repair mismatching checksums
3118  bit2= repair checksums if they are 00 00 with each pack
3119  @return 1 on success, <= 0 on failure
3120  @since 1.2.0
3121 */
3122 int burn_write_opts_set_leadin_text(struct burn_write_opts *opts,
3123  unsigned char *text_packs,
3124  int num_packs, int flag);
3125 
3126 
3127 /* ts A61222 */
3128 /** Sets a start address for writing to media and write modes which allow to
3129  choose this address at all (for now: DVD+RW, DVD-RAM, formatted DVD-RW).
3130  now). The address is given in bytes. If it is not -1 then a write run
3131  will fail if choice of start address is not supported or if the block
3132  alignment of the address is not suitable for media and write mode.
3133  Alignment to 32 kB blocks is supposed to be safe with DVD media.
3134  Call burn_disc_get_multi_caps() can obtain the necessary media info. See
3135  resulting struct burn_multi_caps elements .start_adr , .start_alignment ,
3136  .start_range_low , .start_range_high .
3137  @param opts The write opts to change
3138  @param value The address in bytes (-1 = start at default address)
3139  @since 0.3.0
3140 */
3141 void burn_write_opts_set_start_byte(struct burn_write_opts *opts, off_t value);
3142 
3143 
3144 /* ts A70213 */
3145 /** Caution: still immature and likely to change. Problems arose with
3146  sequential DVD-RW on one drive.
3147 
3148  Controls whether the whole available space of the media shall be filled up
3149  by the last track of the last session.
3150  @param opts The write opts to change
3151  @param fill_up_media If 1 : fill up by last track, if 0 = do not fill up
3152  @since 0.3.4
3153 */
3154 void burn_write_opts_set_fillup(struct burn_write_opts *opts,
3155  int fill_up_media);
3156 
3157 
3158 /* ts A70303 */
3159 /** Eventually makes libburn ignore the failure of some conformance checks:
3160  - the check whether CD write+block type is supported by the drive
3161  - the check whether the media profile supports simulated burning
3162  @param opts The write opts to change
3163  @param use_force 1=ignore above checks, 0=refuse work on failed check
3164  @since 0.3.4
3165 */
3166 void burn_write_opts_set_force(struct burn_write_opts *opts, int use_force);
3167 
3168 
3169 /* ts A80412 */
3170 /** Eventually makes use of the more modern write command AAh WRITE12 and
3171  sets the Streaming bit. With DVD-RAM and BD this can override the
3172  traditional slowdown to half nominal speed. But if it speeds up writing
3173  then it also disables error management and correction. Weigh your
3174  priorities. This affects the write operations of burn_disc_write()
3175  and subsequent calls of burn_random_access_write().
3176  @param opts The write opts to change
3177  @param value 0=use 2Ah WRITE10, 1=use AAh WRITE12 with Streaming bit
3178  @since 0.6.4:
3179  >=16 use WRITE12 but not before the LBA given by value
3180  @since 0.4.6
3181 */
3182 void burn_write_opts_set_stream_recording(struct burn_write_opts *opts,
3183  int value);
3184 
3185 /* ts A91115 */
3186 /** Overrides the write chunk size for DVD and BD media which is normally
3187  determined according to media type and setting of stream recording.
3188  A chunk size of 64 KB may improve throughput with bus systems which show
3189  latency problems.
3190  @param opts The write opts to change
3191  @param obs Number of bytes which shall be sent by a single write command.
3192  0 means automatic size, 32768 and 65336 are the only other
3193  accepted sizes for now.
3194  @since 0.7.4
3195 */
3196 void burn_write_opts_set_dvd_obs(struct burn_write_opts *opts, int obs);
3197 
3198 
3199 /* ts B20406 */
3200 /** Overrides the automatic decision whether to pad up the last write chunk to
3201  its full size. This applies to DVD, BD and stdio: pseudo-drives.
3202  Note: This override may get enabled fixely already at compile time by
3203  defining macro Libburn_dvd_always_obs_paD .
3204  @param opts The write opts to change
3205  @param pad 1 means to pad up in any case, 0 means automatic decision.
3206  @since 1.2.4
3207 */
3208 void burn_write_opts_set_obs_pad(struct burn_write_opts *opts, int pad);
3209 
3210 
3211 /* ts A91115 */
3212 /** Sets the rythm by which stdio pseudo drives force their output data to
3213  be consumed by the receiving storage device. This forcing keeps the memory
3214  from being clogged with lots of pending data for slow devices.
3215  @param opts The write opts to change
3216  @param rythm Number of 2KB output blocks after which fsync(2) is
3217  performed. -1 means no fsync(), 0 means default,
3218  elsewise the value must be >= 32.
3219  Default is currently 8192 = 16 MB.
3220  @since 0.7.4
3221 */
3222 void burn_write_opts_set_stdio_fsync(struct burn_write_opts *opts, int rythm);
3223 
3224 
3225 /** Sets whether to read in raw mode or not
3226  @param opts The read opts to change
3227  @param raw_mode If non-zero, reading will be done in raw mode, so that everything in the data tracks on the
3228  disc is read, including headers.
3229 */
3230 void burn_read_opts_set_raw(struct burn_read_opts *opts, int raw_mode);
3231 
3232 /** Sets whether to report c2 errors or not
3233  @param opts The read opts to change
3234  @param c2errors If non-zero, report c2 errors.
3235 */
3236 void burn_read_opts_set_c2errors(struct burn_read_opts *opts, int c2errors);
3237 
3238 /** Sets whether to read subcodes from audio tracks or not
3239  @param opts The read opts to change
3240  @param subcodes_audio If non-zero, read subcodes from audio tracks on the disc.
3241 */
3242 void burn_read_opts_read_subcodes_audio(struct burn_read_opts *opts,
3243  int subcodes_audio);
3244 
3245 /** Sets whether to read subcodes from data tracks or not
3246  @param opts The read opts to change
3247  @param subcodes_data If non-zero, read subcodes from data tracks on the disc.
3248 */
3249 void burn_read_opts_read_subcodes_data(struct burn_read_opts *opts,
3250  int subcodes_data);
3251 
3252 /** Sets whether to recover errors if possible
3253  @param opts The read opts to change
3254  @param hardware_error_recovery If non-zero, attempt to recover errors if possible.
3255 */
3256 void burn_read_opts_set_hardware_error_recovery(struct burn_read_opts *opts,
3257  int hardware_error_recovery);
3258 
3259 /** Sets whether to report recovered errors or not
3260  @param opts The read opts to change
3261  @param report_recovered_errors If non-zero, recovered errors will be reported.
3262 */
3263 void burn_read_opts_report_recovered_errors(struct burn_read_opts *opts,
3264  int report_recovered_errors);
3265 
3266 /** Sets whether blocks with unrecoverable errors should be read or not
3267  @param opts The read opts to change
3268  @param transfer_damaged_blocks If non-zero, blocks with unrecoverable errors will still be read.
3269 */
3270 void burn_read_opts_transfer_damaged_blocks(struct burn_read_opts *opts,
3271  int transfer_damaged_blocks);
3272 
3273 /** Sets the number of retries to attempt when trying to correct an error
3274  @param opts The read opts to change
3275  @param hardware_error_retries The number of retries to attempt when correcting an error.
3276 */
3277 void burn_read_opts_set_hardware_error_retries(struct burn_read_opts *opts,
3278  unsigned char hardware_error_retries);
3279 
3280 
3281 /* ts A90815 */
3282 /** Gets the list of profile codes supported by the drive.
3283  Profiles depict the feature sets which constitute media types. For
3284  known profile codes and names see burn_disc_get_profile().
3285  @param d is the drive to query
3286  @param num_profiles returns the number of supported profiles
3287  @param profiles returns the profile codes
3288  @param is_current returns the status of the corresponding profile code:
3289  1= current, i.e. the matching media is loaded
3290  0= not current, i.e. the matching media is not loaded
3291  @return always 1 for now
3292  @since 0.7.0
3293 */
3294 int burn_drive_get_all_profiles(struct burn_drive *d, int *num_profiles,
3295  int profiles[64], char is_current[64]);
3296 
3297 
3298 /* ts A90815 */
3299 /** Obtains the profile name associated with a profile code.
3300  @param profile_code the profile code to be translated
3301  @param name returns the profile name (e.g. "DVD+RW")
3302  @return 1= known profile code , 0= unknown profile code
3303  @since 0.7.0
3304 */
3305 int burn_obtain_profile_name(int profile_code, char name[80]);
3306 
3307 
3308 /** Gets the maximum write speed for a drive and eventually loaded media.
3309  The return value might change by the media type of already loaded media,
3310  again by call burn_drive_grab() and again by call burn_disc_read_atip().
3311  @param d Drive to query
3312  @return Maximum write speed in K/s
3313 */
3314 int burn_drive_get_write_speed(struct burn_drive *d);
3315 
3316 
3317 /* ts A61021 */
3318 /** Gets the minimum write speed for a drive and eventually loaded media.
3319  The return value might change by the media type of already loaded media,
3320  again by call burn_drive_grab() and again by call burn_disc_read_atip().
3321  @param d Drive to query
3322  @return Minimum write speed in K/s
3323  @since 0.2.6
3324 */
3325 int burn_drive_get_min_write_speed(struct burn_drive *d);
3326 
3327 
3328 /** Gets the maximum read speed for a drive
3329  @param d Drive to query
3330  @return Maximum read speed in K/s
3331 */
3332 int burn_drive_get_read_speed(struct burn_drive *d);
3333 
3334 
3335 /* ts A61226 */
3336 /** Obtain a copy of the current speed descriptor list. The drive's list gets
3337  updated on various occasions such as burn_drive_grab() but the copy
3338  obtained here stays untouched. It has to be disposed via
3339  burn_drive_free_speedlist() when it is not longer needed. Speeds
3340  may appear several times in the list. The list content depends much on
3341  drive and media type. It seems that .source == 1 applies mostly to CD media
3342  whereas .source == 2 applies to any media.
3343  @param d Drive to query
3344  @param speed_list The copy. If empty, *speed_list gets returned as NULL.
3345  @return 1=success , 0=list empty , <0 severe error
3346  @since 0.3.0
3347 */
3348 int burn_drive_get_speedlist(struct burn_drive *d,
3349  struct burn_speed_descriptor **speed_list);
3350 
3351 /* ts A70713 */
3352 /** Look up the fastest speed descriptor which is not faster than the given
3353  speed_goal. If it is 0, then the fastest one is chosen among the
3354  descriptors with the highest end_lba. If it is -1 then the slowest speed
3355  descriptor is chosen regardless of end_lba. Parameter flag decides whether
3356  the speed goal means write speed or read speed.
3357  @param d Drive to query
3358  @param speed_goal Upper limit for speed,
3359  0=search for maximum speed , -1 search for minimum speed
3360  @param best_descr Result of the search, NULL if no match
3361  @param flag Bitfield for control purposes
3362  bit0= look for best read speed rather than write speed
3363  bit1= look for any source type (else look for source==2 first
3364  and for any other source type only with CD media)
3365  @return >0 indicates a valid best_descr, 0 = no valid best_descr
3366  @since 0.3.8
3367 */
3368 int burn_drive_get_best_speed(struct burn_drive *d, int speed_goal,
3369  struct burn_speed_descriptor **best_descr, int flag);
3370 
3371 
3372 /* ts A61226 */
3373 /** Dispose a speed descriptor list copy which was obtained by
3374  burn_drive_get_speedlist().
3375  @param speed_list The list copy. *speed_list gets set to NULL.
3376  @return 1=list disposed , 0= *speedlist was already NULL
3377  @since 0.3.0
3378 */
3379 int burn_drive_free_speedlist(struct burn_speed_descriptor **speed_list);
3380 
3381 
3382 /* ts A70203 */
3383 /* @since 0.3.2 */
3384 /** The reply structure for burn_disc_get_multi_caps()
3385 */
3387 
3388  /* Multi-session capability allows to keep the media appendable after
3389  writing a session. It also guarantees that the drive will be able
3390  to predict and use the appropriate Next Writeable Address to place
3391  the next session on the media without overwriting the existing ones.
3392  It does not guarantee that the selected write type is able to do
3393  an appending session after the next session. (E.g. CD SAO is capable
3394  of multi-session by keeping a disc appendable. But .might_do_sao
3395  will be 0 afterwards, when checking the appendable media.)
3396  1= media may be kept appendable by burn_write_opts_set_multi(o,1)
3397  0= media will not be appendable
3398  */
3400 
3401  /* Multi-track capability allows to write more than one track source
3402  during a single session. The written tracks can later be found in
3403  libburn's TOC model with their start addresses and sizes.
3404  1= multiple tracks per session are allowed
3405  0= only one track per session allowed
3406  */
3408 
3409  /* Start-address capability allows to set a non-zero address with
3410  burn_write_opts_set_start_byte(). Eventually this has to respect
3411  .start_alignment and .start_range_low, .start_range_high in this
3412  structure.
3413  1= non-zero start address is allowed
3414  0= only start address 0 is allowed (to depict the drive's own idea
3415  about the appropriate write start)
3416  */
3418 
3419  /** The alignment for start addresses.
3420  ( start_address % start_alignment ) must be 0.
3421  */
3423 
3424  /** The lowest permissible start address.
3425  */
3427 
3428  /** The highest addressable start address.
3429  */
3431 
3432  /** Potential availability of write modes
3433  4= needs no size prediction, not to be chosen automatically
3434  3= needs size prediction, not to be chosen automatically
3435  2= available, no size prediction necessary
3436  1= available, needs exact size prediction
3437  0= not available
3438  With CD media (profiles 0x09 and 0x0a) check also the elements
3439  *_block_types of the according write mode.
3440  */
3444 
3445  /** Generally advised write mode.
3446  Not necessarily the one chosen by burn_write_opts_auto_write_type()
3447  because the burn_disc structure might impose particular demands.
3448  */
3450 
3451  /** Write mode as given by parameter wt of burn_disc_get_multi_caps().
3452  */
3454 
3455  /** Profile number which was current when the reply was generated */
3457 
3458  /** Wether the current profile indicates CD media. 1=yes, 0=no */
3460 
3461  /* ts A70528 */
3462  /* @since 0.3.8 */
3463  /** Wether the current profile is able to perform simulated write */
3465 };
3466 
3467 /** Allocates a struct burn_multi_caps (see above) and fills it with values
3468  which are appropriate for the drive and the loaded media. The drive
3469  must be grabbed for this call. The returned structure has to be disposed
3470  via burn_disc_free_multi_caps() when no longer needed.
3471  @param d The drive to inquire
3472  @param wt With BURN_WRITE_NONE the best capabilities of all write modes
3473  get returned. If set to a write mode like BURN_WRITE_SAO the
3474  capabilities with that particular mode are returned and the
3475  return value is 0 if the desired mode is not possible.
3476  @param caps returns the info structure
3477  @param flag Bitfield for control purposes (unused yet, submit 0)
3478  @return < 0 : error , 0 : writing seems impossible , 1 : writing possible
3479  @since 0.3.2
3480 */
3481 int burn_disc_get_multi_caps(struct burn_drive *d, enum burn_write_types wt,
3482  struct burn_multi_caps **caps, int flag);
3483 
3484 /** Removes from memory a multi session info structure which was returned by
3485  burn_disc_get_multi_caps(). The pointer *caps gets set to NULL.
3486  @param caps the info structure to dispose (note: pointer to pointer)
3487  @return 0 : *caps was already NULL, 1 : memory object was disposed
3488  @since 0.3.2
3489 */
3490 int burn_disc_free_multi_caps(struct burn_multi_caps **caps);
3491 
3492 
3493 /** Gets a copy of the toc_entry structure associated with a track
3494  @param t Track to get the entry from
3495  @param entry Struct for the library to fill out
3496 */
3497 void burn_track_get_entry(struct burn_track *t, struct burn_toc_entry *entry);
3498 
3499 /** Gets a copy of the toc_entry structure associated with a session's lead out
3500  @param s Session to get the entry from
3501  @param entry Struct for the library to fill out
3502 */
3503 void burn_session_get_leadout_entry(struct burn_session *s,
3504  struct burn_toc_entry *entry);
3505 
3506 /** Gets an array of all complete sessions for the disc
3507  THIS IS NO LONGER VALID AFTER YOU ADD OR REMOVE A SESSION
3508  The result array contains *num + burn_disc_get_incomplete_sessions()
3509  elements. All above *num are incomplete sessions.
3510  Typically there is at most one incomplete session with one empty track.
3511  DVD+R and BD-R seem to allow more than one track with even readable data.
3512  @param d Disc to get session array for
3513  @param num Returns the number of sessions in the array
3514  @return array of sessions
3515 */
3516 struct burn_session **burn_disc_get_sessions(struct burn_disc *d,
3517  int *num);
3518 
3519 /* ts B30112 */
3520 /* @since 1.2.8 */
3521 /** Obtains the number of incomplete sessions which are recorded in the
3522  result array of burn_disc_get_sessions() after the complete sessions.
3523  See above.
3524  @param d Disc object to inquire
3525  @return Number of incomplete sessions
3526 */
3527 int burn_disc_get_incomplete_sessions(struct burn_disc *d);
3528 
3529 
3530 int burn_disc_get_sectors(struct burn_disc *d);
3531 
3532 /** Gets an array of all the tracks for a session
3533  THIS IS NO LONGER VALID AFTER YOU ADD OR REMOVE A TRACK
3534  @param s session to get track array for
3535  @param num Returns the number of tracks in the array
3536  @return array of tracks
3537 */
3538 struct burn_track **burn_session_get_tracks(struct burn_session *s,
3539  int *num);
3540 
3541 int burn_session_get_sectors(struct burn_session *s);
3542 
3543 /** Gets the mode of a track
3544  @param track the track to query
3545  @return the track's mode
3546 */
3547 int burn_track_get_mode(struct burn_track *track);
3548 
3549 /** Returns whether the first track of a session is hidden in the pregap
3550  @param session the session to query
3551  @return non-zero means the first track is hidden
3552 */
3553 int burn_session_get_hidefirst(struct burn_session *session);
3554 
3555 /** Returns the library's version in its parts.
3556  This is the runtime counterpart of the three build time macros
3557  burn_header_version_* below.
3558  @param major The major version number
3559  @param minor The minor version number
3560  @param micro The micro version number
3561 */
3562 void burn_version(int *major, int *minor, int *micro);
3563 
3564 
3565 /* ts A80129 */
3566 /* @since 0.4.4 */
3567 /** These three release version numbers tell the revision of this header file
3568  and of the API it describes. They are memorized by applications at build
3569  time.
3570  Immediately after burn_initialize() an application should do this check:
3571  burn_version(&major, &minor, &micro);
3572  if(major > burn_header_version_major
3573  || (major == burn_header_version_major
3574  && (minor > burn_header_version_minor
3575  || (minor == burn_header_version_minor
3576  && micro >= burn_header_version_micro)))) {
3577  ... Young enough. Go on with program run ....
3578  } else {
3579  ... Too old. Do not use this libburn version ...
3580  }
3581 
3582 */
3583 #define burn_header_version_major 1
3584 #define burn_header_version_minor 3
3585 #define burn_header_version_micro 4
3586 /** Note:
3587  Above version numbers are also recorded in configure.ac because libtool
3588  wants them as parameters at build time.
3589  For the library compatibility check, BURN_*_VERSION in configure.ac
3590  are not decisive. Only the three numbers above do matter.
3591 */
3592 /** Usage discussion:
3593 
3594 Some developers of the libburnia project have differing
3595 opinions how to ensure the compatibility of libaries
3596 and applications.
3597 
3598 It is about whether to use at compile time and at runtime
3599 the version numbers isoburn_header_version_* provided here.
3600 Thomas Schmitt advises to use them.
3601 Vreixo Formoso advises to use other means.
3602 
3603 At compile time:
3604 
3605 Vreixo Formoso advises to leave proper version matching
3606 to properly programmed checks in the the application's
3607 build system, which will eventually refuse compilation.
3608 
3609 Thomas Schmitt advises to use the macros defined here
3610 for comparison with the application's requirements of
3611 library revisions and to eventually break compilation.
3612 
3613 Both advises are combinable. I.e. be master of your
3614 build system and have #if checks in the source code
3615 of your application, nevertheless.
3616 
3617 At runtime (via *_is_compatible()):
3618 
3619 Vreixo Formoso advises to compare the application's
3620 requirements of library revisions with the runtime
3621 library. This is to allow runtime libraries which are
3622 young enough for the application but too old for
3623 the lib*.h files seen at compile time.
3624 
3625 Thomas Schmitt advises to compare the header
3626 revisions defined here with the runtime library.
3627 This is to enforce a strictly monotonous chain
3628 of revisions from app to header to library,
3629 at the cost of excluding some older libraries.
3630 
3631 These two advises are mutually exclusive.
3632 
3633 */
3634 
3635 /* ts A91226 */
3636 /** Obtain the id string of the SCSI transport interface.
3637  This interface may be a system specific adapter module of libburn or
3638  an adapter to a supporting library like libcdio.
3639  @param flag Bitfield for control puposes, submit 0 for now
3640  @return A pointer to the id string. Do not alter the string content.
3641  @since 0.7.6
3642 */
3643 char *burn_scsi_transport_id(int flag);
3644 
3645 /* ts A60924 : ticket 74 */
3646 /** Control queueing and stderr printing of messages from libburn.
3647  Severity may be one of "NEVER", "ABORT", "FATAL", "FAILURE", "SORRY",
3648  "WARNING", "HINT", "NOTE", "UPDATE", "DEBUG", "ALL".
3649  @param queue_severity Gives the minimum limit for messages to be queued.
3650  Default: "NEVER". If you queue messages then you
3651  must consume them by burn_msgs_obtain().
3652  @param print_severity Does the same for messages to be printed directly
3653  to stderr. Default: "FATAL".
3654  @param print_id A text prefix to be printed before the message.
3655  @return >0 for success, <=0 for error
3656  @since 0.2.6
3657 */
3658 int burn_msgs_set_severities(char *queue_severity,
3659  char *print_severity, char *print_id);
3660 
3661 /* ts A60924 : ticket 74 */
3662 /* @since 0.2.6 */
3663 #define BURN_MSGS_MESSAGE_LEN 4096
3664 
3665 /** Obtain the oldest pending libburn message from the queue which has at
3666  least the given minimum_severity. This message and any older message of
3667  lower severity will get discarded from the queue and is then lost forever.
3668  @param minimum_severity may be one of "NEVER", "ABORT", "FATAL",
3669  "FAILURE", "SORRY", "WARNING", "HINT", "NOTE", "UPDATE",
3670  "DEBUG", "ALL".
3671  To call with minimum_severity "NEVER" will discard the
3672  whole queue.
3673  @param error_code Will become a unique error code as listed in
3674  libburn/libdax_msgs.h
3675  @param msg_text Must provide at least BURN_MSGS_MESSAGE_LEN bytes.
3676  @param os_errno Will become the eventual errno related to the message
3677  @param severity Will become the severity related to the message and
3678  should provide at least 80 bytes.
3679  @return 1 if a matching item was found, 0 if not, <0 for severe errors
3680  @since 0.2.6
3681 */
3682 int burn_msgs_obtain(char *minimum_severity,
3683  int *error_code, char msg_text[], int *os_errno,
3684  char severity[]);
3685 
3686 
3687 /* ts A70922 */
3688 /** Submit a message to the libburn queueing system. It will be queued or
3689  printed as if it was generated by libburn itself.
3690  @param error_code The unique error code of your message.
3691  Submit 0 if you do not have reserved error codes within
3692  the libburnia project.
3693  @param msg_text Not more than BURN_MSGS_MESSAGE_LEN characters of
3694  message text.
3695  @param os_errno Eventual errno related to the message. Submit 0 if
3696  the message is not related to a operating system error.
3697  @param severity One of "ABORT", "FATAL", "FAILURE", "SORRY", "WARNING",
3698  "HINT", "NOTE", "UPDATE", "DEBUG". Defaults to "FATAL".
3699  @param d An eventual drive to which the message shall be related.
3700  Submit NULL if the message is not specific to a
3701  particular drive object.
3702  @return 1 if message was delivered, <=0 if failure
3703  @since 0.4.0
3704 */
3705 int burn_msgs_submit(int error_code, char msg_text[], int os_errno,
3706  char severity[], struct burn_drive *d);
3707 
3708 
3709 /* ts A71016 */
3710 /** Convert a severity name into a severity number, which gives the severity
3711  rank of the name.
3712  @param severity_name A name as with burn_msgs_submit(), e.g. "SORRY".
3713  @param severity_number The rank number: the higher, the more severe.
3714  @param flag Bitfield for control purposes (unused yet, submit 0)
3715  @return >0 success, <=0 failure
3716  @since 0.4.0
3717 */
3718 int burn_text_to_sev(char *severity_name, int *severity_number, int flag);
3719 
3720 
3721 /* ts A80202 */
3722 /** Convert a severity number into a severity name
3723  @param severity_number The rank number: the higher, the more severe.
3724  @param severity_name A name as with burn_msgs_submit(), e.g. "SORRY".
3725  @param flag Bitfield for control purposes (unused yet, submit 0)
3726  @return >0 success, <=0 failure
3727  @since 0.4.4
3728 */
3729 int burn_sev_to_text(int severity_number, char **severity_name, int flag);
3730 
3731 
3732 /* ts B21214 */
3733 /** Return a blank separated list of severity names. Sorted from low
3734  to high severity.
3735  @param flag Bitfield for control purposes (unused yet, submit 0)
3736  @return A constant string with the severity names
3737  @since 1.2.6
3738 */
3739 char *burn_list_sev_texts(int flag);
3740 
3741 
3742 /* ts A70915 */
3743 /** Replace the messenger object handle of libburn by a compatible handle
3744  obtained from a related library.
3745  See also: libisofs, API function iso_get_messenger().
3746  @param messenger The foreign but compatible message handle.
3747  @return 1 : success, <=0 : failure
3748  @since 0.4.0
3749 */
3750 int burn_set_messenger(void *messenger);
3751 
3752 
3753 /* ts A61002 */
3754 /* @since 0.2.6 */
3755 /** The prototype of a handler function suitable for burn_set_signal_handling()
3756  Such a function has to return -2 if it does not want the process to
3757  exit with value 1.
3758 */
3759 typedef int (*burn_abort_handler_t)(void *handle, int signum, int flag);
3760 
3761 /** Control built-in signal handling. Either by setting an own handler or
3762  by activating the built-in signal handler.
3763 
3764  A function parameter handle of NULL activates the built-in abort handler.
3765  Depending on mode it may cancel all drive operations, wait for all drives
3766  to become idle, exit(1). It may also prepare function
3767  burn_drive_get_status() for waiting and performing exit(1).
3768  If parameter handle may be NULL or a text that shall be used as prefix for
3769  pacifier messages of burn_abort_pacifier(). Other than with an application
3770  provided handler, the prefix char array does not have to be kept existing
3771  until the eventual signal event.
3772  Before version 0.7.8 only action 0 was available. I.e. the built-in handler
3773  waited for the drives to become idle and then performed exit(1) directly.
3774  But during burn_disc_write() onto real CD or DVD, FreeBSD 8.0 pauses the
3775  other threads until the signal handler returns.
3776  The new actions try to avoid this deadlock. It is advised to use action 3
3777  at least during burn_disc_write(), burn_disc_erase(), burn_disc_format():
3778  burn_set_signal_handling(text, NULL, 0x30);
3779  and to call burn_is_aborting(0) when the drive is BURN_DRIVE_IDLE.
3780  If burn_is_aborting(0) returns 1, then call burn_abort() and exit(1).
3781 
3782  @param handle Opaque handle eventually pointing to an application
3783  provided memory object
3784  @param handler A function to be called on signals, if the handling bits
3785  in parameter mode are set 0.
3786  It will get parameter handle as argument. flag will be 0.
3787  It should finally call burn_abort(). See there.
3788  If the handler function returns 2 or -2, then the wrapping
3789  signal handler of libburn will return and let the program
3790  continue its operations. Any other return value causes
3791  exit(1).
3792  @param mode : bit0 - bit3: Handling of received signals:
3793  0 Install libburn wrapping signal handler, which will call
3794  handler(handle, signum, 0) on nearly all signals
3795  1 Enable system default reaction on all signals
3796  2 Try to ignore nearly all signals
3797  10 like mode 2 but handle SIGABRT like with mode 0
3798  bit4 - bit7: With handler == NULL :
3799  Action of built-in handler. "control thread" is the one
3800  which called burn_set_signal_handling().
3801  All actions activate receive mode 2 to ignore further
3802  signals.
3803  0 Same as 1 (for pre-0.7.8 backward compatibility)
3804  @since 0.7.8
3805  1 Catch the control thread in abort handler, call
3806  burn_abort() with a patience value > 0 and
3807  finally exit(1). Does not always work with FreeBSD.
3808  2 Call burn_abort() with patience -1 and return from
3809  handler. When the control thread calls
3810  burn_drive_get_status(), then call burn_abort()
3811  with patience 1 instead, and finally exit(1).
3812  Does not always work with FreeBSD.
3813  3 Call burn_abort() with patience -1, return from handler.
3814  It is duty of the application to detect a pending abort
3815  condition by calling burn_is_aborting() and to wait for
3816  all drives to become idle. E.g. by calling burn_abort()
3817  with patience >0.
3818  4 Like 3, but without calling burn_abort() with -1. Only
3819  the indicator of burn_is_aborting() gets set.
3820  bit8: @since 1.3.2
3821  try to ignore SIGPIPE (regardless of bit0 - bit3)
3822 
3823  @since 0.2.6
3824 */
3825 void burn_set_signal_handling(void *handle, burn_abort_handler_t handler,
3826  int mode);
3827 
3828 
3829 /* ts B00304 */
3830 /* Inquire whether the built-in abort handler was triggered by a signal.
3831  This has to be done to detect pending abort handling if signal handling
3832  was set to the built-in handler and action was set to 2 or 3.
3833  @param flag Bitfield for control purposes (unused yet, submit 0)
3834  @return 0 = no abort was triggered
3835  >0 = action that was triggered (action 0 is reported as 1)
3836  @since 0.7.8
3837 */
3838 int burn_is_aborting(int flag);
3839 
3840 
3841 /* ts A70811 */
3842 /** Write data in random access mode.
3843  The drive must be grabbed successfully before calling this function which
3844  circumvents usual libburn session processing and rather writes data without
3845  preparations or finalizing. This will work only with overwriteable media
3846  which are also suitable for burn_write_opts_set_start_byte(). The same
3847  address alignment restrictions as with this function apply. I.e. for DVD
3848  it is best to align to 32 KiB blocks (= 16 LBA units). The amount of data
3849  to be written is subject to the same media dependent alignment rules.
3850  Again, 32 KiB is most safe.
3851  Call burn_disc_get_multi_caps() can obtain the necessary media info. See
3852  resulting struct burn_multi_caps elements .start_adr , .start_alignment ,
3853  .start_range_low , .start_range_high .
3854  Other than burn_disc_write() this is a synchronous call which returns
3855  only after the write transaction has ended (sucessfully or not). So it is
3856  wise not to transfer giant amounts of data in a single call.
3857  Important: Data have to fit into the already formatted area of the media.
3858  @param d The drive to which to write
3859  @param byte_address The start address of the write in byte
3860  (1 LBA unit = 2048 bytes) (do respect media alignment)
3861  @param data The bytes to be written
3862  @param data_count The number of those bytes (do respect media alignment)
3863  data_count == 0 is permitted (e.g. to flush the
3864  drive buffer without further data transfer).
3865  @param flag Bitfield for control purposes:
3866  bit0 = flush the drive buffer after eventual writing
3867  @return 1=sucessful , <=0 : number of transfered bytes * -1
3868  @since 0.4.0
3869 */
3870 int burn_random_access_write(struct burn_drive *d, off_t byte_address,
3871  char *data, off_t data_count, int flag);
3872 
3873 
3874 /* ts A81215 */
3875 /** Inquire the maximum amount of readable data.
3876  It is supposed that all LBAs in the range from 0 to media_read_acpacity-1
3877  can be read via burn_read_data() although some of them may never have been
3878  recorded. If tracks are recognizable then it is better to only read
3879  LBAs which are part of some track.
3880  If the drive is actually a large file or block device, then the capacity
3881  is curbed to a maximum of 0x7ffffff0 blocks = 4 TB - 32 KB.
3882  @param d The drive from which to read
3883  @param capacity Will return the result if valid
3884  @param flag Bitfield for control purposes: Unused yet, submit 0.
3885  @return 1=sucessful , <=0 an error occured
3886  @since 0.6.0
3887 */
3888 int burn_get_read_capacity(struct burn_drive *d, int *capacity, int flag);
3889 
3890 
3891 /* ts A70812 */
3892 /** Read data in random access mode.
3893  The drive must be grabbed successfully before calling this function.
3894  With all currently supported drives and media the byte_address has to
3895  be aligned to 2048 bytes. Only data tracks with 2048 bytes per sector
3896  can be read this way. I.e. not CD-audio, not CD-video-stream ...
3897  This is a synchronous call which returns only after the full read job
3898  has ended (sucessfully or not). So it is wise not to read giant amounts
3899  of data in a single call.
3900  @param d The drive from which to read
3901  @param byte_address The start address of the read in byte (aligned to 2048)
3902  @param data A memory buffer capable of taking data_size bytes
3903  @param data_size The amount of data to be read. This does not have to
3904  be aligned to any block size.
3905  @param data_count The amount of data actually read (interesting on error)
3906  @param flag Bitfield for control purposes:
3907  bit0= - reserved -
3908  bit1= do not submit error message if read error
3909  bit2= on error do not try to read a second time
3910  with single block steps.
3911  @since 0.5.2
3912  bit3= return -2 on permission denied error rather than
3913  issueing a warning message.
3914  @since 1.0.6
3915  bit4= return -3 on SCSI error
3916  5 64 00 ILLEGAL MODE FOR THIS TRACK
3917  and prevent this error from being reported as
3918  event message. Do not retry reading in this case.
3919  (Useful to try the last two blocks of a CD
3920  track which might be non-data because of TAO.)
3921  @since 1.2.6
3922  @return 1=sucessful , <=0 an error occured
3923  with bit3: -2= permission denied error
3924  @since 0.4.0
3925 */
3926 int burn_read_data(struct burn_drive *d, off_t byte_address,
3927  char data[], off_t data_size, off_t *data_count, int flag);
3928 
3929 
3930 /* ts B21119 */
3931 /** Read CD audio sectors in random access mode.
3932  The drive must be grabbed successfully before calling this function.
3933  Only CD audio tracks with 2352 bytes per sector can be read this way.
3934  I.e. not data tracks, not CD-video-stream, ...
3935 
3936  Note that audio data do not have exact block addressing. If you read a
3937  sequence of successive blocks then you will get a seamless stream
3938  of data. But the actual start and end position of this audio stream
3939  will differ by a few dozens of milliseconds, depending on individual
3940  CD and individual drive.
3941  Expect leading and trailing zeros, as well as slight truncation.
3942 
3943  @param d The drive from which to read.
3944  It must be a real MMC drive (i.e. not a stdio file)
3945  and it must have a CD loaded (i.e. not DVD or BD).
3946  @param sector_no The sector number (Logical Block Address)
3947  It may be slightly below 0, depending on drive and
3948  medium. -150 is a lower limit.
3949  @param data A memory buffer capable of taking data_size bytes
3950  @param data_size The amount of data to be read. This must be aligned
3951  to full multiples of 2352.
3952  @param data_count The amount of data actually read (interesting on error)
3953  @param flag Bitfield for control purposes:
3954  bit0= - reserved -
3955  bit1= do not submit error message if read error
3956  bit2= on error do not try to read a second time
3957  with single block steps.
3958  bit3= Enable DAP : "flaw obscuring mechanisms like
3959  audio data mute and interpolate"
3960  bit4= return -3 on SCSI error
3961  5 64 00 ILLEGAL MODE FOR THIS TRACK
3962  and prevent this error from being reported as
3963  event message. Do not retry reading in this case.
3964  (Useful to try the last two blocks of a CD
3965  track which might be non-audio because of TAO.)
3966  @return 1=sucessful , <=0 an error occured
3967  with bit3: -2= permission denied error
3968  @since 1.2.6
3969 */
3970 int burn_read_audio(struct burn_drive *d, int sector_no,
3971  char data[], off_t data_size, off_t *data_count, int flag);
3972 
3973 
3974 /* ts B30522 */
3975 /** Extract an interval of audio sectors from CD and store it as a WAVE
3976  audio file on hard disk.
3977 
3978  @param drive The drive from which to read.
3979  @param start_sector The logical block address of the first audio sector
3980  which shall be read.
3981  @param sector_count The number of audio sectors to be read.
3982  Each sector consists of 2352 bytes.
3983  @param target_path The address of the file where to store the extracted
3984  audio data. Will be opened O_WRONLY | O_CREAT.
3985  The file name should have suffix ".wav".
3986  @param flag Bitfield for control purposes:
3987  bit0= Report about progress by UPDATE messages
3988  bit3= Enable DAP : "flaw obscuring mechanisms like
3989  audio data mute and interpolate"
3990  @since 1.3.2
3991 */
3992 int burn_drive_extract_audio(struct burn_drive *drive,
3993  int start_sector, int sector_count,
3994  char *target_path, int flag);
3995 
3996 
3997 /* ts B30522 */
3998 /** Extract all audio sectors of a track from CD and store them as a WAVE
3999  audio file on hard disk.
4000 
4001  @param drive The drive from which to read.
4002  @param track The track which shall be extracted.
4003  @param target_path The address of the file where to store the extracted
4004  audio data. Will be opened O_WRONLY | O_CREAT.
4005  The file name should have suffix ".wav".
4006  @param flag Bitfield for control purposes:
4007  bit0= Report about progress by UPDATE messages
4008  bit3= Enable DAP : "flaw obscuring mechanisms like
4009  audio data mute and interpolate"
4010  @since 1.3.2
4011 */
4012 int burn_drive_extract_audio_track(struct burn_drive *drive,
4013  struct burn_track *track,
4014  char *target_path, int flag);
4015 
4016 
4017 /* ts A70904 */
4018 /** Inquire whether the drive object is a real MMC drive or a pseudo-drive
4019  created by a stdio: address.
4020  @param d The drive to inquire
4021  @return 0= null-drive
4022  1= real MMC drive
4023  2= stdio-drive, random access, read-write
4024  3= stdio-drive, sequential, write-only
4025  4= stdio-drive, random access, read-only
4026  (only if enabled by burn_allow_drive_role_4())
4027  5= stdio-drive, random access, write-only
4028  (only if enabled by burn_allow_drive_role_4())
4029  @since 0.4.0
4030 */
4031 int burn_drive_get_drive_role(struct burn_drive *d);
4032 
4033 
4034 /* ts B10312 */
4035 /** Allow drive role 4 "random access read-only"
4036  and drive role 5 "random access write-only".
4037  By default a random access file assumes drive role 2 "read-write"
4038  regardless whether it is actually readable or writeable.
4039  If enabled, random-access file objects which recognizably allow no
4040  writing will be classified as role 4 and those which allow no reading
4041  will get role 5.
4042  Candidates are drive addresses of the form stdio:/dev/fd/# , where # is
4043  the integer number of an open file descriptor. If this descriptor was
4044  opened read-only resp. write-only, then it gets role 4 resp. role 5.
4045  Other paths may get tested by an attempt to open them for read-write
4046  (role 2) resp. read-only (role 4) resp. write-only (role 5). See bit1.
4047  @param allowed Bitfield for control purposes:
4048  bit0= Enable roles 4 and 5 for drives which get
4049  aquired after this call
4050  bit1= with bit0:
4051  Test whether the file can be opened for
4052  read-write resp. read-only resp. write-only.
4053  Classify as roles 2 resp. 4 resp. 5.
4054  bit2= with bit0 and bit1:
4055  Classify files which cannot be opened at all
4056  as role 0 : useless dummy.
4057  Else classify as role 2.
4058  bit3= Classify non-empty role 5 drives as
4059  BURN_DISC_APPENDABLE with Next Writeable Address
4060  after the end of the file. It is nevertheless
4061  possible to change this address by call
4062  burn_write_opts_set_start_byte().
4063  @since 1.0.6
4064 */
4065 void burn_allow_drive_role_4(int allowed);
4066 
4067 
4068 /* ts A70923 */
4069 /** Find out whether a given address string would lead to the given drive
4070  object. This should be done in advance for track source addresses
4071  with parameter drive_role set to 2.
4072  Although a real MMC drive should hardly exist as two drive objects at
4073  the same time, this can easily happen with stdio-drives. So if more than
4074  one drive is used by the application, then this gesture is advised:
4075  burn_drive_d_get_adr(d2, adr2);
4076  if (burn_drive_equals_adr(d1, adr2, burn_drive_get_drive_role(d2)))
4077  ... Both drive objects point to the same storage facility ...
4078 
4079  @param d1 Existing drive object
4080  @param adr2 Address string to be tested. Prefix "stdio:" overrides
4081  parameter drive_role2 by either 0 or 2 as appropriate.
4082  The string must be shorter than BURN_DRIVE_ADR_LEN.
4083  @param drive_role2 Role as burn_drive_get_drive_role() would attribute
4084  to adr2 if it was a drive. Use value 2 for checking track
4085  sources resp. pseudo-drive addresses without "stdio:".
4086  Use 1 for checking drive addresses including those with
4087  prefix "stdio:".
4088  @return 1= adr2 leads to d1 , 0= adr2 seems not to lead to d1,
4089  -1 = adr2 is bad
4090  @since 0.4.0
4091 */
4092 int burn_drive_equals_adr(struct burn_drive *d1, char *adr2, int drive_role2);
4093 
4094 
4095 
4096 /*
4097  Audio track data extraction facility.
4098 */
4099 
4100 /* Maximum size for address paths and fmt_info strings */
4101 #define LIBDAX_AUDIOXTR_STRLEN 4096
4102 
4103 
4104 /** Extractor object encapsulating intermediate states of extraction.
4105  The clients of libdax_audioxtr shall only allocate pointers to this
4106  struct and get a storage object via libdax_audioxtr_new().
4107  Appropriate initial value for the pointer is NULL.
4108 */
4109 struct libdax_audioxtr;
4110 
4111 
4112 /** Open an audio file, check wether suitable, create extractor object.
4113  @param xtr Opaque handle to extractor. Gets attached extractor object.
4114  @param path Address of the audio file to extract. "-" is stdin (but might
4115  be not suitable for all futurely supported formats).
4116  @param flag Bitfield for control purposes (unused yet, submit 0)
4117  @return >0 success
4118  0 unsuitable format
4119  -1 severe error
4120  -2 path not found
4121  @since 0.2.4
4122 */
4123 int libdax_audioxtr_new(struct libdax_audioxtr **xtr, char *path, int flag);
4124 
4125 
4126 /** Obtain identification parameters of opened audio source.
4127  @param xtr Opaque handle to extractor
4128  @param fmt Gets pointed to the audio file format id text: ".wav" , ".au"
4129  @param fmt_info Gets pointed to a format info text telling parameters
4130  @param num_channels e.g. 1=mono, 2=stereo, etc
4131  @param sample_rate e.g. 11025, 44100
4132  @param bits_per_sample e.g. 8= 8 bits per sample, 16= 16 bits ...
4133  @param msb_first Byte order of samples: 0= Intel = Little Endian
4134  1= Motorola = Big Endian
4135  @param flag Bitfield for control purposes (unused yet, submit 0)
4136  @return >0 success, <=0 failure
4137  @since 0.2.4
4138 */
4139 int libdax_audioxtr_get_id(struct libdax_audioxtr *xtr,
4140  char **fmt, char **fmt_info,
4141  int *num_channels, int *sample_rate,
4142  int *bits_per_sample, int *msb_first, int flag);
4143 
4144 
4145 /** Obtain a prediction about the extracted size based on internal information
4146  of the formatted file.
4147  @param xtr Opaque handle to extractor
4148  @param size Gets filled with the predicted size
4149  @param flag Bitfield for control purposes (unused yet, submit 0)
4150  @return 1 prediction was possible , 0 no prediction could be made
4151  @since 0.2.4
4152 */
4153 int libdax_audioxtr_get_size(struct libdax_audioxtr *o, off_t *size, int flag);
4154 
4155 
4156 /** Obtain next buffer full of extracted data in desired format (only raw audio
4157  for now).
4158  @param xtr Opaque handle to extractor
4159  @param buffer Gets filled with extracted data
4160  @param buffer_size Maximum number of bytes to be filled into buffer
4161  @param flag Bitfield for control purposes
4162  bit0= do not stop at predicted end of data
4163  @return >0 number of valid buffer bytes,
4164  0 End of file
4165  -1 operating system reports error
4166  -2 usage error by application
4167  @since 0.2.4
4168 */
4169 int libdax_audioxtr_read(struct libdax_audioxtr *xtr,
4170  char buffer[], int buffer_size, int flag);
4171 
4172 
4173 /** Try to obtain a file descriptor which will deliver extracted data
4174  to normal calls of read(2). This may fail because the format is
4175  unsuitable for that, but WAVE (.wav) is ok. If this call succeeds the xtr
4176  object will have forgotten its file descriptor and libdax_audioxtr_read()
4177  will return a usage error. One may use *fd after libdax_audioxtr_destroy()
4178  and will have to close it via close(2) when done with it.
4179  @param xtr Opaque handle to extractor
4180  @param fd Eventually returns the file descriptor number
4181  @param flag Bitfield for control purposes
4182  bit0= do not dup(2) and close(2) but hand out original fd
4183  @return 1 success, 0 cannot hand out fd , -1 severe error
4184  @since 0.2.4
4185 */
4186 int libdax_audioxtr_detach_fd(struct libdax_audioxtr *o, int *fd, int flag);
4187 
4188 
4189 /** Clean up after extraction and destroy extractor object.
4190  @param xtr Opaque handle to extractor, *xtr is allowed to be NULL,
4191  *xtr is set to NULL by this function
4192  @param flag Bitfield for control purposes (unused yet, submit 0)
4193  @return 1 = destroyed object, 0 = was already destroyed
4194  @since 0.2.4
4195 */
4196 int libdax_audioxtr_destroy(struct libdax_audioxtr **xtr, int flag);
4197 
4198 
4199 #ifndef DOXYGEN
4200 
4201 BURN_END_DECLS
4202 
4203 #endif
4204 
4205 
4206 /* ts A91205 */
4207 /* The following experiments may be interesting in future:
4208 */
4209 
4210 /* Perform OPC explicitely.
4211  # define Libburn_pioneer_dvr_216d_with_opC 1
4212 */
4213 
4214 /* Load mode page 5 and modify it rather than composing from scratch.
4215  # define Libburn_pioneer_dvr_216d_load_mode5 1
4216 */
4217 
4218 /* Inquire drive events and react by reading configuration or starting unit.
4219  # define Libburn_pioneer_dvr_216d_get_evenT 1
4220 */
4221 
4222 /* ts A91112 */
4223 /* Do not probe CD modes but declare only data and audio modes supported.
4224  For other modes resp. real probing one has to call
4225  burn_drive_probe_cd_write_modes().
4226 
4227 */
4228 #define Libburn_dummy_probe_write_modeS 1
4229 
4230 /* ts B30112 */
4231 /* Handle DVD+R with reserved tracks in incomplete first session
4232  by loading info about the incomplete session into struct burn_disc
4233 */
4234 #define Libburn_disc_with_incomplete_sessioN 1
4235 
4236 
4237 /* Early experimental:
4238  Do not define Libburn_develop_quality_scaN unless you want to work
4239  towards a usable implementation.
4240  If it gets enabled, then the call must be published in libburn/libburn.ver
4241 */
4242 #ifdef Libburn_develop_quality_scaN
4243 
4244 /* ts B21108 */
4245 /* Experiments mit quality scan command F3 on Optiarc drive */
4246 int burn_nec_optiarc_rep_err_rate(struct burn_drive *d,
4247  int start_lba, int rate_period, int flag);
4248 
4249 #endif /* Libburn_develop_quality_scaN */
4250 
4251 
4252 
4253 #endif /*LIBBURN_H*/

Generated for libburn by  doxygen 1.8.3.1