xorriso  1.5.4.pl02
About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.
  Fossies Dox: xorriso-1.5.4.pl02.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

structure.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include "libburn.h"
#include "structure.h"
#include "write.h"
#include "debug.h"
#include "init.h"
#include "util.h"
#include "transport.h"
#include "mmc.h"
#include "libdax_msgs.h"
Include dependency graph for structure.c:

Go to the source code of this file.

Data Structures

struct  burn_cue_file_cursor
 

Macros

#define O_BINARY   0
 
#define RESIZE(TO, NEW, pos)
 

Functions

struct burn_discburn_disc_create (void)
 
void burn_disc_free (struct burn_disc *d)
 
struct burn_sessionburn_session_create (void)
 
void burn_session_hide_first_track (struct burn_session *s, int onoff)
 
void burn_session_free (struct burn_session *s)
 
int burn_disc_add_session (struct burn_disc *d, struct burn_session *s, unsigned int pos)
 
int burn_disc_remove_session (struct burn_disc *d, struct burn_session *s)
 
struct burn_trackburn_track_create (void)
 
void burn_track_free (struct burn_track *t)
 
int burn_session_add_track (struct burn_session *s, struct burn_track *t, unsigned int pos)
 
int burn_session_remove_track (struct burn_session *s, struct burn_track *t)
 
void burn_structure_print_disc (struct burn_disc *d)
 
void burn_structure_print_session (struct burn_session *s)
 
void burn_structure_print_track (struct burn_track *t)
 
void burn_track_define_data (struct burn_track *t, int offset, int tail, int pad, int mode)
 
int burn_track_set_byte_swap (struct burn_track *t, int swap_source_bytes)
 
int burn_track_set_cdxa_conv (struct burn_track *t, int value)
 
void burn_track_set_isrc (struct burn_track *t, char *country, char *owner, unsigned char year, unsigned int serial)
 
int burn_track_set_isrc_string (struct burn_track *t, char isrc[13], int flag)
 
void burn_track_clear_isrc (struct burn_track *t)
 
int burn_track_set_index (struct burn_track *t, int index_number, unsigned int relative_lba, int flag)
 
int burn_track_clear_indice (struct burn_track *t, int flag)
 
int burn_track_set_pregap_size (struct burn_track *t, int size, int flag)
 
int burn_track_set_postgap_size (struct burn_track *t, int size, int flag)
 
int burn_track_get_sectors_2 (struct burn_track *t, int flag)
 
int burn_track_get_sectors (struct burn_track *t)
 
int burn_track_set_sectors (struct burn_track *t, int sectors)
 
int burn_track_set_size (struct burn_track *t, off_t size)
 
int burn_track_set_fillup (struct burn_track *t, int fill_up_media)
 
int burn_track_apply_fillup (struct burn_track *t, off_t max_size, int flag)
 
int burn_track_is_open_ended (struct burn_track *t)
 
int burn_track_set_default_size (struct burn_track *t, off_t size)
 
off_t burn_track_get_default_size (struct burn_track *t)
 
int burn_track_get_counters (struct burn_track *t, off_t *read_bytes, off_t *written_bytes)
 
int burn_track_is_data_done (struct burn_track *t)
 
int burn_track_get_shortage (struct burn_track *t)
 
int burn_session_get_sectors (struct burn_session *s)
 
int burn_disc_get_sectors (struct burn_disc *d)
 
void burn_track_get_entry (struct burn_track *t, struct burn_toc_entry *entry)
 
void burn_session_get_leadout_entry (struct burn_session *s, struct burn_toc_entry *entry)
 
struct burn_session ** burn_disc_get_sessions (struct burn_disc *d, int *num)
 
int burn_disc_get_incomplete_sessions (struct burn_disc *d)
 
struct burn_track ** burn_session_get_tracks (struct burn_session *s, int *num)
 
int burn_track_get_mode (struct burn_track *track)
 
int burn_session_get_hidefirst (struct burn_session *session)
 
int burn_disc_cd_toc_extensions (struct burn_drive *drive, int flag)
 
int burn_session_set_start_tno (struct burn_session *session, int tno, int flag)
 
int burn_session_get_start_tno (struct burn_session *session, int flag)
 
struct burn_cdtextburn_cdtext_create (void)
 
void burn_cdtext_free (struct burn_cdtext **cdtext)
 
static int burn_cdtext_name_to_type (char *pack_type_name)
 
static int burn_cdtext_set (struct burn_cdtext **cdtext, int pack_type, char *pack_type_name, unsigned char *payload, int length, int flag)
 
static int burn_cdtext_get (struct burn_cdtext *t, int pack_type, char *pack_type_name, unsigned char **payload, int *length, int flag)
 
static int burn_cdtext_check_blockno (int block)
 
int burn_track_set_cdtext (struct burn_track *t, int block, int pack_type, char *pack_type_name, unsigned char *payload, int length, int flag)
 
int burn_track_get_cdtext (struct burn_track *t, int block, int pack_type, char *pack_type_name, unsigned char **payload, int *length, int flag)
 
int burn_track_dispose_cdtext (struct burn_track *t, int block)
 
int burn_session_set_cdtext (struct burn_session *s, int block, int pack_type, char *pack_type_name, unsigned char *payload, int length, int flag)
 
int burn_session_get_cdtext (struct burn_session *s, int block, int pack_type, char *pack_type_name, unsigned char **payload, int *length, int flag)
 
int burn_session_set_cdtext_par (struct burn_session *s, int char_codes[8], int copyrights[8], int block_languages[8], int flag)
 
int burn_session_get_cdtext_par (struct burn_session *s, int char_codes[8], int copyrights[8], int block_languages[8], int flag)
 
int burn_session_dispose_cdtext (struct burn_session *s, int block)
 
static int cue_crs_new (struct burn_cue_file_cursor **reply, int flag)
 
static int cue_crs_destroy (struct burn_cue_file_cursor **victim, int flag)
 
static char * cue_unquote_text (char *text, int flag)
 
static int cue_set_cdtext (struct burn_session *session, struct burn_track *track, int pack_type, char *text, struct burn_cue_file_cursor *crs, int flag)
 
static int cue_attach_track (struct burn_session *session, struct burn_cue_file_cursor *crs, int flag)
 
static int cue_read_number (char **payload, int *number, int flag)
 
static int cue_open_audioxtr (char *path, struct burn_cue_file_cursor *crs, int *fd, int flag)
 
static int cue_create_file_source (char *path, struct burn_cue_file_cursor *crs, int flag)
 
static int cue_read_timepoint_lba (char *apt, char *purpose, int *file_ba, int flag)
 
static int cue_check_for_track (struct burn_cue_file_cursor *crs, char *cmd, int flag)
 
static int cue_interpret_line (struct burn_session *session, char *line, struct burn_cue_file_cursor *crs, int flag)
 
int burn_session_by_cue_file (struct burn_session *session, char *path, int fifo_size, struct burn_source **fifo, unsigned char **text_packs, int *num_packs, int flag)
 

Variables

struct libdax_msgs * libdax_messenger
 

Macro Definition Documentation

◆ O_BINARY

#define O_BINARY   0

Definition at line 26 of file structure.c.

◆ RESIZE

#define RESIZE (   TO,
  NEW,
  pos 
)
Value:
{\
void *tmp;\
\
if (pos > BURN_POS_END)\
return 0;\
if (pos == BURN_POS_END)\
pos = TO->NEW##s;\
if ((int) pos > TO->NEW##s)\
return 0;\
\
tmp = realloc(TO->NEW, sizeof(struct NEW *) * (TO->NEW##s + 1));\
if (!tmp)\
return 0;\
TO->NEW = tmp;\
memmove(TO->NEW + pos + 1, TO->NEW + pos,\
sizeof(struct NEW *) * (TO->NEW##s - pos));\
TO->NEW##s++;\
}
#define BURN_POS_END
Definition: libburn.h:76

Definition at line 45 of file structure.c.

Function Documentation

◆ burn_cdtext_check_blockno()

◆ burn_cdtext_create()

struct burn_cdtext* burn_cdtext_create ( void  )

◆ burn_cdtext_free()

void burn_cdtext_free ( struct burn_cdtext **  cdtext)

◆ burn_cdtext_get()

static int burn_cdtext_get ( struct burn_cdtext t,
int  pack_type,
char *  pack_type_name,
unsigned char **  payload,
int *  length,
int  flag 
)
static

◆ burn_cdtext_name_to_type()

static int burn_cdtext_name_to_type ( char *  pack_type_name)
static

◆ burn_cdtext_set()

static int burn_cdtext_set ( struct burn_cdtext **  cdtext,
int  pack_type,
char *  pack_type_name,
unsigned char *  payload,
int  length,
int  flag 
)
static

◆ burn_disc_add_session()

int burn_disc_add_session ( struct burn_disc d,
struct burn_session s,
unsigned int  pos 
)

Add a session to a disc at a specific position, increasing the sessions's reference count.

Parameters
dDisc to add the session to
sSession to add to the disc
posposition to add at (BURN_POS_END is "at the end")
Returns
0 for failure, 1 for success

Definition at line 142 of file structure.c.

References burn_session::refcnt, RESIZE, and burn_disc::session.

Referenced by isoburn_prepare_disc_aux(), mmc_fake_toc(), mmc_read_toc_al(), mmc_read_toc_fmt0_al(), and Xorriso_burn_track().

◆ burn_disc_cd_toc_extensions()

◆ burn_disc_create()

struct burn_disc* burn_disc_create ( void  )

Create a new disc

Returns
Pointer to a burn_disc object or NULL on failure.

Definition at line 64 of file structure.c.

References burn_disc::refcnt, burn_disc::session, and burn_disc::sessions.

Referenced by isoburn_prepare_disc_aux(), mmc_fake_toc(), mmc_read_toc_al(), mmc_read_toc_fmt0_al(), and Xorriso_burn_track().

◆ burn_disc_free()

void burn_disc_free ( struct burn_disc d)

Delete disc and decrease the reference count on all its sessions

Parameters
dThe disc to be freed

Definition at line 81 of file structure.c.

References burn_session_free(), burn_disc::refcnt, burn_disc::session, and burn_disc::sessions.

Referenced by burn_drive_mark_unready(), isoburn_toc_disc_free(), mmc_read_multi_session_c1(), Xorriso_burn_track(), and Xorriso_write_session().

◆ burn_disc_get_incomplete_sessions()

int burn_disc_get_incomplete_sessions ( struct burn_disc d)

Obtains the number of incomplete sessions which are recorded in the result array of burn_disc_get_sessions() after the complete sessions. See above.

Parameters
dDisc object to inquire
Returns
Number of incomplete sessions

Definition at line 721 of file structure.c.

Referenced by isoburn_toc_disc_get_sectors(), and isoburn_toc_drive_get_disc().

◆ burn_disc_get_sectors()

int burn_disc_get_sectors ( struct burn_disc d)

◆ burn_disc_get_sessions()

struct burn_session** burn_disc_get_sessions ( struct burn_disc d,
int *  num 
)

Gets an array of all complete sessions for the disc THIS IS NO LONGER VALID AFTER YOU ADD OR REMOVE A SESSION The result array contains *num + burn_disc_get_incomplete_sessions() elements. All above *num are incomplete sessions. Typically there is at most one incomplete session with one empty track. DVD+R and BD-R seem support more than one track with even readable data.

Parameters
dDisc to get session array for
numReturns the number of sessions in the array
Returns
array of sessions

Definition at line 702 of file structure.c.

References burn_disc::session, and burn_disc::sessions.

Referenced by isoburn_toc_disc_get_sectors(), isoburn_toc_drive_get_disc(), mmc_read_multi_session_c1(), precheck_disc_has_cdtext(), precheck_write_is_audio(), Xorriso_sanitize_image_size(), and Xorriso_write_session().

◆ burn_disc_remove_session()

int burn_disc_remove_session ( struct burn_disc d,
struct burn_session s 
)

Remove a session from a disc

Parameters
dDisc to remove session from
sSession pointer to find and remove

Definition at line 154 of file structure.c.

References burn_session_free(), burn_disc::session, and burn_disc::sessions.

Referenced by mmc_read_toc_al().

◆ burn_session_add_track()

int burn_session_add_track ( struct burn_session s,
struct burn_track t,
unsigned int  pos 
)

Add a track to a session at specified position

Parameters
sSession to add to
tTrack to insert in session
posposition to add at (BURN_POS_END is "at the end")
Returns
0 for failure, 1 for success

Definition at line 247 of file structure.c.

References burn_track::refcnt, RESIZE, and burn_session::track.

Referenced by cue_attach_track(), isoburn_prepare_disc_aux(), mmc_fake_toc(), mmc_read_toc_al(), mmc_read_toc_fmt0_al(), and Xorriso_burn_track().

◆ burn_session_by_cue_file()

int burn_session_by_cue_file ( struct burn_session session,
char *  path,
int  fifo_size,
struct burn_source **  fifo,
unsigned char **  text_packs,
int *  num_packs,
int  flag 
)

Read a CDRWIN cue sheet file and equip the session object by tracks and CD-TEXT according to the content of the file. For a description of CDRWIN file format see http://digitalx.org/cue-sheet/syntax/ Fully supported commands are: CATALOG , CDTEXTFILE , FLAGS , INDEX , ISRC , PERFORMER , POSTGAP , PREGAP , REM , SONGWRITER , TITLE Further supported commands introduced by cdrecord (usage like PERFORMER): ARRANGER , COMPOSER , MESSAGE Partly supported commands are: FILE which supports only types BINARY , MOTOROLA , WAVE TRACK which supports only datatypes AUDIO , MODE1/2048 Unsupported types of FILE or TRACK lead to failure of the call. libburn does not yet support mixing of AUDIO and MODE1/2048. So this call will fail if such a mix is found. CD-TEXT information is allowed only if all tracks are of datatype AUDIO. Empty lines and lines which start by '#' are ignored.

Parameters
sessionSession where to attach tracks. It must not yet have tracks or else this call will fail.
pathFilesystem address of the CDRWIN cue sheet file. Normally with suffix .cue
fifo_sizeNumber of bytes in fifo. This will be rounded up by the block size of the track mode. <= 0 means no fifo.
fifoReturns a reference to the burn_source object that was installed as fifo between FILE and the track burn sources. One may use this to inquire the fifo state. Dispose it by burn_source_free() when no longer needed. It is permissible to pass this parameter to libburn as NULL, in order to immediately drop ownership on the fifo.
text_packsReturns pre-formatted CD-TEXT packs resulting from cue sheet command CDTEXTFILE. To be used with call burn_write_opts_set_leadin_text(). It is permissible to pass this parameter to libburn as NULL, in order to disable CDTEXTFILE.
num_packsReturns the number of 18 byte records in text_packs.
flagBitfield for control purposes. bit0= Do not attach CD-TEXT information to session and tracks. Do not load text_packs. bit1= Do not use media catalog string of session or ISRC strings of tracks for writing to Q sub-channel.
Returns
> 0 indicates success, <= 0 indicates failure
Since
1.2.0

Definition at line 1987 of file structure.c.

References burn_cue_file_cursor::block_size, burn_cue_file_cursor::block_size_locked, BURN_ALLOC_MEM, burn_cdtext_from_packfile(), BURN_FREE_MEM, burn_printify(), burn_session_get_cdtext(), burn_session_get_tracks(), burn_session_set_cdtext(), burn_sfile_fgets(), burn_track_free(), burn_track_get_cdtext(), burn_track_set_size(), burn_cue_file_cursor::cdtextfile, cue_attach_track(), cue_crs_destroy(), cue_crs_new(), cue_interpret_line(), burn_cue_file_cursor::current_file_ba, burn_cue_file_cursor::fifo, burn_cue_file_cursor::fifo_size, libdax_messenger, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_SEV_SORRY, libdax_msgs_submit(), burn_cue_file_cursor::no_catalog_isrc, burn_cue_file_cursor::no_cdtext, burn_cue_file_cursor::source_size, burn_cue_file_cursor::track, and burn_cue_file_cursor::track_current_index.

◆ burn_session_create()

◆ burn_session_dispose_cdtext()

int burn_session_dispose_cdtext ( struct burn_session s,
int  block 
)

Remove all CD-TEXT attributes of the given block from the session. They were attached by burn_session_set_cdtext().

Parameters
sSession where to remove the CD-TEXT attribute
blockNumber of the language block in which the attribute shall appear. Possible values: 0 to 7. -1 causes text packs of all blocks to be removed.
Returns
> 0 is success, <= 0 failure
Since
1.2.0

Definition at line 1145 of file structure.c.

References burn_cdtext_check_blockno(), burn_cdtext_free(), burn_session_dispose_cdtext(), burn_session::cdtext, burn_session::cdtext_char_code, burn_session::cdtext_copyright, and burn_session::cdtext_language.

Referenced by burn_session_dispose_cdtext().

◆ burn_session_free()

void burn_session_free ( struct burn_session s)

Free a session (and decrease reference count on all tracks inside)

Parameters
sSession to be freed

Definition at line 125 of file structure.c.

References burn_cdtext_free(), burn_track_free(), burn_session::cdtext, burn_session::refcnt, burn_session::track, and burn_session::tracks.

Referenced by burn_disc_free(), burn_disc_remove_session(), isoburn_prepare_disc_aux(), mmc_fake_toc(), mmc_read_toc_al(), mmc_read_toc_fmt0_al(), and Xorriso_burn_track().

◆ burn_session_get_cdtext()

int burn_session_get_cdtext ( struct burn_session s,
int  block,
int  pack_type,
char *  pack_type_name,
unsigned char **  payload,
int *  length,
int  flag 
)

Obtain a CD-TEXT attribute that was set by burn_session_set_cdtext()

Parameters
sSession to inquire
blockNumber of the language block to inquire.
pack_typePack type number to inquire. Used if pack_type_name is NULL or empty text. Else submit 0 and a name. Pack type 0x8f is generated automatically and may not be inquire in advance. Use burn_cdtext_from_session() to generate all packs including type 0x8f packs.
pack_type_nameThe pack type by name. See above burn_session_set_cdtext().
payloadWill return a pointer to text or binary bytes. Not a copy of data. Do not free() this address. If no text attribute is attached for pack type and block, then payload is returned as NULL. The return value will not indicate error in this case.
lengthWill return the number of bytes pointed to by payload. Including terminating 0-bytes.
flagBitfield for control purposes. Unused yet. Submit 0.
Returns
1 single byte char, 2 double byte char, <=0 error
Since
1.2.0

Definition at line 1089 of file structure.c.

References burn_cdtext_check_blockno(), burn_cdtext_get(), burn_session::cdtext, burn_cdtext::length, and burn_cdtext::payload.

Referenced by burn_session_by_cue_file().

◆ burn_session_get_cdtext_par()

int burn_session_get_cdtext_par ( struct burn_session s,
int  char_codes[8],
int  copyrights[8],
int  block_languages[8],
int  flag 
)

Obtain the current settings as of burn_session_set_cdtext_par()

Parameters
sSession which to inquire
char_codesWill return Character Codes for block 0 to 7
copyrightsWill return Copyright bytes for block 0 to 7
block_languagesWill return Language Codes for block 0 to 7
flagBitfiled for control purposes. Unused yet. Submit 0.
Returns
<=0 failure, reply invalid, > 0 success, reply valid
Since
1.2.0

Definition at line 1129 of file structure.c.

References burn_session::cdtext_char_code, burn_session::cdtext_copyright, and burn_session::cdtext_language.

◆ burn_session_get_hidefirst()

int burn_session_get_hidefirst ( struct burn_session session)

Returns whether the first track of a session is hidden in the pregap

Parameters
sessionthe session to query
Returns
non-zero means the first track is hidden

Definition at line 746 of file structure.c.

References burn_session::hidefirst.

◆ burn_session_get_leadout_entry()

void burn_session_get_leadout_entry ( struct burn_session s,
struct burn_toc_entry entry 
)

Gets a copy of the toc_entry structure associated with a session's lead out

Parameters
sSession to get the entry from
entryStruct for the library to fill out

Definition at line 693 of file structure.c.

References burn_track::entry, and burn_session::leadout_entry.

Referenced by isoburn_toc_session_get_leadout_entry().

◆ burn_session_get_sectors()

int burn_session_get_sectors ( struct burn_session s)

◆ burn_session_get_start_tno()

int burn_session_get_start_tno ( struct burn_session session,
int  flag 
)

Inquire the CD track start number, as set by default or by burn_session_set_start_tno().

Parameters
sessionThe session to be inquired
flagBitfield for control purposes. Unused yet. Submit 0.
Returns
> 0 is the currently set CD track start number <= 0 indicates failure
Since
1.2.0

Definition at line 885 of file structure.c.

References burn_session::firsttrack.

Referenced by burn_disc_cd_toc_extensions().

◆ burn_session_get_tracks()

struct burn_track** burn_session_get_tracks ( struct burn_session s,
int *  num 
)

Gets an array of all the tracks for a session THIS IS NO LONGER VALID AFTER YOU ADD OR REMOVE A TRACK

Parameters
ssession to get track array for
numReturns the number of tracks in the array
Returns
array of tracks

Definition at line 735 of file structure.c.

References burn_session::track, and burn_session::tracks.

Referenced by burn_session_by_cue_file(), burn_session_input_sheet_v07t(), isoburn_toc_disc_get_sectors(), isoburn_toc_drive_get_disc(), mmc_read_multi_session_c1(), Xorriso_sanitize_image_size(), and Xorriso_write_session().

◆ burn_session_hide_first_track()

void burn_session_hide_first_track ( struct burn_session s,
int  onoff 
)

Hide the first track in the "pre gap" of the disc

Parameters
ssession to change
onoff1 to enable hiding, 0 to disable

Definition at line 120 of file structure.c.

References burn_session::hidefirst.

◆ burn_session_remove_track()

int burn_session_remove_track ( struct burn_session s,
struct burn_track t 
)

Remove a track from a session

Parameters
sSession to remove track from
tTrack pointer to find and remove
Returns
0 for failure, 1 for success

Definition at line 256 of file structure.c.

References burn_track_free(), burn_session::track, and burn_session::tracks.

◆ burn_session_set_cdtext()

int burn_session_set_cdtext ( struct burn_session s,
int  block,
int  pack_type,
char *  pack_type_name,
unsigned char *  payload,
int  length,
int  flag 
)

Attach text or binary data as CD-TEXT attributes to a session. They can be used to generate CD-TEXT packs by burn_cdtext_from_session() or to write CD-TEXT packs into the lead-in of a CD SAO session. The latter happens only if no array of CD-TEXT packs is attached to the write options by burn_write_opts_set_leadin_text(). For details of the CD-TEXT format and of the payload content, see file doc/cdtext.txt .

Parameters
sSession where to attach CD-TEXT attribute
blockNumber of the language block in which the attribute shall appear. Possible values: 0 to 7.
pack_typePack type number. 0x80 to 0x8e. Used if pack_type_name is NULL or empty text. Else submit 0 and a name. Pack type 0x8f is generated automatically and may not be set by applications.
pack_type_nameThe pack type by name. Defined names are: 0x80 = "TITLE" 0x81 = "PERFORMER" 0x82 = "SONGWRITER" 0x83 = "COMPOSER" 0x84 = "ARRANGER" 0x85 = "MESSAGE" 0x86 = "DISCID" 0x87 = "GENRE" 0x88 = "TOC" 0x89 = "TOC2" 0x8d = "CLOSED" 0x8e = "UPC_ISRC" Names are recognized uppercase and lowercase.
payloadText or binary bytes. The data will be copied to session-internal memory. Pack types 0x80 to 0x85 contain 0-terminated cleartext encoded according to the block's Character Code. If double byte characters are used, then two 0-bytes terminate the cleartext. Pack type 0x86 is 0-terminated ASCII cleartext. Pack type 0x87 consists of two byte big-endian Genre code (see below BURN_CDTEXT_GENRE_LIST), and 0-terminated ASCII cleartext of genre description. Pack type 0x88 mirrors the session table-of-content. Pack type 0x89 is not understood yet. Pack types 0x8a to 0x8c are reserved. Pack type 0x8d contains ISO-8859-1 cleartext which is not to be shown by commercial audio CD players. Pack type 0x8e is ASCII cleartext with UPC/EAN code.
lengthNumber of bytes in payload. Including terminating 0-bytes.
flagBitfield for control purposes. bit0= payload contains double byte characters (with character code 0x80 MS-JIS japanese Kanji)
Returns
> 0 indicates success , <= 0 is failure
Since
1.2.0

Definition at line 1073 of file structure.c.

References burn_cdtext_check_blockno(), burn_cdtext_set(), burn_session::cdtext, burn_cdtext::length, and burn_cdtext::payload.

Referenced by burn_session_by_cue_file(), cue_set_cdtext(), v07t_apply_to_session(), and v07t_cdtext_to_session().

◆ burn_session_set_cdtext_par()

int burn_session_set_cdtext_par ( struct burn_session s,
int  char_codes[8],
int  copyrights[8],
int  languages[8],
int  flag 
)

Set the Character Codes, the Copyright bytes, and the Language Codes for CD-TEXT blocks 0 to 7. They will be used in the block summaries of text packs which get generated from text or binary data submitted by burn_session_set_cdtext() and burn_track_set_cdtext(). Character Code value can be 0x00 = ISO-8859-1 0x01 = 7 bit ASCII 0x80 = MS-JIS (japanesei Kanji, double byte characters) Copyright byte value can be 0x00 = not copyrighted 0x03 = copyrighted Language Code value will typically be 0x09 = English or 0x69 = Japanese. See below macros BURN_CDTEXT_LANGUAGES_0X00 and BURN_CDTEXT_LANGUAGES_0X45, but be aware that many of these codes have never been seen on CD, and that many of them do not have a character representation among the above Character Codes. Default is 0x09 = English for block 0 and 0x00 = Unknown for block 1 to 7. Copyright and Character Code are 0x00 for all blocks by default. See also file doc/cdtext.txt, "Format of a CD-TEXT packs array", "Pack type 0x8f".

Parameter value -1 leaves the current setting of the session parameter unchanged.

Parameters
sSession where to change settings
char_codesCharacter Codes for block 0 to 7
copyrightsCopyright bytes for block 0 to 7
languagesLanguage Codes for block 0 to 7
flagBitfiled for control purposes. Unused yet. Submit 0.
Returns
<=0 failure, > 0 success
Since
1.2.0

Definition at line 1110 of file structure.c.

References burn_session::cdtext_char_code, burn_session::cdtext_copyright, and burn_session::cdtext_language.

Referenced by v07t_apply_to_session().

◆ burn_session_set_start_tno()

int burn_session_set_start_tno ( struct burn_session session,
int  tno,
int  flag 
)

Set the number which shall be written as CD track number with the first track of the session. The following tracks will then get written with consecutive CD track numbers. The resulting number of the last track must not exceed 99. The lowest possible start number is 1, which is also the default. This setting applies only to CD SAO writing.

Parameters
sessionThe session to be manipulated
tnoA number between 1 and 99
flagBitfield for control purposes. Unused yet. Submit 0.
Returns
> 0 indicates success, <= 0 indicates failure
Since
1.2.0

Definition at line 864 of file structure.c.

References burn_session::firsttrack, libdax_messenger, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_SORRY, libdax_msgs_submit(), and burn_session::tracks.

Referenced by burn_session_input_sheet_v07t(), and cue_attach_track().

◆ burn_structure_print_disc()

◆ burn_structure_print_session()

◆ burn_structure_print_track()

void burn_structure_print_track ( struct burn_track t)

◆ burn_track_apply_fillup()

int burn_track_apply_fillup ( struct burn_track t,
off_t  max_size,
int  flag 
)

◆ burn_track_clear_indice()

int burn_track_clear_indice ( struct burn_track t,
int  flag 
)

Remove all index start addresses and reset to the default indexing of CD SAO sessions. This means index 0 of track 1 reaches from LBA -150 to LBA -1. Index 1 of track 1 reaches from LBA 0 to track end. Index 1 of track 2 follows immediately. The same happens for all further tracks after the end of their predecessor.

Parameters
tThe track to be manipulated
flagBitfield for control purposes. Unused yet. Submit 0.
Returns
> 0 indicates success, <= 0 means failure
Since
1.2.0

Definition at line 483 of file structure.c.

References burn_track::index, and burn_track::indices.

◆ burn_track_clear_isrc()

void burn_track_clear_isrc ( struct burn_track t)

Disable ISRC parameters for a track

Parameters
tThe track to change

Definition at line 458 of file structure.c.

References isrc::has_isrc, and burn_track::isrc.

◆ burn_track_create()

◆ burn_track_define_data()

void burn_track_define_data ( struct burn_track t,
int  offset,
int  tail,
int  pad,
int  mode 
)

Define the data in a track

Parameters
tthe track to define
offsetThe lib will write this many 0s before start of data
tailThe number of extra 0s to write after data
pad1 means the lib should pad the last sector with 0s if the track isn't exactly sector sized. (otherwise the lib will begin reading from the next track)
modedata format (bitfield)

Definition at line 329 of file structure.c.

References burn_sector_length(), libdax_messenger, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_SORRY, libdax_msgs_submit(), burn_track::mode, burn_track::offset, burn_track::pad, burn_track::tail, and type_to_form().

Referenced by cue_interpret_line(), and Xorriso_sanitize_image_size().

◆ burn_track_dispose_cdtext()

int burn_track_dispose_cdtext ( struct burn_track t,
int  block 
)

Remove all CD-TEXT attributes of the given block from the track. They were attached by burn_track_set_cdtext().

Parameters
tTrack where to remove the CD-TEXT attribute.
blockNumber of the language block in which the attribute shall appear. Possible values: 0 to 7. -1 causes text packs of all blocks to be removed.
Returns
> 0 is success, <= 0 failure
Since
1.2.0

Definition at line 1054 of file structure.c.

References burn_cdtext_check_blockno(), burn_cdtext_free(), and burn_track::cdtext.

◆ burn_track_free()

◆ burn_track_get_cdtext()

int burn_track_get_cdtext ( struct burn_track t,
int  block,
int  pack_type,
char *  pack_type_name,
unsigned char **  payload,
int *  length,
int  flag 
)

Obtain a CD-TEXT attribute that was set by burn_track_set_cdtext().

Parameters
tTrack to inquire
blockNumber of the language block to inquire.
pack_typePack type number to inquire. Used if pack_type_name is NULL or empty text. Else submit 0 and a name.
pack_type_nameThe pack type by name. See above burn_track_set_cdtext().
payloadWill return a pointer to text bytes. Not a copy of data. Do not free() this address. If no text attribute is attached for pack type and block, then payload is returned as NULL. The return value will not indicate error in this case.
lengthWill return the number of bytes pointed to by payload. Including terminating 0-bytes.
flagBitfield for control purposes. Unused yet. Submit 0.
Returns
1=single byte char , 2= double byte char , <=0 error
Since
1.2.0

Definition at line 1034 of file structure.c.

References burn_cdtext_check_blockno(), burn_cdtext_get(), burn_track::cdtext, burn_cdtext::length, and burn_cdtext::payload.

Referenced by burn_session_by_cue_file().

◆ burn_track_get_counters()

int burn_track_get_counters ( struct burn_track t,
off_t *  read_bytes,
off_t *  written_bytes 
)

Tells how many source bytes have been read and how many data bytes have been written by the track during burn.

Parameters
tThe track to inquire
read_bytesNumber of bytes read from the track source
written_bytesNumber of bytes written to track
Since
0.2.6

Definition at line 636 of file structure.c.

References burn_track::sourcecount, and burn_track::writecount.

Referenced by Xorriso_write_session().

◆ burn_track_get_default_size()

off_t burn_track_get_default_size ( struct burn_track t)

◆ burn_track_get_entry()

void burn_track_get_entry ( struct burn_track t,
struct burn_toc_entry entry 
)

Gets a copy of the toc_entry structure associated with a track

Parameters
tTrack to get the entry from
entryStruct for the library to fill out

Definition at line 685 of file structure.c.

References burn_track::entry.

Referenced by burn_drive_extract_audio_track(), isoburn_toc_disc_get_sectors(), isoburn_toc_track_get_entry(), and mmc_read_multi_session_c1().

◆ burn_track_get_mode()

int burn_track_get_mode ( struct burn_track track)

Gets the mode of a track

Parameters
trackthe track to query
Returns
the track's mode

Definition at line 741 of file structure.c.

References burn_track::mode.

◆ burn_track_get_sectors()

int burn_track_get_sectors ( struct burn_track t)

Tells how many sectors a track will have on disc, or already has on disc. This includes offset, payload, tail, and post-gap, but not pre-gap. The result is NOT RELIABLE with tracks of undefined length

Definition at line 543 of file structure.c.

References burn_track_get_sectors_2().

Referenced by burn_session_get_sectors(), burn_structure_print_track(), and burn_track_apply_fillup().

◆ burn_track_get_sectors_2()

◆ burn_track_get_shortage()

int burn_track_get_shortage ( struct burn_track t)

◆ burn_track_is_data_done()

int burn_track_is_data_done ( struct burn_track t)

◆ burn_track_is_open_ended()

◆ burn_track_set_byte_swap()

int burn_track_set_byte_swap ( struct burn_track t,
int  swap_source_bytes 
)

Define whether a track shall swap bytes of its input stream.

Parameters
tThe track to change
swap_source_bytes0=do not swap, 1=swap byte pairs
Returns
1=success , 0=unacceptable value
Since
0.2.6

Definition at line 358 of file structure.c.

References burn_track::swap_source_bytes.

Referenced by cue_interpret_line().

◆ burn_track_set_cdtext()

int burn_track_set_cdtext ( struct burn_track t,
int  block,
int  pack_type,
char *  pack_type_name,
unsigned char *  payload,
int  length,
int  flag 
)

Attach text or binary data as CD-TEXT attributes to a track. The payload will be used to generate CD-TEXT packs by burn_cdtext_from_session() or to write CD-TEXT packs into the lead-in of a CD SAO session. This happens if the CD-TEXT attribute of the session gets generated, which has the same block number and pack type. In this case, each track should have such a CD-TEXT attribute, too. See burn_session_set_cdtext(). Be cautious not to exceed the maximum number of 253 payload packs per language block. Use burn_cdtext_from_session() to learn whether a valid array of CD-TEXT packs can be generated from your attributes.

Parameters
tTrack where to attach CD-TEXT attribute.
blockNumber of the language block in which the attribute shall appear. Possible values: 0 to 7.
pack_typePack type number. 0x80 to 0x85 or 0x8e. Used if pack_type_name is NULL or empty text. Else submit 0 and a name.
pack_type_nameThe pack type by name. Applicable names are: 0x80 = "TITLE" 0x81 = "PERFORMER" 0x82 = "SONGWRITER" 0x83 = "COMPOSER" 0x84 = "ARRANGER" 0x85 = "MESSAGE" 0x8e = "UPC_ISRC"
payload0-terminated cleartext. If double byte characters are used, then two 0-bytes terminate the cleartext.
lengthNumber of bytes in payload. Including terminating 0-bytes.
flagBitfield for control purposes. bit0= payload contains double byte characters (with character code 0x80 MS-JIS japanese Kanji)
Returns
> 0 indicates success , <= 0 is failure
Since
1.2.0

Definition at line 1018 of file structure.c.

References burn_cdtext_check_blockno(), burn_cdtext_set(), burn_track::cdtext, burn_cdtext::length, and burn_cdtext::payload.

Referenced by cue_set_cdtext(), and v07t_cdtext_to_track().

◆ burn_track_set_cdxa_conv()

int burn_track_set_cdxa_conv ( struct burn_track t,
int  value 
)

Activates CD XA compatibility modes. libburn currently writes data only in CD mode 1. Some programs insist in sending data with additional management bytes. These bytes have to be stripped in order to make the input suitable for BURN_MODE1.

Parameters
tThe track to manipulate
value0= no conversion 1= strip 8 byte sector headers of CD-ROM XA mode 2 form 1 see MMC-5 4.2.3.8.5.3 Block Format for Mode 2 form 1 Data all other values are reserved
Returns
1=success , 0=unacceptable value
Since
0.7.2

Definition at line 368 of file structure.c.

References burn_track::cdxa_conversion.

Referenced by Xorriso_burn_track().

◆ burn_track_set_default_size()

int burn_track_set_default_size ( struct burn_track t,
off_t  size 
)

Set a default track size to be used only if the track turns out to be of unpredictable length and if the effective write type demands a fixed size. This can be useful to enable write types CD SAO or DVD DAO together with a track source like stdin. If the track source delivers fewer bytes than announced then the track will be padded up with zeros.

Parameters
tThe track to change
sizeThe size to set
Returns
0=failure 1=success
Since
0.3.4

Definition at line 621 of file structure.c.

References burn_track::default_size.

◆ burn_track_set_fillup()

int burn_track_set_fillup ( struct burn_track t,
int  fill_up_media 
)

Definition at line 577 of file structure.c.

References burn_track::fill_up_media, and burn_track::open_ended.

Referenced by burn_disc_init_write_status().

◆ burn_track_set_index()

int burn_track_set_index ( struct burn_track t,
int  index_number,
unsigned int  relative_lba,
int  flag 
)

Define an index start address within a track. The index numbers inside a track have to form sequence starting at 0 or 1 with no gaps up to the highest number used. They affect only writing of CD SAO sessions. The first index start address of a track must be 0. Blocks between index 0 and index 1 are considered to be located before the track start as of the table-of-content.

Parameters
tThe track to be manipulated
index_numberA number between 0 and 99
relative_lbaThe start address relative to the start of the burn_source of the track. It will get mapped to the appropriate absolute block address.
flagBitfield for control purposes. Unused yet. Submit 0.
Returns
> 0 indicates success, <= 0 means failure
Since
1.2.0

Definition at line 464 of file structure.c.

References burn_track::index, burn_track::indices, libdax_messenger, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_SORRY, and libdax_msgs_submit().

Referenced by cue_interpret_line().

◆ burn_track_set_isrc()

void burn_track_set_isrc ( struct burn_track t,
char *  country,
char *  owner,
unsigned char  year,
unsigned int  serial 
)

Set the ISRC details for a track. When writing to CD media, ISRC will get written into the Q sub-channel.

Parameters
tThe track to change
countrythe 2 char country code. Each character must be only numbers or letters.
owner3 char owner code. Each character must be only numbers or letters.
year2 digit year. A number in 0-99 (Yep, not Y2K friendly).
serial5 digit serial number. A number in 0-99999.

Definition at line 377 of file structure.c.

References isrc::country, isrc::has_isrc, burn_track::isrc, libdax_messenger, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_SORRY, libdax_msgs_submit(), isrc::owner, isrc::serial, and isrc::year.

Referenced by burn_track_set_isrc_string().

◆ burn_track_set_isrc_string()

int burn_track_set_isrc_string ( struct burn_track t,
char  isrc[13],
int  flag 
)

Set the composed ISRC string for a track. This is an alternative to burn_track_set_isrc().

Parameters
tThe track to be manipulated
isrc12 characters which are composed from ISRC details. Format is CCOOOYYSSSSS, terminated by a 0-byte: Country, Owner, Year(decimal digits), Serial(decimal digits).
flagBitfield for control purposes. Unused yet. Submit 0.
Returns
> 0 indicates success, <= 0 means failure
Since
1.2.0

Definition at line 439 of file structure.c.

References burn_track_set_isrc(), isrc::has_isrc, burn_track::isrc, libdax_messenger, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_SORRY, and libdax_msgs_submit().

Referenced by burn_session_input_sheet_v07t(), and cue_interpret_line().

◆ burn_track_set_postgap_size()

int burn_track_set_postgap_size ( struct burn_track t,
int  size,
int  flag 
)

Define whether a post-gap shall be written at the end of the track and how many sectors this gap shall have. A post-gap occupies the range of an additional index of the track. It contains zeros. No bytes from the track source will be read for writing the post-gap. This setting affects only CD SAO write runs. MMC prescribes to add a post-gap to a data track which is followed by a non-data track. (But libburn does not yet support mixed mode CD SAO sessions.)

Parameters
tThe track to change
sizeNumber of sectors in the post-gap. -1 disables post-gap. libburn allows 0, but MMC does not propose this.
flagBitfield for control purposes. Unused yet. Submit 0.
Returns
> 0 indicates success, <= 0 means failure
Since
1.2.0

Definition at line 502 of file structure.c.

References burn_track::postgap, and burn_track::postgap_size.

Referenced by cue_interpret_line().

◆ burn_track_set_pregap_size()

int burn_track_set_pregap_size ( struct burn_track t,
int  size,
int  flag 
)

Define whether a pre-gap shall be written before the track and how many sectors this pre-gap shall have. A pre-gap is written in the range of track index 0 and contains zeros (audio silence). No bytes from the track source will be read for writing the pre-gap. This setting affects only CD SAO write runs. The first track automatically gets a pre-gap of at least 150 sectors. Its size may be enlarged by this call. Further pre-gaps are demanded by MMC for tracks which follow tracks of a different mode. (But Mode mixing in CD SAO sessions is currently not supported by libburn.)

Parameters
tThe track to change
sizeNumber of sectors in the pre-gap. -1 disables pre-gap, except for the first track. libburn allows 0, but MMC does not propose this.
flagBitfield for control purposes. Unused yet. Submit 0.
Returns
> 0 indicates success, <= 0 means failure
Since
1.2.0

Definition at line 494 of file structure.c.

References burn_track::pregap2, and burn_track::pregap2_size.

Referenced by cue_interpret_line().

◆ burn_track_set_sectors()

◆ burn_track_set_size()

int burn_track_set_size ( struct burn_track t,
off_t  size 
)

Sets a fixed track size after the data source object has already been created.

Parameters
tThe track to operate on
sizethe number of bytes to use as track size
Returns
<=0 indicates failure , >0 success
Since
0.3.6

Definition at line 565 of file structure.c.

References burn_track::open_ended, burn_source::set_size, and burn_track::source.

Referenced by burn_disc_write_sync(), burn_dvd_write_sync(), burn_session_by_cue_file(), cue_interpret_line(), and Xorriso_burn_track().

◆ cue_attach_track()

◆ cue_check_for_track()

static int cue_check_for_track ( struct burn_cue_file_cursor crs,
char *  cmd,
int  flag 
)
static

◆ cue_create_file_source()

◆ cue_crs_destroy()

◆ cue_crs_new()

◆ cue_interpret_line()

static int cue_interpret_line ( struct burn_session session,
char *  line,
struct burn_cue_file_cursor crs,
int  flag 
)
static

Definition at line 1578 of file structure.c.

References burn_cue_file_cursor::block_size, burn_cue_file_cursor::block_size_locked, BURN_4CH, BURN_ALLOC_MEM, BURN_AUDIO, BURN_COPY, burn_fifo_source_new(), BURN_FREE_MEM, BURN_MODE1, burn_offst_source_new(), BURN_PREEMPHASIS, burn_printify(), BURN_SCMS, burn_source_free(), BURN_SOURCE_OK, burn_track_create(), burn_track_define_data(), burn_track_set_byte_swap(), burn_track_set_index(), burn_track_set_isrc_string(), burn_track_set_postgap_size(), burn_track_set_pregap_size(), burn_track_set_size(), burn_track_set_source(), burn_cue_file_cursor::cdtextfile, cue_attach_track(), cue_check_for_track(), cue_create_file_source(), cue_read_number(), cue_read_timepoint_lba(), cue_set_cdtext(), cue_unquote_text(), burn_cue_file_cursor::current_file_ba, burn_cue_file_cursor::current_index_ba, burn_cue_file_cursor::fifo, burn_cue_file_cursor::fifo_size, burn_cue_file_cursor::file_source, libdax_messenger, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_SEV_FATAL, libdax_msgs_submit(), burn_session::mediacatalog, burn_cue_file_cursor::no_catalog_isrc, burn_cue_file_cursor::no_cdtext, burn_cue_file_cursor::offst_source, burn_cue_file_cursor::prev_block_size, burn_cue_file_cursor::prev_file_ba, burn_cue_file_cursor::prev_track, burn_cue_file_cursor::source_file, burn_cue_file_cursor::source_size, burn_cue_file_cursor::swap_audio_bytes, burn_cue_file_cursor::track, burn_cue_file_cursor::track_current_index, burn_cue_file_cursor::track_has_source, burn_cue_file_cursor::track_mode, and burn_cue_file_cursor::track_no.

Referenced by burn_session_by_cue_file().

◆ cue_open_audioxtr()

◆ cue_read_number()

static int cue_read_number ( char **  payload,
int *  number,
int  flag 
)
static

◆ cue_read_timepoint_lba()

static int cue_read_timepoint_lba ( char *  apt,
char *  purpose,
int *  file_ba,
int  flag 
)
static

◆ cue_set_cdtext()

static int cue_set_cdtext ( struct burn_session session,
struct burn_track track,
int  pack_type,
char *  text,
struct burn_cue_file_cursor crs,
int  flag 
)
static

◆ cue_unquote_text()

static char* cue_unquote_text ( char *  text,
int  flag 
)
static

Definition at line 1262 of file structure.c.

Referenced by cue_interpret_line(), and cue_set_cdtext().

Variable Documentation

◆ libdax_messenger