summaryrefslogtreecommitdiff
path: root/src/post/visualizations
diff options
context:
space:
mode:
Diffstat (limited to 'src/post/visualizations')
-rw-r--r--src/post/visualizations/Makefile.am2
-rw-r--r--src/post/visualizations/fftgraph.c32
-rw-r--r--src/post/visualizations/fftscope.c34
-rw-r--r--src/post/visualizations/fooviz.c28
-rw-r--r--src/post/visualizations/oscope.c31
-rw-r--r--src/post/visualizations/visualizations.c4
-rw-r--r--src/post/visualizations/visualizations.h29
7 files changed, 100 insertions, 60 deletions
diff --git a/src/post/visualizations/Makefile.am b/src/post/visualizations/Makefile.am
index db07a7730..ba79640fe 100644
--- a/src/post/visualizations/Makefile.am
+++ b/src/post/visualizations/Makefile.am
@@ -11,4 +11,4 @@ xineplug_post_visualizations_la_SOURCES = \
xineplug_post_visualizations_la_LIBADD = $(XINE_LIB)
xineplug_post_visualizations_la_LDFLAGS = -avoid-version -module @XINE_PLUGIN_MIN_SYMS@ -lm
-noinst_HEADERS = fft.h
+noinst_HEADERS = fft.h visualizations.h
diff --git a/src/post/visualizations/fftgraph.c b/src/post/visualizations/fftgraph.c
index 96d3f758d..22179cec1 100644
--- a/src/post/visualizations/fftgraph.c
+++ b/src/post/visualizations/fftgraph.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2002 the xine project
+ * Copyright (C) 2000-2003 the xine project
*
* This file is part of xine, a free video player.
*
@@ -20,7 +20,7 @@
* FftGraph Visualization Post Plugin For xine
* by Thibaut Mattern (tmattern@noos.fr)
*
- * $Id: fftgraph.c,v 1.2 2003/09/14 12:59:27 tmattern Exp $
+ * $Id: fftgraph.c,v 1.3 2003/10/30 22:40:53 mroi Exp $
*
*/
@@ -33,6 +33,7 @@
#include "xineutils.h"
#include "post.h"
#include "bswap.h"
+#include "visualizations.h"
#include "fft.h"
#define FPS 20
@@ -334,17 +335,10 @@ static void fftgraph_port_put_buffer (xine_audio_port_t *port_gen,
int16_t *data;
int8_t *data8;
int samples_used = 0;
- uint64_t vpts = buf->vpts;
+ int64_t pts = buf->vpts;
+ int64_t vpts = 0;
int i, c;
- /* HACK: compute a pts using metronom internals */
- if (!vpts) {
- metronom_t *metronom = this->stream->metronom;
- pthread_mutex_lock(&metronom->lock);
- vpts = metronom->audio_vpts - metronom->vpts_offset;
- pthread_mutex_unlock(&metronom->lock);
- }
-
/* make a copy of buf data for private use */
if( this->buf.mem_size < buf->mem_size ) {
this->buf.mem = realloc(this->buf.mem, buf->mem_size);
@@ -402,15 +396,23 @@ static void fftgraph_port_put_buffer (xine_audio_port_t *port_gen,
VO_BOTH_FIELDS);
frame->extra_info->invalid = 1;
frame->bad_frame = 0;
- frame->pts = vpts;
- vpts = 0;
-
frame->duration = 90000 * this->samples_per_frame / this->sample_rate;
+ if (!vpts) {
+ vpts = this->stream->metronom->audio_vpts;
+ frame->pts = pts;
+ frame->vpts = vpts;
+ pts = 0;
+ vpts += frame->duration;
+ } else {
+ frame->pts = 0;
+ frame->vpts = vpts;
+ vpts += frame->duration;
+ }
this->sample_counter -= this->samples_per_frame;
draw_fftgraph(this, frame);
- frame->draw(frame, stream);
+ frame->draw(frame, NULL);
frame->free(frame);
}
} while( this->sample_counter >= this->samples_per_frame );
diff --git a/src/post/visualizations/fftscope.c b/src/post/visualizations/fftscope.c
index d7a48272d..4cdc8b93c 100644
--- a/src/post/visualizations/fftscope.c
+++ b/src/post/visualizations/fftscope.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2002 the xine project
+ * Copyright (C) 2000-2003 the xine project
*
* This file is part of xine, a free video player.
*
@@ -22,7 +22,7 @@
*
* FFT code by Steve Haehnichen, originally licensed under GPL v1
*
- * $Id: fftscope.c,v 1.16 2003/09/14 12:44:20 tmattern Exp $
+ * $Id: fftscope.c,v 1.17 2003/10/30 22:40:53 mroi Exp $
*
*/
@@ -33,6 +33,7 @@
#include "xineutils.h"
#include "post.h"
#include "bswap.h"
+#include "visualizations.h"
#include "fft.h"
#define FPS 20
@@ -83,7 +84,7 @@ struct post_plugin_fftscope_s {
/*
* Fade out a YUV pixel
*/
-void fade_out_yuv(uint8_t *y, uint8_t *u, uint8_t *v, float factor) {
+static void fade_out_yuv(uint8_t *y, uint8_t *u, uint8_t *v, float factor) {
#if 0
float r, g, b;
@@ -373,17 +374,10 @@ static void fftscope_port_put_buffer (xine_audio_port_t *port_gen,
int16_t *data;
int8_t *data8;
int samples_used = 0;
- uint64_t vpts = buf->vpts;
+ int64_t pts = buf->vpts;
+ int64_t vpts = 0;
int i, c;
- /* HACK: compute a pts using metronom internals */
- if (!vpts) {
- metronom_t *metronom = this->stream->metronom;
- pthread_mutex_lock(&metronom->lock);
- vpts = metronom->audio_vpts - metronom->vpts_offset;
- pthread_mutex_unlock(&metronom->lock);
- }
-
/* make a copy of buf data for private use */
if( this->buf.mem_size < buf->mem_size ) {
this->buf.mem = realloc(this->buf.mem, buf->mem_size);
@@ -441,15 +435,23 @@ static void fftscope_port_put_buffer (xine_audio_port_t *port_gen,
VO_BOTH_FIELDS);
frame->extra_info->invalid = 1;
frame->bad_frame = 0;
- frame->pts = vpts;
- vpts = 0;
-
frame->duration = 90000 * this->samples_per_frame / this->sample_rate;
+ if (!vpts) {
+ vpts = this->stream->metronom->audio_vpts;
+ frame->pts = pts;
+ frame->vpts = vpts;
+ pts = 0;
+ vpts += frame->duration;
+ } else {
+ frame->pts = 0;
+ frame->vpts = vpts;
+ vpts += frame->duration;
+ }
this->sample_counter -= this->samples_per_frame;
draw_fftscope(this, frame);
- frame->draw(frame, stream);
+ frame->draw(frame, NULL);
frame->free(frame);
}
} while( this->sample_counter >= this->samples_per_frame );
diff --git a/src/post/visualizations/fooviz.c b/src/post/visualizations/fooviz.c
index f5da6f0ec..4b302f2df 100644
--- a/src/post/visualizations/fooviz.c
+++ b/src/post/visualizations/fooviz.c
@@ -23,7 +23,7 @@
* process. It simply paints the screen a solid color and rotates through
* colors on each iteration.
*
- * $Id: fooviz.c,v 1.11 2003/10/23 20:12:35 mroi Exp $
+ * $Id: fooviz.c,v 1.12 2003/10/30 22:40:53 mroi Exp $
*
*/
@@ -172,17 +172,10 @@ static void fooviz_port_put_buffer (xine_audio_port_t *port_gen,
int16_t *data;
int8_t *data8;
int samples_used = 0;
- uint64_t vpts = buf->vpts;
+ int64_t pts = buf->vpts;
+ int64_t vpts = 0;
int i, j;
- /* HACK: compute a pts using metronom internals */
- if (!vpts) {
- metronom_t *metronom = this->stream->metronom;
- pthread_mutex_lock(&metronom->lock);
- vpts = metronom->audio_vpts - metronom->vpts_offset;
- pthread_mutex_unlock(&metronom->lock);
- }
-
/* make a copy of buf data for private use */
if( this->buf.mem_size < buf->mem_size ) {
this->buf.mem = realloc(this->buf.mem, buf->mem_size);
@@ -238,15 +231,24 @@ static void fooviz_port_put_buffer (xine_audio_port_t *port_gen,
VO_BOTH_FIELDS);
frame->extra_info->invalid = 1;
frame->bad_frame = 0;
- frame->pts = vpts;
- vpts = 0;
frame->duration = 90000 * this->samples_per_frame / this->sample_rate;
+ if (!vpts) {
+ vpts = this->stream->metronom->audio_vpts;
+ frame->pts = pts;
+ frame->vpts = vpts;
+ pts = 0;
+ vpts += frame->duration;
+ } else {
+ frame->pts = 0;
+ frame->vpts = vpts;
+ vpts += frame->duration;
+ }
this->sample_counter -= this->samples_per_frame;
memset(frame->base[0], this->current_yuv_byte, FOO_WIDTH * FOO_HEIGHT * 2);
this->current_yuv_byte += 3;
- frame->draw(frame, stream);
+ frame->draw(frame, NULL);
frame->free(frame);
}
} while( this->sample_counter >= this->samples_per_frame );
diff --git a/src/post/visualizations/oscope.c b/src/post/visualizations/oscope.c
index 3e2908d54..4f312ca49 100644
--- a/src/post/visualizations/oscope.c
+++ b/src/post/visualizations/oscope.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2002 the xine project
+ * Copyright (C) 2000-2003 the xine project
*
* This file is part of xine, a free video player.
*
@@ -20,7 +20,7 @@
* Basic Oscilloscope Visualization Post Plugin For xine
* by Mike Melanson (melanson@pcisys.net)
*
- * $Id: oscope.c,v 1.9 2003/08/04 03:47:11 miguelfreitas Exp $
+ * $Id: oscope.c,v 1.10 2003/10/30 22:40:53 mroi Exp $
*
*/
@@ -29,6 +29,7 @@
#include "xine_internal.h"
#include "xineutils.h"
#include "post.h"
+#include "visualizations.h"
#define FPS 20
@@ -244,17 +245,10 @@ static void oscope_port_put_buffer (xine_audio_port_t *port_gen,
int16_t *data;
int8_t *data8;
int samples_used = 0;
- uint64_t vpts = buf->vpts;
+ int64_t pts = buf->vpts;
+ int64_t vpts = 0;
int i, c;
- /* HACK: compute a pts using metronom internals */
- if (!vpts) {
- metronom_t *metronom = this->stream->metronom;
- pthread_mutex_lock(&metronom->lock);
- vpts = metronom->audio_vpts - metronom->vpts_offset;
- pthread_mutex_unlock(&metronom->lock);
- }
-
/* make a copy of buf data for private use */
if( this->buf.mem_size < buf->mem_size ) {
this->buf.mem = realloc(this->buf.mem, buf->mem_size);
@@ -306,15 +300,24 @@ static void oscope_port_put_buffer (xine_audio_port_t *port_gen,
VO_BOTH_FIELDS);
frame->extra_info->invalid = 1;
frame->bad_frame = 0;
- frame->pts = vpts;
- vpts = 0;
frame->duration = 90000 * this->samples_per_frame / this->sample_rate;
+ if (!vpts) {
+ vpts = this->stream->metronom->audio_vpts;
+ frame->pts = pts;
+ frame->vpts = vpts;
+ pts = 0;
+ vpts += frame->duration;
+ } else {
+ frame->pts = 0;
+ frame->vpts = vpts;
+ vpts += frame->duration;
+ }
this->sample_counter -= this->samples_per_frame;
draw_oscope_dots(this);
yuv444_to_yuy2(&this->yuv, frame->base[0], frame->pitches[0]);
- frame->draw(frame, stream);
+ frame->draw(frame, NULL);
frame->free(frame);
}
diff --git a/src/post/visualizations/visualizations.c b/src/post/visualizations/visualizations.c
index 706b66695..4581f9f53 100644
--- a/src/post/visualizations/visualizations.c
+++ b/src/post/visualizations/visualizations.c
@@ -19,7 +19,7 @@
*
* This file contains plugin entries for several visualization post plugins.
*
- * $Id: visualizations.c,v 1.7 2003/10/23 20:12:35 mroi Exp $
+ * $Id: visualizations.c,v 1.8 2003/10/30 22:40:53 mroi Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -29,6 +29,8 @@
#include "xine_internal.h"
#include "post.h"
+#include "visualizations.h"
+
void *oscope_init_plugin(xine_t *xine, void *data);
void *fftscope_init_plugin(xine_t *xine, void *data);
diff --git a/src/post/visualizations/visualizations.h b/src/post/visualizations/visualizations.h
new file mode 100644
index 000000000..967d98c35
--- /dev/null
+++ b/src/post/visualizations/visualizations.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2000-2003 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
+ *
+ * This file contains plugin entries for several visualization post plugins.
+ *
+ * $Id: visualizations.h,v 1.1 2003/10/30 22:40:53 mroi Exp $
+ */
+
+#include "xine_internal.h"
+
+void *oscope_init_plugin(xine_t *xine, void *data);
+void *fftscope_init_plugin(xine_t *xine, void *data);
+void *fftgraph_init_plugin(xine_t *xine, void *data);