changeset 2030:32124206d46b

Automated merge with ssh://hg.atheme.org//hg/audacious-plugins
author William Pitcock <nenolod@atheme.org>
date Fri, 12 Oct 2007 14:24:25 -0500
parents c301531ffa5c (current diff) 47a4e93ed7ce (diff)
children e3d9ef56fec8
files
diffstat 7 files changed, 115 insertions(+), 178 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Fri Oct 12 14:24:14 2007 -0500
+++ b/configure.ac	Fri Oct 12 14:24:25 2007 -0500
@@ -1260,6 +1260,7 @@
 dnl *** Scrobbler ***
 
 scrobbler="yes"
+have_lastfm="no"
 
 dnl libcurl check
 
@@ -1269,12 +1270,9 @@
 dnl check_hex must be UPPERCASE if any hex letters are present
 check_hex="070907"
 
-have_curl="no"
-have_lastfm="no"
-PKG_CHECK_MODULES(CURL, [libcurl >= 7.9.7],
-[
-	have_curl="yes"
-], [scrobbler="no"])
+PKG_CHECK_MODULES(CURL, [libcurl >= 7.9.7], [], [scrobbler="no"])
+AC_SUBST(CURL_CFLAGS)
+AC_SUBST(CURL_LIBS)
 
 if test "x$scrobbler" = "xyes"; then
 	GENERAL_PLUGINS="$GENERAL_PLUGINS scrobbler"
@@ -1282,9 +1280,6 @@
 	have_lastfm="yes"
 fi
 
-AC_SUBST(CURL_CFLAGS)
-AC_SUBST(CURL_LIBS)
-
 dnl *** End of Scrobbler checks ***
 
 dnl *** neon http plugin ***
@@ -1673,7 +1668,6 @@
 echo "  Transport"
 echo "  ---------"
 echo "  stdio transport:                        yes"
-echo "  curl-based http/https:                  $have_curl"
 echo "  neon-based http/https:                  $have_neon"
 echo "  libmms-based mms:                       $have_mms"
 echo "  lastfm transport:                       $have_lastfm"
--- a/src/cdaudio-ng/cdaudio-ng.c	Fri Oct 12 14:24:14 2007 -0500
+++ b/src/cdaudio-ng/cdaudio-ng.c	Fri Oct 12 14:24:25 2007 -0500
@@ -450,7 +450,7 @@
 			}
 
 		if (strlen(trackinfo[trackno].name) == 0)
-			snprintf(trackinfo[trackno].name, trackno, "CD Audio Track %02u", sizeof(trackinfo[trackno].name));
+			snprintf(trackinfo[trackno].name, sizeof(trackinfo[trackno].name), "CD Audio Track %02u", trackno);
 
 	}
 
--- a/src/madplug/Makefile	Fri Oct 12 14:24:14 2007 -0500
+++ b/src/madplug/Makefile	Fri Oct 12 14:24:25 2007 -0500
@@ -16,4 +16,4 @@
 
 CFLAGS += ${PLUGIN_CFLAGS}
 CPPFLAGS += ${PLUGIN_CPPFLAGS} ${DBUS_CFLAGS} ${GTK_CFLAGS} ${GLIB_CFLAGS} ${PANGO_CFLAGS} ${MOWGLI_CFLAGS} ${ARCH_DEFINES} ${SIMD_CFLAGS} -I../..
-LIBS += -lmad -laudid3tag ${GTK_LIBS} ${GLIB_LIBS} ${PANGO_LIBS}
+LIBS += -L${libdir} -lmad -laudid3tag ${GTK_LIBS} ${GLIB_LIBS} ${PANGO_LIBS}
--- a/src/projectm-1.0/main.cxx	Fri Oct 12 14:24:14 2007 -0500
+++ b/src/projectm-1.0/main.cxx	Fri Oct 12 14:24:25 2007 -0500
@@ -34,23 +34,22 @@
 #include <fcntl.h>
 #include <SDL/SDL.h>
 #include <SDL/SDL_thread.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
+
 extern "C" {
 #include <audacious/util.h>
 #include <audacious/plugin.h>
 #include <audacious/auddrct.h>
 }
+
 #include <math.h>
 #include "ConfigFile.h"
 
-#include <libprojectM/BeatDetect.hpp>
-#include <libprojectM/PCM.hpp>
 #include <libprojectM/projectM.hpp>
-#include <libprojectM/KeyHandler.hpp>
+
 #include "sdltoprojectM.h"
 #include "video_init.h"
 
+#include <GL/gl.h>
 #define CONFIG_FILE "/share/projectM/config.inp"
 
 // Forward declarations 
@@ -72,13 +71,9 @@
 
 //FILE * debugFile = fopen("./dwrite-dump", "wb");
 
-// Callback functions
-
 // Our worker thread
 SDL_Thread *worker_thread = NULL;
 SDL_sem *sem = NULL;
-SDL_mutex *mutex = NULL;
-
 SDL_Event event;
 
 SDL_Surface *screen;
@@ -121,8 +116,11 @@
 	if(check_title || pos != last_pos) {
                 title = audacious_drct_pl_get_title(pos);
 		if(title && (!last_title || strcmp(last_title,title))) {
-			globalPM->renderer->title = title;
-			globalPM->renderer->drawtitle = 1;
+		  //globalPM->renderer->title = title;
+			//globalPM->renderer->drawtitle = 1;
+
+		  std::string titlepp(title);
+		  globalPM->projectM_setTitle(titlepp);
 			g_free(last_title);
 			last_title = title;
 		} else if(title && last_title != title) {
@@ -144,24 +142,23 @@
  SDL_TimerID title_timer = NULL;
  std::string config_file;
  config_file = read_config();
-
  ConfigFile config(config_file);
 
  int wvw = config.read<int>( "Window Width", 512 );
  int wvh = config.read<int>( "Window Height", 512 );
+
  int fullscreen = 0;
  if (config.read("Fullscreen", true)) fullscreen = 1;
       else fullscreen = 0;
 
-  init_display(wvw,wvh,&fvw,&fvh,fullscreen);   
+  init_display(wvw,wvh,&fvw,&fvh,fullscreen); 
   SDL_WM_SetCaption("projectM v1.00", "projectM v1.00");
 
-
   /** Initialise projectM */
     
   globalPM = new projectM(config_file);
-         
-  title_timer = SDL_AddTimer(500, (SDL_NewTimerCallback) get_xmms_title, NULL);
+  SDL_SemPost(sem);
+  title_timer = SDL_AddTimer(500, get_xmms_title, NULL);
     /** Initialise the thread */
   // SDL_SemTryWait(sem);
   while ( SDL_SemValue(sem)==1 ) {
@@ -197,11 +194,13 @@
                     if (fullscreen == 0) {
                         w = fvw;
                         h = fvh;
+			fullscreen = 1;
                     } else {
                         w = wvw;
                         h = wvh;
+			fullscreen = 0;
                     }
-                    globalPM->fullscreen = fullscreen ^= 1;
+                  
                     resize_display(w, h, fullscreen);
                     globalPM->projectM_resetGL( w, h ); 
                 }
@@ -223,7 +222,7 @@
               } 
 	    else if ( evt == PROJECTM_VIDEOQUIT ) {
 	      
-	      (void) g_idle_add((GSourceFunc) disable_projectm, NULL);
+	      (void) g_idle_add ((GSourceFunc) disable_projectm, NULL);
 	    }
 	}
 	
@@ -235,9 +234,9 @@
 
 	 //printf("%s\n",title);
 	// strcpy(globalPM->title,title);
-	//SDL_mutexP(mutex);
+	
 	  globalPM->renderFrame();
-	  //SDL_mutexV(mutex);
+	
       
 
         SDL_GL_SwapBuffers();
@@ -246,14 +245,10 @@
 	//	SDL_SemPost(sem);
       }
 
- 
-		
-  printf("Worker thread: Exiting\n");
  if(title_timer) 
-	SDL_RemoveTimer(title_timer);
+  	SDL_RemoveTimer(title_timer);
  delete globalPM;
- globalPM = NULL;
- close_display();
+
 
  return 0;
 }
@@ -261,32 +256,44 @@
 extern "C" void projectM_xmms_init(void) 
 {
   
-  printf("projectM plugin: Initializing\n");
+  /* First, initialize SDL's video subsystem. */
+ // std::cerr << "sdl init begin" << std::endl;  
+  if( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_TIMER ) < 0 ) {
+    /* Failed, exit. */
+    fprintf( stderr, "Video initialization failed: %s\n",
+             SDL_GetError( ) );
+    //projectM_vtable.disable_plugin (&projectM_vtable);
+    return;
+    
+  }
+  sem = SDL_CreateSemaphore(0);
+ // printf("projectM plugin: Initializing\n");
  
   SDL_EnableUNICODE(1);
   
-  mutex = SDL_CreateMutex();
-  sem = SDL_CreateSemaphore(1);
   worker_thread = SDL_CreateThread ( *worker_func, NULL);
  
 }
 
 
 
-extern "C"void projectM_cleanup(void)
+extern "C" void projectM_cleanup(void)
 {
 
-  if(worker_thread) {
-      SDL_SemWait(sem);
-      SDL_WaitThread(worker_thread, NULL);
-      SDL_DestroyMutex(mutex);
-      SDL_DestroySemaphore(sem);
-      SDL_Quit();
-      worker_thread = NULL;
-      sem = NULL;
-      mutex = NULL;
-      printf("projectM plugin: Cleanup completed\n");
-  }
+  if(!sem) return;
+  SDL_SemWait(sem);
+  if(worker_thread) SDL_WaitThread(worker_thread, NULL);
+  // SDL_KillThread(worker_thread);
+  //printf("killed thread\n");
+
+  SDL_DestroySemaphore(sem);
+  //printf("Destroy Mutex\n");
+  SDL_Quit();
+
+  sem = NULL;
+  worker_thread = NULL;
+  
+ // printf("projectM plugin: Cleanup completed\n");
 }
 extern "C" void projectM_about(void)
 {
@@ -306,10 +313,9 @@
 }
 extern "C" void projectM_render_pcm(gint16 pcm_data[2][512])
 {
-  //SDL_mutexP(mutex);
-
-    if(globalPM)
-        globalPM->beatDetect->pcm->addPCM16(pcm_data);
+  //SDL_mutexP(mutex); while ( SDL_SemValue(sem)==1 )
+  if ( SDL_SemValue(sem)==1 )
+        globalPM->pcm->addPCM16(pcm_data);
 	 
        	//SDL_mutexV(mutex);
 	
@@ -336,7 +342,7 @@
    strcpy(projectM_config, PROJECTM_PREFIX);
    strcpy(projectM_config+strlen(PROJECTM_PREFIX), CONFIG_FILE);
    projectM_config[strlen(PROJECTM_PREFIX)+strlen(CONFIG_FILE)]='\0';
-   printf("dir:%s \n",projectM_config);
+   //printf("dir:%s \n",projectM_config);
    home=getenv("HOME");
    strcpy(projectM_home, home);
    strcpy(projectM_home+strlen(home), "/.projectM/config.inp");
@@ -345,7 +351,7 @@
   
  if ((in = fopen(projectM_home, "r")) != 0) 
    {
-     printf("reading ~/.projectM/config.inp \n");
+     //printf("reading ~/.projectM/config.inp \n");
      fclose(in);
      return std::string(projectM_home);
    }
@@ -361,13 +367,13 @@
      strcpy(projectM_home, home);
      strcpy(projectM_home+strlen(home), "/.projectM/config.inp");
      projectM_home[strlen(home)+strlen("/.projectM/config.inp")]='\0';
-     
+
      if((out = fopen(projectM_home,"w"))!=0)
        {
 	
 	 if ((in = fopen(projectM_config, "r")) != 0) 
 	   {
-	     
+
 	     while(fgets(num,80,in)!=NULL)
 	       {
 		 fputs(num,out);
@@ -394,61 +400,63 @@
 	     fclose(in);
 	     return std::string(projectM_config);}
 	 else{ printf("Using implementation defaults, your system is really messed up, I'm suprised we even got this far\n");  abort();}
-	   
        }
 
    }
 
-
-
  abort();
-} 
+}
 
 int frame = 1;
-char dumpPath[128];
 
 
 void saveSnapshotToFile()
 {
-
+  char dumpPath[512];
+  char Home[512];
+  //char *home;
+  
   SDL_Surface *	bitmap;
-       
-        GLint		viewport[4];
-        long		bytewidth;
-        GLint		width, height;
-        long		bytes;
-    
-        glReadBuffer(GL_FRONT);
-        glGetIntegerv(GL_VIEWPORT, viewport);
-        
-        width = viewport[2];
-        height = viewport[3];
+  
+  GLint		viewport[4];
+  long		bytewidth;
+  GLint		width, height;
+  long		bytes;
+  
+  glReadBuffer(GL_FRONT);
+  glGetIntegerv(GL_VIEWPORT, viewport);
+  
+  width = viewport[2];
+  height = viewport[3];
             
-        bytewidth = width * 4;
-        bytewidth = (bytewidth + 3) & ~3;
-        bytes = bytewidth * height;
-
-	/*
-        glFinish();
-        glPixelStorei(GL_PACK_ALIGNMENT, 4);
-        glPixelStorei(GL_PACK_ROW_LENGTH, 0);
-        glPixelStorei(GL_PACK_SKIP_ROWS, 0);
-        glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
-	*/
-	
-
-	bitmap = SDL_CreateRGBSurface(SDL_SWSURFACE, width,  height, 32,0,0,0,0);
-        glReadPixels(0, 0, width, height,
-                    GL_BGRA,
-                    GL_UNSIGNED_INT_8_8_8_8_REV,
-		     bitmap->pixels);
-
-	sprintf(dumpPath, "/home/pete/.projectM/%.8d.bmp", frame++);
-                
-	SDL_SaveBMP(bitmap, dumpPath);
-
-        SDL_FreeSurface(bitmap);
-        
+  bytewidth = width * 4;
+  bytewidth = (bytewidth + 3) & ~3;
+  bytes = bytewidth * height;
+  
+  /*
+    glFinish();
+    glPixelStorei(GL_PACK_ALIGNMENT, 4);
+    glPixelStorei(GL_PACK_ROW_LENGTH, 0);
+    glPixelStorei(GL_PACK_SKIP_ROWS, 0);
+    glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
+  */
+  
+  
+  bitmap = SDL_CreateRGBSurface(SDL_SWSURFACE, width,  height, 32,0,0,0,0);
+  glReadPixels(0, 0, width, height,
+	       GL_BGRA,
+	       GL_UNSIGNED_INT_8_8_8_8_REV,
+	       bitmap->pixels);
+  
+  sprintf(dumpPath, "/.projectM/%.8d.bmp", frame++);
+  // home=getenv("HOME");
+  strcpy(Home, getenv("HOME"));
+  strcpy(Home+strlen(Home), dumpPath);
+  Home[strlen(Home)]='\0';
+  SDL_SaveBMP(bitmap, Home);
+     
+  SDL_FreeSurface(bitmap);
+ 
        
 }
 
--- a/src/projectm-1.0/video_init.cxx	Fri Oct 12 14:24:14 2007 -0500
+++ b/src/projectm-1.0/video_init.cxx	Fri Oct 12 14:24:25 2007 -0500
@@ -9,15 +9,10 @@
 #include <SDL/SDL.h>
 #include <GL/gl.h>
 #include <GL/glu.h>
-
+#include "video_init.h"
+#include <iostream>
 extern SDL_Surface *screen;
 extern int texsize;
-void setup_opengl( int w, int h );
-
-void close_display() {
-  printf("quitting\n");
-  SDL_Quit();
-}
 
 void resize_display(int w, int h, int f) {
   int flags;
@@ -29,7 +24,7 @@
       fprintf( stderr, "Video mode set failed: %s\n", SDL_GetError( ) );
       return;
   }
-  setup_opengl(w,h);
+  
   SDL_ShowCursor(f ? SDL_DISABLE : SDL_ENABLE);
 }
 
@@ -46,15 +41,8 @@
   int bpp = 0;
   /* Flags we will pass into SDL_SetVideoMode. */
   int flags = 0;
-  /* First, initialize SDL's video subsystem. */
-  if( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_TIMER ) < 0 ) {
-    /* Failed, exit. */
-    fprintf( stderr, "Video initialization failed: %s\n",
-             SDL_GetError( ) );
-    //projectM_vtable.disable_plugin (&projectM_vtable);
-    return;
-    
-  }
+
+
   /* Let's get some video information. */
   info = SDL_GetVideoInfo( );
   if( !info ) {
@@ -65,12 +53,10 @@
     return;
   }
   
-  printf("Screen Resolution: %d x %d\n", info->current_w, info->current_h);
+//  printf("Screen Resolution: %d x %d\n", info->current_w, info->current_h);
   *fvw = info->current_w;
   *fvh = info->current_h;
-  printf("set fvw and fvw\n");
   bpp = info->vfmt->BitsPerPixel;
-  printf("set bpp\n");
   //SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8 );
   //SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8 );
   //SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8 );
@@ -81,13 +67,10 @@
   SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 8 );
   SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
   SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
-  printf("set gl attributes\n");
   if (f==0)
      flags = SDL_OPENGL|SDL_HWSURFACE|SDL_RESIZABLE;
   else flags = SDL_OPENGL|SDL_HWSURFACE|SDL_FULLSCREEN;
- printf("set gl attributes2\n");
-  screen= SDL_SetVideoMode( w, h, bpp, flags ) ;
- printf("set screen\n");
+ screen= SDL_SetVideoMode( w, h, bpp, flags ) ;
   if(screen == 0 ) {
     /* 
      * This could happen for a variety of reasons,
@@ -102,55 +85,8 @@
     
   }
   
-  printf("video init done\n");
   // setup_opengl(w,h);
   //gluOrtho2D(0, w, 0, h);
 }
 
 
- void setup_opengl( int w, int h )
-{
-   
-    /* Our shading model--Gouraud (smooth). */
-     glShadeModel( GL_SMOOTH);
-    /* Culling. */
-    //    glCullFace( GL_BACK );
-    //    glFrontFace( GL_CCW );
-    //    glEnable( GL_CULL_FACE );
-    /* Set the clear color. */
-    glClearColor( 0, 0, 0, 0 );
-    /* Setup our viewport. */
-     glViewport( 0, 0, w, h );
-    /*
-     * Change to the projection matrix and set
-     * our viewing volume.
-     */
-    glMatrixMode(GL_TEXTURE);
-    glLoadIdentity();
-    
-    //    gluOrtho2D(0.0, (GLfloat) width, 0.0, (GLfloat) height);
-    glMatrixMode(GL_PROJECTION);
-    glLoadIdentity();  
-   
-    //    glFrustum(0.0, height, 0.0,width,10,40);
-    glMatrixMode(GL_MODELVIEW);
-    glLoadIdentity();
-
-glDrawBuffer(GL_BACK); 
-  glReadBuffer(GL_BACK); 
-  glEnable(GL_BLEND); 
-
-     glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 
-     // glBlendFunc(GL_SRC_ALPHA, GL_ONE); 
-  glEnable(GL_LINE_SMOOTH);
-  glEnable(GL_POINT_SMOOTH);
-  glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
-  glClear(GL_COLOR_BUFFER_BIT);
- 
-  // glCopyTexImage2D(GL_TEXTURE_2D,0,GL_RGB,0,0,texsize,texsize,0);
-  //glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,0,0,texsize,texsize);
-   glLineStipple(2, 0xAAAA);
-  
-    
-}
-
--- a/src/projectm-1.0/video_init.h	Fri Oct 12 14:24:14 2007 -0500
+++ b/src/projectm-1.0/video_init.h	Fri Oct 12 14:24:25 2007 -0500
@@ -1,6 +1,5 @@
- void setup_opengl( int w, int h );
+ 
  void init_display( int w, int h, int *fvw, int *fvh, int fullscreen );
  void resize_display( int w, int h, int fullscreen );
- void close_display();
 
-void CreateRenderTarget(int texsize,int *RenderTargetTextureID, int *RenderTarget);
+
--- a/src/tta/Makefile	Fri Oct 12 14:24:14 2007 -0500
+++ b/src/tta/Makefile	Fri Oct 12 14:24:25 2007 -0500
@@ -10,4 +10,4 @@
 
 CFLAGS += ${PLUGIN_CFLAGS}
 CPPFLAGS += ${PLUGIN_CPPFLAGS} ${MOWGLI_CFLAGS} ${DBUS_CFLAGS} ${GTK_CFLAGS} ${GLIB_CFLAGS} ${PANGO_CFLAGS} -I../../intl -I../..
-LIBS += ${GTK_LIBS} ${GLIB_LIBS} ${PANGO_LIBS} -laudid3tag
+LIBS += -L${libdir} ${GTK_LIBS} ${GLIB_LIBS} ${PANGO_LIBS} -laudid3tag