summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuenter Bartsch <guenter@users.sourceforge.net>2001-09-12 19:50:41 +0000
committerGuenter Bartsch <guenter@users.sourceforge.net>2001-09-12 19:50:41 +0000
commit131676c0f80f073a2f6cd9d4660fe58affb55f46 (patch)
tree5a9f44803dc7e5361f0aa5e72e5b927fb11f5577
parent351db40c64b02835f48bb299295c49deac775997 (diff)
downloadxine-lib-131676c0f80f073a2f6cd9d4660fe58affb55f46.tar.gz
xine-lib-131676c0f80f073a2f6cd9d4660fe58affb55f46.tar.bz2
adding still picture support (needed to implement menus) based on Rich's work
CVS patchset: 625 CVS date: 2001/09/12 19:50:41
-rw-r--r--configure.in1
-rw-r--r--src/Makefile.am2
-rw-r--r--src/libvfill/Makefile.am29
-rw-r--r--src/libvfill/xine_decoder.c131
-rw-r--r--src/xine-engine/video_out.c16
-rw-r--r--src/xine-engine/video_out.h10
6 files changed, 185 insertions, 4 deletions
diff --git a/configure.in b/configure.in
index 512770a6d..3ce312e18 100644
--- a/configure.in
+++ b/configure.in
@@ -659,6 +659,7 @@ src/libmad/Makefile
src/libw32dll/Makefile
src/libw32dll/wine/Makefile
src/libspudec/Makefile
+src/libvfill/Makefile
src/input/Makefile
src/xine-engine/Makefile
misc/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index 2f7bfc01f..df56389cc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,6 @@
SUBDIRS = audio_out video_out dxr3 input libmpeg2 libspudec demuxers \
- liba52 libffmpeg liblpcm libw32dll libmad xine-engine libdts
+ liba52 libffmpeg liblpcm libw32dll libmad xine-engine libdts libvfill
debug:
@list='$(SUBDIRS)'; for subdir in $$list; do \
diff --git a/src/libvfill/Makefile.am b/src/libvfill/Makefile.am
new file mode 100644
index 000000000..4548b4c72
--- /dev/null
+++ b/src/libvfill/Makefile.am
@@ -0,0 +1,29 @@
+#
+# the videofill plugin
+#
+
+CFLAGS = @GLOBAL_CFLAGS@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+
+libdir = $(XINE_PLUGINDIR)
+
+lib_LTLIBRARIES = xineplug_decode_vfill.la
+
+xineplug_decode_vfill_la_SOURCES = xine_decoder.c
+xineplug_decode_vfill_la_LDFLAGS = -avoid-version -module
+
+# noinst_HEADERS =
+
+debug:
+ @$(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
+
+install-debug: debug
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+mostlyclean-generic:
+ -rm -f *~ \#* .*~ .\#*
+
+maintainer-clean-generic:
+ -@echo "This command is intended for maintainers to use;"
+ -@echo "it deletes files that may require special tools to rebuild."
+ -rm -f Makefile.in
diff --git a/src/libvfill/xine_decoder.c b/src/libvfill/xine_decoder.c
new file mode 100644
index 000000000..3b09bf2f2
--- /dev/null
+++ b/src/libvfill/xine_decoder.c
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2000-2001 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
+ *
+ * A decoder to fill the video buffer with similar frames
+ */
+
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "video_out.h"
+#include "buffer.h"
+#include "xine_internal.h"
+
+/* The videofill decoder's job in life is to copy the last frame displayed into
+ * the current display queue, incrementing the PTS value accordingly. It probably
+ * needs some work */
+
+typedef struct videofill_decoder_s {
+ video_decoder_t video_decoder;
+
+ vo_instance_t *video_out;
+} videofill_decoder_t;
+
+static int videofill_can_handle (video_decoder_t *this_gen, int buf_type) {
+ return ((buf_type & 0xFFFF0000) == BUF_VIDEO_FILL) ;
+}
+
+static void videofill_init (video_decoder_t *this_gen, vo_instance_t *video_out) {
+
+ videofill_decoder_t *this = (videofill_decoder_t *) this_gen;
+
+ this->video_out = video_out;
+ this->video_out->open (this->video_out);
+}
+
+static void videofill_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
+
+ videofill_decoder_t *this = (videofill_decoder_t *) this_gen;
+ vo_frame_t *img, *last_img;
+ metronom_t *metronom;
+
+
+ last_img = this->video_out->get_last_frame (this->video_out);
+
+ /* printf ("videofill: "); */
+
+ if (last_img) {
+ int image_size;
+
+ /* printf (" duplicate "); */
+
+ img = this->video_out->get_frame (this->video_out,
+ last_img->width,
+ last_img->height,
+ last_img->ratio,
+ last_img->format,
+ last_img->duration,
+ VO_BOTH_FIELDS);
+
+ image_size = last_img->width * last_img->height;
+
+ memcpy(img->base[0], last_img->base[0], image_size);
+ memcpy(img->base[1], last_img->base[1], image_size >> 2);
+ memcpy(img->base[2], last_img->base[2], image_size >> 2);
+
+ img->PTS = 0;
+ img->bFrameBad = 0;
+
+ img->draw(img);
+ img->free(img);
+ }
+ /* printf ("\n"); */
+}
+
+static void videofill_close (video_decoder_t *this_gen) {
+
+ videofill_decoder_t *this = (videofill_decoder_t *) this_gen;
+
+ this->video_out->close(this->video_out);
+}
+
+static char *videofill_get_id(void) {
+ return "videofill";
+}
+
+video_decoder_t *init_video_decoder_plugin (int iface_version, config_values_t *cfg) {
+
+ videofill_decoder_t *this ;
+
+ if (iface_version != 2) {
+ printf( "videofill: plugin doesn't support plugin API version %d.\n"
+ "videofill: this means there's a version mismatch between xine and this "
+ "videofill: decoder plugin.\nInstalling current plugins should help.\n",
+ iface_version);
+ return NULL;
+ }
+
+ this = (videofill_decoder_t *) malloc (sizeof (videofill_decoder_t));
+
+ this->video_decoder.interface_version = 2;
+ this->video_decoder.can_handle = videofill_can_handle;
+ this->video_decoder.init = videofill_init;
+ this->video_decoder.decode_data = videofill_decode_data;
+ this->video_decoder.close = videofill_close;
+ this->video_decoder.get_identifier = videofill_get_id;
+ this->video_decoder.priority = 2;
+
+ return (video_decoder_t *) this;
+}
+
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index 3b8642c6a..368f06a58 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.44 2001/09/11 09:03:51 jkeil Exp $
+ * $Id: video_out.c,v 1.45 2001/09/12 19:50:41 guenter Exp $
*
*/
@@ -375,6 +375,11 @@ static vo_frame_t *vo_get_frame (vo_instance_t *this,
img->bDisplayLock = 0;
img->bDecoderLock = 1;
img->bDriverLock = 0;
+ img->width = width;
+ img->height = height;
+ img->ratio = ratio;
+ img->format = format;
+ img->duration = duration;
/* let driver ensure this image has the right format */
@@ -442,6 +447,10 @@ static void vo_frame_free (vo_frame_t *img) {
pthread_mutex_unlock (&img->mutex);
}
+static vo_frame_t *vo_get_last_frame (vo_instance_t *this) {
+ return this->last_frame;
+}
+
static int vo_frame_draw (vo_frame_t *img) {
vo_instance_t *this = img->instance;
@@ -493,10 +502,12 @@ static int vo_frame_draw (vo_frame_t *img) {
xprintf (VERBOSE|VIDEO, "frame is ok => appending to display buffer\n");
+ this->last_frame = img;
+
pthread_mutex_lock (&img->mutex);
img->bDisplayLock = 1;
pthread_mutex_unlock (&img->mutex);
-
+
vo_append_to_img_buf_queue (this->display_img_buf_queue, img);
} else {
@@ -550,6 +561,7 @@ vo_instance_t *vo_new_instance (vo_driver_t *driver, metronom_t *metronom) {
this->open = vo_open;
this->get_frame = vo_get_frame;
+ this->get_last_frame = vo_get_last_frame;
this->close = vo_close;
this->exit = vo_exit;
this->get_capabilities = vo_get_capabilities;
diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h
index 03c68a7ca..2f14a5e9c 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.17 2001/08/17 15:54:31 ehasenle Exp $
+ * $Id: video_out.h,v 1.18 2001/09/12 19:50:41 guenter Exp $
*
*
* xine version of video_out.h
@@ -64,6 +64,10 @@ struct vo_frame_s {
uint8_t *base[3];
int nType; /* I, B or P frame */
+ /* additional information to be able to duplicate frames: */
+ int width, height;
+ int ratio, format, duration;
+
int bDisplayLock, bDecoderLock, bDriverLock;
pthread_mutex_t mutex; /* so the various locks will be serialized */
@@ -124,6 +128,8 @@ struct vo_instance_s {
uint32_t height, int ratio_code,
int format, uint32_t duration,
int flags);
+
+ vo_frame_t* (*get_last_frame) (vo_instance_t *this);
/* overlay stuff */
void (*register_ovl_src) (vo_instance_t *this, ovl_src_t *ovl_src);
@@ -144,6 +150,8 @@ struct vo_instance_s {
img_buf_fifo_t *free_img_buf_queue;
img_buf_fifo_t *display_img_buf_queue;
+ vo_frame_t *last_frame;
+
int video_loop_running;
pthread_t video_thread;