summaryrefslogtreecommitdiffstats
path: root/media/tools/mfdecoder/README.chromium
blob: c946a54e42c26911af8831e44a93f4f3966d450c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
This tool decodes a H.264 format video into YV12 frames and draws them onto
a window.

The program uses Media Foundation to do much of the work. Specifically, it 
uses the Source Reader (IMFSourceReader) to read from a file and the built-in
H.264 decoder (as an IMFTransform) to decode the video file into YV12 frames.
The decoding can be done with or without hardware acceleration.

If decoding is done without hardware acceleration, then the YV12 frames are 
converted into RGB using ConvertYUVToRGB32() provided in  
media/base/yuv_convert.h. They are then drawn to a window using StretchDIBits()
provided in gfx/gdi_util.h.

If decoding is done with hardware acceleration, then the frames are obtained
from a D3D surface (IDirect3DSurface9). It is then drawn through calling 
methods of a D3D device (IDirect3DDevice9) that is associated with the
video window that we created during initialization.

The painting is done using a MessageLoop that posts paint tasks every 30ms
until the end of stream is reached. Thus the painting part acts like a
playback.

Note: The current version uses a synchronous version of source reader. An
asynchronous version will likely to be more useful and have better
performance.

Note2: The maximum resolution supported by Microsoft's H.264 decoder is
1920 by 1088 pixels. If you try to feed it a larger video, it will "fail
to determine frame size." This is an inherent limitation that cannot be fixed
unless a different decoder is used.


Requirements: Windows 7

usage: mfdecoder (-s|-h) (-d|-r|-f) input-file
flags:
-s: Use software decoding
-h: Uses hardware decoding

-d: Decode to YV12 as fast as possible, no rendering or color-space conversion
-r: Render to window
-f: Decode+render as fast as possible

WARNING: Using both -h and -f, or opening too many windows with -h may lead to
driver crash / system instability. Realistically, you will never want to 
do this unless you want to push the limits of the GPU ...