1 draft of new OSD engine:
2 ========================
4 including ideas from mailing list from Jiri Svoboda, Tobias Diedrich,
5 Artur Zaprzala, Michael Niedermayer, Felix Buenemann, LGB
8 - be able to do partial rendering, within a given bounding box
9 useful when parts of the OSD are outside of the image and has to be
10 updated only when OSD changes, or even has different colorspace
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
15 - OSD elements should be cached - so rendering once into the cache and
16 reuse this while it's unchanged
18 - color support (colorspace could be YA, YUVA, RGB)
20 - change brightness, saturation, hue of chars ???
22 - way to disable alphablending, and use black outline (FAST_OSD now)
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)
27 - develop some text-based apps: osdterm, osdzilla etc ;)
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 a
32 union. The basic types: box, text, symbol, progressbar, group.
34 Group would be a special type, grouping other OSD objects together,
35 with a common x,y and boundingbox. Useful for grouping symbol+progrbar
36 or multiline subtitle text.
38 Each object 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 coordinates, or percent. flags to set left/center/right alignment...
45 - start and end timestamp, to automagically set/reset visible flag
49 typedef struct mp_osd_obj_s {
50 struct mp_osd_obj_s* next;
52 unsigned char alignment; // 2 bits: x;y percentages, 2 bits: x;y relative to parent; 2 bits: alignment left/right/center
55 unsigned char color[4]; // YUVA
56 mp_osd_bbox_t bbox; // bounding box
57 unsigned int start,duration; // PTS
70 int symbol; // unicode
80 unsigned int* palette;
83 struct mp_osd_obj_s* children;