annotate DOCS/tech/libvo.txt @ 29508:3fd3fae1b6f0

Fix AC3 in least one Bluray sample with demuxer lavf.
author cehoyos
date Wed, 26 Aug 2009 02:37:56 +0000
parents 0f1b5b68af32
children 32725ca88fed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5586
6ce9c6231bdd updated
arpi
parents:
diff changeset
1 libvo --- the library to handle video output by A'rpi, 2002.04
6ce9c6231bdd updated
arpi
parents:
diff changeset
2 ============================================
6ce9c6231bdd updated
arpi
parents:
diff changeset
3
6ce9c6231bdd updated
arpi
parents:
diff changeset
4 Note: before start on this, read colorspaces.txt !
6ce9c6231bdd updated
arpi
parents:
diff changeset
5
6ce9c6231bdd updated
arpi
parents:
diff changeset
6 The constants for different pixelformats are defined in img_format.h,
6ce9c6231bdd updated
arpi
parents:
diff changeset
7 their usage is mandatory.
6ce9c6231bdd updated
arpi
parents:
diff changeset
8
28632
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
9 WARNING: Please keep in mind that some of this information may be out-dated,
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
10 so if you are working on a new vo, consider submitting preliminary patches
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
11 very early on. Currently vo_gl is one of the more up-to-date VOs to use
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
12 as reference if you are unsure about something and do not want to ask on the
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
13 list.
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
14 vo_vdpau and vo_direct3d may be a good choice, too, they use different
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
15 approaches closer to the sometimes convoluted way DirectX works.
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
16
5586
6ce9c6231bdd updated
arpi
parents:
diff changeset
17 Each vo driver _has_ to implement these:
6ce9c6231bdd updated
arpi
parents:
diff changeset
18
6ce9c6231bdd updated
arpi
parents:
diff changeset
19 preinit():
6ce9c6231bdd updated
arpi
parents:
diff changeset
20 init the video system (to support querying for supported formats)
6ce9c6231bdd updated
arpi
parents:
diff changeset
21
6ce9c6231bdd updated
arpi
parents:
diff changeset
22 uninit():
6ce9c6231bdd updated
arpi
parents:
diff changeset
23 Uninit the whole system, this is on the same "level" as preinit.
6ce9c6231bdd updated
arpi
parents:
diff changeset
24
6ce9c6231bdd updated
arpi
parents:
diff changeset
25 control():
28632
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
26 Current controls (VOCTRL_QUERY_FORMAT must be implemented,
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
27 VOCTRL_DRAW_IMAGE, VOCTRL_FULLSCREEN, VOCTRL_UPDATE_SCREENINFO
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
28 should be implemented):
5586
6ce9c6231bdd updated
arpi
parents:
diff changeset
29 VOCTRL_QUERY_FORMAT - queries if a given pixelformat is supported.
6ce9c6231bdd updated
arpi
parents:
diff changeset
30 It also returns various flags decsirbing the capabilities
6ce9c6231bdd updated
arpi
parents:
diff changeset
31 of the driver with teh given mode. for the flags, see
6ce9c6231bdd updated
arpi
parents:
diff changeset
32 file vfcaps.h !
6ce9c6231bdd updated
arpi
parents:
diff changeset
33 the most important flags, every driver must properly report
6ce9c6231bdd updated
arpi
parents:
diff changeset
34 these:
6ce9c6231bdd updated
arpi
parents:
diff changeset
35 0x1 - supported (with or without conversion)
6ce9c6231bdd updated
arpi
parents:
diff changeset
36 0x2 - supported without conversion (define 0x1 too!)
6ce9c6231bdd updated
arpi
parents:
diff changeset
37 0x100 - driver/hardware handles timing (blocking)
6ce9c6231bdd updated
arpi
parents:
diff changeset
38 also SET sw/hw scaling and osd support flags, and flip,
6847
c0a3d33f3245 10l - PUT_IMAGE->DRAW_IMAGE
arpi
parents: 6815
diff changeset
39 and accept_stride if you implement VOCTRL_DRAW_IMAGE (see bellow)
5586
6ce9c6231bdd updated
arpi
parents:
diff changeset
40 NOTE: VOCTRL_QUERY_FORMAT may be called _before_ first config()
6ce9c6231bdd updated
arpi
parents:
diff changeset
41 but is always called between preinit() and uninit()
6ce9c6231bdd updated
arpi
parents:
diff changeset
42 VOCTRL_GET_IMAGE
6ce9c6231bdd updated
arpi
parents:
diff changeset
43 libmpcodecs Direct Rendering interface
6ce9c6231bdd updated
arpi
parents:
diff changeset
44 You need to update mpi (mp_image.h) structure, for example,
6ce9c6231bdd updated
arpi
parents:
diff changeset
45 look at vo_x11, vo_sdl, vo_xv or mga_common.
6847
c0a3d33f3245 10l - PUT_IMAGE->DRAW_IMAGE
arpi
parents: 6815
diff changeset
46 VOCTRL_DRAW_IMAGE
5586
6ce9c6231bdd updated
arpi
parents:
diff changeset
47 replacement for the current draw_slice/draw_frame way of
6ce9c6231bdd updated
arpi
parents:
diff changeset
48 passing video frames. by implementing SET_IMAGE, you'll get
6ce9c6231bdd updated
arpi
parents:
diff changeset
49 image in mp_image struct instead of by calling draw_*.
6847
c0a3d33f3245 10l - PUT_IMAGE->DRAW_IMAGE
arpi
parents: 6815
diff changeset
50 unless you return VO_TRUE for VOCTRL_DRAW_IMAGE call, the
5586
6ce9c6231bdd updated
arpi
parents:
diff changeset
51 old-style draw_* functils will be called!
6ce9c6231bdd updated
arpi
parents:
diff changeset
52 Note: draw_slice is still mandatory, for per-slice rendering!
6ce9c6231bdd updated
arpi
parents:
diff changeset
53 VOCTRL_RESET - reset the video device
6ce9c6231bdd updated
arpi
parents:
diff changeset
54 This is sent on seeking and similar and is useful if you are
6ce9c6231bdd updated
arpi
parents:
diff changeset
55 using a device which prebuffers frames that need to flush them
6ce9c6231bdd updated
arpi
parents:
diff changeset
56 before refilling audio/video buffers.
6ce9c6231bdd updated
arpi
parents:
diff changeset
57 VOCTRL_PAUSE
6ce9c6231bdd updated
arpi
parents:
diff changeset
58 VOCTRL_RESUME
6ce9c6231bdd updated
arpi
parents:
diff changeset
59 VOCTRL_GUISUPPORT
6ce9c6231bdd updated
arpi
parents:
diff changeset
60 return true only if driver supports co-operation with
6ce9c6231bdd updated
arpi
parents:
diff changeset
61 MPlayer's GUI (not yet used by GUI)
6815
bdd6735a8d83 equalizer docs updated
alex
parents: 5586
diff changeset
62 VOCTRL_SET_EQUALIZER
bdd6735a8d83 equalizer docs updated
alex
parents: 5586
diff changeset
63 set the video equalizer to the given values
bdd6735a8d83 equalizer docs updated
alex
parents: 5586
diff changeset
64 two arguments are provided: item and value
bdd6735a8d83 equalizer docs updated
alex
parents: 5586
diff changeset
65 item is a string, the possible values are (currently):
bdd6735a8d83 equalizer docs updated
alex
parents: 5586
diff changeset
66 brightness, contrast, saturation, hue
bdd6735a8d83 equalizer docs updated
alex
parents: 5586
diff changeset
67 VOCTRL_GET_EQUALIZER
bdd6735a8d83 equalizer docs updated
alex
parents: 5586
diff changeset
68 get the current video equalizer values
bdd6735a8d83 equalizer docs updated
alex
parents: 5586
diff changeset
69 two arguments are provided: item and value
11542
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 10904
diff changeset
70 item is a string, the possible values are (currently):
6815
bdd6735a8d83 equalizer docs updated
alex
parents: 5586
diff changeset
71 brightness, contrast, saturation, hue
11542
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 10904
diff changeset
72 VOCTRL_ONTOP
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 10904
diff changeset
73 Makes the player window stay-on-top. Only supported (currently)
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 10904
diff changeset
74 by drivers which use X11, except SDL, as well as directx and
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 10904
diff changeset
75 gl2 under Windows.
16968
e9d849bf8050 add a switch, slave command, and vo control to toggle borderless window.
joey
parents: 12852
diff changeset
76 VOCTRL_BORDER
28632
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
77 Makes the player window borderless.
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
78 VOCTRL_FULLSCREEN
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
79 Switch from and to fullscreen mode
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
80 VOCTRL_GET_PANSCAN
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
81 VOCTRL_SET_PANSCAN
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
82 Needed to implement pan-scan support ('w' and 'e' keys during
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
83 playback in fullscreen mode)
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
84 VOCTRL_START_SLICE
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
85 Called before the first draw_slice of each frame, useful if
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
86 you need to do some set-up work.
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
87 VOCTRL_DRAW_EOSD
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
88 Required for EOSD (ASS subtitle) support. Provides all
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
89 information necessary to draw the EOSD for the current video
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
90 frame.
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
91 VOCTRL_GET_EOSD_RES
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
92 Required for EOSD (ASS subtitle) support. Informs the ASS
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
93 renderer about the properties of the drawing area (size,
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
94 borders).
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
95 VOCTRL_SET_DEINTERLACE
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
96 VOCTRL_GET_DEINTERLACE
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
97 Get or set deinterlacing status for VOs that support some kind
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
98 of deinterlacing.
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
99 VOCTRL_UPDATE_SCREENINFO
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
100 Should set the xinerama_x, xinerama_y, vo_screenwidth and
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
101 vo_screenheight appropriately for the currently used
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
102 monitor and -xineramascreen option.
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
103 Usually should simply call the w32_update_xinerama_info or
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
104 update_xinerama_info function.
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
105 By supporting this, the VO also requests the newer API
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
106 that sets vo_dx, vo_dy etc. appropriately before config()
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
107 is called.
5586
6ce9c6231bdd updated
arpi
parents:
diff changeset
108
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28632
diff changeset
109 config():
5586
6ce9c6231bdd updated
arpi
parents:
diff changeset
110 Set up the video system. You get the dimensions and flags.
6ce9c6231bdd updated
arpi
parents:
diff changeset
111 width, height: size of the source image
6ce9c6231bdd updated
arpi
parents:
diff changeset
112 d_width, d_height: wanted scaled/display size (it's a hint)
6ce9c6231bdd updated
arpi
parents:
diff changeset
113 Flags:
6ce9c6231bdd updated
arpi
parents:
diff changeset
114 0x01 - force fullscreen (-fs)
6ce9c6231bdd updated
arpi
parents:
diff changeset
115 0x02 - allow mode switching (-vm)
6ce9c6231bdd updated
arpi
parents:
diff changeset
116 0x04 - allow software scaling (-zoom)
6ce9c6231bdd updated
arpi
parents:
diff changeset
117 0x08 - flipping (-flip)
6ce9c6231bdd updated
arpi
parents:
diff changeset
118 They're defined as VOFLAG_* (see libvo/video_out.h)
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28632
diff changeset
119
22897
82a108d63c2a typo fix (s/M/N/) in IMPORTA_M_T
gpoirier
parents: 22289
diff changeset
120 IMPORTANT NOTE: config() may be called 0 (zero), 1 or more (2,3...)
5586
6ce9c6231bdd updated
arpi
parents:
diff changeset
121 times between preinit() and uninit() calls. You MUST handle it, and
6ce9c6231bdd updated
arpi
parents:
diff changeset
122 you shouldn't crash at second config() call or at uninit() without
6ce9c6231bdd updated
arpi
parents:
diff changeset
123 any config() call! To make your life easier, vo_config_count is
6ce9c6231bdd updated
arpi
parents:
diff changeset
124 set to the number of previous config() call, counted from preinit().
6ce9c6231bdd updated
arpi
parents:
diff changeset
125 It's set by the caller (vf_vo.c), you don't have to increase it!
6ce9c6231bdd updated
arpi
parents:
diff changeset
126 So, you can check for vo_config_count>0 in uninit() when freeing
6ce9c6231bdd updated
arpi
parents:
diff changeset
127 resources allocated in config() to avoid crash!
6ce9c6231bdd updated
arpi
parents:
diff changeset
128
28632
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
129 You should implement VOCTRL_UPDATE_SCREENINFO so that vo_dx, vo_dy,
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
130 vo_dwidth and vo_dheight are already pre-set to values that take
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
131 aspect and -geometry into account. It is also necessary to properly
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
132 support multi-monitor setups (if based on x11_common, w32_common).
10904
407840681da1 add some docu about when and how to call geometry
attila
parents: 6847
diff changeset
133
5586
6ce9c6231bdd updated
arpi
parents:
diff changeset
134 draw_slice(): this displays YV12 pictures (3 planes, one full sized that
6ce9c6231bdd updated
arpi
parents:
diff changeset
135 contains brightness (Y), and 2 quarter-sized which the colour-info
6ce9c6231bdd updated
arpi
parents:
diff changeset
136 (U,V). MPEG codecs (libmpeg2, opendivx) use this. This doesn't have
6ce9c6231bdd updated
arpi
parents:
diff changeset
137 to display the whole frame, only update small parts of it.
28632
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
138 If this is not supported, it must be signaled in QUERY_FORMAT with
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
139 VOCAP_NOSLICES.
5586
6ce9c6231bdd updated
arpi
parents:
diff changeset
140
6ce9c6231bdd updated
arpi
parents:
diff changeset
141 draw_frame(): this is the older interface, this displays only complete
6ce9c6231bdd updated
arpi
parents:
diff changeset
142 frames, and can do only packed format (YUY2, RGB/BGR).
6ce9c6231bdd updated
arpi
parents:
diff changeset
143 Win32 codecs use this (DivX, Indeo, etc).
28632
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
144 If you implement VOCTRL_DRAW_IMAGE, you do not need to implement draw_frame.
5586
6ce9c6231bdd updated
arpi
parents:
diff changeset
145
6ce9c6231bdd updated
arpi
parents:
diff changeset
146 draw_osd(): this displays subtitles and OSD.
6ce9c6231bdd updated
arpi
parents:
diff changeset
147 It's a bit tricky to use it, since it's a callback-style stuff.
6ce9c6231bdd updated
arpi
parents:
diff changeset
148 It should call vo_draw_text() with screen dimension and your
6ce9c6231bdd updated
arpi
parents:
diff changeset
149 draw_alpha implementation for the pixelformat (function pointer).
6ce9c6231bdd updated
arpi
parents:
diff changeset
150 The vo_draw_text() checks the characters to draw, and calls
6ce9c6231bdd updated
arpi
parents:
diff changeset
151 draw_alpha() for each. As a help, osd.c contains draw_alpha for
6ce9c6231bdd updated
arpi
parents:
diff changeset
152 each pixelformats, use this if possible!
28632
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
153 Note that if you do not draw directly onto the video you should
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
154 use vo_draw_text_ext() which allows you to specify the border
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
155 values etc. needed to draw DVD menu highlights at the correct place.
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
156 If you do not want to implement this, you can still use -vf
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
157 expand=osd=1 to draw the OSD, or even implement code to insert
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
158 this filter automatically.
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
159 Make sure you set VFCAP_OSD depending on whether you implemented it
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
160 or not.
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 28632
diff changeset
161
22289
780caed72ac7 cosmetics: typo fixes, usefuLL --> useful and aswell --> as well
diego
parents: 16968
diff changeset
162 NOTE: This one will be obsolete soon! But it's still useful when
5586
6ce9c6231bdd updated
arpi
parents:
diff changeset
163 you want to do tricks, like rendering osd _after_ hardware scaling
6ce9c6231bdd updated
arpi
parents:
diff changeset
164 (tdfxfb) or render subtitles under of the image (vo_mpegpes, sdl)
6ce9c6231bdd updated
arpi
parents:
diff changeset
165
28632
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
166 NOTE2: above NOTE is probably wrong, there are currently no plans to
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
167 obsolete draw_osd, though there is the more advanced EOSD support for
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
168 ASS subtitles.
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
169
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
170 flip_page(): this is called after each frame, this displays the buffer for
12852
diego
parents: 11542
diff changeset
171 real. This is 'swapbuffers' when doublebuffering.
28632
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
172 Try to do as little work here as possible, since that affect jitter/
6e90a47a6aaf Try to update libvo.txt
reimar
parents: 22897
diff changeset
173 A-V sync.
5586
6ce9c6231bdd updated
arpi
parents:
diff changeset
174