MythTV Architecture
0.21
Over the last couple years MythTV has grown into a rather large application. The purpose of these pages is to provide a portal into the code for developers to get their heads around it. This is intended for both those new to MythTV and experienced with it to get familiar with different aspects of the code base.
If you are just looking for the code formatting standards, see the official MythTV wiki article coding standards. If you are looking for the bug tracker, it can be found on the official pages. If you haven't already, you should subscribe to the developer mailing list and the SVN commits mailing list
If you just stumbled onto the developer pages by accident, maybe you want to go to the official MythTV Installation page. There is also a good unofficial Fedora MythTV installation page, and a Gentoo MythTV installation page.
If you are new to Qt programming it is essential that you keep in mind that almost all Qt objects are not thread-safe, including QString. Almost all Qt container objects, including QString, make shallow copies on assignment, the two copies of the object must only be used in one thread unless you use a lock on the object. You can use the QDeepCopy template on most Qt containers to make a copy you can use in another thread.
There are also special dangers when using QObject outside the Qt event thread.
The is also short HOWTO on Profiling MythTV available in addition to documentation on the code itself.
MythTV is divided up into eleven libraries:
- libmyth
- Core MythTV library. Used by the Plugins. The database, audio, LCD, OSD, LIRC, and the myth network protocol are supported by libmyth.
- libmythtv
- MythTV TV functionality library. The recorders, video and A/V players are supported by libmythtv.
- libmythui
- Main user interface rendering library
- libavcodec/libavformat/libavutil
- This is the ffmpeg A/V decoding library (aka avlib). Documented Externally.
- libmythmpeg2
- Alternate MPEG-1/2 A/V decoding library. External Website.
- libmythsamplerate
- Audio resampling library Documented Externally. We use this to support a different output sample rates than the sample rate used in the audio streams we play.
- libmythsoundtouch
- Pitch preserving audio resampling library. External Website. We use this for the time-stretch feature.
- libmythdvdnav
- Used for navigating DVD menus when using the internal player
- libmythfreemheg
- UK interactive TV viewer
- libmythlivemedia
- Support for the FreeBox recorder device
- libmythupnp
- Initial uPnP (universal Plug and Play) support
Two libraries libmythmpeg2 and libmythsamplerate appear redundant, but libmpeg2 decodes MPEG-2 more quickly than ffmpeg on some systems, and libmythsamplerate resamples audio with better quality when we only need to match the hardware sample rate to the A/V streams audio sample rate.
The database schema is documented here
MythTV Database Schema.
MythTV contains 14 applications:
- mythbackend
- This is the backend which runs the recorders.
- mythfrontend
- This is the frontend which is the main application for viewing programs and using the MythTV plugins.
- mythtv-setup
- This is the program which sets up the database to use a machine as a backend server.
- mythtv
- This was an "External Player" used to play videos from within mythfrontend. Setting the player command to "internal" does the same thing now. This is handy for testing the audio and videoout code, though.
- mythtvosd
- This is used externally by programs that want to pop-up an on screen display in MythTV while one is watching a recording.
- mythfilldatabase
- This is used both internally and externally to fetch program listings. Tribune Media provides listings in exchange for demographic information in the USA, and Australia uses a community-driven TV guide originally developed for OzTiVo. Other markets are served by the XMLTV web spiders.
- mythtranscode
- This is used both internally and externally to transcode videos from one format to another. This is used to shrink HDTV programs to lower quality recordings that match the hardware the user has.
- mythjobqueue
- This is used internally by mythfrontend to schedule jobs such as commercial flagging and transcoding.
- mythcommflag
- This is used internally by mythfrontend to flag commercials.
- mythepg
- This is used internally by mythfrontend to find upcoming programs to record based on the channel and time.
- mythprogfind
- This is used internally by mythfrontend to find programs to record based on the first letter of the program name.
- mythuitest
- This is a test program for libmythui development.
- mythlcdserver
- This is an interface between a number of Myth clients and a small text display (LCDProc server).
- mythwelcome/mythshutdown
- These programs manage Power Saving (shutdown/wakeup) on your Myth PCs.
- mytharchive
- Creates themed Video DVDs from recordings (and other video files).
- mythbrowser
- Provides a simple web browser.
- mythcontrols
- Editor for Myth Key bindings, et c.
- mythflix
- mythgallery
- A simple picture viewer for your TV.
- mythgame
- Launches the xmame classic game system emulator.
- mythmovies
- mythmusic
- A simple music player for your TV.
- mythnews
- Browses RSS news feeds.
- mythphone
- SIP based video phone.
- mythvideo
- Launch DVD players, and a Video Browser for other files (non-MythTV recordings).
- mythweather
- Presents your local weather report.
- mythzoneminder
- mythweb
- Provides a PHP based web pages to control mythbackend.
These tools are in the contrib directory of the source tree:
- osx-packager.pl
- Downloads and builds all dependencies, then the source, of MythTV and all the official plugins, on Mac OS 10.3 thru 10.5
- win32-packager.pl
- Similar tool for Windows XP and Vista