import type { ReadableStream, TransformStream } from "@yume-chan/stream-extra";
import type { AsyncExactReadable, ValueOrPromise } from "@yume-chan/struct";
import type { ScrcpyBackOrScreenOnControlMessage, ScrcpyControlMessageType, ScrcpyInjectTouchControlMessage, ScrcpySetClipboardControlMessage } from "../control/index.js";
import type { ScrcpyScrollController } from "./1_16/scroll.js";
import type { ScrcpyAudioStreamMetadata, ScrcpyMediaStreamPacket, ScrcpyVideoStream } from "./codec.js";
export declare const DEFAULT_SERVER_PATH = "/data/local/tmp/scrcpy-server.jar";
export interface ScrcpyOptionValue {
    toOptionValue(): string | undefined;
}
export declare function isScrcpyOptionValue(value: unknown): value is ScrcpyOptionValue;
export declare function toScrcpyOptionValue<T>(value: unknown, empty: T): string | T;
export interface ScrcpyEncoder {
    type: "video" | "audio";
    codec?: string;
    name: string;
}
export interface ScrcpyDisplay {
    id: number;
    resolution?: string;
}
export declare abstract class ScrcpyOptions<T extends object> {
    #private;
    abstract get defaults(): Required<T>;
    get controlMessageTypes(): readonly ScrcpyControlMessageType[];
    readonly value: Required<T>;
    get clipboard(): ReadableStream<string>;
    /**
     * Creates a new instance of `ScrcpyOptions`, delegating all methods to the `Base` class.
     * The derived class can override the methods to provide different behaviors.
     * In those override methods, the derived class can call `super.currentMethodName()` to
     * include the behavior of the `Base` class.
     *
     * Because `Base` is another derived class of `ScrcpyOptions`, its constructor might
     * call this constructor with another `Base` class, forming a chain of classes, but without
     * direct derivation to avoid type incompatibility when options are changed.
     *
     * When the `Base` class is constructed, its `value` field will be the same object as `value`,
     * so the `setListXXX` methods in `Base` will modify `this.value`.
     *
     * @param Base The base class's constructor
     * @param value The options value
     * @param defaults The default option values
     */
    constructor(Base: (new (value: never) => ScrcpyOptions<object>) | undefined, value: T, defaults: Required<T>);
    abstract serialize(): string[];
    /**
     * Set the essential options to let Scrcpy server print out available encoders.
     */
    setListEncoders(): void;
    /**
     * Set the essential options to let Scrcpy server print out available displays.
     */
    setListDisplays(): void;
    /**
     * Parse encoder information from Scrcpy server output
     * @param line One line of Scrcpy server output
     */
    parseEncoder(line: string): ScrcpyEncoder | undefined;
    /**
     * Parse display information from Scrcpy server output
     * @param line One line of Scrcpy server output
     */
    parseDisplay(line: string): ScrcpyDisplay | undefined;
    /**
     * Parse the device metadata from video stream according to the current version and options.
     * @param stream The video stream.
     * @returns
     * A tuple of the video stream and the metadata.
     *
     * The returned video stream may be different from the input stream, and should be used for further processing.
     */
    parseVideoStreamMetadata(stream: ReadableStream<Uint8Array>): ValueOrPromise<ScrcpyVideoStream>;
    parseAudioStreamMetadata(stream: ReadableStream<Uint8Array>): ValueOrPromise<ScrcpyAudioStreamMetadata>;
    parseDeviceMessage(id: number, stream: AsyncExactReadable): Promise<boolean>;
    createMediaStreamTransformer(): TransformStream<Uint8Array, ScrcpyMediaStreamPacket>;
    serializeInjectTouchControlMessage(message: ScrcpyInjectTouchControlMessage): Uint8Array;
    serializeBackOrScreenOnControlMessage(message: ScrcpyBackOrScreenOnControlMessage): Uint8Array | undefined;
    /**
     * Convert a clipboard control message to binary data
     * @param message The clipboard control message
     * @returns A `Uint8Array` containing the binary data, or a tuple of the binary data and a promise that resolves when the clipboard is updated on the device
     */
    serializeSetClipboardControlMessage(message: ScrcpySetClipboardControlMessage): Uint8Array | [Uint8Array, Promise<void>];
    createScrollController(): ScrcpyScrollController;
}
//# sourceMappingURL=types.d.ts.map