annotate DOCS/tech/vidix.txt @ 30088:4977e04f3a18

Add support for parsing audio streams (though should be easy to extend to video) via libavcodec. Parsing can be done at the demuxer stage (currently disabled) or at the decoder (ad_ffmpeg, enabled). Should allow using the libavcodec AAC, DTS, ... decoders independent of container format.
author reimar
date Sun, 27 Dec 2009 15:28:01 +0000
parents 0f1b5b68af32
children 0ad2da052b2e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4103
917aff165995 Documentation
nick
parents:
diff changeset
1 VIDIX - VIDeo Interface for *niX
917aff165995 Documentation
nick
parents:
diff changeset
2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 4435
diff changeset
3
4103
917aff165995 Documentation
nick
parents:
diff changeset
4 This interface was designed and introduced as interface to userspace drivers
917aff165995 Documentation
nick
parents:
diff changeset
5 to provide DGA everywhere where it's possible (unline X11).
917aff165995 Documentation
nick
parents:
diff changeset
6 I hope that these drivers will be portable same as X11 (not only on *nix).
917aff165995 Documentation
nick
parents:
diff changeset
7
917aff165995 Documentation
nick
parents:
diff changeset
8 What is it:
917aff165995 Documentation
nick
parents:
diff changeset
9 - It's portable successor of mga_vid technology which is located in user-space.
917aff165995 Documentation
nick
parents:
diff changeset
10 - Unlikely X11 it's provides DGA everywhere where it's possible.
917aff165995 Documentation
nick
parents:
diff changeset
11 - Unlikely v4l it provides interface for video playback
917aff165995 Documentation
nick
parents:
diff changeset
12 - Unlikely linux's drivers it uses mathematics library.
917aff165995 Documentation
nick
parents:
diff changeset
13
917aff165995 Documentation
nick
parents:
diff changeset
14 Why it was developed:
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 4435
diff changeset
15 As said Vladimir Dergachev
4103
917aff165995 Documentation
nick
parents:
diff changeset
16 (http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/gatos/km/km.rfc.txt):
917aff165995 Documentation
nick
parents:
diff changeset
17 "0) Motivation
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 4435
diff changeset
18 v4l, v4l2 and Xv are all suffering from the same problem: attempt to fit
4103
917aff165995 Documentation
nick
parents:
diff changeset
19 existing multimedia devices into a fixed scheme."
917aff165995 Documentation
nick
parents:
diff changeset
20 Well - I tried to implement something similar by motivation.
917aff165995 Documentation
nick
parents:
diff changeset
21
917aff165995 Documentation
nick
parents:
diff changeset
22 How it works:
917aff165995 Documentation
nick
parents:
diff changeset
23 ~~~~~~~~~~~~~
917aff165995 Documentation
nick
parents:
diff changeset
24
917aff165995 Documentation
nick
parents:
diff changeset
25 This interface is almost finished. But I guess it can be expanded by developer's
917aff165995 Documentation
nick
parents:
diff changeset
26 requests.
917aff165995 Documentation
nick
parents:
diff changeset
27 So any suggestions, reports, criticism are gladly accepted.
917aff165995 Documentation
nick
parents:
diff changeset
28
917aff165995 Documentation
nick
parents:
diff changeset
29 1) APP calls vixGetVersion to check age of driver ;)
917aff165995 Documentation
nick
parents:
diff changeset
30 2) APP calls vixProbe. Driver should return 0 if it can handle something in PC.
917aff165995 Documentation
nick
parents:
diff changeset
31 3) APP calls vixGetCapability. Driver should return filled
917aff165995 Documentation
nick
parents:
diff changeset
32 vidix_capability_t.type field at least.
917aff165995 Documentation
nick
parents:
diff changeset
33 4) If above calls were succesful then APP calls vixInit function
917aff165995 Documentation
nick
parents:
diff changeset
34 (Driver can have not exported this function in this case call will be
917aff165995 Documentation
nick
parents:
diff changeset
35 skiped).
917aff165995 Documentation
nick
parents:
diff changeset
36 5) After initializing of driver APP calls vixGetCapability again
917aff165995 Documentation
nick
parents:
diff changeset
37 (In this case driver must fill every field of struct)
917aff165995 Documentation
nick
parents:
diff changeset
38 6) APP calls vixQueryFourcc. Driver should answer - can it configure
917aff165995 Documentation
nick
parents:
diff changeset
39 video memory for given fourcc or not.
917aff165995 Documentation
nick
parents:
diff changeset
40 7) APP calls vixConfigPlayback. Driver should prepare BES on this call.
917aff165995 Documentation
nick
parents:
diff changeset
41 APP pass to driver following info:
917aff165995 Documentation
nick
parents:
diff changeset
42 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
917aff165995 Documentation
nick
parents:
diff changeset
43 vidix_playback_t.fourcc - contains fourcc of movie
917aff165995 Documentation
nick
parents:
diff changeset
44 vidix_playback_t.capability - currently contsinas copy of vidix_capability_t.flags
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 4435
diff changeset
45 vidix_playback_t.blend_factor- currently unused
4435
c012c026d0e8 Documenting new tune info
nick
parents: 4195
diff changeset
46 vidix_playback_t.src - x,y,w,h fields contain original movie size
c012c026d0e8 Documenting new tune info
nick
parents: 4195
diff changeset
47 (in pixels) x and y often are nulls.
c012c026d0e8 Documenting new tune info
nick
parents: 4195
diff changeset
48 vidix_playback_t.src.pitch.y These fields contain source pitches
c012c026d0e8 Documenting new tune info
nick
parents: 4195
diff changeset
49 vidix_playback_t.src.pitch.u - for each Y,U,V plane in bytes.
c012c026d0e8 Documenting new tune info
nick
parents: 4195
diff changeset
50 vidix_playback_t.src.pitch.v (For packed fourcc only Y value is used)
c012c026d0e8 Documenting new tune info
nick
parents: 4195
diff changeset
51 They are hints for driver to use same destinition
c012c026d0e8 Documenting new tune info
nick
parents: 4195
diff changeset
52 pitches as in source memory (to speed up
c012c026d0e8 Documenting new tune info
nick
parents: 4195
diff changeset
53 memcpy process).
c012c026d0e8 Documenting new tune info
nick
parents: 4195
diff changeset
54 Note: when source pitches are unknown or
c012c026d0e8 Documenting new tune info
nick
parents: 4195
diff changeset
55 variable these field will be filled into 0.
4103
917aff165995 Documentation
nick
parents:
diff changeset
56 vidix_playback_t.dest - x,y,w,h fields contains destinition rectange
917aff165995 Documentation
nick
parents:
diff changeset
57 on the screen in pixels.
917aff165995 Documentation
nick
parents:
diff changeset
58 vidix_playback_t.num_frames - maximal # of frames which can be used by APP.
917aff165995 Documentation
nick
parents:
diff changeset
59 (Currently 10).
917aff165995 Documentation
nick
parents:
diff changeset
60 Driver should fill following fields:
917aff165995 Documentation
nick
parents:
diff changeset
61 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
917aff165995 Documentation
nick
parents:
diff changeset
62 vidix_playback_t.num_frames - real # of frames which will be used by driver.
917aff165995 Documentation
nick
parents:
diff changeset
63 (Should be less or equal to app's num_frames).
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 4435
diff changeset
64
4103
917aff165995 Documentation
nick
parents:
diff changeset
65 vidix_playback_t.dest.pitch.y These fields should contain alignment
917aff165995 Documentation
nick
parents:
diff changeset
66 vidix_playback_t.dest.pitch.u - for each Y,U,V plane in bytes.
917aff165995 Documentation
nick
parents:
diff changeset
67 vidix_playback_t.dest.pitch.v (For packed fourcc only Y value is used)
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 4435
diff changeset
68
4103
917aff165995 Documentation
nick
parents:
diff changeset
69 vidix_playback_t.frame_size - Driver should tell to app which size of
917aff165995 Documentation
nick
parents:
diff changeset
70 source frame (src.w and src.h) should
917aff165995 Documentation
nick
parents:
diff changeset
71 use APP (according to pitches and offsets)
917aff165995 Documentation
nick
parents:
diff changeset
72
917aff165995 Documentation
nick
parents:
diff changeset
73 vidix_playback_t.offsets - offsets from begin of BES memory for each frame
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 4435
diff changeset
74
4103
917aff165995 Documentation
nick
parents:
diff changeset
75 vidix_playback_t.offset.y These field should contain offset
917aff165995 Documentation
nick
parents:
diff changeset
76 vidix_playback_t.offset.u - for each Y,U,V plane within frame.
917aff165995 Documentation
nick
parents:
diff changeset
77 vidix_playback_t.offset.v (For packed fourcc only Y value is used)
917aff165995 Documentation
nick
parents:
diff changeset
78
917aff165995 Documentation
nick
parents:
diff changeset
79 vidix_playback_t.dga_addr - Address of BES memory.
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 4435
diff changeset
80
4103
917aff165995 Documentation
nick
parents:
diff changeset
81 Also see this picture:
917aff165995 Documentation
nick
parents:
diff changeset
82
917aff165995 Documentation
nick
parents:
diff changeset
83 VIDEO MEMORY layout:
917aff165995 Documentation
nick
parents:
diff changeset
84 +----------- It's begin of video memory End of video memory--------------+
917aff165995 Documentation
nick
parents:
diff changeset
85 | |
917aff165995 Documentation
nick
parents:
diff changeset
86 v v
917aff165995 Documentation
nick
parents:
diff changeset
87 [ RGB memory | YUV memory | UNDEF ]
917aff165995 Documentation
nick
parents:
diff changeset
88 ^
917aff165995 Documentation
nick
parents:
diff changeset
89 |
917aff165995 Documentation
nick
parents:
diff changeset
90 +---- begin of BES memory
917aff165995 Documentation
nick
parents:
diff changeset
91
917aff165995 Documentation
nick
parents:
diff changeset
92 BES MEMORY layout:
917aff165995 Documentation
nick
parents:
diff changeset
93 +-------- begin of BES memory
917aff165995 Documentation
nick
parents:
diff changeset
94 |
917aff165995 Documentation
nick
parents:
diff changeset
95 v
917aff165995 Documentation
nick
parents:
diff changeset
96 [ | | | | |
917aff165995 Documentation
nick
parents:
diff changeset
97 ^ ^ ^ ^ ^
917aff165995 Documentation
nick
parents:
diff changeset
98 | | | | + BEGIN of second frame
917aff165995 Documentation
nick
parents:
diff changeset
99 | | | + BEGIN of V plane
917aff165995 Documentation
nick
parents:
diff changeset
100 | | + BEGIN of U plane
917aff165995 Documentation
nick
parents:
diff changeset
101 | +------- BEGIN of Y plane
917aff165995 Documentation
nick
parents:
diff changeset
102 |
917aff165995 Documentation
nick
parents:
diff changeset
103 +--------- BEGIN of first frame
917aff165995 Documentation
nick
parents:
diff changeset
104
917aff165995 Documentation
nick
parents:
diff changeset
105 This means that in general case:
917aff165995 Documentation
nick
parents:
diff changeset
106 offset of frame != offset of BES
917aff165995 Documentation
nick
parents:
diff changeset
107 offset of Y plane != offset of first frame
917aff165995 Documentation
nick
parents:
diff changeset
108
917aff165995 Documentation
nick
parents:
diff changeset
109 But often: vidix_playback_t.offsets[0] = vidix_playback_t.offset.y = 0;
917aff165995 Documentation
nick
parents:
diff changeset
110
917aff165995 Documentation
nick
parents:
diff changeset
111 Formula: (For Y plane) copy source to:
917aff165995 Documentation
nick
parents:
diff changeset
112 vidix_playback_t.dga_addr +
917aff165995 Documentation
nick
parents:
diff changeset
113 vidix_playback_t.offsets[i] +
917aff165995 Documentation
nick
parents:
diff changeset
114 vidix_playback_t.offset.y
917aff165995 Documentation
nick
parents:
diff changeset
115
917aff165995 Documentation
nick
parents:
diff changeset
116 8) APP calls vixPlaybackOn. Driver should activate BES on this call.
917aff165995 Documentation
nick
parents:
diff changeset
117 9) PLAYBACK. Driver should sleep here ;)
917aff165995 Documentation
nick
parents:
diff changeset
118 But during playback can be called:
917aff165995 Documentation
nick
parents:
diff changeset
119 vixFrameSelect (if this function is exported)
917aff165995 Documentation
nick
parents:
diff changeset
120 Driver should prepare and activate corresponded frame.
917aff165995 Documentation
nick
parents:
diff changeset
121 This function is used only for double and trilpe buffering and
917aff165995 Documentation
nick
parents:
diff changeset
122 never used for single buffering playback.
917aff165995 Documentation
nick
parents:
diff changeset
123 vixGet(Set)GrKeys (if this function is exported)
917aff165995 Documentation
nick
parents:
diff changeset
124 This interface should be tuned but intriduced for overlapped playback
917aff165995 Documentation
nick
parents:
diff changeset
125 and video effects (TYPE_FX)
917aff165995 Documentation
nick
parents:
diff changeset
126 vixPlaybackGet(Set)Eq (if this function is exported)
917aff165995 Documentation
nick
parents:
diff changeset
127 For color correction.
917aff165995 Documentation
nick
parents:
diff changeset
128 10) APP calls vixPlaybackOff. Driver should deactivate BES on this call.
917aff165995 Documentation
nick
parents:
diff changeset
129 11) If vixDestroy is defined APP calls this function before unloading driver
917aff165995 Documentation
nick
parents:
diff changeset
130 from memory.
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 4435
diff changeset
131
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 4435
diff changeset
132
4103
917aff165995 Documentation
nick
parents:
diff changeset
133 What functions are mandatory:
917aff165995 Documentation
nick
parents:
diff changeset
134 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
917aff165995 Documentation
nick
parents:
diff changeset
135 vixGetVersion
917aff165995 Documentation
nick
parents:
diff changeset
136 vixProbe
917aff165995 Documentation
nick
parents:
diff changeset
137 vixGetCapability
917aff165995 Documentation
nick
parents:
diff changeset
138 vixQueryFourcc
917aff165995 Documentation
nick
parents:
diff changeset
139 vixConfigPlayback
917aff165995 Documentation
nick
parents:
diff changeset
140 vixPlaybackOn
917aff165995 Documentation
nick
parents:
diff changeset
141 vixPlaybackOff
917aff165995 Documentation
nick
parents:
diff changeset
142
917aff165995 Documentation
nick
parents:
diff changeset
143 All other functions are optionaly.
917aff165995 Documentation
nick
parents:
diff changeset
144
4195
b086b94ec244 Useful links
nick
parents: 4103
diff changeset
145 Useful links:
b086b94ec244 Useful links
nick
parents: 4103
diff changeset
146 ~~~~~~~~~~~~~
b086b94ec244 Useful links
nick
parents: 4103
diff changeset
147 Guide to DTV http://www.digitaltelevision.com/dtvbook/toc.shtml
b086b94ec244 Useful links
nick
parents: 4103
diff changeset
148 Fourcc http://www.webartz.com/fourcc/
b086b94ec244 Useful links
nick
parents: 4103
diff changeset
149 MPEG http://www.mpeg.org/MPEG/index.html
b086b94ec244 Useful links
nick
parents: 4103
diff changeset
150 Analog colors http://www.miranda.com/en/app_notes/TN/TN-05/TN-05.htm
b086b94ec244 Useful links
nick
parents: 4103
diff changeset
151
4103
917aff165995 Documentation
nick
parents:
diff changeset
152 Please send your suggestions, reports, feedback to mplayer-dev-eng@mplayerhq.hu
917aff165995 Documentation
nick
parents:
diff changeset
153 Best regards! Nick Kurshev.