[mythtv] Constant ringbuffer

Daniel Thor Kristjansson danielk at mrl.nyu.edu
Fri Oct 22 14:14:05 UTC 2004

On Fri, 22 Oct 2004, Jake Smith wrote:
]1) 24/7 recording (have mentioned on another thread). i.e. does not stop
]ring buffer when jumping out of LiveTV
]2) The ability to record the whole of (as much as in ringbuffer) the
]'current' program from an arbitary point. e.g. program has started - halfway
]3) An extension of 2) ; i) record any program that is in buffer, e.g. rewind
]to program that has recently '_finished_' and record it. (NB - not something
]Tivo can do)

Features 2 & 3 should not be too difficult. There are two ways to 
implement it. One would be to simply lock the LiveTV buffer until the 
program is over, and then copy the program out of the LiveTV buffer to a 
new file and insert the right DB entries. The other would be to open the 
new file, seek ahead to where we are currently in the programs stream 
and restart recording there, and then copy the missing bits out of the 
LiveTV buffer in the background. The first method is simpler, but 
the LiveTV buffer must be big enough to contain the whole program. The 
second method may also miss part of the program, and requires switching 
playing buffers, and potentially modifying seek so you can't seek back 
to bits of the program that haven't been copied over yet.

Feature 1 requires some changes in how LiveTV is handled. You would 
need to close the player but not the recorder, and you would need to be 
able to restart the player on the LiveTV buffer. Also the UI would need 
to be able to inform the user when MythTV wants to record another 
program using the LiveTV's tuner. I'm guessing you would want to have a 
timeout, so that if you've left LiveTV for say 10 minutes MythTV 
would just take the tuner, without informing the user (otherwise every 
recording on that tuner would need to get user approval.)

If you go ahead and implement any of these features please keep in mind 
feature 4: allow the user to keep watching the program after Myth has 
taken the tuner for another program, but before the program you are 
watching is over.

]I'd also appreciate any feedback comments as to feasibility, as I too have
]been thinking of delving into the ring buffer code etc. with this in mind.
]I realize there are all sort of complications especially with 2)+3) in
]'extracting' (simply copying would be bad solution) the program from the
]video buffer.

Copying is the only feasable solution. But it's not so bad because you 
can just mark the recording as having been done with the LiveTV profile, 
and you can transcode later if you want to. I would implement this by
copying out the relevant bits out of the LiveTV buffer after the 
recording. It's much simpler, and doesn't require coding acrobatics to 
avoid missing chunks in the middle of the program. It also avoids 
switching buffers for LiveTV playing in mid-stream. The downside is that 
it also locks the LiveTV buffer for the length of the program, so you 
might want to be able to create another LiveTV buffer for other tuners. 
Then you could leave the recording, and go back to LiveTV to watch 
another program.

Keep in mind that most Myth developers never watch LiveTV so you need to 
do this yourself, but we will gladly test it.

-- Daniel

More information about the mythtv-dev mailing list