-- 008 — Extended codec controls for recorders.
--
-- Adds video bitrate, framerate, audio codec / bitrate / channels, and
-- container format columns to recorders so the UI can offer granular
-- control instead of the four-options dropdown. capture-manager.js reads
-- these via env vars and builds ffmpeg args from them.

ALTER TABLE recorders
  ADD COLUMN IF NOT EXISTS recording_video_bitrate  TEXT,
  ADD COLUMN IF NOT EXISTS recording_framerate      TEXT,
  ADD COLUMN IF NOT EXISTS recording_audio_codec    TEXT DEFAULT 'pcm_s24le',
  ADD COLUMN IF NOT EXISTS recording_audio_bitrate  TEXT,
  ADD COLUMN IF NOT EXISTS recording_audio_channels INTEGER DEFAULT 2,
  ADD COLUMN IF NOT EXISTS recording_container      TEXT DEFAULT 'mov',
  ADD COLUMN IF NOT EXISTS proxy_video_bitrate      TEXT DEFAULT '8M',
  ADD COLUMN IF NOT EXISTS proxy_framerate          TEXT,
  ADD COLUMN IF NOT EXISTS proxy_audio_codec        TEXT DEFAULT 'aac',
  ADD COLUMN IF NOT EXISTS proxy_audio_bitrate      TEXT DEFAULT '192k',
  ADD COLUMN IF NOT EXISTS proxy_audio_channels     INTEGER DEFAULT 2,
  ADD COLUMN IF NOT EXISTS proxy_container          TEXT DEFAULT 'mp4',
  ADD COLUMN IF NOT EXISTS node_id                  UUID,
  ADD COLUMN IF NOT EXISTS device_index             INTEGER;

-- node_id is the cluster_nodes.id the recorder is pinned to (for SDI
-- recorders this is the node hosting the DeckLink card). device_index is
-- the DeckLink port index on that node.
