using Godot;
using System;
namespace VideoOrchestra.Platform
{
///
/// Cross-platform interface for VP9 video decoding implementations
///
public interface IVP9PlatformDecoder : IDisposable
{
///
/// Platform identifier
///
string PlatformName { get; }
///
/// Check if VP9 hardware decoding is supported on this platform
///
bool IsHardwareDecodingSupported { get; }
///
/// Initialize the decoder with specified dimensions
///
/// Video width
/// Video height
/// Enable hardware acceleration if available
/// True if initialization succeeded
bool Initialize(int width, int height, bool enableHardware = true);
///
/// Decode a VP9 frame for the specified stream
///
/// VP9 encoded frame data
/// Stream identifier (0-2)
/// True if decoding succeeded
bool DecodeFrame(byte[] frameData, int streamId);
///
/// For asynchronous decoders, this method updates the internal textures with any new frames
/// that have been decoded since the last call. Should be called on the main thread.
///
void UpdateTextures();
///
/// Get the decoded frame as ImageTexture for the specified stream
///
/// Stream identifier (0-2)
/// Decoded frame texture, or null if not available
ImageTexture GetDecodedTexture(int streamId);
///
/// Get platform-specific texture ID (OpenGL/DirectX/Metal)
///
/// Stream identifier (0-2)
/// Native texture ID, or 0 if not available
uint GetNativeTextureId(int streamId);
///
/// Get current decoder status
///
VP9DecoderStatus GetStatus();
///
/// Release all resources
///
void Release();
}
///
/// VP9 decoder status enumeration
///
public enum VP9DecoderStatus
{
Uninitialized,
Initialized,
Decoding,
Error,
Released
}
///
/// Exception thrown by VP9 platform decoders
///
public class VP9DecoderException : Exception
{
public string PlatformName { get; }
public int StreamId { get; }
public VP9DecoderException(string platformName, string message)
: base($"[{platformName}] {message}")
{
PlatformName = platformName;
StreamId = -1;
}
public VP9DecoderException(string platformName, int streamId, string message)
: base($"[{platformName}] Stream {streamId}: {message}")
{
PlatformName = platformName;
StreamId = streamId;
}
public VP9DecoderException(string platformName, string message, Exception innerException)
: base($"[{platformName}] {message}", innerException)
{
PlatformName = platformName;
StreamId = -1;
}
}
}