diff options
Diffstat (limited to 'src/xine-engine')
-rw-r--r-- | src/xine-engine/video_out.c | 42 | ||||
-rw-r--r-- | src/xine-engine/video_out.h | 12 | ||||
-rw-r--r-- | src/xine-engine/video_overlay.c | 21 |
3 files changed, 57 insertions, 18 deletions
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index 6a278758b..3e14a4229 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -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: video_out.c,v 1.82 2002/03/21 12:58:20 miguelfreitas Exp $ + * $Id: video_out.c,v 1.83 2002/03/21 16:21:02 miguelfreitas Exp $ * * frame allocation / queuing / scheduling / output functions */ @@ -60,7 +60,8 @@ typedef struct { vo_frame_t *last_frame; vo_frame_t *img_backup; int backup_is_logo; - + int redraw_needed; + int video_loop_running; int video_opened; pthread_t video_thread; @@ -453,15 +454,16 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts) { this->img_backup->decoder_locked = 0; this->img_backup->display_locked = 1; this->img_backup->driver_locked = 0; - this->img_backup->duration = 10000; + this->img_backup->duration = 3000; xine_fast_memcpy(this->img_backup->base[0], this->logo_yuy2, this->logo_w*this->logo_h*2); this->backup_is_logo = 1; + this->redraw_needed = 1; } - if (this->img_backup) { + if (this->img_backup && this->redraw_needed) { #ifdef LOG printf("video_out: generating still frame (cur_vpts = %lld) \n", @@ -576,9 +578,26 @@ static void overlay_and_display_frame (vos_t *this, this->video_loop_running && this->overlay_enabled); } - this->driver->display_frame (this->driver, img); + this->driver->display_frame (this->driver, img); + + this->redraw_needed = 0; +} + +static void check_redraw_needed (vos_t *this, int64_t vpts) { + + if (this->overlay_source) { + /* This is the only way for the overlay manager to get pts values + * for flushing its buffers. So don't remove it! */ + + if( this->overlay_source->redraw_needed (this->overlay_source, vpts) ) + this->redraw_needed = 1; + } + + if( this->driver->redraw_needed (this->driver) ) + this->redraw_needed = 1; } + static void *video_out_loop (void *this_gen) { int64_t vpts, diff; @@ -622,6 +641,10 @@ static void *video_out_loop (void *this_gen) { #endif overlay_and_display_frame (this, img); } + else + { + check_redraw_needed( this, vpts ); + } /* * if we haven't heared from the decoder for some time @@ -666,15 +689,6 @@ static void *video_out_loop (void *this_gen) { usec_to_sleep, vpts); #endif - /* - if( usec_to_sleep > 1000000 ) - { - printf ("video_out: master clock changed\n"); - next_frame_vpts = vpts; - usec_to_sleep = 0; - } - */ - if (usec_to_sleep>0) xine_usec_sleep (usec_to_sleep); diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index 78147f1c2..58fc2c397 100644 --- a/src/xine-engine/video_out.h +++ b/src/xine-engine/video_out.h @@ -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: video_out.h,v 1.50 2002/03/14 13:57:15 miguelfreitas Exp $ + * $Id: video_out.h,v 1.51 2002/03/21 16:21:02 miguelfreitas Exp $ * * * xine version of video_out.h @@ -259,7 +259,7 @@ struct vo_instance_s { * from generic vo functions. */ -#define VIDEO_OUT_DRIVER_IFACE_VERSION 4 +#define VIDEO_OUT_DRIVER_IFACE_VERSION 5 struct vo_driver_s { @@ -307,6 +307,12 @@ struct vo_driver_s { void *data); void (*exit) (vo_driver_t *this); + + /* check if a redraw is needed (due to resize) + * this is only used for still frames, normal video playback + * must call that inside display_frame() function. + */ + int (*redraw_needed) (vo_driver_t *this); }; @@ -354,6 +360,8 @@ struct video_overlay_instance_s { void (*flush_events) (video_overlay_instance_t *this_gen ); + int (*redraw_needed) (video_overlay_instance_t *this_gen, int64_t vpts ); + void (*multiple_overlay_blend) (video_overlay_instance_t *this_gen, int64_t vpts, vo_driver_t *output, vo_frame_t *vo_img, int enabled); }; diff --git a/src/xine-engine/video_overlay.c b/src/xine-engine/video_overlay.c index 52b01beb8..2101cc455 100644 --- a/src/xine-engine/video_overlay.c +++ b/src/xine-engine/video_overlay.c @@ -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: video_overlay.c,v 1.16 2002/03/14 13:57:15 miguelfreitas Exp $ + * $Id: video_overlay.c,v 1.17 2002/03/21 16:21:03 miguelfreitas Exp $ * */ @@ -328,16 +328,19 @@ static void video_overlay_print_overlay( vo_overlay_t *ovl ) { /* process overlay events if vpts == 0 will process everything now (used in flush) + return true if something has been processed */ -static void video_overlay_event( video_overlay_t *this, int64_t vpts ) { +static int video_overlay_event( video_overlay_t *this, int64_t vpts ) { int32_t handle; uint32_t this_event; + int processed = 0; pthread_mutex_lock (&this->video_overlay_events_mutex); this_event=this->video_overlay_events[0].next_event; while ( this_event && (vpts > this->video_overlay_events[this_event].event->vpts || vpts == 0) ) { + processed++; handle=this->video_overlay_events[this_event].event->object.handle; switch( this->video_overlay_events[this_event].event->event_type ) { case EVENT_SHOW_SPU: @@ -597,6 +600,8 @@ static void video_overlay_event( video_overlay_t *this, int64_t vpts ) { } pthread_mutex_unlock (&this->video_overlay_events_mutex); + + return processed; } /* This is called from video_out.c @@ -636,6 +641,17 @@ static void video_overlay_flush_events(video_overlay_instance_t *this_gen ) video_overlay_event( this, 0 ); } +/* this is called from video_out.c on still frames to check + if a redraw is needed. +*/ +static int video_overlay_redraw_needed(video_overlay_instance_t *this_gen, int64_t vpts ) +{ + video_overlay_t *this = (video_overlay_t *) this_gen; + + return video_overlay_event( this, vpts ); +} + + static void video_overlay_dispose(video_overlay_instance_t *this_gen) { video_overlay_t *this = (video_overlay_t *) this_gen; @@ -663,6 +679,7 @@ video_overlay_instance_t *video_overlay_new_instance () { this->video_overlay.free_handle = video_overlay_free_handle; this->video_overlay.add_event = video_overlay_add_event; this->video_overlay.flush_events = video_overlay_flush_events; + this->video_overlay.redraw_needed = video_overlay_redraw_needed; this->video_overlay.multiple_overlay_blend = video_overlay_multiple_overlay_blend; return (video_overlay_instance_t *) &this->video_overlay; |