annotate DOCS/tech/libvo2.txt @ 7936:635baf6d2e1d

1l
author jonas
date Sun, 27 Oct 2002 18:01:40 +0000
parents 6face4250a29
children 551d1f5ca980
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5586
6ce9c6231bdd updated
arpi
parents: 4091
diff changeset
1
6ce9c6231bdd updated
arpi
parents: 4091
diff changeset
2 ============================================================
6ce9c6231bdd updated
arpi
parents: 4091
diff changeset
3
7727
6face4250a29 better wording
arpi
parents: 5586
diff changeset
4 NOTE: the 'libvo2 from scratch' plan was abandoned, we're changing libvo1 now.
5586
6ce9c6231bdd updated
arpi
parents: 4091
diff changeset
5
7727
6face4250a29 better wording
arpi
parents: 5586
diff changeset
6 So, this draft is ONLY A DRAFT, see libvo.txt for the current code docs!
5586
6ce9c6231bdd updated
arpi
parents: 4091
diff changeset
7
6ce9c6231bdd updated
arpi
parents: 4091
diff changeset
8 ============================================================
6ce9c6231bdd updated
arpi
parents: 4091
diff changeset
9
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
10 //First Announce by Ivan Kalvachev
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
11 //Some explanations by Arpi & Pontscho
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
12
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
13 If you have any suggestion related to the subjects in this document you
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
14 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
15 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
16 could feel free to add paragraphs that you will sign with your name.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
17 Be warned that the text could be changed, modified and your name could be
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
18 moved at the top of the document.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
19
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
20 1.libvo2 drivers
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
21 1.1 functions
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
22 Currently these functions are implemented:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
23 init
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
24 control
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
25 start
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
26 stop
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
27 get_surface
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
28 update_surface - renamed draw
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
29 show_surface - renamed flip_page
3342
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 hw_decode
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
32 subpicture
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
33
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
34 Here is detailed description of the functions:
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
35 init - initialisation. It is called once on mplayer start
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
36 control - this function is message oriented interface for controlling the libvo2 driver
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
37 start - sets given mode and display it on the screen
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
38 stop - closes libvo2 driver, after stop we may call start again
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
39 query - the negotiation is more complex than just finding which imgfmt the
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
40 device could show, we must have list of capabilities, etc.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
41 This function will have at least 3 modes:
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
42 a) return list with description of available modes.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
43 b) check could we use this mode with these parameters. E.g. if we want
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
44 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
45 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
46 surfaces.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
47 c) return supported subpicture formats if any.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
48 +d) supported functionality by hw_decode
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
49
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
50 As you may see I have removed some functionality from control() and made
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
51 separate function. Why? It is generally good thing functions that are
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
52 critical to the driver to have it's own implementation.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
53 get_surface - this function give us surfaces where we could write. In most
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
54 cases this is video memory, but it is possible to be and computer RAM, with
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
55 some special meaning (AGP memory , X shared memory, GL texture ...).
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
56
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
57 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
58 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
59 second it really must update video surface, it must directly call the
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
60 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
61 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
62 (e.g ystart, yend), if we want draw function, we will call one form libvo2
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
63 core, that will call this one with ystart=0; yend=Ymax;. Also some system
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
64 screen update functions wait for vertical retrace before return, other
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
65 functions just can't handle partial updates. In this case we should inform
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
66 libvo2 core that device cannot slice, and libvo2 core must take care of
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
67 the additional buffering and update_surface becomes usual draw function.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
68 When update_surface() is used with combination on get_surface(), ONLY VALID
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
69 POINTERS ARE THESE RETURNED BY get_surface(). Watch out with cropping.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
70
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
71 show_surface - this functions is always called on frame change. it is used
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
72 to show the given surface on the screen.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
73 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
74 does nothing.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
75
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
76 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
77 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
78 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
79 be supported and under linux. Be careful:)
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
80
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
81 subpicture - this function will place subtitles. It must be called once to
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
82 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
83 frame, the driver will take care of this. Currently I propose this
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
84 implementation: we get array of bitmaps. Each one have its own starting
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
85 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
86 in specific imgfmt (spfmt). THE BITMAPS SHOULD NOT OVERLAP! This may not
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
87 be hw limitation but sw subtitles may get confused if they work as 'c'
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
88 filter (look my libvo2 core). Anyway, so far I don't know hardware that
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
89 have such limitations, but it is safer to be so (and faster I think).
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
90 It is generally good to merge small bitmaps (like characters) in larger
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
91 ones and make all subtitles as one bitmap( or one bitmap for one subtitle line).
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
92 There will be and one for each OSD time & seek/brightness/contrast/volume bar.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
93
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
94 1.2 control()
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
95 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
96 SET_ASPECT
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
97 SET_SCALLE_X, SET_SIZE_X
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
98 SET_SCALLE_Y, SET_SIZE_Y
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
99 RESET_SIZE
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
100 GET/SET_POSITION_X
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
101 GET/SET_POSTIION_Y
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
102 GET/SET_RESOLUTION
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
103 GET/SET_DISPLAY
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
104 GET/SET_ATTRIBUTES
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
105 + GET/SET_WIN_DECORATION
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
106
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
107 Here is description of how these controls to be used:
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_ASPECT - this is the move/video aspect, why not calculate it in
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
110 different place (mplayer.c) and pass the results to driver by
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
111 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
112 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
113 width.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
114
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
115 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
116 override SET_ASPECT, they will have cumulative effect, this could be used
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
117 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
118 want to lose aspect calculations. Or better SET_SCALLE to work with
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
119 current size?
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
120
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
121 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
122 and for more precise results.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
123
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
124 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
125
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
126 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
127 window.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
128
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
129 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
130 for changing desktop resolution or the resolution of the current
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
131 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
132
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
133 GET/SET_DISPLAY - mainly for X11 and remote displays. Not very useful, but
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
134 may be handy.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
135
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
136 GET/SET_ATTRIBUTES - Xv overlays have contrast, brightness, hue,
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
137 saturation etc. these and others could be controlled by this. If we want
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
138 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
139 there (xv developers be careful, 2 or 3 of default attributes sometimes
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
140 are not queried by X, but could be set).
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
141
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
142 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
143 I would like to hear the GUI developers. Could we separate Mouse/Keyboard
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
144 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
145 it's own keyboard/mouse interface. Maybe we should allow video driver to
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
146 change the libin driver ?
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
147
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
148 <SOP>
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
149 Arpi wrote:
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
150 I've asked Pontscho (he doesn't understand english well...).
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
151 There is 2 option of GUI<->mplayer interface.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
152
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
153 The current, ugly (IMHO) way:
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
154 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
155 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
156 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
157 already display the video window.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
158
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
159 The wanted way:
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
160 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
161 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
162 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
163 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
164 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
165 extra control() call and some extra code in mplayer.c
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
166
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
167 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
168 head for TVout etc), hardware decoders (dvb.dxr3) etc.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
169
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
170 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
171 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
172
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
173 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
174 enable/disable window decoration (title, border).
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 we need fullscreen switch control function too.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
177
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
178 > Maybe we should allow video driver to change the libin driver ?
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
179 forget libin. most input stuff is handled by libvo drivers.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
180 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
181 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
182 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
183 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
184 and handled by getch2.
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 I can't see any sense of writing libin.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
187
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
188 mpalyer.c should _handle_ all input events, collected from lirc interface,
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
189 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
190
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
191 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
192 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
193 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
194 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
195 bigger binaries...
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
196 <EOP, Arpi>
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
197
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
198 Btw. when we finish we will have libin, but it will be spread around mplayer.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
199 I agree that libin could be build in in libvo2 driver, but there have to be
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
200 standart way to send commands to the mplayer itself.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
201
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
202
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
203 1.3. query()
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
204
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
205 Here come and some attributes for the queried modes, each supported mode
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
206 should have such description. It is even possible to have more than one mode
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
207 that could display given imgfmt. I think that we have to separate window from fullscreen
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
208 modes and to have yv12 mode for window and yv12 fullscreen mode. We need and naming
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
209 scheme, in order to have *.conf control over modes - to disable buggy modes, to limit
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
210 surfaces (buggy ones), to manually disable slices etc. The naming should not change from
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
211 one computer to another and have to be flexible.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
212 {
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
213 IMGFMT - image format (RGB,YV12, etc...)
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
214
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
215 Height - the height of fullscreen mode or the maximum height of window mode
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
216
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
217 Width - the width of fullscreen mode or the maximum withd of window mode
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
218
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
219 }
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
220 {
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
221 Scale y/n - hardware scale, do you think that we must have one for x and
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
222 one for y (win does)?
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
223
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
224 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
225 fullscreen and window we must threat them as separate modes.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
226
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
227 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
228 it is mutually exclusive with Fullscreen
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
229
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
230 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
231
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
232 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
233
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
234 HWdecode y/n - if driver could take advantage of hw_decode()
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
235
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
236 MaxSurfaces 1..n - Theoretical maximum of surfaces
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
237
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
238 SubPicture y/n - Could we put subpicture (OSD) of any kind by hw
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
239
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
240 WriteCombine y/n - if GetSurface==yes, most (or all) pci&agp cards are
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
241 extremely slow on byte access, this is hint to vo2 core those surfaces
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
242 that got affected by WC. Some surfaces are in memory (X shm, OpenGL textures)
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
243 This is only a hint.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
244
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
245 us_clip y/n - if UpdateSurface=yes, this shows could update_surface()
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
246 remove strides (when stride> width ), this is used and for cropping. If
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
247 not, we must do it.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
248
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
249 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
250 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
251 vertical retrace, so we could update surface slice by slice.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
252 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
253
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
254 us_upsidedown - if UpdateSufrace=yes, this shows that update_suface()
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
255 could flip the image vertically. In some case this could be combined with
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
256 us_clip /stride tricks/
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
257
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
258 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
259 of desktop, if fullscreen==y, shows that we could change resolution, after
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
260 we have set the fullscreen mode.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
261
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
262 deinterlace y/n - indicates that the device could deinterlace on it's own
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
263 (radeon, TV out).
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
264 }
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
265 1.4 conclusion
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
266
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
267 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
268 is a lot of functionality that should be checked and handled by libvo2 core.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
269 If some of the functionality is not supported the libvo2 core should add filters
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
270 that will support it by software.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
271
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
272 Some of the parameters should be able to
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
273 be overridden by user config, mainly
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
274 to disable buggy modes or parameters. I
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
275 believe that this should not be done
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
276 by command line as there are enough
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
277 commands now.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
278
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
279 I wait comments and ideas.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
280 //--------------------------------------------------------------------------
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
281 2. libvo2 core
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
282 2.1 functions
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
283 now these function are implemented:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
284 init
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
285 new
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
286 start
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
287 query_format
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
288 close
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
289
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
290 and as draw.c:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
291 choose_buffering
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
292 draw_slice_start
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
293 draw_slice
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
294 draw_frame
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
295 flip
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
296
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
297 init() is called at mplayer start. internal initialisation.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
298 new() -> rename to open_drv() or something like this.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
299 query_format -> not usable in this form, this function mean that all
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
300 negotiation will be performed outside libvo2. Replace or find better name.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
301 close -> open/close :)
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
302
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
303 choose_buffering - all buffering must stay hidden. The only exception is for
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
304 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
305 It will be replaced with some kind of negotiation.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
306 draw_slice_start, draw_slice -> if you like it this way, then it's OK. But i think that
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
307 draw_slice_done could help.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
308
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
309 draw_frame -> classic draw function.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
310
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
311 2.2 Minimal buffering
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
312
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
313 I should say that I stand after the idea all buffering, postprocessing,
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
314 format conversion , sw draw of subtitles, etc to be done in libvo2 core.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
315 Why? First this is the only way we could fully control buffering and
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
316 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
317 could have the opposite effect (look at direct rendering).
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
318
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
319 The first step of the analyse is to find out what we need:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
320
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
321 DECODER - num_out_buffers={1/2/3/...}
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
322 {
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
323 buffer_type:{fixed/static/movable}
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
324 read_only:{yes/no}
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
325 } * (num_out_buffers)
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
326 slice:{not/supported}
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
327
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
328 FILTER 1..x - processing:{ c-copy(buff1,buff2), p-process(buff1) },
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
329 slice:{not/supported}
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
330 write_combine:{not/safe},
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
331 runtime_remove:{static/dynamic}
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
332
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
333 VIDEO_OUT - method:{get_surface,update_surface},
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
334 slice:{not/supported},
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
335 write_combine:{not/safe},
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
336 clip:{can/not},
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
337 upsidedown:(can/not),
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
338 surfaces:{1/2/3,..,n}
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
339
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
340
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
341
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
342 I use one letter code for the type of filters. You could find them in filters section.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
343 Details:
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
344
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
345 DECODER - We always get buffer from the decoder, some decoders could give
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
346 pointer to it's internal buffers, other takes pointers to buffers where
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
347 they should store the final image. Some decoders could call draw_slice
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
348 after they have finished with some portion of the image.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
349
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
350 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
351 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
352 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
353 of different types(2 static and 1 temp).
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
354
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
355 buffer_type -
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
356 - 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
357 just take pointer to this buffer. No direct rendering is possible.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
358 - 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
359 - 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
360 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
361 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
362 of filter we'll make copy.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
363
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
364 slice - this flag shows that decoder knows and want to work with slices.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
365
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
366 FILTER - postprocessing, sw drawing subtitles, format conversion, crop,
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
367 external filters.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
368
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
369 slice - could this filter work with slice order. We could use slice even
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
370 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
371 does. This could give us remarkable speed boost.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
372
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
373 processing - some filters can copy the image from one buffer to the other,
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
374 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
375 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
376 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
377 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
378 them 't' class, after analyse they will fade to 'c' or 'p'.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
379
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
380 runtime_remove - postprocess with autoq. Subtitles appear and disappear,
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
381 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
382 at all?
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
383
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
384 //clip, crop, upsidedown - all 'c' filters must support strides, and should
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
385 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
386
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
387 VIDEO_OUT - take a look of libvo2 driver I propose.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
388 method - If we get surface -'S'. If we use draw* (update_surface) - 'd'
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
389
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
390 As you may see hw_decode don't have complicated buffering:)
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
391
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
392 I make the analyse this way. First I put decoder buffer, then I put all
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
393 filters, that may be needed, and finally I put video out method. Then I add
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
394 temp buffers where needed. This is simple enough to be made on runtime.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
395
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
396 2.5 Various
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
397 2.5.1 clip&crop - we have x1,y1 that shows how much of the beginning and
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
398 x2,y2 how much of the end we should remove.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
399 plane+=(x1*sizeof(pixel))+(y1*stride);//let plane point to 1'st visible pixel
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
400 height-=y1+y2;
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
401 width-=x1+x2;
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
402 isn't is simple? no copy just change few variables. In order to make normal
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
403 plane we just need to copy it to frame where stide=width;
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
404
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
405 2.5.2 flip,upsidedown - in windows this is indicated by negative height, here
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
406 in mplayer we may use negative stride, so we must make sure that filters and
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
407 drivers could use negative stride
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
408 plane+=(width-1)*stride;//point to the last line
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
409 stride=-stride;//make stride point to previus line
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
410 and this one is very simple, and I hope that could work with all know image formats
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
411
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
412 BE careful, some modes may pack 2 pixels in 1 byte!
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
413 Other modes (YUYV) require y1 to be multiply of 2.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
414
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
415 stride is always in bytes, while width & height are in pixels
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
416
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
417 2.5.3 PostProcessing
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
418 Arpi was afraid that postprocessing needs more internal data to work. I think
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
419 that the quantization table should be passed as additional plane.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
420 How to be done this? When using Frame structure there is qbase that should point
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
421 to quantization table. The only problem is that usually the table is with fixed
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
422 size. I expect recommendations how to be properly implemented. should we crop it? Or add qstride, qheight, qwidth? Or mark the size of marcoblocks and
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
423 calc table size form image size? Currently pp work with fixed 8x8 blocks.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
424 There may have and problem with interlaced images.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
425 / for frame look at 2.3.4 /
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
426 I recommend splitting postprocessing to it's original filters and ability to
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
427 use them separately.
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
428
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
429 2.3. Rules for minimal buffering
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
430 2.3.1 Direct rendering.
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
431 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
432 Most of the decoders have internal buffers and on request they copy
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
433 the ready image from one of them to a given location. As we can't get pointer
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
434 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
435 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
436 copy routines are optimised for double words aligned access.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
437 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
438 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
439 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
440 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
441 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
442 performed. Moreover, reading from video memory on some cards is extremely
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
443 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
444 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
445 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
446 speed as DivX4 is skipping frames.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
447
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
448 What does we need for Direct Rendering?
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
449 1. We should be able to get video surfaces.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
450 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
451 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
452 'p' filter we may allow it.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
453 4. If decoder have one static buffer, then we are limited to 1 video surface.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
454 In this case we may see how the frame is rendered (ugly refresh in best case)
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
455 5. Each static buffer and each read_only buffer needs to have it own
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
456 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
457 but it is too complicated //using direct rendering for the first in
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
458 the list and the rest will use memory buffering. And we must have (1 or 2 ) free
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
459 video surfaces for the rest of decoder buffers//
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
460 6. Normal (buffer_type=movable, read_only=no) buffer could be redirected to
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
461 any available video surface.
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
462
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
463 2.3.2 Normal process
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
464 The usual case libvo2 core takes responsibility to move the data. It must
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
465 follow these rules:
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
466 1. The 'p' filters process in the buffer of the left, if we have read_only
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
467 buffer then vo2 core must insert 'c' copy filter and temp buffer.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
468 2. With 'c' filter we must make sure that we have buffer on the right(->) side. I think
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
469 that
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
470 3. In the usual case 't' are replaced with 'p' except when 't' is before video surface.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
471 We must have at least one 'c' if core have to make crop, clip, or flip image
3491
c9aca79b7527 x11control, direct rendering and some minor changes
iive
parents: 3342
diff changeset
472 upside down.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
473 4. Take care for the additional buffering when we have 1 surface (the libvo1 way).
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
474 5. Be aware that some filters must be before other. E.g. Postporcessing should
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
475 be before subtitles:)
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
476 6. 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
477 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
478 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
479 one filter.
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
480 7. If we have video surface then the final 'c' filters will update it for us. If the filter
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
481 and video surface are not WriteCombine safe we may add buffering. In case we use both
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
482 get_surface and update_surface, after writing in video surface we must call and
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
483 update_sufrace() function.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
484
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
485 If we must update_surface() then we will call it with the last buffer. This buffer could
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
486 be and the internal decoder buffer if there are no 'c' filters. This buffer could be
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
487 returned and by get_surface().
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
488
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
489 2.3.3 Slices.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
490 Slice is a small rectangle of the image. In decoders world it represents
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
491 independently rendered portion of the image. In mplayer slice width is equal
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
492 to the image width, the height is usually 8 but there is no problem to vary.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
493 The slices advantage is that working with smaller part of the image the most
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
494 of data stays in the cache, so post processing would read the data for free.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
495 This makes slice processing of video data preferred even when decoder and/or
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
496 video driver couldn't work with slices.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
497 Smaller slices increase possibility of data to be in the cache, but also
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
498 increase the overhead of function calls( brunch prediction too), so it may be
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
499 good to tune the size, when it is possible (mainly at 2 filter slices)
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
500
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
501 Here are some rules:
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
502 1. Slices are always with width of the image
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
503 2. Slices always are one after another, so you could not skip few lines because
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
504 they are not changed. This is made for postprocessing filter as there may
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
505 have different output image based on different neighbourhood lines(slices).
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
506 3. Slice always finish with last line, this is extended of 2. rule.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
507 4. Slice buffers are normal buffers that could contain a whole frame. This is
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
508 need in case we have to accumulate slices for frame process (draw). This is
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
509 needed and for pp filters.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
510 5. Slice processing could be used if:
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
511 5.1. decoder know for slices and call function when one is completed. The next
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
512 filter (or video driver) should be able to work with slices.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
513 5.2. Two or more filters could work with slices. Call them one after another.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
514 The result will be accumulated in the buffer of the last filter (look down
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
515 for 'p' type)
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
516 5.3. If the final filter can slice and vo2_driver can slice
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
517 6. All filers should have independent counters for processed lines. These counters
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
518 must be controlled by vo2 core.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
519
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
520 2.3.3.1 Slice counters.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
521 For the incoming image we need:
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
522 1. value that show the last valid line.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
523 2. value that show the line from where filter will start working. It is updated by the
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
524 filter to remember what portion of the image is processed. Vo2 core will zero it
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
525 on new frame.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
526
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
527 For the result image we need:
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
528 1. value that show which line is ready. This will be last valid line for next filter.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
529
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
530 The filter may need more internal variables. And as it may be used 2 or more times
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
531 in one chain it must be reentrant. So that internal variables should be passed to
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
532 filter as parameter.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
533
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
534 2.3.3.2 Auto slice.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
535 In case we have complete frame that will be processed by few filters that support slices, we must start processing this frame slice by slice. We have same situation
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
536 when one filter accumulates too many lines and forces the next filters to work with bigger slice.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
537 To avoid that case and to automatically start slicing we need to limit the slice size
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
538 and when slice is bigger to break it apart. If some filter needs more image lines then
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
539 it will wait until it accumulates them.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
540
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
541 2.3.4. Frame structure
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
542 So far we have buffer, that contain image, we have filters that work with
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
543 buffers. For croping and for normal work with the image data we need to know
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
544 dimensions of the image. We also need some structure to pass to the filters as
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
545 they have to know from where to read, and where they should write.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
546 So I introduce Frame struct:
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
547 {
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
548 imgfmt - the image format, the most important parameter
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
549 height, width - dimensions in pixel
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
550 stride - size of image line in bytes, it could be larger then width*sizeof(pixel),
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
551 it could be and negative (for vertical flip)
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
552 base0,base1,base2,base3 - pointers to planes, thay depend on imgfmt
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
553 baseq - quant storage plane. we may need to add qstride, or some qhight/qwidth
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
554 palette - pointer to table with palette colors.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
555 flags read-only - this frame is read only.
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
556 //screen position ??
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
557 }
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
558
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
559
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
560 2.4 Negotiation
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
561 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
562 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
563 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
564 something like megabytes/second, something that we may measure or benchmark.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
565
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
566 1. We choose codec
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
567 2. We choose video driver.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
568 3. For each combination find the total weight and if there are any
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
569 optional filters find min and max weight. Be careful max weight is not
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
570 always at maximum filters!! (e.g. cropping)
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
571 4. Compare the results.
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
572
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
573 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
574 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
575 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
576 order of decoders and video modes:)
3342
8cb0c0a7c415 libvo2 draft by Ivan - with linewrapping...
arpi
parents:
diff changeset
577
4091
696341879c3c few changes, slice and frame
iive
parents: 3491
diff changeset
578 I wait comments and ideas.