diff options
-rw-r--r-- | xine/xvdr_metronom.c | 28 | ||||
-rw-r--r-- | xine/xvdr_metronom.h | 6 |
2 files changed, 30 insertions, 4 deletions
diff --git a/xine/xvdr_metronom.c b/xine/xvdr_metronom.c index 4ca3f63b..cc2b48d1 100644 --- a/xine/xvdr_metronom.c +++ b/xine/xvdr_metronom.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: xvdr_metronom.c,v 1.6 2010-02-14 13:41:25 phintuka Exp $ + * $Id: xvdr_metronom.c,v 1.7 2010-02-19 13:44:57 phintuka Exp $ * */ @@ -171,6 +171,27 @@ static void xvdr_metronom_set_still_mode(xvdr_metronom_t *this, int still_mode) this->still_mode = still_mode; } +static void xvdr_metronom_wire(xvdr_metronom_t *this) +{ + if (!this->wired) { + this->wired = 1; + + /* attach to stream */ + this->stream->metronom = &this->metronom; + } +} + +static void xvdr_metronom_unwire(xvdr_metronom_t *this) +{ + if (this->wired) { + this->wired = 0; + + /* detach from stream */ + this->stream->metronom = this->orig_metronom; + } +} + + /* * init */ @@ -186,6 +207,8 @@ xvdr_metronom_t *xvdr_metronom_init(xine_stream_t *stream) this->reset_frames = xvdr_metronom_reset_frames; this->set_trickspeed = xvdr_metronom_set_trickspeed; this->set_still_mode = xvdr_metronom_set_still_mode; + this->wire = xvdr_metronom_wire; + this->unwire = xvdr_metronom_unwire; this->dispose = xvdr_metronom_dispose; this->metronom.set_audio_rate = set_audio_rate; @@ -200,8 +223,7 @@ xvdr_metronom_t *xvdr_metronom_init(xine_stream_t *stream) this->metronom.exit = metronom_exit; - /* hook up to stream */ - this->stream->metronom = &this->metronom; + xvdr_metronom_wire(this); return this; } diff --git a/xine/xvdr_metronom.h b/xine/xvdr_metronom.h index fd24d4c0..487022ef 100644 --- a/xine/xvdr_metronom.h +++ b/xine/xvdr_metronom.h @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: xvdr_metronom.h,v 1.5 2010-02-14 13:41:25 phintuka Exp $ + * $Id: xvdr_metronom.h,v 1.6 2010-02-19 13:44:57 phintuka Exp $ * */ @@ -33,6 +33,9 @@ struct xvdr_metronom_s { void (*set_trickspeed)(xvdr_metronom_t *, int); void (*set_still_mode)(xvdr_metronom_t *, int); + void (*wire) (xvdr_metronom_t *); + void (*unwire) (xvdr_metronom_t *); + /* accumulated frame data */ volatile uint video_frames; volatile uint audio_frames; @@ -52,6 +55,7 @@ struct xvdr_metronom_s { int trickspeed; /* current trick speed */ int still_mode; int64_t last_vo_pts; /* last displayed video frame PTS */ + int wired; /* true if currently wired to stream */ #endif }; |