summaryrefslogtreecommitdiff
path: root/src/post/visualizations/fooviz.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/post/visualizations/fooviz.c')
-rw-r--r--src/post/visualizations/fooviz.c49
1 files changed, 31 insertions, 18 deletions
diff --git a/src/post/visualizations/fooviz.c b/src/post/visualizations/fooviz.c
index 4f70de432..fccb6d72f 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.13 2003/11/11 18:45:00 f1rmb Exp $
+ * $Id: fooviz.c,v 1.14 2003/11/16 12:18:59 mroi Exp $
*
*/
@@ -42,6 +42,14 @@
typedef struct post_plugin_fooviz_s post_plugin_fooviz_t;
+typedef struct post_class_fooviz_s post_class_fooviz_t;
+
+struct post_class_fooviz_s {
+ post_class_t post_class;
+
+ xine_t *xine;
+};
+
struct post_plugin_fooviz_s {
post_plugin_t post;
@@ -49,6 +57,9 @@ struct post_plugin_fooviz_s {
xine_video_port_t *vo_port;
xine_stream_t *stream;
+ /* private metronom for syncing the video */
+ metronom_t *metronom;
+
double ratio;
int data_idx;
@@ -150,6 +161,8 @@ static int fooviz_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream,
this->stream = stream;
this->data_idx = 0;
+ this->metronom->set_master(this->metronom, stream->metronom);
+
return port->original_port->open(port->original_port, stream, bits, rate, mode );
}
@@ -160,6 +173,8 @@ static void fooviz_port_close(xine_audio_port_t *port_gen, xine_stream_t *stream
this->stream = NULL;
+ this->metronom->set_master(this->metronom, NULL);
+
port->original_port->close(port->original_port, stream );
}
@@ -173,7 +188,6 @@ static void fooviz_port_put_buffer (xine_audio_port_t *port_gen,
int8_t *data8;
int samples_used = 0;
int64_t pts = buf->vpts;
- int64_t vpts = 0;
int i, j;
/* make a copy of buf data for private use */
@@ -232,17 +246,9 @@ static void fooviz_port_put_buffer (xine_audio_port_t *port_gen,
frame->extra_info->invalid = 1;
frame->bad_frame = 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;
- }
+ frame->pts = pts;
+ this->metronom->got_video_frame(this->metronom, frame);
+
this->sample_counter -= this->samples_per_frame;
memset(frame->base[0], this->current_yuv_byte, FOO_WIDTH * FOO_HEIGHT * 2);
@@ -260,6 +266,8 @@ static void fooviz_dispose(post_plugin_t *this_gen)
xine_post_out_t *output = (xine_post_out_t *)xine_list_last_content(this_gen->output);
xine_video_port_t *port = *(xine_video_port_t **)output->data;
+ this->metronom->exit(this->metronom);
+
if (this->stream)
port->close(port, this->stream);
@@ -279,6 +287,7 @@ static post_plugin_t *fooviz_open_plugin(post_class_t *class_gen, int inputs,
xine_audio_port_t **audio_target,
xine_video_port_t **video_target)
{
+ post_class_fooviz_t *class = (post_class_fooviz_t *)class_gen;
post_plugin_fooviz_t *this = (post_plugin_fooviz_t *)malloc(sizeof(post_plugin_fooviz_t));
xine_post_in_t *input = (xine_post_in_t *)malloc(sizeof(xine_post_in_t));
post_fooviz_out_t *output = (post_fooviz_out_t *)malloc(sizeof(post_fooviz_out_t));
@@ -294,6 +303,8 @@ static post_plugin_t *fooviz_open_plugin(post_class_t *class_gen, int inputs,
return NULL;
}
+ this->metronom = _x_metronom_init(0, class->xine);
+
this->sample_counter = 0;
this->stream = NULL;
this->vo_port = video_target[0];
@@ -357,15 +368,17 @@ static void fooviz_class_dispose(post_class_t *class_gen)
/* plugin class initialization function */
static void *fooviz_init_plugin(xine_t *xine, void *data)
{
- post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t));
+ post_class_fooviz_t *class = (post_class_fooviz_t *)malloc(sizeof(post_class_fooviz_t));
if (!class)
return NULL;
- class->open_plugin = fooviz_open_plugin;
- class->get_identifier = fooviz_get_identifier;
- class->get_description = fooviz_get_description;
- class->dispose = fooviz_class_dispose;
+ class->post_class.open_plugin = fooviz_open_plugin;
+ class->post_class.get_identifier = fooviz_get_identifier;
+ class->post_class.get_description = fooviz_get_description;
+ class->post_class.dispose = fooviz_class_dispose;
+
+ class->xine = xine;
return class;
}