summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video_out/video_out_sdl.c9
-rw-r--r--src/video_out/video_out_syncfb.c22
-rw-r--r--src/video_out/video_out_x11.h5
-rw-r--r--src/video_out/video_out_xv.c13
-rw-r--r--src/xine-engine/video_out.c257
-rw-r--r--src/xine-engine/video_out.h6
-rw-r--r--src/xine-engine/xine.c31
7 files changed, 212 insertions, 131 deletions
diff --git a/src/video_out/video_out_sdl.c b/src/video_out/video_out_sdl.c
index 39efccc63..f724fd057 100644
--- a/src/video_out/video_out_sdl.c
+++ b/src/video_out/video_out_sdl.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_sdl.c,v 1.3 2002/01/22 01:43:13 miguelfreitas Exp $
+ * $Id: video_out_sdl.c,v 1.4 2002/01/24 23:09:53 guenter Exp $
*
* video_out_sdl.c, Simple DirectMedia Layer
*
@@ -513,13 +513,6 @@ static int sdl_gui_data_exchange (vo_driver_t *this_gen,
sdl_adapt_to_output_area (this, area->x, area->y, area->w, area->h);
break;
- case GUI_DATA_EX_LOGO_VISIBILITY:
-#ifdef SDL_LOG
- printf ("video_out_sdl: GUI_DATA_EX_LOGO_VISIBILITY\n");
-#endif
- /* FIXME: implement */
- break;
-
case GUI_DATA_EX_DRAWABLE_CHANGED:
#ifdef SDL_LOG
printf ("video_out_sdl: GUI_DATA_EX_DRAWABLE_CHANGED\n");
diff --git a/src/video_out/video_out_syncfb.c b/src/video_out/video_out_syncfb.c
index b163f8adb..87a042c61 100644
--- a/src/video_out/video_out_syncfb.c
+++ b/src/video_out/video_out_syncfb.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_syncfb.c,v 1.51 2002/01/22 01:43:13 miguelfreitas Exp $
+ * $Id: video_out_syncfb.c,v 1.52 2002/01/24 23:09:53 guenter Exp $
*
* video_out_syncfb.c, SyncFB (for Matrox G200/G400 cards) interface for xine
*
@@ -88,7 +88,6 @@ typedef struct {
int screen_depth;
int video_win_visibility;
- int logo_visibility;
syncfb_property_t props[VO_NUM_PROPERTIES];
@@ -455,13 +454,12 @@ static void syncfb_adapt_to_output_area(syncfb_driver_t* this,
static int prev_posx = 0;
static int prev_posy = 0;
static int prev_v_w_visibility = 0;
- static int prev_logo_visibility = 0;
XLockDisplay(this->display);
XGetWindowAttributes(this->display, this->drawable, &window_attributes);
- if(this->logo_visibility || !this->video_win_visibility || window_attributes.map_state == IsUnmapped || window_attributes.map_state == IsUnviewable)
+ if (!this->video_win_visibility || window_attributes.map_state == IsUnmapped || window_attributes.map_state == IsUnviewable)
posx = posy = -1;
else
XTranslateCoordinates(this->display, this->drawable, window_attributes.root, 0, 0, &posx, &posy, &temp_window);
@@ -508,8 +506,7 @@ static void syncfb_adapt_to_output_area(syncfb_driver_t* this,
prev_deinterlacing != this->deinterlace_enabled ||
prev_posx != posx ||
prev_posy != posy ||
- prev_v_w_visibility != this->video_win_visibility ||
- prev_logo_visibility != this->logo_visibility) {
+ prev_v_w_visibility != this->video_win_visibility) {
prev_output_width = this->output_width;
prev_output_height = this->output_height;
@@ -521,7 +518,6 @@ static void syncfb_adapt_to_output_area(syncfb_driver_t* this,
prev_posx = posx;
prev_posy = posy;
prev_v_w_visibility = this->video_win_visibility;
- prev_logo_visibility = this->logo_visibility;
/*
* configuring SyncFB module from this point on.
@@ -1089,17 +1085,6 @@ static int syncfb_gui_data_exchange (vo_driver_t* this_gen, int data_type, void
}
break;
- case GUI_DATA_EX_LOGO_VISIBILITY: {
- this->logo_visibility = (int)(int *)data;
-
- this->delivered_width = 0;
- this->delivered_height = 0;
- this->delivered_ratio_code = 0;
-
- syncfb_adapt_to_output_area(this, this->output_xoffset, this->output_yoffset, this->output_width, this->output_height);
- }
- break;
-
default:
return -1;
}
@@ -1249,7 +1234,6 @@ vo_driver_t *init_video_out_plugin (config_values_t *config, void *visual_gen) {
this->frame_height = 0;
this->frame_width = 0;
this->gc = XCreateGC (this->display, this->drawable, 0, NULL);
- this->logo_visibility = 0;
this->output_height = 0;
this->output_width = 0;
this->output_xoffset = 0;
diff --git a/src/video_out/video_out_x11.h b/src/video_out/video_out_x11.h
index ae8a1a39b..8bb8c7f49 100644
--- a/src/video_out/video_out_x11.h
+++ b/src/video_out/video_out_x11.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_x11.h,v 1.12 2002/01/22 20:15:00 mshopf Exp $
+ * $Id: video_out_x11.h,v 1.13 2002/01/24 23:09:54 guenter Exp $
*
* structs and defines specific to all x11 related output plugins
* (any x11 base xine ui should include this)
@@ -105,9 +105,6 @@ typedef struct {
/* int *data */
#define GUI_DATA_EX_VIDEOWIN_VISIBLE 5
/* int *data */
-#define GUI_DATA_EX_LOGO_VISIBILITY 6
-
-/* int *data */
#define GUI_DATA_EX_FULLSCREEN 7
/* *data contains chosen visual, select a new one or change it to NULL
diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c
index b21c6df23..68fd7b15d 100644
--- a/src/video_out/video_out_xv.c
+++ b/src/video_out/video_out_xv.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_xv.c,v 1.89 2002/01/22 01:43:13 miguelfreitas Exp $
+ * $Id: video_out_xv.c,v 1.90 2002/01/24 23:09:54 guenter Exp $
*
* video_out_xv.c, X11 video extension interface for xine
*
@@ -1037,17 +1037,6 @@ static int xv_gui_data_exchange (vo_driver_t *this_gen,
xv_adapt_to_output_area (this, area->x, area->y, area->w, area->h);
break;
- case GUI_DATA_EX_LOGO_VISIBILITY:
-
- if (!data)
- xv_clear_unused_output_area (this,
- this->window_xoffset,
- this->window_yoffset,
- this->window_width,
- this->window_height);
- break;
-
-
case GUI_DATA_EX_COMPLETION_EVENT: {
XShmCompletionEvent *cev = (XShmCompletionEvent *) data;
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index a66f6111b..6c81da8cf 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.66 2002/01/15 13:51:10 guenter Exp $
+ * $Id: video_out.c,v 1.67 2002/01/24 23:09:54 guenter Exp $
*
*/
@@ -31,6 +31,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
+#include <zlib.h>
#include "video_out.h"
#include "xine_internal.h"
@@ -181,13 +182,53 @@ static void video_out_send_decoder_flush( fifo_buffer_t *video_fifo ) {
}
+static vo_frame_t *vo_get_frame (vo_instance_t *this,
+ uint32_t width, uint32_t height,
+ int ratio, int format, uint32_t duration,
+ int flags) {
+
+ vo_frame_t *img;
+
+ /*
+ printf ("video_out : get_frame %d x %d from queue %d\n",
+ width, height, this->free_img_buf_queue);
+ fflush(stdout);
+ */
+
+ if (this->pts_per_frame != duration) {
+ this->pts_per_frame = duration;
+ this->pts_per_half_frame = duration / 2;
+ this->metronom->set_video_rate (this->metronom, duration);
+ }
+
+ img = vo_remove_from_img_buf_queue (this->free_img_buf_queue);
+ pthread_mutex_lock (&img->mutex);
+ img->display_locked = 0;
+ img->decoder_locked = 1;
+ img->driver_locked = 0;
+ img->width = width;
+ img->height = height;
+ img->ratio = ratio;
+ img->format = format;
+ img->duration = duration;
+ img->drawn = 0;
+
+ /* let driver ensure this image has the right format */
+
+ this->driver->update_frame_format (this->driver, img, width, height, ratio, format, flags);
+
+ pthread_mutex_unlock (&img->mutex);
+
+ return img;
+}
static void *video_out_loop (void *this_gen) {
uint32_t cur_pts;
int diff, absdiff, pts=0;
vo_frame_t *img, *img_backup;
+ int backup_is_logo = 0;
uint32_t video_step, video_step_new;
vo_instance_t *this = (vo_instance_t *) this_gen;
static int prof_video_out = -1;
@@ -325,7 +366,8 @@ static void *video_out_loop (void *this_gen) {
/* we must not clear display_locked from img_backup.
without it decoder may try to free our backup. */
- img_backup = img;
+ img_backup = img;
+ backup_is_logo = 0;
} else {
pthread_mutex_lock (&img->mutex);
@@ -352,6 +394,51 @@ static void *video_out_loop (void *this_gen) {
printf ("video_out : no frame\n");
#endif
+ /*
+ * display logo ?
+ */
+ if (!this->video_opened && (!img_backup || !backup_is_logo)) {
+
+ if (img_backup) {
+ pthread_mutex_lock (&img_backup->mutex);
+#ifdef VIDEO_OUT_LOG
+ printf("video_out : overwriting frame backup\n");
+#endif
+ img_backup->display_locked = 0;
+ if (!img_backup->decoder_locked)
+ vo_append_to_img_buf_queue (this->free_img_buf_queue, img_backup);
+
+ pthread_mutex_unlock (&img_backup->mutex);
+ }
+
+ img_backup = vo_get_frame (this, this->logo_w, this->logo_h,
+ 42, IMGFMT_YUY2, 6000, VO_BOTH_FIELDS);
+
+ img_backup->decoder_locked = 0;
+ img_backup->display_locked = 1;
+ img_backup->driver_locked = 0;
+
+ xine_fast_memcpy(img_backup->base[0], this->logo_yuy2,
+ this->logo_w*this->logo_h*2);
+
+ if (img_backup->copy) {
+ int height = this->logo_h;
+ int stride = this->logo_w;
+ uint8_t* src[3];
+
+ src[0] = img->base[0];
+
+ while ((height -= 16) >= 0) {
+ img->copy(img, src);
+ src[0] += 32 * stride;
+ }
+ }
+
+ backup_is_logo = 1;
+
+ }
+
+
if (img_backup) {
/*
@@ -383,9 +470,11 @@ static void *video_out_loop (void *this_gen) {
diff = 0;
} else {
+
#ifdef VIDEO_OUT_LOG
printf ("video_out : no frame, but no backup frame\n");
#endif
+
xine_profiler_stop_count (prof_video_out);
continue;
}
@@ -426,6 +515,7 @@ static void *video_out_loop (void *this_gen) {
this->xine->video_fifo->size(this->xine->video_fifo), flush_sent);
img_backup = this->duplicate_frame(this, img);
+ backup_is_logo = 0;
}
flush_sent = 0;
@@ -518,75 +608,6 @@ static uint32_t vo_get_capabilities (vo_instance_t *this) {
return this->driver->get_capabilities (this->driver);
}
-static void vo_open (vo_instance_t *this) {
-
- pthread_attr_t pth_attrs;
- int err;
-
- if (!this->video_loop_running) {
- this->video_loop_running = 1;
- this->decoder_started_flag = 0;
- this->pts_per_frame = 0;
-
- pthread_attr_init(&pth_attrs);
- pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM);
-
- if((err = pthread_create (&this->video_thread,
- &pth_attrs, video_out_loop, this)) != 0) {
-
- LOG_MSG(this->xine, _("video_out : can't create thread (%s)\n"), strerror(err));
- /* FIXME: how does this happen ? */
- LOG_MSG(this->xine, _("video_out : sorry, this should not happen. please restart xine.\n"));
- exit(1);
- }
- else
- LOG_MSG(this->xine, _("video_out : thread created\n"));
- } else
- LOG_MSG(this->xine, _("video_out : vo_open : warning! video thread already running\n"));
-
-}
-
-static vo_frame_t *vo_get_frame (vo_instance_t *this,
- uint32_t width, uint32_t height,
- int ratio, int format, uint32_t duration,
- int flags) {
-
- vo_frame_t *img;
-
- /*
- printf ("video_out : get_frame %d x %d from queue %d\n",
- width, height, this->free_img_buf_queue);
- fflush(stdout);
- */
-
- if (this->pts_per_frame != duration) {
- this->pts_per_frame = duration;
- this->pts_per_half_frame = duration / 2;
- this->metronom->set_video_rate (this->metronom, duration);
- }
-
- img = vo_remove_from_img_buf_queue (this->free_img_buf_queue);
-
- pthread_mutex_lock (&img->mutex);
- img->display_locked = 0;
- img->decoder_locked = 1;
- img->driver_locked = 0;
- img->width = width;
- img->height = height;
- img->ratio = ratio;
- img->format = format;
- img->duration = duration;
- img->drawn = 0;
-
- /* let driver ensure this image has the right format */
-
- this->driver->update_frame_format (this->driver, img, width, height, ratio, format, flags);
-
- pthread_mutex_unlock (&img->mutex);
-
- return img;
-}
-
static vo_frame_t * vo_duplicate_frame( vo_instance_t *this, vo_frame_t *img ) {
vo_frame_t *dupl;
int image_size;
@@ -661,20 +682,19 @@ static vo_frame_t * vo_duplicate_frame( vo_instance_t *this, vo_frame_t *img ) {
return dupl;
}
+static void vo_open (vo_instance_t *this) {
+
+ this->video_opened = 1;
+
+}
+
static void vo_close (vo_instance_t *this) {
/* this will make sure all hide events were processed */
if (this->overlay_source)
this->overlay_source->flush_events (this->overlay_source);
-
- if (this->video_loop_running) {
- void *p;
- this->video_loop_running = 0;
- this->video_paused = 0;
- /*kill (0, SIGALRM);*/
- pthread_join (this->video_thread, &p);
- }
+ this->video_opened = 0;
}
static void vo_free_img_buffers (vo_instance_t *this) {
@@ -693,9 +713,21 @@ static void vo_free_img_buffers (vo_instance_t *this) {
static void vo_exit (vo_instance_t *this) {
+ printf ("video_out: vo_exit...\n");
+ if (this->video_loop_running) {
+ void *p;
+
+ this->video_loop_running = 0;
+ this->video_paused = 0;
+
+ pthread_join (this->video_thread, &p);
+ }
+
vo_free_img_buffers (this);
this->driver->exit (this->driver);
+
+ printf ("video_out: vo_exit... done\n");
}
static void vo_frame_displayed (vo_frame_t *img) {
@@ -836,10 +868,24 @@ static void vo_decoder_started (vo_instance_t *this) {
this->decoder_started_flag = 1;
}
+static uint16_t gzread_i16(gzFile *fp) {
+ uint16_t ret;
+ ret = gzgetc(fp) << 8 ;
+ ret |= gzgetc(fp);
+ return ret;
+}
+
+#define LOGO_PATH_MAX 1025
+
vo_instance_t *vo_new_instance (vo_driver_t *driver, xine_t *xine) {
vo_instance_t *this;
int i;
+ char pathname[LOGO_PATH_MAX];
+ pthread_attr_t pth_attrs;
+ int err;
+ gzFile *fp;
+
this = xine_xmalloc (sizeof (vo_instance_t)) ;
this->driver = driver;
@@ -863,8 +909,8 @@ vo_instance_t *vo_new_instance (vo_driver_t *driver, xine_t *xine) {
this->display_img_buf_queue = vo_new_img_buf_queue ();
this->video_loop_running = 0;
this->video_paused = 0;
- this->pts_per_frame = 0;
- this->pts_per_half_frame = 0;
+ this->pts_per_frame = 6000;
+ this->pts_per_half_frame = 3000;
this->overlay_source = video_overlay_new_instance();
this->overlay_source->init (this->overlay_source);
@@ -884,6 +930,55 @@ vo_instance_t *vo_new_instance (vo_driver_t *driver, xine_t *xine) {
img);
}
+ /*
+ * load xine logo
+ */
+
+ snprintf (pathname, LOGO_PATH_MAX, "%s/xine_logo.zyuy2", XINE_SKINDIR);
+
+ if ((fp = gzopen (pathname, "rb")) != NULL) {
+
+ this->logo_w = gzread_i16 (fp);
+ this->logo_h = gzread_i16 (fp);
+
+ printf ("video_out: loading logo %d x %d pixels, yuy2\n",
+ this->logo_w, this->logo_h);
+
+ this->logo_yuy2 = malloc (this->logo_w * this->logo_h *2);
+
+ gzread (fp, this->logo_yuy2, this->logo_w * this->logo_h *2);
+
+ gzclose (fp);
+ }
+
+ /*
+ * start video output thread
+ *
+ * this thread will alwys be running, displaying the
+ * logo when "idle" thus making it possible to have
+ * osd when not playing a stream
+ */
+
+ this->video_loop_running = 1;
+ this->decoder_started_flag = 0;
+ this->video_opened = 0;
+
+ pthread_attr_init(&pth_attrs);
+ pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM);
+
+ if ((err = pthread_create (&this->video_thread,
+ &pth_attrs, video_out_loop, this)) != 0) {
+
+ printf (_("video_out: can't create thread (%s)\n"),
+ strerror(err));
+ /* FIXME: how does this happen ? */
+ printf (_("video_out: sorry, this should not happen. please restart xine.\n"));
+ exit(1);
+ } else
+ LOG_MSG(this->xine, _("video_out : thread created\n"));
+
return this;
}
+
+
diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h
index c591b25b5..7738e8ad8 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.38 2002/01/15 20:22:44 jcdutton Exp $
+ * $Id: video_out.h,v 1.39 2002/01/24 23:09:54 guenter Exp $
*
*
* xine version of video_out.h
@@ -170,6 +170,7 @@ struct vo_instance_s {
vo_frame_t *last_frame;
int video_loop_running;
+ int video_opened;
int video_paused;
pthread_t video_thread;
@@ -182,6 +183,9 @@ struct vo_instance_s {
int decoder_started_flag;
uint32_t last_draw_vpts;
+
+ int logo_w, logo_h;
+ uint8_t *logo_yuy2;
} ;
/* constants for the get/set property functions */
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index d8cc7b2e6..023f3618c 100644
--- a/src/xine-engine/xine.c
+++ b/src/xine-engine/xine.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: xine.c,v 1.99 2002/01/16 17:35:34 miguelfreitas Exp $
+ * $Id: xine.c,v 1.100 2002/01/24 23:09:54 guenter Exp $
*
* top-level xine functions
*
@@ -116,7 +116,7 @@ static void xine_internal_osd (xine_t *this, char *str,
uint32_t seconds;
char tstr[256];
- if( this->osd_display ) {
+ if (this->osd_display) {
this->osd_renderer->filled_rect (this->osd, 0, 0, 299, 99, 0);
this->osd_renderer->render_text (this->osd, 0, 5, str, OSD_TEXT1);
@@ -194,7 +194,7 @@ void xine_stop (xine_t *this) {
am i abusing of xine architeture? :)
*/
this->metronom->adjust_clock(this->metronom,
- this->metronom->get_current_time(this->metronom) + 30 * 90000 );
+ this->metronom->get_current_time(this->metronom) + 30 * 90000 );
}
@@ -301,7 +301,7 @@ int xine_play (xine_t *this, char *mrl,
/* this will make output threads discard about everything
(seeking should be faster!) */
this->metronom->adjust_clock(this->metronom,
- this->metronom->get_current_time(this->metronom) + 30 * 90000 );
+ this->metronom->get_current_time(this->metronom) + 30 * 90000 );
this->status = XINE_STOP;
}
@@ -446,7 +446,7 @@ xine_t *xine_init (vo_driver_t *vo,
bindtextdomain("xine-lib", XINE_LOCALEDIR);
#endif
- LOG_MSG(this, _("xine_init entered\n"));
+ printf ("xine: xine_init entered\n");
this->err = XINE_ERROR_NONE;
this->config = config;
@@ -519,7 +519,26 @@ xine_t *xine_init (vo_driver_t *vo,
this->audio_out = ao_new_instance (ao, this->metronom, config);
audio_decoder_init (this);
- LOG_MSG(this, _("xine_init returning\n"));
+
+ /*
+ * start metronom clock (needed for osd)
+ */
+
+ this->metronom->start_clock (this->metronom, 0);
+
+ if (this->osd_display) {
+
+ char tstr[30];
+
+ this->osd_renderer->filled_rect (this->osd, 0, 0, 299, 99, 0);
+ sprintf (tstr, "xine-lib v%01d.%01d.%01d", XINE_MAJOR, XINE_MINOR, XINE_SUB);
+
+ this->osd_renderer->render_text (this->osd, 5, 5, tstr, OSD_TEXT1);
+
+ this->osd_renderer->show (this->osd, 0);
+ this->osd_renderer->hide (this->osd, 300000);
+ }
+
return this;
}