128 lines
2.4 KiB
TypeScript
128 lines
2.4 KiB
TypeScript
|
|
/**
|
||
|
|
* Supported converter engines
|
||
|
|
*/
|
||
|
|
export type ConverterEngine = 'ffmpeg' | 'imagemagick' | 'pandoc';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* File category based on type
|
||
|
|
*/
|
||
|
|
export type FileCategory = 'video' | 'audio' | 'image' | 'document';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Conversion status
|
||
|
|
*/
|
||
|
|
export type ConversionStatus = 'pending' | 'loading' | 'processing' | 'completed' | 'error';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Supported conversion format
|
||
|
|
*/
|
||
|
|
export interface ConversionFormat {
|
||
|
|
id: string;
|
||
|
|
name: string;
|
||
|
|
extension: string;
|
||
|
|
mimeType: string;
|
||
|
|
category: FileCategory;
|
||
|
|
converter: ConverterEngine;
|
||
|
|
description?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Conversion job configuration
|
||
|
|
*/
|
||
|
|
export interface ConversionJob {
|
||
|
|
id: string;
|
||
|
|
inputFile: File;
|
||
|
|
inputFormat: ConversionFormat;
|
||
|
|
outputFormat: ConversionFormat;
|
||
|
|
options: ConversionOptions;
|
||
|
|
status: ConversionStatus;
|
||
|
|
progress: number;
|
||
|
|
result?: Blob;
|
||
|
|
error?: string;
|
||
|
|
startTime?: number;
|
||
|
|
endTime?: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Generic conversion options
|
||
|
|
*/
|
||
|
|
export interface ConversionOptions {
|
||
|
|
// Video options
|
||
|
|
videoBitrate?: string;
|
||
|
|
videoCodec?: string;
|
||
|
|
videoResolution?: string;
|
||
|
|
videoFps?: number;
|
||
|
|
|
||
|
|
// Audio options
|
||
|
|
audioBitrate?: string;
|
||
|
|
audioCodec?: string;
|
||
|
|
audioSampleRate?: number;
|
||
|
|
audioChannels?: number;
|
||
|
|
|
||
|
|
// Image options
|
||
|
|
imageQuality?: number;
|
||
|
|
imageWidth?: number;
|
||
|
|
imageHeight?: number;
|
||
|
|
imageFormat?: string;
|
||
|
|
|
||
|
|
// Document options
|
||
|
|
documentPageSize?: string;
|
||
|
|
documentMargins?: string;
|
||
|
|
documentStyles?: boolean;
|
||
|
|
|
||
|
|
// Generic options
|
||
|
|
[key: string]: string | number | boolean | undefined;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* History item for conversion history
|
||
|
|
*/
|
||
|
|
export interface ConversionHistoryItem {
|
||
|
|
id: string;
|
||
|
|
inputFileName: string;
|
||
|
|
inputFormat: string;
|
||
|
|
outputFormat: string;
|
||
|
|
outputFileName: string;
|
||
|
|
timestamp: number;
|
||
|
|
fileSize: number;
|
||
|
|
result?: Blob;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Format preset for common conversions
|
||
|
|
*/
|
||
|
|
export interface FormatPreset {
|
||
|
|
id: string;
|
||
|
|
name: string;
|
||
|
|
description: string;
|
||
|
|
category: FileCategory;
|
||
|
|
sourceFormats: string[];
|
||
|
|
targetFormat: string;
|
||
|
|
options: ConversionOptions;
|
||
|
|
icon?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* WASM module loading state
|
||
|
|
*/
|
||
|
|
export interface WASMModuleState {
|
||
|
|
ffmpeg: boolean;
|
||
|
|
imagemagick: boolean;
|
||
|
|
pandoc: boolean;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Progress callback for conversion
|
||
|
|
*/
|
||
|
|
export type ProgressCallback = (progress: number) => void;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Conversion result
|
||
|
|
*/
|
||
|
|
export interface ConversionResult {
|
||
|
|
success: boolean;
|
||
|
|
blob?: Blob;
|
||
|
|
error?: string;
|
||
|
|
duration?: number;
|
||
|
|
}
|