__all__: list[str] = []

import cv2
import cv2.typing
import typing as _typing


# Enumerations
Codec_AVC: int
CODEC_AVC: int
Codec_HEVC: int
CODEC_HEVC: int
Codec_JPEG: int
CODEC_JPEG: int
Codec = int
"""One of [Codec_AVC, CODEC_AVC, Codec_HEVC, CODEC_HEVC, Codec_JPEG, CODEC_JPEG]"""

PicStruct_FRAME: int
PIC_STRUCT_FRAME: int
PicStruct_TOP: int
PIC_STRUCT_TOP: int
PicStruct_BOT: int
PIC_STRUCT_BOT: int
PicStruct_TOP_BOT: int
PIC_STRUCT_TOP_BOT: int
PicStruct_BOT_TOP: int
PIC_STRUCT_BOT_TOP: int
PicStruct_TOP_BOT_TOP: int
PIC_STRUCT_TOP_BOT_TOP: int
PicStruct_BOT_TOP_BOT: int
PIC_STRUCT_BOT_TOP_BOT: int
PicStruct_FRAME_X2: int
PIC_STRUCT_FRAME_X2: int
PicStruct_FRAME_X3: int
PIC_STRUCT_FRAME_X3: int
PicStruct_TOP_PREV_BOT: int
PIC_STRUCT_TOP_PREV_BOT: int
PicStruct_BOT_PREV_TOP: int
PIC_STRUCT_BOT_PREV_TOP: int
PicStruct_TOP_NEXT_BOT: int
PIC_STRUCT_TOP_NEXT_BOT: int
PicStruct_BOT_NEXT_TOP: int
PIC_STRUCT_BOT_NEXT_TOP: int
PicStruct = int
"""One of [PicStruct_FRAME, PIC_STRUCT_FRAME, PicStruct_TOP, PIC_STRUCT_TOP, PicStruct_BOT, PIC_STRUCT_BOT, PicStruct_TOP_BOT, PIC_STRUCT_TOP_BOT, PicStruct_BOT_TOP, PIC_STRUCT_BOT_TOP, PicStruct_TOP_BOT_TOP, PIC_STRUCT_TOP_BOT_TOP, PicStruct_BOT_TOP_BOT, PIC_STRUCT_BOT_TOP_BOT, PicStruct_FRAME_X2, PIC_STRUCT_FRAME_X2, PicStruct_FRAME_X3, PIC_STRUCT_FRAME_X3, PicStruct_TOP_PREV_BOT, PIC_STRUCT_TOP_PREV_BOT, PicStruct_BOT_PREV_TOP, PIC_STRUCT_BOT_PREV_TOP, PicStruct_TOP_NEXT_BOT, PIC_STRUCT_TOP_NEXT_BOT, PicStruct_BOT_NEXT_TOP, PIC_STRUCT_BOT_NEXT_TOP]"""

BitDepth_FIRST: int
BIT_DEPTH_FIRST: int
BitDepth_ALLOC: int
BIT_DEPTH_ALLOC: int
BitDepth_STREAM: int
BIT_DEPTH_STREAM: int
BitDepth_B8: int
BIT_DEPTH_B8: int
BitDepth_B10: int
BIT_DEPTH_B10: int
BitDepth_B12: int
BIT_DEPTH_B12: int
BitDepth = int
"""One of [BitDepth_FIRST, BIT_DEPTH_FIRST, BitDepth_ALLOC, BIT_DEPTH_ALLOC, BitDepth_STREAM, BIT_DEPTH_STREAM, BitDepth_B8, BIT_DEPTH_B8, BitDepth_B10, BIT_DEPTH_B10, BitDepth_B12, BIT_DEPTH_B12]"""

Tier_MAIN: int
TIER_MAIN: int
Tier_HIGH: int
TIER_HIGH: int
Tier = int
"""One of [Tier_MAIN, TIER_MAIN, Tier_HIGH, TIER_HIGH]"""

RCMode_CONST_QP: int
RCMODE_CONST_QP: int
RCMode_CBR: int
RCMODE_CBR: int
RCMode_VBR: int
RCMODE_VBR: int
RCMode_LOW_LATENCY: int
RCMODE_LOW_LATENCY: int
RCMode_CAPPED_VBR: int
RCMODE_CAPPED_VBR: int
RCMode = int
"""One of [RCMode_CONST_QP, RCMODE_CONST_QP, RCMode_CBR, RCMODE_CBR, RCMode_VBR, RCMODE_VBR, RCMode_LOW_LATENCY, RCMODE_LOW_LATENCY, RCMode_CAPPED_VBR, RCMODE_CAPPED_VBR]"""

Entropy_CAVLC: int
ENTROPY_CAVLC: int
Entropy_CABAC: int
ENTROPY_CABAC: int
Entropy = int
"""One of [Entropy_CAVLC, ENTROPY_CAVLC, Entropy_CABAC, ENTROPY_CABAC]"""

GOPMode_BASIC: int
GOPMODE_BASIC: int
GOPMode_BASIC_B: int
GOPMODE_BASIC_B: int
GOPMode_PYRAMIDAL: int
GOPMODE_PYRAMIDAL: int
GOPMode_PYRAMIDAL_B: int
GOPMODE_PYRAMIDAL_B: int
GOPMode_LOW_DELAY_P: int
GOPMODE_LOW_DELAY_P: int
GOPMode_LOW_DELAY_B: int
GOPMODE_LOW_DELAY_B: int
GOPMode_ADAPTIVE: int
GOPMODE_ADAPTIVE: int
GOPMode = int
"""One of [GOPMode_BASIC, GOPMODE_BASIC, GOPMode_BASIC_B, GOPMODE_BASIC_B, GOPMode_PYRAMIDAL, GOPMODE_PYRAMIDAL, GOPMode_PYRAMIDAL_B, GOPMODE_PYRAMIDAL_B, GOPMode_LOW_DELAY_P, GOPMODE_LOW_DELAY_P, GOPMode_LOW_DELAY_B, GOPMODE_LOW_DELAY_B, GOPMode_ADAPTIVE, GOPMODE_ADAPTIVE]"""

GDRMode_DISABLE: int
GDRMODE_DISABLE: int
GDRMode_VERTICAL: int
GDRMODE_VERTICAL: int
GDRMode_HORIZONTAL: int
GDRMODE_HORIZONTAL: int
GDRMode = int
"""One of [GDRMode_DISABLE, GDRMODE_DISABLE, GDRMode_VERTICAL, GDRMODE_VERTICAL, GDRMode_HORIZONTAL, GDRMODE_HORIZONTAL]"""



# Classes
class RawInfo:
    eos: bool
    fourcc: int
    bitsPerLuma: int
    bitsPerChroma: int
    stride: int
    width: int
    height: int
    posX: int
    posY: int
    cropTop: int
    cropBottom: int
    cropLeft: int
    cropRight: int
    picStruct: PicStruct

class DecoderInitParams:
    codec: Codec
    fourcc: int
    fourccConvert: int
    maxFrames: int
    bitDepth: BitDepth
    szReturnQueue: int

    # Functions
    def __init__(self, codec: Codec = ..., fourcc: int = ..., fourccConvert: int = ..., maxFrames: int = ..., bitDepth: BitDepth = ...) -> None: ...


class Decoder:
    # Functions
    @_typing.overload
    def nextFrame(self, frame: cv2.typing.MatLike | None = ...) -> tuple[bool, cv2.typing.MatLike, RawInfo]: ...
    @_typing.overload
    def nextFrame(self, frame: cv2.UMat | None = ...) -> tuple[bool, cv2.UMat, RawInfo]: ...

    @_typing.overload
    def nextFramePlanes(self, planes: _typing.Sequence[cv2.typing.MatLike] | None = ..., byRef: bool = ...) -> tuple[bool, _typing.Sequence[cv2.typing.MatLike], RawInfo]: ...
    @_typing.overload
    def nextFramePlanes(self, planes: _typing.Sequence[cv2.UMat] | None = ..., byRef: bool = ...) -> tuple[bool, _typing.Sequence[cv2.UMat], RawInfo]: ...

    def set(self, propId: int, value: float) -> bool: ...

    def get(self, propId: int) -> float: ...

    def streamInfo(self) -> str: ...

    def statistics(self) -> str: ...


class RCSettings:
    mode: RCMode
    entropy: Entropy
    bitrate: int
    maxBitrate: int
    cpbSize: int
    initialDelay: int
    fillerData: bool
    maxQualityTarget: int
    maxPictureSizeI: int
    maxPictureSizeP: int
    maxPictureSizeB: int
    skipFrame: bool
    maxSkip: int

    # Functions
    def __init__(self, mode: RCMode = ..., entropy: Entropy = ..., bitrate: int = ..., maxBitrate: int = ..., cbPSize: int = ..., initialDelay: int = ..., fillerData: bool = ..., maxQualityTarget: int = ..., maxPictureSizeI: int = ..., maxPictureSizeP: int = ..., maxPictureSizeB: int = ..., skipFrame: bool = ..., maxSkip: int = ...) -> None: ...


class GOPSettings:
    mode: GOPMode
    gdrMode: GDRMode
    gopLength: int
    nrBFrames: int
    longTermRef: bool
    longTermFreq: int
    periodIDR: int

    # Functions
    def __init__(self, mode: GOPMode = ..., gdrMode: GDRMode = ..., gopLength: int = ..., nrBFrames: int = ..., longTermRef: bool = ..., longTermFreq: int = ..., periodIDR: int = ...) -> None: ...


class ProfileSettings:
    profile: str
    level: str
    tier: Tier

    # Functions
    def __init__(self, profile: str = ..., level: str = ..., tier: Tier = ...) -> None: ...


class GlobalMotionVector:
    frameIndex: int
    gmVectorX: int
    gmVectorY: int

    # Functions
    def __init__(self, frameIndex: int = ..., gmVectorX: int = ..., gmVectorY: int = ...) -> None: ...


class EncoderInitParams:
    codec: Codec
    fourcc: int
    rcMode: RCMode
    bitrate: int
    pictWidth: int
    pictHeight: int
    frameRate: int
    gopLength: int
    nrBFrames: int
    profileSettings: ProfileSettings

    # Functions
    def __init__(self, codec: Codec = ..., fourcc: int = ..., rcMode: RCMode = ..., bitrate: int = ..., pictWidth: int = ..., pictHeight: int = ..., frameRate: int = ..., gopLength: int = ..., nrBFrames: int = ...) -> None: ...


class EncoderCallback:
    ...

class Encoder:
    # Functions
    @_typing.overload
    def write(self, frame: cv2.typing.MatLike) -> None: ...
    @_typing.overload
    def write(self, frame: cv2.UMat) -> None: ...

    def eos(self) -> bool: ...

    @_typing.overload
    def set(self, propId: int, value: float) -> bool: ...
    @_typing.overload
    def set(self, rcSettings: RCSettings) -> None: ...
    @_typing.overload
    def set(self, gopSettings: GOPSettings) -> None: ...
    @_typing.overload
    def set(self, gmVector: GlobalMotionVector) -> None: ...
    @_typing.overload
    def set(self, profileSettings: ProfileSettings) -> None: ...

    @_typing.overload
    def get(self, propId: int) -> float: ...
    @_typing.overload
    def get(self, rcSettings: RCSettings) -> None: ...
    @_typing.overload
    def get(self, gopSettings: GOPSettings) -> None: ...
    @_typing.overload
    def get(self, gmVector: GlobalMotionVector) -> None: ...
    @_typing.overload
    def get(self, profileSettings: ProfileSettings) -> None: ...

    def setSceneChange(self, frameIdx: int, lookAhead: int) -> None: ...

    def setIsLongTerm(self, frameIdx: int) -> None: ...

    def setUseLongTerm(self, frameIdx: int) -> None: ...

    def restartGop(self, frameIdx: int) -> None: ...

    def restartGopRecoveryPoint(self, frameIdx: int) -> None: ...

    def setGopLength(self, frameIdx: int, gopLength: int) -> None: ...

    def setNumB(self, frameIdx: int, numB: int) -> None: ...

    def setFreqIDR(self, frameIdx: int, freqIDR: int) -> None: ...

    def setFrameRate(self, frameIdx: int, frameRate: int, clockRatio: int) -> None: ...

    def setBitRate(self, frameIdx: int, bitRate: int) -> None: ...

    def setMaxBitRate(self, frameIdx: int, iTargetBitRate: int, iMaxBitRate: int) -> None: ...

    def setQP(self, frameIdx: int, qp: int) -> None: ...

    def setQPOffset(self, frameIdx: int, iQpOffset: int) -> None: ...

    def setQPBounds(self, frameIdx: int, iMinQP: int, iMaxQP: int) -> None: ...

    def setQPBoundsI(self, frameIdx: int, iMinQP_I: int, iMaxQP_I: int) -> None: ...

    def setQPBoundsP(self, frameIdx: int, iMinQP_P: int, iMaxQP_P: int) -> None: ...

    def setQPBoundsB(self, frameIdx: int, iMinQP_B: int, iMaxQP_B: int) -> None: ...

    def setQPIPDelta(self, frameIdx: int, iQPDelta: int) -> None: ...

    def setQPPBDelta(self, frameIdx: int, iQPDelta: int) -> None: ...

    def setLFMode(self, frameIdx: int, iMode: int) -> None: ...

    def setLFBetaOffset(self, frameIdx: int, iBetaOffset: int) -> None: ...

    def setLFTcOffset(self, frameIdx: int, iTcOffset: int) -> None: ...

    def setCostMode(self, frameIdx: int, bCostMode: bool) -> None: ...

    def setMaxPictureSize(self, frameIdx: int, iMaxPictureSize: int) -> None: ...

    def setMaxPictureSizeI(self, frameIdx: int, iMaxPictureSize_I: int) -> None: ...

    def setMaxPictureSizeP(self, frameIdx: int, iMaxPictureSize_P: int) -> None: ...

    def setMaxPictureSizeB(self, frameIdx: int, iMaxPictureSize_B: int) -> None: ...

    def setQPChromaOffsets(self, frameIdx: int, iQp1Offset: int, iQp2Offset: int) -> None: ...

    def setAutoQP(self, frameIdx: int, bUseAutoQP: bool) -> None: ...

    def setHDRIndex(self, frameIdx: int, iHDRIdx: int) -> None: ...

    def setIsSkip(self, frameIdx: int) -> None: ...

    def setSAO(self, frameIdx: int, bSAOEnabled: bool) -> None: ...

    def setAutoQPThresholdQPAndDeltaQP(self, frameIdx: int, bEnableUserAutoQPValues: bool, thresholdQP: _typing.Sequence[int], deltaQP: _typing.Sequence[int]) -> None: ...

    @staticmethod
    def getProfiles(codec: Codec) -> str: ...

    @staticmethod
    def getLevels(codec: Codec) -> str: ...


class ChromaCoordinates:
    x: int
    y: int

class MasteringDisplayColourVolume:
    display_primaries: _typing.Sequence[ChromaCoordinates]
    white_point: ChromaCoordinates
    max_display_mastering_luminance: int
    min_display_mastering_luminance: int

class ContentLightLevel:
    max_content_light_level: int
    max_pic_average_light_level: int

class AlternativeTransferCharacteristics:
    preferred_transfer_characteristics: int

class ProcessingWindow_ST2094_10:
    active_area_left_offset: int
    active_area_right_offset: int
    active_area_top_offset: int
    active_area_bottom_offset: int

class ImageCharacteristics_ST2094_10:
    min_pq: int
    max_pq: int
    avg_pq: int

class ManualAdjustment_ST2094_10:
    target_max_pq: int
    trim_slope: int
    trim_offset: int
    trim_power: int
    trim_chroma_weight: int
    trim_saturation_gain: int
    ms_weight: int

class DynamicMeta_ST2094_10:
    application_version: int
    processing_window_flag: bool
    processing_window: ProcessingWindow_ST2094_10
    image_characteristics: ImageCharacteristics_ST2094_10
    manual_adjustments: _typing.Sequence[ManualAdjustment_ST2094_10]

class ProcessingWindow_ST2094_1:
    upper_left_corner_x: int
    upper_left_corner_y: int
    lower_right_corner_x: int
    lower_right_corner_y: int

class ProcessingWindow_ST2094_40:
    center_of_ellipse_x: int
    center_of_ellipse_y: int
    rotation_angle: int
    semimajor_axis_internal_ellipse: int
    semimajor_axis_external_ellipse: int
    semiminor_axis_external_ellipse: int
    overlap_process_option: int

class DisplayPeakLuminance_ST2094_40:
    actual_peak_luminance_flag: bool
    num_rows_actual_peak_luminance: int
    num_cols_actual_peak_luminance: int
    actual_peak_luminance: _typing.Sequence[_typing.Sequence[int]]

class TargetedSystemDisplay_ST2094_40:
    maximum_luminance: int
    peak_luminance: DisplayPeakLuminance_ST2094_40

class ToneMapping_ST2094_40:
    tone_mapping_flag: bool
    knee_point_x: int
    knee_point_y: int
    bezier_curve_anchors: _typing.Sequence[int]

class ProcessingWindowTransform_ST2094_40:
    maxscl: _typing.Sequence[int]
    average_maxrgb: int
    distribution_maxrgb_percentages: _typing.Sequence[int]
    distribution_maxrgb_percentiles: _typing.Sequence[int]
    fraction_bright_pixels: int
    tone_mapping: ToneMapping_ST2094_40
    color_saturation_mapping_flag: bool
    color_saturation_weight: int

class DynamicMeta_ST2094_40:
    application_version: int
    processing_windows: _typing.Sequence[ProcessingWindow_ST2094_40]
    targeted_system_display: TargetedSystemDisplay_ST2094_40
    mastering_display_peak_luminance: DisplayPeakLuminance_ST2094_40
    processing_window_transforms: _typing.Sequence[ProcessingWindowTransform_ST2094_40]

class HDRSEIs:
    ...


# Functions
def createDecoder(filename: str, params: DecoderInitParams) -> Decoder: ...

def createEncoder(filename: str, params: EncoderInitParams, callback: EncoderCallback = ...) -> Encoder: ...


