annotate DOCS/tech/osd.txt @ 33771:6e774a02d00c

Remove gtkClearStruct code from mplayer() in interface.c. Move it as static function guiInfoMediumClear() where it is used and rename the symbolic constants used with this code.
author ib
date Sat, 09 Jul 2011 11:48:13 +0000
parents 0ad2da052b2e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16835
527c1561a0ad spelling/grammar/wording
diego
parents: 11000
diff changeset
1 draft of new OSD engine:
527c1561a0ad spelling/grammar/wording
diego
parents: 11000
diff changeset
2 ========================
5581
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
3 written by A'rpi
16835
527c1561a0ad spelling/grammar/wording
diego
parents: 11000
diff changeset
4 including ideas from mailing list from Jiri Svoboda, Tobias Diedrich,
527c1561a0ad spelling/grammar/wording
diego
parents: 11000
diff changeset
5 Artur Zaprzala, Michael Niedermayer, Felix Buenemann, LGB
5581
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
6
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
7 requirements:
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
8 - be able to do partial rendering, within a given bounding box
16835
527c1561a0ad spelling/grammar/wording
diego
parents: 11000
diff changeset
9 useful when parts of the OSD are outside of the image and has to be
527c1561a0ad spelling/grammar/wording
diego
parents: 11000
diff changeset
10 updated only when OSD changes, or even has different colorspace
5581
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
11
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
12 - text should be rendered in 2-pass way: 1. alpha 2. pixels
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
13 so char's alpha won't overwrite previous char, and may be faster
16835
527c1561a0ad spelling/grammar/wording
diego
parents: 11000
diff changeset
14
527c1561a0ad spelling/grammar/wording
diego
parents: 11000
diff changeset
15 - OSD elements should be cached - so rendering once into the cache and
5581
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
16 reuse this while it's unchanged
16835
527c1561a0ad spelling/grammar/wording
diego
parents: 11000
diff changeset
17
527c1561a0ad spelling/grammar/wording
diego
parents: 11000
diff changeset
18 - color support (colorspace could be YA, YUVA, RGB)
5581
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
19
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
20 - change brightness, saturation, hue of chars ???
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
21
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
22 - way to disable alphablending, and use black outline (FAST_OSD now)
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
23
16835
527c1561a0ad spelling/grammar/wording
diego
parents: 11000
diff changeset
24 - respect movie and monitor aspect, so OSD is rendered/scaled correctly
527c1561a0ad spelling/grammar/wording
diego
parents: 11000
diff changeset
25 eg. for SVCD/anamorphic DVD with hardware scaling (now OSD is squashed)
5591
9243e8988e0f Added aspect considerations.
atmos4
parents: 5581
diff changeset
26
5581
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
27 - develop some text-based apps: osdterm, osdzilla etc ;)
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
28
16835
527c1561a0ad spelling/grammar/wording
diego
parents: 11000
diff changeset
29 Ok. The basic idea of my design is using 'OSD objects', a data structure
5581
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
30 in a 1 (or 2?) way linked list.
16835
527c1561a0ad spelling/grammar/wording
diego
parents: 11000
diff changeset
31 There would be different object types, sharing type-dependent data in a
5581
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
32 union. The basic types: box, text, symbol, progressbar, group.
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
33
16835
527c1561a0ad spelling/grammar/wording
diego
parents: 11000
diff changeset
34 Group would be a special type, grouping other OSD objects together,
527c1561a0ad spelling/grammar/wording
diego
parents: 11000
diff changeset
35 with a common x,y and boundingbox. Useful for grouping symbol+progrbar
5581
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
36 or multiline subtitle text.
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
37
16835
527c1561a0ad spelling/grammar/wording
diego
parents: 11000
diff changeset
38 Each object could have flags, for example:
5581
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
39 - visible (set if we should display it)
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
40 - color (set if it's YUVA not YA)
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
41 - cached (set when there is a cached rendered variant)
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
42 - bbox updated (should be set when recalc bbox, reset when change params)
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
43 - several flags to control positioning. for example, x;y could be
16835
527c1561a0ad spelling/grammar/wording
diego
parents: 11000
diff changeset
44 absolute coordinates, or percent. flags to set left/center/right alignment...
5581
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
45 - start and end timestamp, to automagically set/reset visible flag
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
46
16835
527c1561a0ad spelling/grammar/wording
diego
parents: 11000
diff changeset
47 OK, my first draft:
5581
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
48
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
49 typedef struct mp_osd_obj_s {
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
50 struct mp_osd_obj_s* next;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
51 unsigned char type;
11000
6e35326c742f many small typo and grammar fixes
gabucino
parents: 5591
diff changeset
52 unsigned char alignment; // 2 bits: x;y percentages, 2 bits: x;y relative to parent; 2 bits: alignment left/right/center
5581
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
53 unsigned short flags;
30990
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
54 int x,y; // coords
5581
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
55 unsigned char color[4]; // YUVA
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
56 mp_osd_bbox_t bbox; // bounding box
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
57 unsigned int start,duration; // PTS
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
58 union {
30990
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
59 struct {
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
60 int x1,y1,x2,y2;
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
61 } line;
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
62 struct {
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
63 int x,y,w,h;
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
64 } rect;
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
65 struct {
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
66 char* text;
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
67 mp_font_t* font;
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
68 } text;
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
69 struct {
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
70 int symbol; // unicode
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
71 mp_font_t* font;
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
72 } symbol;
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
73 struct {
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
74 float value;
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
75 mp_font_t* font;
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
76 } pbar;
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
77 struct {
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
78 int w,h;
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
79 unsigned char* image;
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
80 unsigned int* palette;
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
81 } spu; // FIXME!
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
82 struct {
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
83 struct mp_osd_obj_s* children;
0ad2da052b2e the great MPlayer tab removal: part I
diego
parents: 30633
diff changeset
84 } group;
5581
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
85 } params;
1f231091fb54 draft v0.1
arpi
parents:
diff changeset
86 } mp_osd_obj_t;