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; |