summaryrefslogtreecommitdiff
path: root/xine_input_vdr.c
diff options
context:
space:
mode:
authorphintuka <phintuka>2008-06-12 22:05:32 +0000
committerphintuka <phintuka>2008-06-12 22:05:32 +0000
commitefff3868262e9cc0de92e7ac8cdee0c58a17641f (patch)
tree5876dd579d125e7aae7bcebe035d8d83c3b278a9 /xine_input_vdr.c
parentedf4da907246391e820a6e15a3d869619be37791 (diff)
downloadxineliboutput-efff3868262e9cc0de92e7ac8cdee0c58a17641f.tar.gz
xineliboutput-efff3868262e9cc0de92e7ac8cdee0c58a17641f.tar.bz2
Splitting large vdr_plugin_read_block (adjust_scr_speed)
Diffstat (limited to 'xine_input_vdr.c')
-rw-r--r--xine_input_vdr.c65
1 files changed, 36 insertions, 29 deletions
diff --git a/xine_input_vdr.c b/xine_input_vdr.c
index f33d8c1d..5ab9b6e9 100644
--- a/xine_input_vdr.c
+++ b/xine_input_vdr.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: xine_input_vdr.c,v 1.147 2008-06-12 22:00:43 phintuka Exp $
+ * $Id: xine_input_vdr.c,v 1.148 2008-06-12 22:05:32 phintuka Exp $
*
*/
@@ -5093,14 +5093,45 @@ static void handle_disconnect(vdr_input_plugin_t *this)
this->stream->emergency_brake = 1;
}
+static int adjust_scr_speed(vdr_input_plugin_t *this)
+{
+ int need_pause = 0;
+
+#ifdef ADJUST_SCR_SPEED
+ if(pthread_mutex_lock(&this->lock)) {
+ LOGERR("adjust_scr_speed: pthread_mutex_lock failed");
+ return 0;
+ }
+
+ if( (!this->live_mode && (this->fd_control < 0 ||
+ this->fixed_scr)) ||
+ this->slave_stream) {
+ if(this->scr_tunning)
+ reset_scr_tunning(this, this->speed_before_pause);
+ } else {
+# ifdef TEST_SCR_PAUSE
+ if(this->stream_start || this->send_pts) {
+ reset_scr_tunning(this, this->speed_before_pause);
+ need_pause = 1;
+ } else {
+ vdr_adjust_realtime_speed(this);
+ }
+# else
+ vdr_adjust_realtime_speed(this);
+# endif
+ }
+ pthread_mutex_unlock(&this->lock);
+#endif
+
+ return need_pause;
+}
+
static buf_element_t *vdr_plugin_read_block (input_plugin_t *this_gen,
fifo_buffer_t *fifo, off_t todo)
{
vdr_input_plugin_t *this = (vdr_input_plugin_t *) this_gen;
buf_element_t *buf = NULL;
-#ifdef TEST_SCR_PAUSE
- int need_pause = 0;
-#endif
+ int need_pause;
TRACE("vdr_plugin_read_block");
@@ -5124,31 +5155,7 @@ static buf_element_t *vdr_plugin_read_block (input_plugin_t *this_gen,
#endif
/* adjust SCR speed */
-#ifdef ADJUST_SCR_SPEED
- if(pthread_mutex_lock(&this->lock)) {
- LOGERR("read_block: pthread_mutex_lock failed");
- return NULL;
- }
-
- if( (!this->live_mode && (this->fd_control < 0 ||
- this->fixed_scr)) ||
- this->slave_stream) {
- if(this->scr_tunning)
- reset_scr_tunning(this, this->speed_before_pause);
- } else {
-# ifdef TEST_SCR_PAUSE
- if(this->stream_start || this->send_pts) {
- reset_scr_tunning(this, this->speed_before_pause);
- need_pause = 1;
- } else {
-# endif
- vdr_adjust_realtime_speed(this);
-# ifdef TEST_SCR_PAUSE
- }
-# endif
- }
- pthread_mutex_unlock(&this->lock);
-#endif
+ need_pause = adjust_scr_speed(this);
do {
buf = fifo_buffer_try_get(this->block_buffer);