Annotation of libsoftmpeg/README, revision 1.3

1.1       hunold      1: libsoftmpeg
                      2: ===========
                      3: 
                      4: 1) The idea
                      5: -----------
                      6: 
1.2       hunold      7: Many people have recently decided to work on software only mpeg
                      8: decoderes. The goal is to have a cheap DVB x86 box with vdr or MythTV
                      9: on it, but only using a so-called budget DVB card without onboard mpeg
                     10: decoder.
1.1       hunold     11: 
                     12: 2) The problems
                     13: ---------------
                     14: 
1.2       hunold     15: The "linuxtv-softmpeg" project tries to provide the "libsoftmpeg"
                     16: library, a thin library on top of existing technologies that adresses
                     17: the following problems:
1.1       hunold     18: 
                     19: - low-delay buffering (for fast channel switches)
                     20: - mpeg audio decoding
                     21: - audio and video syncronization 
                     22: - audio rendering
                     23: - video rendering
                     24: - long term playback stability
                     25: 
                     26: 3) Existing "solutions"
                     27: -----------------------
                     28: 
1.2       hunold     29: In the past, there have been different approaches to solve these
                     30: problems, but they are not quite satisfying yet.
1.1       hunold     31: 
1.2       hunold     32: For example, while "mplayer" and "xine" are excellent movie players,
                     33: they use huge buffers for buffering and therefore make channel
                     34: switching nearly unbearable. Additionally, they lack long-term
                     35: stability, because they don't synchronize to the incoming stream and
                     36: buffer over- and underrums quite frequently occur. (see below for
                     37: details)
                     38: 
                     39: The "softdevice" plugin from VDR is on the right way, but unfortunately
                     40: it is bound to VDR. Other projects like "mythtv" and the like need to
                     41: duplicate the code or invent the wheel again,
1.1       hunold     42: 
                     43: 4) libsoftmpeg
                     44: --------------
                     45: 
1.2       hunold     46: In order to use this project, you need: 
                     47: 
                     48: - DirectFB and a supported gfx
                     49: adapter (cle266 or Matrox G200/4x0/5x0 is fine, vesafb is only enough
                     50: if you have a horibbly fast machine ;-)
                     51: 
                     52: - FusionSound, which needs OSS or ALSA (with oss emulation) sound
                     53: drivers
                     54: 
1.1       hunold     55: - libavcodec, version 0.4.8 from http://ffmpeg.sf.net is fine
                     56: 
                     57: "libsoftmpeg" already does the following:
                     58: 
1.2       hunold     59: - low-delay buffering for audio and video, adjustable audio
                     60: prebuffering (currently 500ms, channel switching is usually done in
                     61: less than a second)
1.1       hunold     62: 
                     63: - mpeg audio decoding via libavcodec from "ffmpeg" project
                     64: 
                     65: - mpeg video decoding via libavcodec from "ffmpeg" project
                     66: 
1.2       hunold     67: - audio and video synchronization using a "sync-to-audio-pts" approach
                     68: and "free flowing video display" (see below for a detailed description
                     69: of my ideas)
                     70: 
                     71: - video rendering using DirectFB (http://www.directfb.org), a thin
                     72: library ontop of the Linux framebuffer device. DirectFB hosts a
                     73: "cle266" driver which drives the tv out of the EPIA/cle266 boards very
                     74: well
                     75: 
                     76: - audio rendering using FusionSound
                     77: (http://www.directfb.org/fusionsound.xml), a thin library on top of
                     78: DirectFB and Fusion (fast interprocess communication), which supports
                     79: sound mixing, pitch adjustment and other neat features. Sound mixing is
                     80: very important, other applications can overlay system sounds onto the
                     81: live tv audio.
1.1       hunold     82: 
                     83: 4) How to get it to work
                     84: ------------------------
                     85: 
1.2       hunold     86: All this is working fairly well, a demonstration application is
                     87: included with the library that reads from the DVR device (so you need
                     88: "szap" for example to tune to a service and have the data put to the
                     89: DVR device) and displays audio and video. It should be easily possible
                     90: to use "libsoftmpeg" in "vdr", too.
                     91: 
                     92: Please apply the "fusionsound_realtimepriority_reset_on_flush.diff"
                     93: patch to FusionSound first via "patch -p0 < [...]) in the FusionSound
                     94: directory and compile again. This adds realtime priority to the audio
                     95: feeding thread. If you omit this, the audio thread might starve and
                     96: sound will be jerky.
                     97: 
1.3     ! hunold     98: Before you proceed, make sure that your framebuffer device is set
        !            99: to 720x576 at 50Hz refresh rate. A suitable fb modes entry looks like
        !           100: this:
        !           101: mode "720x576-50"
        !           102:     geometry 720 576 720 576 16
        !           103:     timings 31208 144 40 32 10 128 3
        !           104: endmode
        !           105: 
        !           106: Make sure to use "fbset -a 720x576-50" after each startup -- the sync code
        !           107: currently relies on this.
        !           108: 
        !           109: Ok, if you do a "./autogen.sh ; make install" you'll get a demo application
1.2       hunold    110: called "dfb_ts", which reads a transport stream from the DVB dvr
                    111: device. You need to tune your frontend with "szap" for example and
                    112: redirect the data to the dvr device with the "-r" switch. For example:
1.1       hunold    113: 
                    114: > szap -r "Das Erste"
1.2       hunold    115: 
                    116: Then you can start the demo application and provide the video and audio
                    117: pids for the service you like to watch (have a look at "szap", it tells
                    118: you the correct pids):
                    119: 
1.1       hunold    120: > ./dfb_ts /dev/dvb/adapter0/dvr0 0x7ff 0x800
                    121: 
                    122: 4) The future
                    123: ------------------------
                    124: 
1.2       hunold    125: What's currently completely missing is long-term playback stability. As
                    126: you probably know, the problem arises due to the different clocks used
                    127: for dvb encoding and decoding. See below for a detailed description of
                    128: the problem and my ideas on how it can be solved on x86.
                    129: 
                    130: The next major step would be to add the ideas of long-term playback
                    131: stability and the cle266 mpeg decoder stuff to the library, so that
                    132: EPIA users can use the hardware acceleration.
                    133: 
                    134: "IDEAS" contains a description of the concepts currently implemented
                    135: for audio/video synchronization and the ideas for long-term playback
                    136: stability.
1.1       hunold    137: 
                    138: 5) If you want to participate
                    139: -----------------------------
                    140: 
1.2       hunold    141: There is a mailing list for this project. Write a mail to
                    142: <ecartis@linuxtv.org> with "subscribe linuxtv-softmpeg" in the subject
                    143: to subscribe.

LinuxTV legacy CVS <linuxtv.org/cvs>