This is a video subtitling program which uses the popular JACOSub file format.

I had to stop working on it from lack of time to use it, combined with the poor video quality of the hardware I was using it with, but I did use it a few times.

It is written in C, and uses the WASTE (WorldScript Aware Styled Text Engine) demo program as a text editor and skeleton program.

The coolest part of this code is getting the timing right. Other writers of Mac subtitling programs have used TickCount, which is way too inaccurate at 60.15Hz. I tried to use the Time Manager to get millisecond timing, but I was getting about 1021 per second, so I had to write a "software phase locked loop" to lock it to the real-time clock chip. This averages the number of ticks encountered over the last 10 seconds, and scales the current count by the average.

The buffering code is pretty cool, too. I keep 10 offscreen buffers around in which to draw the text, and I draw the outline shadows in multiple passes. The text is rendered long before it is needed, so as to minimize the time it takes to appear on the screen, for more accurate timing and less flicker.

The following files are just the parts that I wrote entirely from scratch:

ClockTime.c
ClockTime.h
Directives.c
Directives.h
Format.c
Format.h
Format1.c
Format1.h
RunScript.c
RunScript.h
ScriptText.c
ScriptText.h
SubApp.c
SubApp.h
Documentation

My eventual plan is to start from scratch and write a more Mac-like program. But first I have to find hardware which either does true genlock or has a good enough passthru/overlay mode to substitute for true genlock.

Return to main page