DOCS/tech-overview.txt: updates

Oh, this file still exists.
This commit is contained in:
wm4 2017-06-29 17:28:04 +02:00
parent 1b0dec04f4
commit 016c9a1d8f
1 changed files with 26 additions and 50 deletions

View File

@ -46,9 +46,7 @@ player/*.c:
- most state is in MPContext (core.h), which is not available to the - most state is in MPContext (core.h), which is not available to the
subsystems subsystems
- the currently played tracks are in mpctx->current_tracks, and decoder - the currently played tracks are in mpctx->current_tracks, and decoder
state in d_video/d_audio/d_sub state in track.d_video/d_audio/d_sub
- the timeline stuff is used only with MKV ordered chapters (and some other
minor features: cue, edl)
- the other subsystems rarely call back into the frontend, and the frontend - the other subsystems rarely call back into the frontend, and the frontend
polls them instead (probably a good thing) polls them instead (probably a good thing)
- one exceptions are wakeup callbacks, which notify a "higher" component - one exceptions are wakeup callbacks, which notify a "higher" component
@ -56,23 +54,15 @@ player/*.c:
I like to call the player/*.c files the "frontend". I like to call the player/*.c files the "frontend".
talloc.h & talloc.c: ta.h & ta.c:
Hierarchical memory manager copied from Samba. It's like a malloc() with Hierarchical memory manager inspired by talloc from Samba. It's like a
more features. Most importantly, each talloc allocation can have a parent, malloc() with more features. Most importantly, each talloc allocation can
and if the parent is free'd, all children will be free'd as well. The have a parent, and if the parent is free'd, all children will be free'd as
parent is an arbitrary talloc allocation. It's either set by the allocation well. The parent is an arbitrary talloc allocation. It's either set by the
call by passing a talloc parent, usually as first argument to the allocation allocation call by passing a talloc parent, usually as first argument to the
function. It can also be set or reset later by other calls (at least allocation function. It can also be set or reset later by other calls (at
talloc_steal()). A talloc allocation that is used as parent is often called least talloc_steal()). A talloc allocation that is used as parent is often
a talloc context. called a talloc context.
Lots of code still uses malloc() proper, and you should be careful what
type of allocation you're dealing with when returning or free'ing an
allocation. (Needless to say, talloc_free() and free() are completely
different things.)
The copy in mpv has been modified to abort on OOM conditions. An
allocation call will never return NULL.
One very useful feature of talloc is fast tracking of memory leaks. ("Fast" One very useful feature of talloc is fast tracking of memory leaks. ("Fast"
as in it doesn't require valgrind.) You can enable it by setting the as in it doesn't require valgrind.) You can enable it by setting the
@ -83,16 +73,14 @@ talloc.h & talloc.c:
Documentation can be found here: Documentation can be found here:
http://git.samba.org/?p=samba.git;a=blob;f=lib/talloc/talloc.h;hb=HEAD http://git.samba.org/?p=samba.git;a=blob;f=lib/talloc/talloc.h;hb=HEAD
For some reason, we're still using API-compatible wrappers instead of TA
directly. The talloc wrapper has only a subset of the functionality, and
in particular the wrappers abort() on memory allocation failure.
Note: unlike tcmalloc, jemalloc, etc., talloc() is not actually a malloc Note: unlike tcmalloc, jemalloc, etc., talloc() is not actually a malloc
replacement. It works on top of system malloc and provides additional replacement. It works on top of system malloc and provides additional
features that are supposed to make memory management easier. features that are supposed to make memory management easier.
Warning: actually, we're not using talloc anymore. talloc in mpv has been
replaced by a custom re-implementation (TA in ta/). It provides
some talloc emulation (just the parts needed by mpv). We will get
rid of the talloc emulation later and use TA natively.
(See ta/README for details.)
player/command.c: player/command.c:
This contains the implementation for client API commands and properties. This contains the implementation for client API commands and properties.
Properties are essentially dynamic variables changed by certain commands. Properties are essentially dynamic variables changed by certain commands.
@ -120,7 +108,7 @@ options/options.h, options/options.c
their own sub-option tables separate from MPOpts. their own sub-option tables separate from MPOpts.
The actual option parser is spread over m_option.c, m_config.c, and The actual option parser is spread over m_option.c, m_config.c, and
parser-mpcmd.c, and uses the option table in options.c. parse_commandline.c, and uses the option table in options.c.
input/input.c: input/input.c:
This translates keyboard input coming from VOs and other sources (such This translates keyboard input coming from VOs and other sources (such
@ -161,8 +149,7 @@ demux/:
Most demuxers have been removed from this fork, and the only important and Most demuxers have been removed from this fork, and the only important and
"actual" demuxers left are demux_mkv.c and demux_lavf.c (uses libavformat). "actual" demuxers left are demux_mkv.c and demux_lavf.c (uses libavformat).
There are some pseudo demuxers like demux_cue.c, which exist only to invoke There are some pseudo demuxers like demux_cue.c.
other frontend code (tl_cue.c in this case).
The main interface is in demux.h. The stream headers are in stheader.h. The main interface is in demux.h. The stream headers are in stheader.h.
There is a stream header for each audio/video/sub stream, and each of them There is a stream header for each audio/video/sub stream, and each of them
@ -176,8 +163,8 @@ video/:
internally. internally.
video/decode/: video/decode/:
vd_*.c are video decoders. (There's only vd_lavc.c left.) dec_video.c/vd.c vd_*.c are video decoders. (There's only vd_lavc.c left.) dec_video.c
handle most of connecting the frontend with the actual decoder. handles most of connecting the frontend with the actual decoder.
video/filter/: video/filter/:
vf_*.c and vf.c form the video filter chain. They are fed by the video vf_*.c and vf.c form the video filter chain. They are fed by the video
@ -193,24 +180,23 @@ video/out/:
vo_opengl can pick a windowing system at runtime, e.g. the same binary can vo_opengl can pick a windowing system at runtime, e.g. the same binary can
provide both X11 and Cocoa support on OSX. provide both X11 and Cocoa support on OSX.
VOs can be reconfigured at runtime. A vo_config() call can change the video VOs can be reconfigured at runtime. A vo_reconfig() call can change the video
resolution and format, without destroying the window. resolution and format, without destroying the window.
vo_vdpau and vo_opengl should be taken as reference. vo_opengl should be taken as reference.
audio/: audio/:
format.h/format.c define the uncompressed audio formats. (As well as some format.h/format.c define the uncompressed audio formats. (As well as some
compressed formats used for spdif.) compressed formats used for spdif.)
audio/decode/: audio/decode/:
ad_*.c and dec_audio.c/ad.c handle audio decoding. ad_lavc.c is the ad_*.c and dec_audio.c handle audio decoding. ad_lavc.c is the
decoder using ffmpeg. ad_spdif.c is not really a decoder, but is used for decoder using ffmpeg. ad_spdif.c is not really a decoder, but is used for
compressed audio passthrough. compressed audio passthrough.
audio/filter/: audio/filter/:
Audio filter chain. af_lavrresample is inserted if any form of conversion Audio filter chain. af_lavrresample is inserted if any form of conversion
between audio formats is needed. (af_convert24.c and af_convertsignendian.c between audio formats is needed.
are also used for some formats not directly supported by FFmpeg.)
audio/out/: audio/out/:
Audio outputs. Audio outputs.
@ -244,22 +230,12 @@ sub/:
The subtitles are passed to dec_sub.c and the subtitle decoders in sd_*.c The subtitles are passed to dec_sub.c and the subtitle decoders in sd_*.c
as they are demuxed. All text subtitles are rendered by sd_ass.c. If text as they are demuxed. All text subtitles are rendered by sd_ass.c. If text
subtitles are not in the ASS format, subtitle converters are inserted, for subtitles are not in the ASS format, the libavcodec subtitle converters are
example sd_srt.c, which is used to convert SRT->ASS. sd_srt.c is also used used (lavc_conv.c).
as general converter for text->ASS (to prevent interpretation of text as
ASS tags).
Text subtitles can be preloaded, in which case they are read fully as soon Text subtitles can be preloaded, in which case they are read fully as soon
as the subtitle is selected, and then effectively stored in an ASS_Track. as the subtitle is selected. In this case, they are effectively stored in
It's used for external text subtitles, and required to make codepage sd_ass.c's internal state.
detection as well as timing postprocessing work. (Timing postprocessing
removes tiny gaps or overlaps between subtitle events.)
player/timeline/:
A timeline is the abstraction used by loadfile.c to combine several files
into one seemingly linear video. It's mainly used for ordered chapters
playback. The high level code to find and load other files containing the
segments for playing an ordered chapters file is in tl_matroska.c.
etc/: etc/:
The file input.conf is actually integrated into the mpv binary by the The file input.conf is actually integrated into the mpv binary by the