summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibaut Mattern <tmattern@users.sourceforge.net>2003-01-05 23:38:23 +0000
committerThibaut Mattern <tmattern@users.sourceforge.net>2003-01-05 23:38:23 +0000
commit4d0c368a2a62e594da411995fd9fae4d1324f5f8 (patch)
tree6959e792d1c98e760163cb9669cc9b5274099636
parent13c47e27329ca2a864d7ff49be59a8831960fa62 (diff)
downloadxine-lib-4d0c368a2a62e594da411995fd9fae4d1324f5f8.tar.gz
xine-lib-4d0c368a2a62e594da411995fd9fae4d1324f5f8.tar.bz2
Adapts fooviz to the new logic
CVS patchset: 3796 CVS date: 2003/01/05 23:38:23
-rw-r--r--src/post/visualizations/fooviz.c82
1 files changed, 45 insertions, 37 deletions
diff --git a/src/post/visualizations/fooviz.c b/src/post/visualizations/fooviz.c
index 6ef77ae8f..dbfef60bf 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.1 2003/01/04 20:42:48 tmmm Exp $
+ * $Id: fooviz.c,v 1.2 2003/01/05 23:38:23 tmattern Exp $
*
*/
@@ -167,50 +167,58 @@ static void fooviz_port_put_buffer (xine_audio_port_t *port_gen,
vo_frame_t *frame;
int16_t *data;
int8_t *data8;
+ int samples_used = 0;
+ uint64_t vpts = buf->vpts;
int i, j;
this->sample_counter += buf->num_frames;
j = (this->channels >= 2) ? 1 : 0;
- if( this->bits == 8 ) {
- data8 = (int8_t *)buf->mem;
-
- /* scale 8 bit data to 16 bits and convert to signed as well */
- for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES;
- i++, this->data_idx++, data8 += this->channels ) {
- this->data[0][this->data_idx] = ((int16_t)data8[0] << 8) - 0x8000;
- this->data[1][this->data_idx] = ((int16_t)data8[j] << 8) - 0x8000;
+ do {
+
+ if( this->bits == 8 ) {
+ data8 = (int8_t *)buf->mem;
+ data8 += samples_used * this->channels;
+
+ /* scale 8 bit data to 16 bits and convert to signed as well */
+ for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES;
+ i++, this->data_idx++, data8 += this->channels ) {
+ this->data[0][this->data_idx] = ((int16_t)data8[0] << 8) - 0x8000;
+ this->data[1][this->data_idx] = ((int16_t)data8[j] << 8) - 0x8000;
+ }
+ } else {
+ data = buf->mem;
+ data += samples_used * this->channels;
+
+ for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES;
+ i++, this->data_idx++, data += this->channels ) {
+ this->data[0][this->data_idx] = data[0];
+ this->data[1][this->data_idx] = data[j];
+ }
}
- } else {
- data = buf->mem;
-
- for( i = 0; i < buf->num_frames && this->data_idx < NUMSAMPLES;
- i++, this->data_idx++, data += this->channels ) {
- this->data[0][this->data_idx] = data[0];
- this->data[1][this->data_idx] = data[j];
+
+ if( this->sample_counter >= this->samples_per_frame &&
+ this->data_idx == NUMSAMPLES ) {
+
+ this->data_idx = 0;
+ samples_used += this->samples_per_frame;
+
+ frame = this->vo_port->get_frame (this->vo_port, FOO_WIDTH, FOO_HEIGHT,
+ XINE_VO_ASPECT_SQUARE, XINE_IMGFMT_YUY2,
+ VO_BOTH_FIELDS);
+ frame->pts = vpts;
+ vpts = 0;
+ frame->duration = 90000 * this->samples_per_frame / this->sample_rate;
+ 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->free(frame);
}
- }
-
- if( this->sample_counter >= this->samples_per_frame &&
- this->data_idx == NUMSAMPLES ) {
-
- this->data_idx = 0;
-
- frame = this->vo_port->get_frame (this->vo_port, FOO_WIDTH, FOO_HEIGHT,
- XINE_VO_ASPECT_SQUARE, XINE_IMGFMT_YUY2,
- VO_BOTH_FIELDS);
- frame->pts = buf->vpts;
- frame->duration = 90000 * this->sample_counter / this->sample_rate;
-
- memset(frame->base[0], this->current_yuv_byte, FOO_WIDTH * FOO_HEIGHT * 2);
- this->current_yuv_byte += 3;
-
- frame->draw(frame, stream);
- frame->free(frame);
-
- this->sample_counter = 0;
- }
+ } while( this->sample_counter >= this->samples_per_frame );
port->original_port->put_buffer(port->original_port, buf, stream );
}