hide subtitles after actual duration timeout, unescape entities and simulate bold...
[enigma2.git] / lib / gui / evideo.cpp
1 #include <lib/gui/evideo.h>
2
3 eVideoWidget::eVideoWidget(eWidget *parent): eWidget(parent)
4 {
5         m_decoder = 1;
6         parent->setPositionNotifyChild(1);
7 }
8
9 int eVideoWidget::event(int event, void *data, void *data2)
10 {
11         switch (event)
12         {
13         case evtChangedPosition:
14         case evtChangedSize:
15         case evtParentChangedPosition:
16         case evtParentVisibilityChanged:
17                 updatePosition(!isVisible());
18                 break;
19         }
20         return eWidget::event(event, data, data2);
21 }
22
23 eVideoWidget::~eVideoWidget()
24 {
25         updatePosition(1);
26 }
27
28 void eVideoWidget::updatePosition(int disable)
29 {
30         eRect pos(0, 0, 0, 0);
31         if (!disable)
32                 pos = eRect(getAbsolutePosition(), size());
33
34         if (m_cur_pos == pos)
35                 return;
36
37         m_cur_pos = pos;
38
39         eDebug("position is %d %d -> %d %d", pos.left(), pos.top(), pos.width(), pos.height());
40
41         for (int i=0; i<4; ++i)
42         {
43                 const char *targets[]={"left", "top", "width", "height"};
44                 char filename[128];
45                 snprintf(filename, 128, "/proc/stb/vmpeg/%d/dst_%s", m_decoder, targets[i]);
46                 FILE *f = fopen(filename, "w");
47                 if (!f)
48                 {
49                         eDebug("failed to open %s - %m", filename);
50                         break;
51                 }
52                 int val = 0;
53                 switch (i)
54                 {
55                 case 0: val = pos.left(); break;
56                 case 1: val = pos.top(); break;
57                 case 2: val = pos.width(); break;
58                 case 3: val = pos.height(); break;
59                 }
60                 fprintf(f, "%08x\n", val);
61                 fclose(f);
62                 eDebug("%s %08x", filename, val);
63         }
64 }
65
66 void eVideoWidget::setDecoder(int decoder)
67 {
68         m_decoder = decoder;
69 }