/** @packageDocumentation Musepack (MPC) file format handler. Supports ID3v1, ID3v2 detection, and APE tags. */ import { File } from "../file.js"; import { Tag } from "../tag.js"; import { ReadStyle } from "../toolkit/types.js"; import type { IOStream } from "../toolkit/ioStream.js"; import { ID3v1Tag } from "../mpeg/id3v1/id3v1Tag.js"; import { ApeTag } from "../ape/apeTag.js"; import { MpcProperties } from "./mpcProperties.js"; /** Bitmask of tag types present in or to be applied to an MPC file. */ export declare enum MpcTagTypes { /** No tags. */ NoTags = 0, /** ID3v1 tag. */ ID3v1 = 1, /** ID3v2 tag (detected and stripped; invalid in MPC). */ ID3v2 = 2, /** APE tag. */ APE = 4, /** All supported tag types. */ AllTags = 65535 } /** * Musepack (MPC) file format handler. * * Supports APE (primary) and ID3v1 (secondary) tags. ID3v2 tags are * detected and skipped but not parsed — they are invalid in MPC files. */ export declare class MpcFile extends File { /** The APE tag read from or to be written to the file, or `null` if absent. */ private _apeTag; /** The ID3v1 tag read from or to be written to the file, or `null` if absent. */ private _id3v1Tag; /** Priority-ordered combined view of all tags (APE preferred over ID3v1). */ private _combinedTag; /** Parsed audio properties, or `null` if not yet read. */ private _properties; /** Byte offset of the APE tag in the file, or `-1` if absent. */ private _apeLocation; /** Original byte size of the APE tag on disk (used for in-place replacement). */ private _apeOriginalSize; /** Byte offset of the ID3v1 tag in the file, or `-1` if absent. */ private _id3v1Location; /** Byte offset of the ID3v2 tag in the file, or `-1` if absent. */ private _id3v2Location; /** Byte size of the ID3v2 tag on disk. */ private _id3v2Size; /** Whether an ID3v2 tag was found on disk (it will be stripped on save). */ private _hasId3v2; /** * Private constructor — use {@link MpcFile.open} to create instances. * @param stream - The underlying I/O stream for the MPC file. */ private constructor(); /** * Open and parse an MPC file from the given stream. * @param stream - The I/O stream to read from. * @param readProperties - Whether to parse audio properties. Defaults to `true`. * @param readStyle - Level of detail for audio property parsing. Defaults to `ReadStyle.Average`. * @returns A fully initialised `MpcFile` instance. */ static open(stream: IOStream, readProperties?: boolean, readStyle?: ReadStyle): Promise; /** * Quick-check whether `stream` looks like a valid MPC file. * Skips a leading ID3v2 tag if present. */ static isSupported(stream: IOStream): Promise; /** * Returns the combined tag providing unified access to all tag data. * @returns The {@link CombinedTag} for this file. */ tag(): Tag; /** * Returns the audio properties parsed from the MPC stream. * @returns The {@link MpcProperties}, or `null` if `readProperties` was `false` on open. */ audioProperties(): MpcProperties | null; /** * Writes all pending tag changes to the file. * Any ID3v2 tag found on disk is automatically removed (it is invalid in MPC). * @returns `true` on success, `false` if the file is read-only. */ save(): Promise; /** Get the ID3v1 tag, optionally creating one if absent. */ id3v1Tag(create?: boolean): ID3v1Tag | null; /** Get the APE tag, optionally creating one if absent. */ apeTag(create?: boolean): ApeTag | null; /** * Remove the specified tag types from the in-memory representation. * Call `save()` afterwards to persist the changes to disk. */ strip(tags?: MpcTagTypes): void; /** Whether the file on disk has an ID3v1 tag. */ get hasID3v1Tag(): boolean; /** Whether the file on disk has an APE tag. */ get hasAPETag(): boolean; /** * Reads all tags and (optionally) audio properties from the file. * @param readProperties - Whether to parse audio properties. * @param readStyle - Level of detail for audio property parsing. */ private read; /** * Detects an ID3v2 tag at the start of the file and records its location and size. * The tag content is not parsed — ID3v2 is invalid in MPC and will be removed on save. */ private findID3v2; /** * Searches the end of the file for an ID3v1 tag and, if found, * populates {@link _id3v1Location} and {@link _id3v1Tag}. */ private findID3v1; /** * Searches for an APE tag footer immediately before the ID3v1 tag (or end of file) * and, if found, populates {@link _apeLocation}, {@link _apeOriginalSize}, and {@link _apeTag}. */ private findAPE; /** * Rebuilds {@link _combinedTag} from the currently active tag objects, * ordered by priority (APE before ID3v1). */ private refreshCombinedTag; } //# sourceMappingURL=mpcFile.d.ts.map