diff options
-rw-r--r-- | misc/Makefile.am | 6 | ||||
-rw-r--r-- | misc/xine-logoconv.c | 236 | ||||
-rw-r--r-- | misc/xine_logo.mpg | bin | 0 -> 27309 bytes | |||
-rw-r--r-- | misc/xine_logo.yv12.gz | bin | 29869 -> 0 bytes | |||
-rw-r--r-- | src/xine-engine/video_out.c | 129 | ||||
-rw-r--r-- | src/xine-engine/xine.c | 21 |
6 files changed, 22 insertions, 370 deletions
diff --git a/misc/Makefile.am b/misc/Makefile.am index b8712a15d..9c774b6ab 100644 --- a/misc/Makefile.am +++ b/misc/Makefile.am @@ -1,11 +1,11 @@ SUBDIRS = fonts EXTRA_DIST = autogen.sh upload.pl SlackBuild.in SlackBuild build_rpms.sh \ - xine-lib.spec.in xine-lib.spec \ - xine_logo.png xine_logo.yv12.gz xine-fontconv.c + xine-lib.spec.in xine-lib.spec xine-fontconv.c \ + xine_logo.png xine_logo.mpg datadir = $(XINE_SKINDIR) -data_DATA = xine_logo.png xine_logo.yv12.gz +data_DATA = xine_logo.png xine_logo.mpg bin_SCRIPTS = xine-config diff --git a/misc/xine-logoconv.c b/misc/xine-logoconv.c deleted file mode 100644 index 9965f7b5f..000000000 --- a/misc/xine-logoconv.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright (C) 2002 the xine project - * - * This file is part of xine, a free video player. - * - * xine is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * xine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * - * xine-logoconv.c - * - * converts png (or any other file types imlib understands) to xine logos - * - * xine logo file format: - * - * int16_t width - * int16_t height - * uint8_t zlib_compressed (yuy2_data[width*height*2]) - * - * compile: - * gcc -o xine-logoconv xine-logoconv.c -L/usr/X11R6/lib -lX11 -lXext -ljpeg -lpng -ltiff -lz -lImlib - * - * usage: - * xine-logoconv logo.png - * - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <zlib.h> -#include <inttypes.h> - -#include <Imlib.h> - -#define LUMARED 0.299 -#define LUMAGREEN 0.587 -#define LUMABLUE 0.114 - -static void wr16 (gzFile *fp, int i) { - - uint8_t c; - - c = i >> 8; - gzputc (fp, c); - c = i & 0xff; - gzputc (fp, c); -} - -static void save_image (char *oldname, ImlibImage *img) { - - gzFile *fp; - int32_t px, py, w, h; - char filename[1024]; - char *extension; - - w = img->rgb_width; - h = img->rgb_height; - - extension = strrchr (oldname, '.'); - if (extension) - *extension = 0; - - snprintf (filename, 1023, "%s.yv12.gz", oldname); - - if (!(fp = gzopen (filename ,"w"))) { - printf ("failed to create file '%s'\n", filename); - return; - } - - printf ("saving %d x %d logo image to %s\n", - w, h, filename); - - wr16 (fp, w); - wr16 (fp, h); - - /* - * convert yuv to yv12 - */ - - for (py=0; py<h; py++) { - printf ("."); - for (px=0; px<w; px++) { - - double r, g, b; - double y, u, v; - unsigned char cy,cu,cv; - -#ifdef WORDS_BIGENDIAN - r = img->rgb_data[(px+py*w)*3]; - g = img->rgb_data[(px+py*w)*3+1]; - b = img->rgb_data[(px+py*w)*3+2]; -#else - r = img->rgb_data[(px+py*w)*3+2]; - g = img->rgb_data[(px+py*w)*3+1]; - b = img->rgb_data[(px+py*w)*3]; -#endif - - y = (LUMARED*r) + (LUMAGREEN*g) + (LUMABLUE*b); - // u = (b-y) / (2 - 2*LUMABLUE); - // v = (r-y) / (2 - 2*LUMABLUE); - u = (b-y) / (2 - 2*LUMABLUE); - v = (r-y) / (2 - 2*LUMABLUE); - - cy = y; - cu = u + 128.0; - cv = v + 128.0; - - gzwrite (fp, &cy, 1); - } - } - - for (py=0; py<h; py+=2) { - printf ("."); - for (px=0; px<w; px+=2) { - - double r, g, b; - double y, u, v; - unsigned char cy,cu,cv; - -#ifdef WORDS_BIGENDIAN - r = img->rgb_data[(px+py*w)*3]; - g = img->rgb_data[(px+py*w)*3+1]; - b = img->rgb_data[(px+py*w)*3+2]; -#else - r = img->rgb_data[(px+py*w)*3+2]; - g = img->rgb_data[(px+py*w)*3+1]; - b = img->rgb_data[(px+py*w)*3]; -#endif - - y = (LUMARED*r) + (LUMAGREEN*g) + (LUMABLUE*b); - // u = (b-y) / (2 - 2*LUMABLUE); - // v = (r-y) / (2 - 2*LUMABLUE); - u = (b-y) / (2 - 2*LUMABLUE); - v = (r-y) / (2 - 2*LUMABLUE); - - cy = y; - cu = u + 128.0; - cv = v + 128.0; - - gzwrite (fp, &cu, 1); - - /* - printf ("%f %f %f => %f %f %f\n",r,g,b,y,u,v); - */ - - } - } - - for (py=0; py<h; py+=2) { - printf ("."); - for (px=0; px<w; px+=2) { - - double r, g, b; - double y, u, v; - unsigned char cy,cu,cv; - -#ifdef WORDS_BIGENDIAN - r = img->rgb_data[(px+py*w)*3]; - g = img->rgb_data[(px+py*w)*3+1]; - b = img->rgb_data[(px+py*w)*3+2]; -#else - r = img->rgb_data[(px+py*w)*3+2]; - g = img->rgb_data[(px+py*w)*3+1]; - b = img->rgb_data[(px+py*w)*3]; -#endif - - y = (LUMARED*r) + (LUMAGREEN*g) + (LUMABLUE*b); - // u = (b-y) / (2 - 2*LUMABLUE); - // v = (r-y) / (2 - 2*LUMABLUE); - u = (b-y) / (2 - 2*LUMABLUE); - v = (r-y) / (2 - 2*LUMABLUE); - - cy = y; - cu = u + 128.0; - cv = v + 128.0; - - gzwrite (fp, &cv, 1); - - /* - printf ("%f %f %f => %f %f %f\n",r,g,b,y,u,v); - */ - - } - } - printf ("\ndone.\n"); - gzclose(fp); -} - -int main(int argc, char *argv[]) { - - Display *display; - ImlibData *imlib_data; - ImlibImage *img; - - if (argc != 2) { - printf ("usage: %s foo.png\n", argv[0]); - exit (1); - } - - if (!(display = XOpenDisplay (NULL))) { - printf ("failed to open X11 display\n"); - exit (1); - } - - if (!(imlib_data = Imlib_init(display))) { - printf ("failed to initialize imlib\n"); - exit(1); - } - - if (!(img = Imlib_load_image(imlib_data, argv[1]))) { - printf ("failed to load '%s'\n", argv[1]); - exit(1); - } - - Imlib_render(imlib_data, img, - img->rgb_width, - img->rgb_height); - - save_image (argv[1], img); - -} diff --git a/misc/xine_logo.mpg b/misc/xine_logo.mpg Binary files differnew file mode 100644 index 000000000..b1cb59414 --- /dev/null +++ b/misc/xine_logo.mpg diff --git a/misc/xine_logo.yv12.gz b/misc/xine_logo.yv12.gz Binary files differdeleted file mode 100644 index a5a56cf61..000000000 --- a/misc/xine_logo.yv12.gz +++ /dev/null diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index a3bd2f592..569177f4d 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.95 2002/05/01 20:38:19 guenter Exp $ + * $Id: video_out.c,v 1.96 2002/05/02 01:44:44 siggi Exp $ * * frame allocation / queuing / scheduling / output functions */ @@ -60,7 +60,6 @@ typedef struct { vo_frame_t *last_frame; vo_frame_t *img_backup; - int backup_is_logo; int redraw_needed; int video_loop_running; @@ -74,10 +73,6 @@ typedef struct { /* pts value when decoder delivered last video frame */ int64_t last_delivery_pts; - char *logo_pathname; - pthread_mutex_t logo_mutex; - int logo_w, logo_h; - uint8_t *logo_yv12; video_overlay_instance_t *overlay_source; int overlay_enabled; @@ -373,7 +368,6 @@ static void expire_frames (vos_t *this, int64_t cur_vpts) { printf("video_out: possible still frame (old)\n"); this->img_backup = img; - this->backup_is_logo = 0; /* wait 4 frames before drawing this one. this allow slower systems to recover. */ @@ -406,35 +400,6 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts) { printf ("video_out: no frame\n"); #endif - /* - * display logo ? - */ - if (!this->video_opened && (!this->img_backup || !this->backup_is_logo)) { - - if (this->img_backup) { -#ifdef LOG - printf("video_out: overwriting frame backup\n"); -#endif - vo_frame_dec_lock( this->img_backup ); - } - - printf("video_out: copying logo image\n"); - - pthread_mutex_lock(&this->logo_mutex); - - this->img_backup = vo_get_frame (&this->vo, this->logo_w, this->logo_h, - 42, IMGFMT_YV12, VO_BOTH_FIELDS); - - this->img_backup->duration = 3000; - - xine_fast_memcpy(this->img_backup->base[0], this->logo_yv12, - this->logo_w*this->logo_h*3/2); - - pthread_mutex_unlock(&this->logo_mutex); - this->backup_is_logo = 1; - this->redraw_needed = 1; - } - if (this->img_backup && (this->redraw_needed==1)) { #ifdef LOG @@ -498,7 +463,6 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts) { this->xine->video_fifo->size(this->xine->video_fifo)); this->img_backup = this->vo.duplicate_frame (&this->vo, img); - this->backup_is_logo = 0; } /* @@ -811,12 +775,6 @@ static void vo_exit (vo_instance_t *this_gen) { free (this->free_img_buf_queue); free (this->display_img_buf_queue); - pthread_mutex_lock(&this->logo_mutex); - if (this->logo_yv12) - free (this->logo_yv12); - pthread_mutex_unlock(&this->logo_mutex); - pthread_mutex_destroy(&this->logo_mutex); - free (this); } @@ -839,65 +797,6 @@ static void vo_enable_overlay (vo_instance_t *this_gen, int overlay_enabled) { this->overlay_enabled = overlay_enabled; } -/* - * Logo related functions + config callback. - */ -static uint16_t gzread_i16(gzFile *fp) { - uint16_t ret; - ret = gzgetc(fp) << 8 ; - ret |= gzgetc(fp); - return ret; -} - -static int _load_logo_file(vos_t *this) { - gzFile *fp; - int retval = 0; - - pthread_mutex_lock(&this->logo_mutex); - - if ((fp = gzopen (this->logo_pathname, "rb")) != NULL) { - - if (this->logo_yv12) - free (this->logo_yv12); - - this->logo_w = gzread_i16 (fp); - this->logo_h = gzread_i16 (fp); -#ifdef LOG - printf ("video_out: loading logo %d x %d pixels, yv12\n", - this->logo_w, this->logo_h); -#endif - - this->logo_yv12 = malloc (this->logo_w * this->logo_h *3/2); - - gzread (fp, this->logo_yv12, this->logo_w * this->logo_h *3/2); - gzclose (fp); - - this->backup_is_logo = 0; - - retval = 1; - } - - pthread_mutex_unlock(&this->logo_mutex); - return retval; -} - -#ifdef LOGO_CONFIG_OPTION -static void _logo_change_cb(void *data, cfg_entry_t *cfg) { - vos_t *this = (vos_t *) data; - char default_logo[2048]; - - this->logo_pathname = cfg->str_value; - - if(!_load_logo_file(this)) { -#ifdef LOG - printf("_load_logo_file() failed, reload default\n"); -#endif - snprintf(default_logo, 2048, "%s/xine_logo.yv12.gz", XINE_SKINDIR); - cfg->config->update_string(cfg->config, cfg->key, default_logo); - } -} - -#endif vo_instance_t *vo_new_instance (vo_driver_t *driver, xine_t *xine) { @@ -932,7 +831,6 @@ vo_instance_t *vo_new_instance (vo_driver_t *driver, xine_t *xine) { this->video_loop_running = 0; this->img_backup = NULL; - this->backup_is_logo = 0; this->overlay_source = video_overlay_new_instance(); this->overlay_source->init (this->overlay_source); @@ -962,31 +860,6 @@ vo_instance_t *vo_new_instance (vo_driver_t *driver, xine_t *xine) { } - /* - * load xine logo - */ - { - config_values_t *config; - char default_logo[2048]; - - config = xine->config; - - pthread_mutex_init(&this->logo_mutex, NULL); - -#ifdef LOGO_CONFIG_OPTION - snprintf(default_logo, 2048, "%s/xine_logo.yv12.gz", XINE_SKINDIR); - - this->logo_pathname = config->register_string(config, "video.logo_file", default_logo, - "logo displayed in video output window", NULL, - _logo_change_cb, (void *) this); -#else - this->logo_pathname = malloc (2048); - snprintf (this->logo_pathname, 2048, "%s/xine_logo.yv12.gz", XINE_SKINDIR); -#endif - - _load_logo_file(this); - } - /* * start video output thread * diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 7814fdae6..d9eb2f396 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.123 2002/05/01 19:42:57 guenter Exp $ + * $Id: xine.c,v 1.124 2002/05/02 01:44:44 siggi Exp $ * * top-level xine functions * @@ -56,15 +56,25 @@ #include "xineutils.h" #include "compat.h" +static char *logo_mrl= XINE_SKINDIR "/xine_logo.mpg"; +#define LOGO_DELAY 500000 /* usec */ + void * xine_notify_stream_finished_thread (void * this_gen) { xine_t *this = this_gen; xine_event_t event; xine_stop_internal (this); - event.type = XINE_EVENT_PLAYBACK_FINISHED; + if (strcmp(this->cur_mrl, logo_mrl)) { + + event.type = XINE_EVENT_PLAYBACK_FINISHED; + xine_send_event (this, &event); - xine_send_event (this, &event); + xine_usec_sleep (LOGO_DELAY); + if (this->status == XINE_STOP) { + xine_play(this, logo_mrl, 0, 0); + } + } pthread_detach( pthread_self() ); @@ -213,6 +223,7 @@ void xine_stop_internal (xine_t *this) { printf ("xine_stop: done\n"); pthread_mutex_unlock (&this->xine_lock); + } void xine_stop (xine_t *this) { @@ -224,6 +235,9 @@ void xine_stop (xine_t *this) { */ this->metronom->adjust_clock(this->metronom, this->metronom->get_current_time(this->metronom) + 30 * 90000 ); + + xine_play(this, logo_mrl,0,0); + } @@ -612,6 +626,7 @@ xine_t *xine_init (vo_driver_t *vo, this->osd_renderer->hide (this->osd, 300000); } + xine_play(this, logo_mrl,0,0); return this; } |