Class ChdEncodeOptions
Optional configuration for ChdEncoder encoding calls.
public sealed class ChdEncodeOptions
- Inheritance
-
ChdEncodeOptions
- Inherited Members
Properties
AutoClassify
When true,
EncodeRaw(Stream, string, uint, uint, IReadOnlyList<uint>?, ChdEncodeOptions?, CancellationToken)
classifies the source automatically:
an ISO-9660 image (DVD) gets 'DVD ' metadata and a 2048-byte unit size, any other raw
image gets synthesized 'GDDD' hard-disk geometry metadata (cylinders/heads/sectors/bps with
BPS = the unit size). Default: false (chdman-compatible output without metadata).
public bool AutoClassify { get; set; }
Property Value
HunkBytes
Overrides the hunk size for Copy(string, string, IReadOnlyList<uint>?, ChdEncodeOptions?, CancellationToken) (chdman copy -hs parity).
When null, the source CHD's hunk size is used. When set, must be within
16..1MiB and a multiple of the source's unit size. Default: null.
public uint? HunkBytes { get; set; }
Property Value
- uint?
HunkCompleted
Invoked once per hunk, in hunk order, after compression — e.g. for per-hunk
compression-ratio logging. Default: null (no reporting).
public Action<HunkProgress>? HunkCompleted { get; set; }
Property Value
InputLengthBytes
Number of source bytes to encode (CHDlite input_bytes parity). When null,
the whole source from InputStartBytes onward is encoded. Used for
split-disc create round-trips. Default: null.
public long? InputLengthBytes { get; set; }
Property Value
- long?
InputStartBytes
Byte offset into the source stream where encoding starts (CHDlite
input_start_byte parity). The source bytes before this offset are skipped
(seek for seekable sources, drained for streaming sources) and are not part of the
image. Default: 0.
public long InputStartBytes { get; set; }
Property Value
LogicalLengthBytes
Overrides the logical image size of the encoded CHD (MAME chdman createhd parity:
the CHD is created at cylinders * heads * sectors * bytes_per_sector — the
guessed-CHS product — which rounds sub-geometry inputs UP past the actual file length).
Hunks past the source's data are encoded from MAME's compression work buffer, whose
slots keep the data of earlier cycles when the source ends (chd.cpp async_read),
and the same bytes fold into the raw SHA-1. When null, the logical size is the
source length. Default: null.
public long? LogicalLengthBytes { get; set; }
Property Value
- long?
Metadata
Additional metadata entries to write into the CHD, appended after any entries the
encoder generates itself (e.g. the CD/GD-ROM track entries of EncodeCd(string, string, uint, uint, IReadOnlyList<uint>?, ChdEncodeOptions?, CancellationToken)).
Each entry is checksummed (CHD_MDFLAGS_CHECKSUM) and folded into the combined SHA-1.
Default: null (no extra metadata). Writing metadata shifts the map offset, so
the produced file is not byte-identical to chdman output without metadata.
public IReadOnlyList<MetadataEntry>? Metadata { get; set; }
Property Value
NoMetadataUpgrade
When true, Copy(string, string, IReadOnlyList<uint>?, ChdEncodeOptions?, CancellationToken) preserves legacy CD/GD-ROM metadata tags
(CHCD, CHTR, CHGT) instead of upgrading them to their modern
equivalents (CHT2, CHGD). Default: false (legacy tags are upgraded,
matching MAME chdman's copy command behavior).
public bool NoMetadataUpgrade { get; set; }
Property Value
ParentPath
Path of a parent CHD used to create a differential (delta) child: hunks whose data
already exists in the parent are stored as COMPRESSION_PARENT references instead
of compressed blocks (MAME chdman's -op behavior). The parent is walked once
before encoding: every unit-sized window of its decompressed data is hashed, and each
child hunk whose full-hunk hash matches a window is emitted as a parent reference
(SELF references take priority, like chdman). The parent's hunk size and unit size must
match the encoder's; the parent's SHA-1 is stored in the child header's parent-SHA-1
field. Default: null (standalone CHD).
public string? ParentPath { get; set; }
Property Value
SourceParentPath
Path of the parent CHD of a child source read by Copy(string, string, IReadOnlyList<uint>?, ChdEncodeOptions?, CancellationToken):
when the source CHD is a differential child, its parent must be supplied here so the
source's hunks can be resolved. Ignored by the EncodeRaw/EncodeCd methods.
Default: null (standalone source).
public string? SourceParentPath { get; set; }
Property Value
TaskCount
Number of parallel hunk-compression workers used by the encoder's producer→worker→consumer
pipeline (each worker owns a private set of codec instances). When null (default),
CHDSharp.Chd.TaskCount is used, so the same global knob that tunes parallel
verification also tunes parallel encoding. Must be between 1 and 64.
public int? TaskCount { get; set; }
Property Value
- int?