/** @packageDocumentation Factory for creating typed ID3v2 frame instances from raw tag data, with version conversion support. */ import { ByteVector, StringType } from "../../byteVector.js"; import { Id3v2Frame } from "./id3v2Frame.js"; import { Id3v2Header } from "./id3v2Header.js"; /** * Factory that creates appropriate ID3v2 frame types from raw data. * * The singleton instance is accessible via {@link Id3v2FrameFactory.instance}. * Its {@link defaultTextEncoding} property controls which text encoding is used * for all newly created ID3v2 text frames — equivalent to C++ TagLib's * `FrameFactory::setDefaultTextEncoding()`. */ export declare class Id3v2FrameFactory { /** Singleton instance of the factory. */ private static _instance; /** The text encoding applied to newly created text frames. Defaults to UTF-8. */ private _defaultTextEncoding; /** * Returns the singleton `Id3v2FrameFactory` instance, creating it on first access. * @returns The shared factory instance. */ static get instance(): Id3v2FrameFactory; /** * Gets the default text encoding used when creating new ID3v2 text frames. * Defaults to `StringType.UTF8`. */ get defaultTextEncoding(): StringType; /** * Sets the default text encoding used when creating new ID3v2 text frames. * Equivalent to C++ TagLib's `FrameFactory::setDefaultTextEncoding()`. * @param encoding - The encoding to use for newly created text frames. */ set defaultTextEncoding(encoding: StringType); /** * Alias for {@link defaultTextEncoding} setter — mirrors the C++ TagLib API. * @param encoding - The encoding to use for newly created text frames. */ setDefaultTextEncoding(encoding: StringType): void; /** * Convert a v2.2 (3-byte) frame ID to a v2.4 (4-byte) frame ID. */ static convertFrameId(v2Id: ByteVector): ByteVector; /** * Convert a v2.3 (4-byte) frame ID to a v2.4 (4-byte) frame ID. */ static convertFrameIdV3(v3Id: ByteVector): ByteVector; /** * Create a frame from data at the given offset. * * @param data - The tag body data (all frame data). * @param tagHeader - The ID3v2 tag header. * @param offset - Byte offset into `data` where the frame starts (default 0). * @returns An object with the parsed frame (or null if padding/invalid) and * the total number of bytes consumed (frame header + frame data). */ createFrame(data: ByteVector, tagHeader: Id3v2Header, offset?: number): { frame: Id3v2Frame | null; size: number; }; /** * Instantiate the correct `Id3v2Frame` subclass for the given frame ID. * * @param frameId - The four-character (v2.4-normalised) frame ID string. * @param frameData - The raw bytes covering the complete frame (header + payload). * @param frameHeader - The already-parsed frame header. * @param version - The ID3v2 major version the data was encoded with. * @param _tagHeader - The enclosing tag header (reserved for future use). * @returns The instantiated frame object. */ private _createFrameForId; } //# sourceMappingURL=id3v2FrameFactory.d.ts.map