#!/usr/bin/env python3
#
# Copyright (c) 2026 Stormux
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.

"""Compatibility helpers for GStreamer GI bindings."""

from __future__ import annotations

from typing import Any


def gst_init_check_available(gst: Any) -> bool:
    """Return Gst.init_check(None) availability across GI variants."""

    initCheckResult = gst.init_check(None)
    if isinstance(initCheckResult, tuple):
        return bool(initCheckResult[0])

    return bool(initCheckResult)
