19 Commits

Author SHA1 Message Date
Christian Benincasa
e98cccb94d chore: cleanup turbo tasks, consolidate some shared package versions 2025-09-30 21:02:20 -04:00
Christian Benincasa
fe7736591c refactor: get all tests passing; configure at top-level 2025-07-06 20:51:18 -04:00
Christian Benincasa
0a02ed2e31 refactor(scheduling): generate all time slot schedules on the server (#1231) 2025-06-11 14:50:55 -04:00
Christian Benincasa
c9c3130d70 refactor: use bun for runtime and packaging (#1063) 2025-01-29 13:42:34 -05:00
Christian Benincasa
828367c08a fix: use correct pixel formats when downloading from hardware (#1008)
this ended up being a large refactoring of the way pixel formats are
handled in the new ffmpeg pipeline. This was done to make reasoning
about which format to use when a bit easier -- it's still complicated.
The main issue here was for 10-bit output: when the incoming video was
using something like yuv420p10le, but we were using hwaccel, we have to
be sure to use the equivalent p010 format when reformatting frames from
hardware; p010le and yuv420p10le, for instance, are equivalent.

The way this is done now is by keeping the notion of "wrapper" pixel
format types while also introducing a delineation between
software/hardware pixel formats. While the naming isn't technically
"correct" (we could use p010le on hardware, if we wanted) it is meant to
be clear about which formats can be used on the boundaries between
software/hardware and when.
2024-12-10 09:16:50 -05:00
Christian Benincasa
7c05f3599f chore: fix dep graph for new types build
also fixes clean tasks
2024-09-10 10:26:51 -04:00
Christian Benincasa
5ef1fc8bb8 feat: major streaming overhaul (#749)
This commit features a major rewrite and refactoring of the streaming
pipeline and class hierachy in Tunarr. It introduces new default
streaming modes in an attempt to stabilize transitions between program
streams, reuse underlying resources (e.g. ffmpeg processes), reduce the
complexity of interaction between various streaming class components,
and increase flexibility for future development.

Some notable changes:
* The default MPEG-TS stream is now backed by HLS. IPTV and Web
  streaming sessions are shared
* Transcode readahead implementation. This should create smoother
  streams. For FFMPEG 7 (and future versions) we use the native
  "readrate_initial_burst" option. For earlier versions we use an
  artificial readahead. **NOTE**: FFMPEG <7 artificial readahead might
  have unintended side effects (e.g. loudness normalization issues) and
  as such FFMPEG 7+ is recommended
* Separation between building an ffmpeg process, spawning the process,
  and the notion of a 'transcode session'. These are all separate
  classes now with narrow concerns
* Other misc refactoring to cleanup code and remove leftover superfluous
  logic from DTV
2024-09-06 14:44:50 -04:00
Christian Benincasa
6f32ce60f2 chore: bump turborepo to latest version (#614) 2024-07-13 21:23:32 -04:00
Christian Benincasa
98b6e25abf Do not display tanstack router devtools in prod builds (#570) 2024-06-25 15:57:06 -04:00
Christian Benincasa
bc17560563 Fix Mac OS executable bundling + remove unused deps (#565) 2024-06-25 06:38:51 -04:00
Christian Benincasa
2e0f021e41 Do not use query params on /video endpoint so that Plex DVR works (#408)
Plex will blindly append query parameters on the end of channel URLs
(e.g. ?transcode=heavy), instead of first checking if the URL has a
query param. It seems that Express (DTV) handled this differently than
Fastify; the latter seems to take the _last_ query string from the URL,
resulting in a 404.

This also hooks up dotenv for the server, making it much easier to set
env variables for different run modes (e.g. using
TUNARR_BIND_ADDR=0.0.0.0 to have Plex auto discover the HDHR tuner when
running the dev server)
2024-04-30 12:25:08 -04:00
Christian Benincasa
d8c32672ec Specific routes for channel edit tabs (#302) 2024-04-17 12:58:38 -04:00
Christian Benincasa
e2448debaa Cleaning up + optimizing (#277)
* Cleaning up scary code - checkpoint 1

* Massive server cleanup + optimizations - Part 1

* Bump mikro-orm versions
* Pilot using tagged types (type branding) on FillerShow.uuid for
  (maybe) better type checking
* Start hacking away at the 'helperFuncs' file inherited from DTV
    * Optimizations in getCurrentProgramAndTimeElapsed to reuse the
      precalculated 'startTimeOffsets' from the channel lineup
    * More type checks
    * Untangling some of the crazier types I added earlier on to make
      sense of the original code
    * General cleanup + best practices
* Move util.ts to util/index.ts
* No longer using req.hijack() to send raw video stream to frontend -
  this cleaned up a lot of code
* Introduce VideoStream + ConcatStream classes which hold functionality
  related to streaming that used to be in the monolithic video.ts
* Simplify ChannelCache and break dependence on Plex IDs. This now
  caches using our internal DB IDs

Left TODO:
* Completely remove helperFuncs.ts and put the functions in a more
  appropriate place
* Subdirectories for Plex files
* Subdirectories for 'Player' classes
* Subdirectories for 'ffmpeg' classes
* Persist channel cache to disk periodically so that server restarts
  preserve that information about streaming

* Update lockfile

* Fix build
2024-04-12 07:01:59 -04:00
Christian Benincasa
d3ca4a2816 Code health updates (#242)
* Checkpoint - this isn't working right

* typecheck should depend on generate-db-cache action

* Fix some lint warnings
2024-04-07 08:46:40 -04:00
Christian Benincasa
67f2d144e2 Dynamic channels - phase 1 (#231)
* Checkpoint - dynamic channels

* Yet another checkpoint

* Bump versions - makes a ton of stuff work magically; needed a patch for ts-essentials because of https://github.com/ts-essentials/ts-essentials/issues/381

* Checkpointing

* Checkpoint
2024-04-03 15:08:31 -04:00
Christian Benincasa
593a29ba9b Support for custom shows in channels - Part 2 (#173) 2024-03-15 07:35:33 -04:00
Christian Benincasa
b3a9d17d88 WIP (#153) 2024-03-07 20:45:43 -05:00
Christian Benincasa
bfe3d044f9 Ensure that we build types and shared libraries before launching dev tasks 2024-03-06 14:53:05 -05:00
Christian Benincasa
a0cdb7600a Integrate turborepo for easier monorepo dep management and bundling (#146) 2024-03-06 12:44:11 -05:00