View | Details | Raw Unified | Return to bug 253304
Collapse All | Expand All

(-)files/patch-osd__manager.c (+64 lines)
Line 0 Link Here
1
--- a/xine/osd_manager.c.orig	2012-05-11 07:37:27 UTC
2
+++ b/xine/osd_manager.c
3
@@ -11,7 +11,6 @@
4
 #include <stdlib.h>
5
 #include <pthread.h>
6
 
7
-#define XINE_ENGINE_INTERNAL
8
 #include <xine/xine_internal.h>
9
 #include <xine/video_out.h>
10
 
11
@@ -70,18 +69,25 @@ typedef struct osd_manager_impl_s {
12
 /*
13
  * acquire_ticket()
14
  */
15
-static void acquire_ticket(osd_manager_impl_t *this)
16
+static int acquire_ticket(osd_manager_impl_t *this)
17
 {
18
-  if (!this->ticket_acquired) {
19
-    this->stream->xine->port_ticket->acquire(this->stream->xine->port_ticket, 1);
20
+  if (this->ticket_acquired) {
21
+    return 1;
22
+  }
23
+
24
+  if (_x_lock_port_rewiring(this->stream->xine, 200)) {
25
     this->ticket_acquired = 1;
26
+    return 1;
27
   }
28
+
29
+  LOGMSG("lock_port_rewiring() failed");
30
+  return 0;
31
 }
32
 
33
 static void release_ticket(osd_manager_impl_t *this)
34
 {
35
   if (this->ticket_acquired) {
36
-    this->stream->xine->port_ticket->release(this->stream->xine->port_ticket, 1);
37
+    _x_unlock_port_rewiring(this->stream->xine);
38
     this->ticket_acquired = 0;
39
   }
40
 }
41
@@ -92,7 +98,10 @@ static void release_ticket(osd_manager_impl_t *this)
42
 video_overlay_manager_t *get_ovl_manager(osd_manager_impl_t *this)
43
 {
44
   /* Get overlay manager. We need ticket ... */
45
-  acquire_ticket(this);
46
+
47
+  if (!acquire_ticket(this))
48
+    return NULL;
49
+
50
   video_overlay_manager_t *ovl_manager = this->stream->video_out->get_overlay_manager(this->stream->video_out);
51
   if (!ovl_manager) {
52
     LOGMSG("Stream has no overlay manager !");
53
@@ -256,7 +265,10 @@ static int exec_osd_size(osd_manager_impl_t *this, osd
54
   osd->video_window_w = 0;
55
   osd->video_window_h = 0;
56
 
57
-  acquire_ticket(this);
58
+  if (!acquire_ticket(this)) {
59
+    return CONTROL_PARAM_ERROR;
60
+  }
61
+
62
 
63
   xine_video_port_t *video_out = this->stream->video_out;
64
 
(-)files/patch-xine_frontend.c (+108 lines)
Line 0 Link Here
1
--- a/xine_frontend.c.orig	2012-05-11 07:37:27 UTC
2
+++ b/xine_frontend.c
3
@@ -25,7 +25,6 @@
4
 # undef boolean
5
 #endif
6
 
7
-#define XINE_ENGINE_INTERNAL
8
 #include <xine.h>
9
 #include <xine/xine_internal.h>
10
 
11
@@ -1702,13 +1701,16 @@ static vo_frame_t *yuy2_to_yv12_frame(xine_stream_t *s
12
 {
13
   /* convert yuy12 frames to yv12 */
14
   if (frame && frame->format == XINE_IMGFMT_YUY2) {
15
-    stream->xine->port_ticket->acquire(stream->xine->port_ticket, 0);
16
-    vo_frame_t *img = stream->video_out->get_frame (stream->video_out,
17
-                                                    frame->width, frame->height,
18
-                                                    frame->ratio, XINE_IMGFMT_YV12,
19
-                                                    VO_BOTH_FIELDS);
20
-    stream->xine->port_ticket->release(stream->xine->port_ticket, 0);
21
+    vo_frame_t *img = NULL;
22
 
23
+    if (_x_lock_port_rewiring(stream->xine, 0)) {
24
+      img = stream->video_out->get_frame (stream->video_out,
25
+                                          frame->width, frame->height,
26
+                                          frame->ratio, XINE_IMGFMT_YV12,
27
+                                          VO_BOTH_FIELDS);
28
+      _x_unlock_port_rewiring(stream->xine);
29
+    }
30
+
31
     if (!img) {
32
       LOGMSG("yuy2_to_yv12_frame: get_frame failed");
33
       frame->free(frame);
34
@@ -1738,6 +1740,8 @@ static char *frame_compress_jpeg(fe_t *this, int *size
35
 
36
   /* convert yuy2 frames to yv12 */
37
   frame = yuy2_to_yv12_frame(this->stream, frame);
38
+  if (!frame)
39
+    return NULL;
40
 
41
   /* Compress JPEG */
42
 
43
@@ -1836,13 +1840,16 @@ static vo_frame_t *yv12_to_yuy2_frame(xine_stream_t *s
44
 {
45
   /* convert yv12 frames to yuy2 */
46
   if (frame && frame->format == XINE_IMGFMT_YV12) {
47
-    stream->xine->port_ticket->acquire(stream->xine->port_ticket, 0);
48
-    vo_frame_t *img = stream->video_out->get_frame (stream->video_out,
49
-                                                    frame->width, frame->height,
50
-                                                    frame->ratio, XINE_IMGFMT_YUY2,
51
-                                                    VO_BOTH_FIELDS);
52
-    stream->xine->port_ticket->release(stream->xine->port_ticket, 0);
53
+    vo_frame_t *img = NULL;
54
 
55
+    if (_x_lock_port_rewiring(stream->xine, 0)) {
56
+      img = stream->video_out->get_frame (stream->video_out,
57
+                                          frame->width, frame->height,
58
+                                          frame->ratio, XINE_IMGFMT_YUY2,
59
+                                          VO_BOTH_FIELDS);
60
+      _x_unlock_port_rewiring(stream->xine);
61
+    }
62
+
63
     if (!img) {
64
       LOGMSG("yv12_to_yuy2_frame: get_frame failed");
65
       frame->free(frame);
66
@@ -2006,11 +2013,16 @@ static char *fe_grab(frontend_t *this_gen, int *size, 
67
   height = (MAX(16, MIN(height, 1200)) + 1) & ~1; /* 16...1200, even */
68
 
69
   /* get last frame */
70
-  this->stream->xine->port_ticket->acquire(this->stream->xine->port_ticket, 0);
71
 
72
 #ifdef HAVE_XINE_GRAB_VIDEO_FRAME
73
+  xine_grab_video_frame_t *grab_frame = NULL;
74
   char *img = NULL;
75
-  xine_grab_video_frame_t *grab_frame = xine_new_grab_video_frame(this->stream);
76
+
77
+  if (_x_lock_port_rewiring(this->xine, 0)) {
78
+    grab_frame = xine_new_grab_video_frame(this->stream);
79
+    _x_unlock_port_rewiring(this->xine);
80
+  }
81
+
82
   if (grab_frame) {
83
     grab_frame->width = width;
84
     grab_frame->height = height;
85
@@ -2018,15 +2030,18 @@ static char *fe_grab(frontend_t *this_gen, int *size, 
86
       img = fe_compress_grab_frame(this, size, jpeg, quality, width, height, grab_frame);
87
     grab_frame->dispose(grab_frame);
88
   }
89
-  this->stream->xine->port_ticket->release(this->stream->xine->port_ticket, 0);
90
   return img;
91
 #else
92
-  vo_frame_t *frame = this->stream->video_out->get_last_frame (this->stream->video_out);
93
+  vo_frame_t *frame = NULL;
94
+
95
+  if (_x_lock_port_rewiring(this->xine, 0)) {
96
+    frame = this->stream->video_out->get_last_frame (this->stream->video_out);
97
 #if XINE_VERSION_CODE < 10190
98
-  if(frame)
99
-    frame->lock(frame);
100
+    if (frame)
101
+      frame->lock(frame);
102
 #endif
103
-  this->stream->xine->port_ticket->release(this->stream->xine->port_ticket, 0);
104
+    _x_unlock_port_rewiring(this->xine);
105
+  }
106
 
107
   if(!frame) {
108
     LOGMSG("fe_grab: get_last_frame() failed");
(-)files/patch-xine_input_vdr.c (+283 lines)
Line 0 Link Here
1
--- xine_input_vdr.c.orig	2012-05-11 07:37:27 UTC
2
+++ xine_input_vdr.c
3
@@ -1573,9 +1573,7 @@ static void set_still_mode(vdr_input_plugin_t *this, i
4
   if (still_mode || this->still_mode)
5
     CHECK_FALSE(this->live_mode);
6
 
7
-  pthread_mutex_lock (&this->stream->first_frame_lock);
8
-  this->stream->first_frame_flag = 2;
9
-  pthread_mutex_unlock (&this->stream->first_frame_lock);
10
+  _x_trigger_relaxed_frame_drop_mode(this->stream);
11
 
12
   this->still_mode = !!still_mode;
13
   _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HAS_STILL, this->still_mode);
14
@@ -1719,11 +1717,12 @@ static void queue_blank_yv12(vdr_input_plugin_t *this)
15
   _x_demux_control_newpts(this->stream, 0, BUF_FLAG_SEEK);
16
 
17
 
18
-  this->class->xine->port_ticket->acquire (this->class->xine->port_ticket, 1);
19
-  img = this->stream->video_out->get_frame (this->stream->video_out,
20
-                                            width, height, dratio,
21
-                                            XINE_IMGFMT_YV12, VO_BOTH_FIELDS);
22
-  this->class->xine->port_ticket->release (this->class->xine->port_ticket, 1);
23
+  if (_x_lock_port_rewiring(this->class->xine, 100)) {
24
+    img = this->stream->video_out->get_frame (this->stream->video_out,
25
+                                              width, height, dratio,
26
+                                              XINE_IMGFMT_YV12, VO_BOTH_FIELDS);
27
+    _x_unlock_port_rewiring(this->class->xine);
28
+  }
29
 
30
   if (img) {
31
     if (img->format == XINE_IMGFMT_YV12 && img->base[0] && img->base[1] && img->base[2]) {
32
@@ -1977,88 +1976,6 @@ static int vdr_plugin_exec_osd_command(vdr_input_plugi
33
 
34
 /******************************* Control *********************************/
35
 
36
-#if XINE_VERSION_CODE < 10111
37
-# define DEMUX_MUTEX_LOCK
38
-# define DEMUX_MUTEX_UNLOCK
39
-# define DEMUX_RESUME_SIGNAL
40
-#else
41
-# define DEMUX_MUTEX_LOCK    pthread_mutex_lock(&stream->demux_mutex)
42
-# define DEMUX_MUTEX_UNLOCK  pthread_mutex_unlock(&stream->demux_mutex)
43
-# define DEMUX_RESUME_SIGNAL pthread_cond_signal(&this->stream->demux_resume)
44
-#endif
45
-
46
-#if XINE_VERSION_CODE < 10200
47
-# define RAISE_ACTION_PENDING this->stream->demux_action_pending = 1
48
-# define LOWER_ACTION_PENDING this->stream->demux_action_pending = 0
49
-#else
50
-# define RAISE_ACTION_PENDING _x_action_raise(this->stream)
51
-# define LOWER_ACTION_PENDING _x_action_lower(this->stream)
52
-#endif
53
-
54
-static void suspend_demuxer(vdr_input_plugin_t *this)
55
-{
56
-  if (this->is_paused)
57
-    LOGMSG("WARNING: called suspend_demuxer in paused mode !");
58
-
59
-  /* request demuxer to release demux_lock */
60
-  RAISE_ACTION_PENDING;
61
-
62
-  /* signal all possible sync points to speed up this */
63
-  pthread_cond_broadcast(&this->engine_flushed);
64
-  signal_buffer_not_empty(this);
65
-
66
-  /* let demuxer return from vdr_plugin_read_* */
67
-  if (pthread_mutex_unlock( &this->lock ))
68
-    LOGERR("pthread_mutex_unlock failed !");
69
-
70
-  /* lock demuxer */
71
-  pthread_mutex_lock( &this->stream->demux_lock );
72
-
73
-  LOWER_ACTION_PENDING;
74
-
75
-  pthread_mutex_lock( &this->lock );
76
-
77
-  /* must be paired with resume_demuxer !!! */
78
-}
79
-
80
-static void resume_demuxer(vdr_input_plugin_t *this)
81
-{
82
-  /* must be paired with suspend_demuxer !!! */
83
-
84
-  DEMUX_RESUME_SIGNAL;
85
-  pthread_mutex_unlock( &this->stream->demux_lock );
86
-}
87
-
88
-static void vdr_x_demux_control_newpts( xine_stream_t *stream, int64_t pts, 
89
-					uint32_t flags ) 
90
-{
91
-  buf_element_t *buf;
92
-
93
-  DEMUX_MUTEX_LOCK;
94
-
95
-  buf = stream->video_fifo ? stream->video_fifo->buffer_pool_try_alloc (stream->video_fifo) : NULL;
96
-  if(buf) {
97
-    buf->type = BUF_CONTROL_NEWPTS;
98
-    buf->decoder_flags = flags;
99
-    buf->disc_off = pts;
100
-    stream->video_fifo->put (stream->video_fifo, buf); 
101
-  } else {
102
-    LOGMSG("vdr_x_demux_control_newpts: video fifo full !");
103
-  }
104
-
105
-  buf = stream->audio_fifo ? stream->audio_fifo->buffer_pool_try_alloc (stream->audio_fifo) : NULL;
106
-  if (buf) {
107
-    buf->type = BUF_CONTROL_NEWPTS;
108
-    buf->decoder_flags = flags;
109
-    buf->disc_off = pts;
110
-    stream->audio_fifo->put (stream->audio_fifo, buf);
111
-  } else {
112
-    LOGMSG("vdr_x_demux_control_newpts: audio fifo full !");
113
-  }
114
-
115
-  DEMUX_MUTEX_UNLOCK;
116
-}
117
-
118
 static void vdr_flush_engine(vdr_input_plugin_t *this, uint64_t discard_index)
119
 {
120
   CHECK_LOCKED(this->lock);
121
@@ -2078,44 +1995,30 @@ static void vdr_flush_engine(vdr_input_plugin_t *this,
122
     return;
123
   }
124
 
125
+  if (this->is_paused)
126
+    LOGMSG("WARNING: called suspend_demuxer in paused mode !");
127
+
128
   /* reset speed */
129
+  reset_scr_tuning(this);
130
   if(xine_get_param(this->stream, XINE_PARAM_FINE_SPEED) <= 0) {
131
     LOGMSG("vdr_flush_engine: playback is paused <0>");
132
     xine_set_param(this->stream, XINE_PARAM_FINE_SPEED, XINE_FINE_SPEED_NORMAL);
133
   }
134
 
135
-  /* suspend demuxer */
136
-  suspend_demuxer(this);
137
+  pthread_mutex_unlock(&this->lock);
138
 
139
-  reset_scr_tuning(this);
140
+  _x_demux_seek(this->stream, 0, 0, 1);
141
+  pthread_mutex_lock(&this->lock);
142
 
143
-  /* reset speed again (adjust_realtime_speed might have set pause) */
144
-  if(xine_get_param(this->stream, XINE_PARAM_FINE_SPEED) <= 0) {
145
-    LOGMSG("vdr_flush_engine: playback is paused <1>");
146
-    xine_set_param(this->stream, XINE_PARAM_FINE_SPEED, XINE_FINE_SPEED_NORMAL);
147
-  }
148
-
149
-#if 0
150
-  _x_demux_flush_engine (this->stream);
151
-  /* warning: after clearing decoders fifos an absolute discontinuity
152
-   *          indication must be sent. relative discontinuities are likely
153
-   *          to cause "jumps" on metronom.
154
-   */
155
-#else
156
-  this->stream->demux_plugin->seek (this->stream->demux_plugin,
157
-				    0, 0, this->stream->demux_thread_running);
158
-#endif
159
-
160
 #if XINE_VERSION_CODE < 10104
161
   /* disabled _x_demux_control_start as it causes alsa output driver to exit now and then ... */
162
 #else
163
   _x_demux_control_start(this->stream);
164
 #endif
165
+
166
+reset_scr_tuning(this);
167
   this->stream_start = 1;
168
   this->I_frames = this->B_frames = this->P_frames = 0;
169
-  this->discard_index = discard_index;
170
-
171
-  resume_demuxer(this);
172
 }
173
 
174
 static int set_deinterlace_method(vdr_input_plugin_t *this, const char *method_name)
175
@@ -2327,13 +2230,14 @@ static void select_spu_channel(xine_stream_t *stream, 
176
   if (channel == SPU_CHANNEL_NONE) {
177
     /* re-enable overlay for VDR OSD ... */
178
     if (stream->video_out) {
179
-      pthread_mutex_lock (&stream->frontend_lock);
180
-      stream->xine->port_ticket->acquire (stream->xine->port_ticket, 0);
181
-    
182
-      stream->video_out->enable_ovl (stream->video_out, 1);
183
+      //pthread_mutex_lock (&stream->frontend_lock);
184
 
185
-      stream->xine->port_ticket->release (stream->xine->port_ticket, 0);
186
-      pthread_mutex_unlock (&stream->frontend_lock);
187
+      if (_x_lock_port_rewiring(stream->xine, 100)) {
188
+        stream->video_out->enable_ovl (stream->video_out, 1);
189
+        _x_unlock_port_rewiring(stream->xine);
190
+      }
191
+
192
+      //pthread_mutex_unlock (&stream->frontend_lock);
193
     }
194
   }
195
 }
196
@@ -2957,12 +2861,13 @@ static int vdr_plugin_flush(vdr_input_plugin_t *this, 
197
     return 1; 
198
   }
199
 
200
-  this->class->xine->port_ticket->acquire(this->class->xine->port_ticket, 1);
201
-  result = MAX(0, pool->size(pool)) + 
202
-           MAX(0, buffer->size(buffer)) +
203
-           this->stream->video_out->get_property(this->stream->video_out, 
204
-						 VO_PROP_BUFS_IN_FIFO);
205
-  this->class->xine->port_ticket->release(this->class->xine->port_ticket, 1);
206
+  if (_x_lock_port_rewiring(this->class->xine, 100)) {
207
+    result = MAX(0, pool->size(pool)) +
208
+        MAX(0, buffer->size(buffer)) +
209
+        this->stream->video_out->get_property(this->stream->video_out,
210
+                                              VO_PROP_BUFS_IN_FIFO);
211
+    _x_unlock_port_rewiring(this->class->xine);
212
+  }
213
 
214
   put_control_buf(buffer, pool, BUF_CONTROL_FLUSH_DECODER);
215
   put_control_buf(buffer, pool, BUF_CONTROL_NOP);
216
@@ -2985,12 +2890,14 @@ static int vdr_plugin_flush(vdr_input_plugin_t *this, 
217
 					 &pool->buffer_pool_mutex, &abstime);
218
     pthread_mutex_unlock(&pool->buffer_pool_mutex);
219
 
220
-    this->class->xine->port_ticket->acquire(this->class->xine->port_ticket, 1);
221
-    result = MAX(0, pool->size(pool)) +
222
-             MAX(0, buffer->size(buffer)) +
223
-             this->stream->video_out->get_property(this->stream->video_out, 
224
-						   VO_PROP_BUFS_IN_FIFO);
225
-    this->class->xine->port_ticket->release(this->class->xine->port_ticket, 1);
226
+    result = 0;
227
+    if (_x_lock_port_rewiring(this->class->xine, 100)) {
228
+      result = MAX(0, pool->size(pool)) +
229
+          MAX(0, buffer->size(buffer)) +
230
+          this->stream->video_out->get_property(this->stream->video_out,
231
+                                                VO_PROP_BUFS_IN_FIFO);
232
+      _x_unlock_port_rewiring(this->class->xine);
233
+    }
234
   }
235
 
236
   TRACE("vdr_plugin_flush returns %d (%d+%d used, %d frames)\n", result,
237
@@ -4775,7 +4682,6 @@ static buf_element_t *preprocess_buf(vdr_input_plugin_
238
 	     this->block_buffer->fifo_size,
239
 	     this->stream->video_fifo->fifo_size);
240
     } else {
241
-      vdr_x_demux_control_newpts(this->stream, 0, BUF_FLAG_SEEK);
242
       queue_blank_yv12(this);
243
     }
244
     pthread_mutex_unlock(&this->lock);
245
@@ -4815,9 +4721,7 @@ static buf_element_t *preprocess_buf(vdr_input_plugin_
246
   /* First packet ? */
247
   if (this->stream_start) {
248
     this->stream_start = 0;
249
-    pthread_mutex_lock (&this->stream->first_frame_lock);
250
-    this->stream->first_frame_flag = 2;
251
-    pthread_mutex_unlock (&this->stream->first_frame_lock);
252
+    _x_trigger_relaxed_frame_drop_mode(this->stream);
253
 
254
     memset(&this->scr_buf, 0, sizeof(this->scr_buf));
255
 
256
@@ -4900,7 +4804,9 @@ static void handle_disconnect(vdr_input_plugin_t *this
257
   reset_trick_speed(this);
258
   this->live_mode = 0;
259
   reset_scr_tuning(this);
260
+#if XINE_VERSION_CODE < 10209
261
   this->stream->emergency_brake = 1;
262
+#endif
263
 
264
   this->control_running = 0;
265
   errno = ENOTCONN;
266
@@ -5869,11 +5775,12 @@ static int vdr_plugin_open_net (input_plugin_t *this_g
267
     return 0;
268
   }
269
 
270
-  this->class->xine->port_ticket->acquire(this->class->xine->port_ticket, 1);
271
-  if(!(this->stream->video_out->get_capabilities(this->stream->video_out) &
272
-       VO_CAP_UNSCALED_OVERLAY))
273
-    LOGMSG("WARNING: Video output driver reports it does not support unscaled overlays !");
274
-  this->class->xine->port_ticket->release(this->class->xine->port_ticket, 1);
275
+  if (_x_lock_port_rewiring(this->class->xine, 0)) {
276
+    if(!(this->stream->video_out->get_capabilities(this->stream->video_out) &
277
+         VO_CAP_UNSCALED_OVERLAY))
278
+      LOGMSG("WARNING: Video output driver reports it does not support unscaled overlays !");
279
+    _x_unlock_port_rewiring(this->class->xine);
280
+  }
281
 
282
   this->threads_initialized = 1;
283
   return 1;

Return to bug 253304