5581
|
1 some draft of new osd engine:
|
|
2 =============================
|
|
3 written by A'rpi
|
|
4 including ideas from maillist from Jiri Svoboda, Tobias Diedrich, Artur Zaprzala
|
|
5 Michael Niedermayer, Felix Buenemann, LGB
|
|
6
|
|
7 requirements:
|
|
8 - be able to do partial rendering, within a given bounding box
|
|
9 usefull, when parts of osd are outside of teh image and has to be
|
|
10 updated only when osd changes, or even has different colorspace
|
|
11
|
|
12 - text should be rendered in 2-pass way: 1. alpha 2. pixels
|
|
13 so char's alpha won't overwrite previous char, and may be faster
|
|
14
|
|
15 - osd elements should be cached - so rendering once into the cache and
|
|
16 reuse this while it's unchanged
|
|
17
|
|
18 - colors support (csp could be YA, YUVA, RGB )
|
|
19
|
|
20 - change brightness, saturation, hue of chars ???
|
|
21
|
|
22 - way to disable alphablending, and use black outline (FAST_OSD now)
|
|
23
|
5591
|
24 - respect movie and monitor aspect, so osd is rendered/scaled correctly
|
|
25 eg. for svcd/anamorphic dvd with hardware scaling (now OSD is squashed)
|
|
26
|
5581
|
27 - develop some text-based apps: osdterm, osdzilla etc ;)
|
|
28
|
|
29 Ok. The basic idea of my design is using 'osd objects', a data structure
|
|
30 in a 1 (or 2?) way linked list.
|
|
31 There would be different object types, sharing type-dependent data in an
|
|
32 union. The basic types: box, text, symbol, progressbar, group.
|
|
33
|
|
34 Group would be a special type, grouping other osd objects together,
|
|
35 with a common x,y and boundingbox. usefull for grouping symbol+progrbar
|
|
36 or multiline subtitle text.
|
|
37
|
|
38 Each obj could have flags, for example:
|
|
39 - visible (set if we should display it)
|
|
40 - color (set if it's YUVA not YA)
|
|
41 - cached (set when there is a cached rendered variant)
|
|
42 - bbox updated (should be set when recalc bbox, reset when change params)
|
|
43 - several flags to control positioning. for example, x;y could be
|
|
44 absolute coord, or percent. flags to set left/center/right alignment...
|
|
45 - start and end timestamp, to automagically set/reset visible flag
|
|
46
|
|
47 ok, my first draft:
|
|
48
|
|
49 typedef struct mp_osd_obj_s {
|
|
50 struct mp_osd_obj_s* next;
|
|
51 unsigned char type;
|
11000
|
52 unsigned char alignment; // 2 bits: x;y percentages, 2 bits: x;y relative to parent; 2 bits: alignment left/right/center
|
5581
|
53 unsigned short flags;
|
|
54 int x,y; // coords
|
|
55 unsigned char color[4]; // YUVA
|
|
56 mp_osd_bbox_t bbox; // bounding box
|
|
57 unsigned int start,duration; // PTS
|
|
58 union {
|
|
59 struct {
|
|
60 int x1,y1,x2,y2;
|
|
61 } line;
|
|
62 struct {
|
|
63 int x,y,w,h;
|
|
64 } rect;
|
|
65 struct {
|
|
66 char* text;
|
|
67 mp_font_t* font;
|
|
68 } text;
|
|
69 struct {
|
|
70 int symbol; // unicode
|
|
71 mp_font_t* font;
|
|
72 } symbol;
|
|
73 struct {
|
|
74 float value;
|
|
75 mp_font_t* font;
|
|
76 } pbar;
|
|
77 struct {
|
|
78 int w,h;
|
|
79 unsigned char* image;
|
|
80 unsigned int* palette;
|
|
81 } spu; // FIXME!
|
|
82 struct {
|
|
83 struct mp_osd_obj_s* children;
|
|
84 } group;
|
|
85 } params;
|
|
86 } mp_osd_obj_t;
|
|
87
|