77 líneas
2.0 KiB
TypeScript
77 líneas
2.0 KiB
TypeScript
// Type definitions for img2mp3
|
|
|
|
export interface EncodeResult {
|
|
success: boolean;
|
|
originalImageSize: number;
|
|
mp3Size: number;
|
|
outputSize: number;
|
|
imageSize: string;
|
|
}
|
|
|
|
export interface DecodeResult {
|
|
success: boolean;
|
|
extractedImageSize: number;
|
|
extractedMp3Size: number;
|
|
originalImagePath: string;
|
|
mp3Path: string;
|
|
}
|
|
|
|
export interface FileInfo {
|
|
isValid: boolean;
|
|
mp3Size?: number;
|
|
originalImageSize?: number;
|
|
imageWidth?: number;
|
|
containerSize?: number;
|
|
format?: string;
|
|
dimensions?: string;
|
|
error?: string;
|
|
}
|
|
|
|
export interface PlaybackStatus {
|
|
isPlaying: boolean;
|
|
hasActiveProcess: boolean;
|
|
}
|
|
|
|
export interface PlayOptions {
|
|
[key: string]: any;
|
|
}
|
|
|
|
export declare class MP3ImageEncoder {
|
|
constructor();
|
|
encode(imagePath: string, mp3Path: string, outputPath: string): Promise<EncodeResult>;
|
|
decode(i2mPath: string, outputImagePath: string, outputMp3Path: string): Promise<DecodeResult>;
|
|
getInfo(i2mPath: string): Promise<FileInfo>;
|
|
}
|
|
|
|
export declare class I2MPlayer {
|
|
constructor();
|
|
play(i2mPath: string, options?: PlayOptions): Promise<void>;
|
|
stop(): void;
|
|
getStatus(): PlaybackStatus;
|
|
cleanup(): void;
|
|
cleanupAll(): void;
|
|
}
|
|
|
|
export declare class IMG2MP3 {
|
|
constructor();
|
|
encode(imagePath: string, mp3Path: string, outputPath: string): Promise<EncodeResult>;
|
|
decode(i2mPath: string, outputImagePath: string, outputMp3Path: string): Promise<DecodeResult>;
|
|
getInfo(i2mPath: string): Promise<FileInfo>;
|
|
play(i2mPath: string, options?: PlayOptions): Promise<void>;
|
|
stop(): void;
|
|
getPlaybackStatus(): PlaybackStatus;
|
|
cleanup(): void;
|
|
}
|
|
|
|
// Convenience functions
|
|
export declare function encode(imagePath: string, mp3Path: string, outputPath: string): Promise<EncodeResult>;
|
|
export declare function decode(i2mPath: string, outputImagePath: string, outputMp3Path: string): Promise<DecodeResult>;
|
|
export declare function play(i2mPath: string, options?: PlayOptions): Promise<void>;
|
|
export declare function getInfo(i2mPath: string): Promise<FileInfo>;
|
|
|
|
export {
|
|
IMG2MP3 as default,
|
|
MP3ImageEncoder,
|
|
I2MPlayer
|
|
};
|