Add backend/app/models.py
This commit is contained in:
parent
8de0ac50d3
commit
5866ad3510
1 changed files with 76 additions and 0 deletions
76
backend/app/models.py
Normal file
76
backend/app/models.py
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
from enum import Enum
|
||||||
|
from datetime import datetime
|
||||||
|
from pydantic import BaseModel, Field, ConfigDict
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
|
||||||
|
class CodecType(str, Enum):
|
||||||
|
"""Supported video codec types"""
|
||||||
|
PRORES = "prores"
|
||||||
|
DNXHD = "dnxhd"
|
||||||
|
UNCOMPRESSED = "uncompressed"
|
||||||
|
H264 = "h264"
|
||||||
|
|
||||||
|
|
||||||
|
class RecorderConfig(BaseModel):
|
||||||
|
"""Configuration for a recorder port"""
|
||||||
|
model_config = ConfigDict(use_enum_values=False)
|
||||||
|
|
||||||
|
port_index: int = Field(..., description="Index of the recorder port (0-based)")
|
||||||
|
codec: CodecType = Field(..., description="Selected codec for recording")
|
||||||
|
bitrate: int = Field(..., description="Target bitrate in Mbps")
|
||||||
|
quality_profile: str = Field(
|
||||||
|
...,
|
||||||
|
description="Quality profile name (high, medium, low)"
|
||||||
|
)
|
||||||
|
recording_path: str = Field(
|
||||||
|
...,
|
||||||
|
description="Directory path for recording output files"
|
||||||
|
)
|
||||||
|
srt_enabled: bool = Field(
|
||||||
|
default=False, description="Enable SRT streaming output"
|
||||||
|
)
|
||||||
|
srt_destination: Optional[str] = Field(
|
||||||
|
default=None, description="SRT destination address (host:port)"
|
||||||
|
)
|
||||||
|
preview_enabled: bool = Field(
|
||||||
|
default=True, description="Enable live HLS preview"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class PortStatus(BaseModel):
|
||||||
|
"""Real-time status of a recorder port"""
|
||||||
|
model_config = ConfigDict(use_enum_values=False)
|
||||||
|
|
||||||
|
port_index: int = Field(..., description="Index of the recorder port")
|
||||||
|
is_recording: bool = Field(..., description="Whether this port is currently recording")
|
||||||
|
frame_count: int = Field(..., description="Total frames recorded")
|
||||||
|
fps: float = Field(..., description="Frames per second")
|
||||||
|
bitrate_mbps: float = Field(..., description="Current bitrate in Mbps")
|
||||||
|
uptime_seconds: int = Field(..., description="Recording uptime in seconds")
|
||||||
|
current_file: str = Field(..., description="Current output file path")
|
||||||
|
codec: CodecType = Field(..., description="Codec being used")
|
||||||
|
|
||||||
|
|
||||||
|
class SCTE35Marker(BaseModel):
|
||||||
|
"""SCTE-35/SCTE-104 advertisement marker"""
|
||||||
|
model_config = ConfigDict(use_enum_values=False)
|
||||||
|
|
||||||
|
event_id: str = Field(
|
||||||
|
..., description="Unique identifier for this ad break event"
|
||||||
|
)
|
||||||
|
duration_seconds: int = Field(
|
||||||
|
..., description="Duration of the ad break in seconds"
|
||||||
|
)
|
||||||
|
out_of_network: bool = Field(
|
||||||
|
..., description="Whether this is an out-of-network ad"
|
||||||
|
)
|
||||||
|
splice_immediate: bool = Field(
|
||||||
|
..., description="Whether splice should happen immediately"
|
||||||
|
)
|
||||||
|
timestamp: datetime = Field(
|
||||||
|
..., description="Timestamp when marker was created/triggered"
|
||||||
|
)
|
||||||
|
webhook_url: Optional[str] = Field(
|
||||||
|
default=None, description="Webhook URL to notify on ad break"
|
||||||
|
)
|
||||||
Loading…
Reference in a new issue