[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xine-cvslog
Subject:    [xine-cvs] CVS: xine-lib/src/post/visualizations visualizations.h,NONE,1.1 Makefile.am,1.6,1.7 fftgr
From:       Michael Roitzsch <mroi () users ! sourceforge ! net>
Date:       2003-10-30 22:40:56
[Download RAW message or body]

Update of /cvsroot/xine/xine-lib/src/post/visualizations
In directory sc8-pr-cvs1:/tmp/cvs-serv7952/src/post/visualizations

Modified Files:
	Makefile.am fftgraph.c fftscope.c fooviz.c oscope.c 
	visualizations.c 
Added Files:
	visualizations.h 
Log Message:
* modify the engine slightly, so that the stream member in a video frame or
  audio buffer can be NULL; this should be used to indicate that the frame/
  buffer does not come directly from a stream, but was generated otherwise
  (the most important result is that frames/buffers with stream NULL will not
  be passed through metronom)
* modify visualization post plugins so they set the stream on the generated
  frames to NULL, this avoids cluttering metronom, when playing a stream with
  audio AND video AND a visualization post
* this also means modifying the way post plugins provide vpts values:
  they have to calculate them themselves for now


--- NEW FILE: visualizations.h ---
/*
 * 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);

Index: Makefile.am
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/post/visualizations/Makefile.am,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Makefile.am	21 Sep 2003 11:04:53 -0000	1.6
+++ Makefile.am	30 Oct 2003 22:40:53 -0000	1.7
@@ -11,4 +11,4 @@
 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

Index: fftgraph.c
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/post/visualizations/fftgraph.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- fftgraph.c	14 Sep 2003 12:59:27 -0000	1.2
+++ fftgraph.c	30 Oct 2003 22:40:53 -0000	1.3
@@ -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.
  *
@@ -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 @@
   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 @@
                                         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 );

Index: fftscope.c
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/post/visualizations/fftscope.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- fftscope.c	14 Sep 2003 12:44:20 -0000	1.16
+++ fftscope.c	30 Oct 2003 22:40:53 -0000	1.17
@@ -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.
  *
@@ -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 @@
 /*
  *  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 @@
   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 @@
                                         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 );

Index: fooviz.c
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/post/visualizations/fooviz.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- fooviz.c	23 Oct 2003 20:12:35 -0000	1.11
+++ fooviz.c	30 Oct 2003 22:40:53 -0000	1.12
@@ -172,17 +172,10 @@
   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 @@
                                         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 );

Index: oscope.c
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/post/visualizations/oscope.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- oscope.c	4 Aug 2003 03:47:11 -0000	1.9
+++ oscope.c	30 Oct 2003 22:40:53 -0000	1.10
@@ -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.
  * 
@@ -29,6 +29,7 @@
 #include "xine_internal.h"
 #include "xineutils.h"
 #include "post.h"
+#include "visualizations.h"
 
 #define FPS 20
 
@@ -244,17 +245,10 @@
   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 @@
                                         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);
 
     }

Index: visualizations.c
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/post/visualizations/visualizations.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- visualizations.c	23 Oct 2003 20:12:35 -0000	1.7
+++ visualizations.c	30 Oct 2003 22:40:53 -0000	1.8
@@ -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);



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Xine-cvslog mailing list
Xine-cvslog@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xine-cvslog
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic