MythTV  master
A/V Player Subsystem
Collaboration diagram for A/V Player Subsystem:

TV is the main class for handling playback. It instantiates several important classes:

Decodes audio and video from the RingBuffer, then plays and displays them, resp.
Communicates with TVRec on the backend.
Creates on-screen-display for NuppelVideoPlayer to display.
Handles A/V file I/O, including streaming.

NuppelVideoPlayer is a bit of a misnomer. This class plays all video formats that MythTV can handle. It creates AudioOutput to handle the audio, a FilterChain to perform post-processing on the video, a DecoderBase class to do the actual video decoding, and a VideoOutput class to do the actual video output. See that class for more on what it does.

TV has three active states that correspond to the same states in TVRec: kState_WatchingLiveTV, kState_WatchingPreRecorded, kState_WatchingRecording. When watching "LiveTV" the TVRec via RemoteEncoder responds to channel changing and other commands from TV while streaming the recording to TV's RingBuffer. When watching a pre-recorded stream, a recording is streamed from TVRec's RingBuffer to TV's RingBuffer, but no channel changing commands can be sent to TVRec. When watching an 'in-progress' recording things work pretty much as when watching a pre-recorded stream, except TV must be prevented from seeking too far ahead in the program, and keyframe and commercial flags must be synced from the recorder periodically.

TV also has three additional states: kState_Error, kState_None, kState_ChangingState. The error state allows MythTV to know when something has gone wrong. The null or none state means the player is not doing anything and is ready for commands. Finally, the "ChangingState" state tells us that a state change request is pending, so other state changing commands should not be issued.