annotate DOCS/tech/libvo2.txt @ 3721:66da035c4ee2

some quick updates for the prerelease
author gabucino
date Mon, 24 Dec 2001 23:00:07 +0000
parents c9aca79b7527
children 696341879c3c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
1 This is a brief description on libvo2 interface. It is not C code, just
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
2 draft scheme. Feel free to suggest exact parameters.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
3 I have tried to put some numbering. So if you want to reply then put the
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
4 topic number in the subject line. Please don't reply to the whole draft,
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
5 or at least don't include big paragraphs from it.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
6 I'm gonna put this text as attachment to force you to copy only the parts
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
7 you want to reply;)
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
8
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
9 Best Regards
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
10 Ivan Kalvachev
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
11
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
12 P.S. This text was included in the DOC/tech/, if you have any suggestion you
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
13 could send them to mplayer developer or advanced users mail lists. If you are
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
14 developer and have CVS access do not delete parts of this document, but you
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
15 could feel free to add paragraphs that you will sign with your name.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
16 Be warned that the text could be changed, removed, modified, and your name
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
17 could be moved at the top of the document.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
18
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
19 1.libvo2 drivers
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
20 1.1 functions
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
21 Currently these functions are implemented:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
22 init
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
23 control
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
24 start
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
25 stop
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
26 get_surface
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
27 flip_image -> we may need to change it's name to show_surface
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
28
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
29 They are simple enough. So I introduce to be implemented and these functions:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
30 query
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
31 update_surface - renamed draw
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
32 hw_decode
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
33 subpicture
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
34
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
35 Here is detailed description of new functions:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
36
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
37 query - the negotiation is more complex than just finding which imgfmt the
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
38 device could show, we must have list of capabilities, testing modes, etc.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
39 This function will have at least 3 modes:
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
40 a) return list of available modes with description.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
41 b) check could we use this mode with these parameter. E.g. if we want
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
42 RGB32 with 3 surfaces for windows image 800x600 we may get out of video
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
43 memory. We don't want error because this mode could be used with 2
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
44 surfaces.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
45 c) return supported subpicture formats if any.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
46
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
47 As you may see I have removed some functionality from control() and made
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
48 separate function. Why? It is generally good thing functions that are
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
49 critical to the driver to have it's own implementation.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
50
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
51 update_surface - as in the note above, this is draw function. Why I change
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
52 it's name? I have 2 reasons, first I don't want implementation like vo1,
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
53 second it really must update video surface, it must directly call the
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
54 system function that will do it. This function should work only with
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
55 slices, the size of slice should not be limited and should be passed
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
56 (e.g ystart, yend), if we want draw function, we will call one form libvo2
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
57 core, that will call this one with start=0; ymax=Ymax;. Also some system
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
58 screen update functions wait for vertical retrace before return, other
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
59 functions just can't handle partial updates. In this case we should inform
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
60 libvo2 core that device cannot slice, and libvo2 core must take care of
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
61 the additional buffering.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
62
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
63 show_surface - this function is used to show the given surface on the screen.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
64 If there is only one surface then it is always visible and this function
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
65 does nothing.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
66 hw_decode - to make all dvb,dxr3, TV etc. developers happy. This function
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
67 is for you. Be careful, don't OBSEBE it, think and for the future, this
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
68 function should have and ability to control HW IDCT, MC that one day will
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
69 be supported and under linux. Be careful:)
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
70
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
71 subpicture - this function will place subtitles. It must be called once to
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
72 place them and once to remove them, it should not be called on every
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
73 frame, the driver will take care of this. Currently I propose this
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
74 implementation: we get array of bitmaps. Each one have its own starting
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
75 x, y and it's own height and width, each one (or all together) could be
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
76 in specific imgfmt (spfmt). THE BITMAPS SHOULD NOT OVERLAP! This may not
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
77 be hw limitation but sw subtitles may get confused if they work as 'c'
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
78 filter (look my libvo2 core).
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
79 I think that it is good to merge small bitmaps (like characters) in larger
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
80 ones and make all subtitles as one bitmap. The OSD will have another one.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
81 One more bitmap for and for seek/brightness/contrast/volume bar.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
82
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
83 1.2 control()
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
84 OK, here is list of some control()s that I think that could be useful:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
85 SET_ASPECT
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
86 SET_SCALLE_X, SET_SIZE_X
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
87 SET_SCALLE_Y, SET_SIZE_Y
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
88 RESET_SIZE
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
89 GET/SET_POSITION_X
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
90 GET/SET_POSTIION_Y
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
91 GET/SET_RESOLUTION
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
92 GET/SET_DISPLAY
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
93 GET/SET_ATTRIBUTES
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
94
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
95 Here is description of how these controls to be used:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
96
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
97 SET_ASPECT - this is the move/video aspect, why not calculate it in
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
98 different place (mplayer.c) and pass the results to driver by
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
99 set_size_x/y. First this is only if hardware could scale. Second we may
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
100 need this value if we have TV and we won't calculate any new height and
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
101 width.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
102
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
103 SET_SCALLE_X/Y - this is to enlarge/downscale the image, it WILL NOT
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
104 override SET_ASPECT, they will have cumulative effect, this could be used
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
105 for deinterlacing (HALF SIZE). Second if we want to zoom 200% we don't
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
106 want to lose aspect calculations. Or better SET_SCALLE to work with
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
107 current size?
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
108
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
109 SET_SIZE_X/Y - This is for custom enlarge, to save some scale calculation
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
110 and for more precise results.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
111
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
112 RESET_SIZE - Set the original size of image, we must call SET_ASPECT again.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
113
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
114 GET/SET_POSOTION_X/Y - This if for windows only, to allow custom move on
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
115 window.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
116
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
117 GET/SET_RESOLUTION - change resolution and/or bpp if possible. To be used
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
118 for changing desktop resolution or the resolution of the current
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
119 fullscreen mode (NOT TO SET IT just to change it if we don't like it)
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
120
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
121 GET/SET_DISPLAY - mainly for X11 and remote displays. Not very useful, but
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
122 may be handy.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
123
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
124 GET/SET_ATTRIBUTES - Xv overlays have contrast, brightness, hue,
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
125 saturation etc. these and others could be controlled by this. If we want
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
126 to query it we must call GET_*, and the to check does our attribute is in
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
127 there (xv developers be careful, 2 or 3 of default attributes sometimes
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
128 are not queried by X, but could be set).
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
129
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
130 Do you think that TV encoding (NTSC,PAL,SECAM) should have it's own attribute?
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
131 I would like to hear the GUI developers. Could we separate Mouse/Keyboard
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
132 from the driver. What info do you need to do it. Don't forget that SDL have
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
133 it's own keyboard/mouse interface. Maybe we should allow video driver to
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
134 change the libin driver ?
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
135
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
136 <SOP>
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
137 Arpi wrote:
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
138 I've asked Pontscho (he doesn't understand english well...).
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
139 There is 2 option of GUI<->mplayer interface.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
140
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
141 The current, ugly (IMHO) way:
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
142 gui have the control of the video window, it does handle resizing, moving,
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
143 key events etc. all window manipulation in libvo drivers are disabled as gui
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
144 is enabled. it was required as libvo isn't inited and running when gui
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
145 already display the video window.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
146
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
147 The wanted way:
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
148 GUI shouldn't control the X window directly, it should use libvo2 control
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
149 calls to resize/move/etc it. But there is a big problem: X cannot be opened
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
150 twice from a process. It means GUI and libvo2 should share the X connection.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
151 And, as GUI run first (and when file is selected etc then libvo2 is started)
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
152 it should connect to X and later pass the connection to libvo2. It needs an
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
153 extra control() call and some extra code in mplayer.c
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
154
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
155 but this way gui could work with non-X stuff, like SDL, fbdev (on second
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
156 head for TVout etc), hardware decoders (dvb.dxr3) etc.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
157
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
158 as X is so special, libvo2 should have a core function to open/get an X
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
159 connection, and it should be used by all X-based X drivers and gui.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
160
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
161 also, GUI needs functions to get mouse and keyboard events, and to
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
162 enable/disable window decoration (title, border).
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
163
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
164 we need fullscreen switch control function too.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
165
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
166 > Maybe we should allow video driver to change the libin driver ?
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
167 forget libin. most input stuff is handled by libvo drivers.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
168 think of all X stuff (x11,xv,dga,xmga,gl), SDL, aalib, svgalib.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
169 only a few transparent drivers (fbdev, mga, tdfxfb, vesa) has not, but all
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
170 of them are running on console (and maybe on second head) at fullscreen, so
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
171 they may not need mouse events. console keyboard events are already catched
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
172 and handled by getch2.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
173
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
174 I can't see any sense of writing libin.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
175
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
176 mpalyer.c should _handle_ all input events, collected from lirc interface,
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
177 getch2, libvo2 etc. and it should set update flags, for gui and osd.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
178
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
179 but we should share some plugin code. examples: *_vid code, all common X
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
180 code. it can be either implementing them in libvo2 core (and called from
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
181 plugins) or include these files from all drivers which need it. later method
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
182 is a bit cleaner (from viewpoint of core-plugin independency) but results
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
183 bigger binaries...
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
184 <EOP, Arpi>
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
185
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
186 Btw. when we finish we will have libin, but it will be spread around mplayer.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
187 Here is my idea how libin should work:
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
188 1.mplayer sends X connection to libvo2 driver.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
189 2.libvo2 uses X connection and open window
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
190 3.libvo2 driver opens new libin driver for the newly created window
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
191 4.libin driver sends all commands to mplayer
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
192 5.mplayer collects all commands from opened libin drivers (if more windows are open, lirc, etc)
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
193 In case of SDL we may not skip step 1, may we?
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
194 I just wonder where is the place of OSD in this picture?
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
195
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
196 1.3. query()
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
197
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
198 Here come and some attributes for the queried modes, each supported mode
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
199 should have such description. It is even possible to have more than one mode
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
200 that could display given imgfmt. I think that we have to separate window from fullscreen modes and to have yv12 mode for window and yv12 fullscreen mode.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
201 {
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
202 Scale y/n - hardware scale, do you think that we mast have one for x and
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
203 one for y (win does)?
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
204
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
205 Fullscreen y/n - if the supported mode is fullscreen, if we have yv12 for
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
206 fullscreen and window we must threat them as separate modes.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
207
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
208 Window y/n - The mode will show the image in a window. Could be removed as
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
209 it is mutually exclusive with Fullscreen
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
210
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
211 GetSurface y/n - if driver could give us video surface we'll use get_surface()
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
212
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
213 UpdateSurfece y/n - if driver will update video surface through sys function (X,SDL)
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
214
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
215 HWdecode y/n - if driver could take advantage of hw_decode()
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
216
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
217 MaxSurfaces 1..n - Theoretical maximum of surfaces
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
218
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
219 SubPicture y/n - Could we put subpicture (OSD) of any kind by hw
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
220
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
221 WriteCombine y/n - if GetSurface==yes, most (or all) pci&agp cards are
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
222 extremely slow on byte access, this is hint to vo2 core those surfaces
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
223 that got affected by WC. This is only a hint.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
224
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
225 us_clip y/n - if UpdateSurface=yes, this shows could update_surface()
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
226 remove strides (when stride> width ), this is used and for cropping. If
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
227 not, we must do it.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
228
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
229 us_slice y/n - if UpdateSurface=yes, this shows that update_surface()
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
230 could draw slices and that after updating surface,it won't wait for
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
231 vertical retrace, so we could update surface slice by slice.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
232 If us_slice==n we will have to accumulate all slices in some buffer.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
233
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
234 us_upsidedown - if UpdateSufrace=yes, this shows that update_suface()
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
235 could flip the image vertically. In some case this could be united with
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
236 us_clip /stride tricks/
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
237
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
238 switch_resoliton y/n - if window=y, this shows could we switch resolution
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
239 of desktop, if fullscreen==y, shows that we could change resolution, after
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
240 we have set the fullscreen mode.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
241
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
242 deinterlace y/n - indicates that the device could deinterlace on it's own
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
243 (radeon, TV).
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
244
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
245 1.4 conclusion
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
246
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
247 As you see, I have removed all additional buffering from the driver. There
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
248 is a lot of functionality that should be checked and handled by libvo2 core.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
249 First we should check what else could be added to this draft. Then to check
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
250 all cases and how to handle them. Some of the parameters should be able to
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
251 be overridden by user config, mainly to disable buggy modes or parameters. I
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
252 believe that this should not be done by command line as there are enough
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
253 commands now.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
254
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
255 //--------------------------------------------------------------------------
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
256 2. libvo2 core
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
257 2.1 functions
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
258 now these function are implemented:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
259 init
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
260 new
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
261 start
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
262 query_format
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
263 close
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
264
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
265 and as draw.c:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
266 choose_buffering
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
267 draw_slice_start
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
268 draw_slice
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
269 draw_frame
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
270 flip
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
271
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
272 init() is called at mplayer start. internal initialisation.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
273 new() -> rename to open_drv() or something like this.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
274 query_format -> not usable in this form, this function mean that all
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
275 negotiation will be performed outside libvo2. Replace or find better name.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
276 close -> open/close :)
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
277
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
278 choose_buffering - all buffering must stay hidden. The only exception is for
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
279 hw_decode. In the new implementation this functions is not usable.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
280 It will be replaced with some kind of negotiation.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
281 draw_slice_start, draw_slice -> if you like it this way, then it's OK.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
282 draw_frame -> classic draw function.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
283
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
284 2.2 Minimal buffering
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
285
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
286 I should say that I stand after the idea all buffering, postprocessing,
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
287 format conversion , sw draw of subtitles, etc to be done in libvo2 core.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
288 Why? First this is the only way we could fully control buffering and
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
289 decrease it to minimum. Less buffers means less coping. In some cases this
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
290 could have the opposite effect (look at direct rendering).
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
291
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
292 The first step of the analyse is to find out what we need:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
293
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
294 DECODER - num_out_buffers={1/2/3/...}
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
295 {
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
296 buffer_type:{fixed/static/movable}
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
297 read_only:{yes/no}
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
298 } * (num_out_buffers)
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
299 slice:{not/supported}
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
300
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
301 FILTER 1..x - processing:{ c-copy(buff1,buff2), p-process(buff1) },
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
302 slice:{not/supported}
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
303 write_combine:{not/safe},
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
304 runtime_remove:{static/dynamic}
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
305
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
306 VIDEO_OUT - method:{get_surface/update_surface},
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
307 slice:{not/supported},
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
308 write_combine:{not/safe},
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
309 clip:{can/not},
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
310 upsidedown:(can/not),
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
311 surfaces:{1/2/3,..,n}
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
312
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
313
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
314 Here I introduce and one letter codes that I use for analyse.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
315 Details:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
316
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
317 DECODER - We always get buffer from the decoder, some decoders could give
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
318 pointer to it's internal buffers, other takes pointers to buffers where
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
319 they should store the final image. Some decoders could call draw_slice
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
320 after they have finished with some portion of the image.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
321
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
322 num_out_buffers - number of output buffers. Each one could have it's own
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
323 parameters. In the usual case there will be only one buffer. Some
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
324 decoders may have 2 internal buffers like odivx, or like mpeg12 - 3 buffers
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
325 of different types(2 static and 1 temp).
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
326
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
327 buffer_type -
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
328 - fixed - we don't have control where the buffer will be. We could
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
329 just take pointer to this buffer. No direct rendering is possible.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
330 - static - we could set this buffer but then we can't change it's position.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
331 - movable - we could set this buffer to any location at any time.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
332 read_only - the data in this buffer will be used in future so we must not
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
333 try to write in there or we'll corrupt the video. If we have any 'p' kind
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
334 of filter we'll make copy.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
335
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
336 slice - this flag shows that decoder knows and want to work with slices.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
337
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
338 FILTER - postprocessing, sw drawing subtitles, format conversion, crop,
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
339 external filters.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
340
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
341 slice - could this filter work with slice order. We could use slice even
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
342 when decoder does not support slice, we just need 2 or more filters that
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
343 does. This could give us remarkable speed boost.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
344
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
345 processing - some filters can copy the image from one buffer to the other,
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
346 I call them 'c', convert and crop(stride copy) are good examples but don't
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
347 forget simple 1:1 copy. Other filters does process only part if the image,
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
348 and could reuse the given buffer, e.g. putting subtitles. I call them 'p'
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
349 Other filters could work in one buffer, but could work and with 2, I call
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
350 them 't' class, after analyse they will fade to 'c' or 'p'.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
351
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
352 runtime_remove - postprocess with autoq. Subtitles appear and disappear,
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
353 should we copy image from one buffer to another if there is no processing
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
354 at all?
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
355
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
356 //clip, crop, upsidedown - all 'c' filters must support strides, and should
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
357 be able to remove them and to make some tricks like crop and upside_down.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
358
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
359 VIDEO_OUT - take a look of libvo2 driver I propose.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
360 method - If we get surface -'S'. If we use draw* (update_surface) - 'd'
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
361
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
362 As you may see hw_decode don't have complicated buffering:)
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
363 I make the analyse this way. First I put decoder buffer, then I put all
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
364 filters, that may be needed, and finally I put video out method.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
365
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
366 2.3. Rules for minimal buffering
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
367 A) Direct rendering.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
368 Direct rendering means that the decoder will use video surface as output buffer.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
369 Most of the decoders have internal buffers and on request they copy
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
370 the ready image from one of them to given location, as we can't get pointer
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
371 to the internal buffer the fastest way is to give video surface as
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
372 output buffer and the decoder will draw it for us. This is safe as most of
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
373 copy routines are optimised for double words aligned access.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
374 If we get internal buffer, we could copy the image on our own. This is not
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
375 direct rendering but it gets the same speed. If fact that's why -vc odivx
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
376 is faster that -vc divx4 while they use the same divx4linux library.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
377 Sometimes it's possible to set video surface as internal buffer, but in most
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
378 cases the decoding process is byte oriented and many unaligned access is
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
379 performed. Moreover, reading from video memory on some cards is extremely
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
380 slow, about 4 times and more (and this is without setting MTRR), but some
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
381 decoders could take advantage of this. In the best case (reading performed
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
382 from the cache and using combined write ) we'll watch DivX movie with the same
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
383 speed as DivX4 is skipping frames.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
384
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
385 What does we need for Direct Rendering?
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
386 1. We should be able to get video surfaces.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
387 2. The decoder should have at least one buffer with buffer_type != fixed.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
388 3. If we have 'c' filter we can not use direct rendering. If we have
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
389 'p' filter we may allow it.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
390 4. If decoder have one static buffer, then we are limited to 1 video surface.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
391 In this case we will see how the frame is rendered (ugly refresh in best case)
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
392 4. Each static buffer and each read_only buffer needs to have it own
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
393 video surface. If we don't have enough ... well we may make some tricks
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
394 but it is too complicated //using direct rendering for the first in
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
395 the list and the rest will use memory buffering. And we must have free
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
396 video surfaces for the rest of decoder buffers//
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
397 5. Normal (buffer_type=movable, read_only=no) buffer could be redirected to
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
398 any available video surface.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
399
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
400 B) The usual case libvo2 core takes responsibility to move the data. It mast
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
401 follow these rules:
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
402 The 'p' filters process in the buffer of the left, if we have read_only
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
403 buffer then we must copy the buffer content in temp buffer.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
404 With 'c' filter we must make sure that we have buffer on the right(->) side.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
405 In the usual case 't' are replaced with 'p' except when 't' is before 'S'.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
406 We must have at least one 'c' if we have to make crop, clip, or flip image
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
407 upside down.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
408 Take care for the additional buffering when we have 1 surface (the libvo1 way).
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
409 Be aware that some filters must be before other. E.g. Postporcessing should
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
410 be before subtitles:)
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
411 If we want scale (-zoom), and vo2 driver can't make it then add and scale
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
412 filter 'c'. For better understanding I have only one convert filter that can
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
413 copy, convert, scale, convert and scale. In mplayer it really will be only
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
414 one filter.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
415
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
416
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
417 2.4 Negotiation
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
418 Few words about negotiation. It is hard thing to find the best mode. Here is
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
419 algorithm that could find the best mode. But first I must say that we need
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
420 some kind of weight for the filters and drawing. I think that we could use
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
421 something like megabytes/second, something that we may measure or benchmark.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
422
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
423 1. We choose codec
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
424 2. We choose video driver.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
425 3. For each combination find the total weight and if there are any
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
426 optional filters find min and max weight. Be careful max weight is not
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
427 always at maximum filters!!
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
428 4. Compare the results.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
429
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
430 I may say that we don't need automatic codec selection as now we could put
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
431 best codecs at beginning of codecs.conf as it is now. We may need to make
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
432 the same thing with videodrv.conf. Or better make config files with preferred
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
433 order of decoders and video modes:)
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
434