From c45882ae342607f721d53f258b700cb9b6958991 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Fri, 21 Mar 2003 17:54:53 +0000 Subject: add pvr realtime reporting event CVS patchset: 4464 CVS date: 2003/03/21 17:54:53 --- include/xine.h.in | 11 ++++++++++- src/input/input_pvr.c | 25 +++++++++++++++++++++---- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/include/xine.h.in b/include/xine.h.in index 34306ae9d..bf2abeda8 100644 --- a/include/xine.h.in +++ b/include/xine.h.in @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine.h.in,v 1.68 2003/03/20 22:58:41 miguelfreitas Exp $ + * $Id: xine.h.in,v 1.69 2003/03/21 17:54:54 miguelfreitas Exp $ * * public xine-lib (libxine) interface and documentation * @@ -1229,6 +1229,7 @@ void xine_config_reset (xine_t *self); #define XINE_EVENT_SET_V4L2 200 #define XINE_EVENT_PVR_SAVE 201 #define XINE_EVENT_PVR_REPORT_NAME 202 +#define XINE_EVENT_PVR_REALTIME 203 /* * xine event struct @@ -1349,6 +1350,14 @@ typedef struct { char name[256]; /* name for saving, might be longer */ } xine_pvr_save_data_t; +typedef struct { + /* mode values: + * 0 = non realtime + * 1 = realtime + */ + int mode; +} xine_pvr_realtime_t; + #endif /* opaque xine_event_queue_t */ diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c index 84302450d..d03a32558 100644 --- a/src/input/input_pvr.c +++ b/src/input/input_pvr.c @@ -39,7 +39,7 @@ * usage: * xine pvr:\!\! * - * $Id: input_pvr.c,v 1.11 2003/03/21 17:41:13 miguelfreitas Exp $ + * $Id: input_pvr.c,v 1.12 2003/03/21 17:54:53 miguelfreitas Exp $ */ /************************************************************************** @@ -604,7 +604,9 @@ static int pvr_rec_file(pvr_input_plugin_t *this) { static int pvr_play_file(pvr_input_plugin_t *this, fifo_buffer_t *fifo, uint8_t *buffer, int speed) { off_t pos; - + xine_event_t event; + xine_pvr_realtime_t data; + /* check for realtime. don't switch back unless enough buffers are * free to not block the pvr thread */ if( this->play_blk >= this->rec_blk-1 && speed >= XINE_SPEED_NORMAL && @@ -624,6 +626,13 @@ static int pvr_play_file(pvr_input_plugin_t *this, fifo_buffer_t *fifo, uint8_t #ifdef LOG printf("input_pvr: switching back to realtime\n"); #endif + event.type = XINE_EVENT_PVR_REALTIME; + event.stream = this->stream; + event.data = &data; + event.data_length = sizeof(data); + gettimeofday(&event.tv, NULL); + data.mode = 1; + xine_event_send(this->stream, &event); } this->want_data = 1; @@ -634,11 +643,19 @@ static int pvr_play_file(pvr_input_plugin_t *this, fifo_buffer_t *fifo, uint8_t if( this->play_fd == -1 || (this->play_blk - this->page_block[this->play_page]) >= BLOCKS_PER_PAGE ) { + if(this->play_fd == -1) { #ifdef LOG - if(this->play_fd == -1) printf("input_pvr: switching to non-realtime\n"); #endif - + event.type = XINE_EVENT_PVR_REALTIME; + event.stream = this->stream; + event.data = &data; + event.data_length = sizeof(data); + gettimeofday(&event.tv, NULL); + data.mode = 0; + xine_event_send(this->stream, &event); + } + if( this->play_fd != -1 && this->play_fd != this->rec_fd ) { close(this->play_fd); } -- cgit v1.2.3