aboutsummaryrefslogtreecommitdiff
path: root/multimedia/vdr-plugin-xineliboutput/files/patch-osd__manager.c
blob: acc7c835b7e768a883429f997ebbb46bb8c6d4ff (plain) (blame)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
--- a/xine/osd_manager.c.orig	2012-05-11 07:37:27 UTC
+++ b/xine/osd_manager.c
@@ -11,7 +11,6 @@
 #include <stdlib.h>
 #include <pthread.h>
 
-#define XINE_ENGINE_INTERNAL
 #include <xine/xine_internal.h>
 #include <xine/video_out.h>
 
@@ -70,18 +69,25 @@ typedef struct osd_manager_impl_s {
 /*
  * acquire_ticket()
  */
-static void acquire_ticket(osd_manager_impl_t *this)
+static int acquire_ticket(osd_manager_impl_t *this)
 {
-  if (!this->ticket_acquired) {
-    this->stream->xine->port_ticket->acquire(this->stream->xine->port_ticket, 1);
+  if (this->ticket_acquired) {
+    return 1;
+  }
+
+  if (_x_lock_port_rewiring(this->stream->xine, 200)) {
     this->ticket_acquired = 1;
+    return 1;
   }
+
+  LOGMSG("lock_port_rewiring() failed");
+  return 0;
 }
 
 static void release_ticket(osd_manager_impl_t *this)
 {
   if (this->ticket_acquired) {
-    this->stream->xine->port_ticket->release(this->stream->xine->port_ticket, 1);
+    _x_unlock_port_rewiring(this->stream->xine);
     this->ticket_acquired = 0;
   }
 }
@@ -92,7 +98,10 @@ static void release_ticket(osd_manager_impl_t *this)
 video_overlay_manager_t *get_ovl_manager(osd_manager_impl_t *this)
 {
   /* Get overlay manager. We need ticket ... */
-  acquire_ticket(this);
+
+  if (!acquire_ticket(this))
+    return NULL;
+
   video_overlay_manager_t *ovl_manager = this->stream->video_out->get_overlay_manager(this->stream->video_out);
   if (!ovl_manager) {
     LOGMSG("Stream has no overlay manager !");
@@ -256,7 +265,10 @@ static int exec_osd_size(osd_manager_impl_t *this, osd
   osd->video_window_w = 0;
   osd->video_window_h = 0;
 
-  acquire_ticket(this);
+  if (!acquire_ticket(this)) {
+    return CONTROL_PARAM_ERROR;
+  }
+
 
   xine_video_port_t *video_out = this->stream->video_out;