A browser+player for place.stream.video records
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

HolyC 41.4%
C 38.7%
Python 11.0%
Shell 4.7%
Makefile 3.6%
Assembly 0.5%
Other 0.1%
4 1 0

Clone this repository

https://tangled.org/stavola.xyz/vod-browser https://tangled.org/did:plc:tahmjtpwnkuhopngqe5q7jp2/vod-browser
git@tangled.org:stavola.xyz/vod-browser git@tangled.org:did:plc:tahmjtpwnkuhopngqe5q7jp2/vod-browser

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

VodBrowser#

VodBrowser grid menu VodBrowser playing a VOD VodBrowser post-playback stats

A browser for place.stream.video records with basic playback functionality, for TempleOS. Streams and plays H.264 video over HLS from place.stream.video records. Audio, pause/play, seeking, and thumbnails are not supported.

This is my entry for VODJAM. I like doing weird, dumb projects so when I looked at the "What we're looking for section" and saw "Hilarious and amazing nonsense that we couldn't possibly have predicted," it was a done deal. I had originally planned to finish this by Easter Sunday (he has risen, et cetera et cetera) but, believe it or not, this was a bit hard to get going properly and I totally blew past that artificial deadline.

Now, after submission, I can safely say that I will definitely not be adding anything else to this repo. HolyC was nice to work with and TempleOS could be pleasant at times, but I spent way too much time chasing pointer addresses and reading asm to form good memories here. If you would like to contribute, I would suggest forking!

Usage#

Using the prebuilt ISO, you can just invoke VodBrowser from the TempleOS REPL.

Installation#

Prebuilt, all-in-one ISO#

Download here. Boot it in any TempleOS-compatible VMM and VodBrowser; is ready from the REPL.

Minimal QEMU invocation (cribbed from qemu-run.sh, which has more knobs if you need them):

qemu-system-x86_64 \
  -machine pc-i440fx-10.0,vmport=off,hpet=off \
  -cpu Skylake-Client \
  -m 2048 \
  -smp 4 \
  -accel tcg,tb-size=512 \
  -vga none -device cirrus-vga \
  -device pcnet,netdev=net0 \
  -netdev user,id=net0 \
  -cdrom path/to/vodbrowser.iso \
  -boot d

If QEMU opens headless, add -display cocoa (macOS), -display gtk (Linux), or -display sdl depending on what your build was compiled with.

From source#

Prerequisites#

  • Zig - used as the cross-compiler (zig cc / zig c++) targeting x86_64-linux-musl. Any recent Zig should work.
  • Python 3 - runs elf/elf2bin.py, elf/make_program.py, tools/mkredseaiso.py, and tools/mkdistroiso.py
  • curl - to fetch the upstream TempleOS ISO. You can skip this by dropping a TempleOS.iso into the project root manually.
  • UTM on macOS, QEMU on Linux, or any other VMM that can mount an ISO as a CD.

Steps#

  • Clone (with all submodules):
git clone --recursive git@tangled.org:stavola.xyz/vod-browser
cd vod-browser
  • Run ./deploy.sh

  • Boot TempleOS in your VMM of choice and attach isos/sources.iso as a CD-ROM.

  • From the TempleOS REPL, load the sources and run it:

Cd("T:/");
#include "VodBrowser";
VodBrowser;

How it works#

The general approach is the one James Whitham describes in Porting third-party programs to TempleOS: take third-party C code, cross-compile it to a freestanding ELF that runs in TempleOS's address space, and bridge it back to HolyC through small trampolines. Almost all of the work here went into making specific C libraries tolerate the constraints of running under TempleOS.

The rule of thumb for picking dependencies was to find the smallest, most self-contained C implementation of a thing and then wrap it. Every library under lib/ is there because it had a minimal-dependency build that could survive without libc, without threads, and without hardware floating point. Anything that wanted libm, pthreads, or SSE had to be patched, stubbed, or swapped out for something simpler.

Credits#

Libraries#

Everything under lib/ is a git submodule. Each one was picked for being the smallest self-contained implementation of its role that was permissively licensed and required minimal alterations, if any.

Library Role
lib/bearssl TLS for HTTPS (ATProto API, VOD segment fetches)
lib/jsmn JSON parsing for ATProto API responses
lib/lwip TCP/IP and DHCP, driven by a HolyC NIC shim
lib/media-server libmov, the fragmented MP4 demuxer
lib/openh264 H.264 / AVC video decoder
lib/picohttpparser HTTP response header parsing

Repo layout#

holyc/          HolyC source. Entry point: VodBrowser.HC.
net/            C source for Net.prg (lwIP, BearSSL, HTTP, JSON).
media/          C source for Media.prg (libmov, openh264).
elf/            Linker scripts and ELF-to-.prg Python tooling.
lib/            Third-party submodules.
tools/          RedSea ISO packer.
isos/           Build output.

Makefile                  Rebuild Net.prg and Media.prg.
deploy.sh                 Build everything and pack sources.iso.
qemu-run.sh               Cross-platform QEMU launcher.
build-vodbrowser-dist.sh  Produce a bootable distributable ISO
                          by injecting VodBrowser into the stock
                          TempleOS ISO via tools/mkdistroiso.py.

License#

MIT

AI Usage#

Co-designed with Claude Opus, which did most of the low-level details.