[Mplayer-cvslog] CVS: main/Gui interface.c,1.21,1.22 interface.h,1.14,1.15

Zoltan Ponekker pontscho at mplayerhq.hu
Fri Jul 12 02:53:27 CEST 2002


Update of /cvsroot/mplayer/main/Gui
In directory mail:/var/tmp.root/cvs-serv9684/Gui

Modified Files:
	interface.c interface.h 
Log Message:
add simple playlist support

Index: interface.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/interface.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- interface.c	5 Jul 2002 23:46:56 -0000	1.21
+++ interface.c	12 Jul 2002 00:53:25 -0000	1.22
@@ -214,6 +214,8 @@
 	 btnModify( evSetBalance,guiIntfStruct.Balance );
 	}
 
+#if 0
+#warning video equalizer support disabled 
 	if ( gtkEnableVideoEqualizer )
 	 {
 	  gtkSet( gtkSetContrast,gtkContrast,NULL );
@@ -221,6 +223,7 @@
 	  gtkSet( gtkSetHue,gtkHue,NULL );
 	  gtkSet( gtkSetSaturation,gtkSaturation,NULL );
 	 }
+#endif
 	if ( gtkEnableAudioEqualizer )
 	 {
 	  equalizer_t eq;
@@ -291,13 +294,94 @@
 
 float gtkEquChannels[6][10];
 
-void gtkSet( int cmd,float fparam, void * vparam )
+plItem * plCurrent = NULL;
+plItem * plList = NULL;
+plItem * plLastPlayed = NULL;
+
+#if defined( MP_DEBUG ) && 0
+void list( void )
+{
+ plItem * next = plList;
+ printf( "--- list ---\n" );
+ while( next || next->next )
+  {
+   printf( "item: %s/%s\n",next->path,next->name );
+   if ( next->next ) next=next->next; else break;
+  }
+ printf( "--- end of list ---\n" );
+}
+#else
+#define list();
+#endif
+
+void * gtkSet( int cmd,float fparam, void * vparam )
 {
- mp_cmd_t * mp_cmd = (mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) );
+ mp_cmd_t    * mp_cmd = (mp_cmd_t *)calloc( 1,sizeof( *mp_cmd ) );
  equalizer_t * eq = (equalizer_t *)vparam;
+ plItem      * item = (plItem *)vparam;
  
  switch ( cmd )
   {
+// --- handle playlist
+   case gtkAddPlItem: // add item to platlist
+	if ( plList )
+	 {
+	  plItem * next = plList;
+	  while ( next->next ) { /*printf( "%s\n",next->name );*/ next=next->next; }
+	  next->next=item; item->prev=next;
+	 }
+	 else { item->prev=item->next=NULL; plCurrent=plList=item; }
+        list();
+        return NULL;
+   case gtkGetNextPlItem: // get current item from playlist
+	if ( plCurrent )
+	 {
+	  plCurrent=plCurrent->next;
+	  if ( !plCurrent && plList ) 
+	   {
+	    plItem * next = plList;
+	    while ( next->next ) { if ( !next->next ) break; next=next->next; }
+	    plCurrent=next;
+	   }
+	  return plCurrent;
+	 }
+        return NULL;
+   case gtkGetPrevPlItem:
+	if ( plCurrent )
+	 {
+	  plCurrent=plCurrent->prev;
+	  if ( !plCurrent && plList ) plCurrent=plList;
+	  return plCurrent;
+	 }
+	break;
+   case gtkGetCurrPlItem: // get current item
+        return plCurrent;
+   case gtkDelPl: // delete list
+        {
+	 plItem * curr = plList;
+	 plItem * next;
+	 if ( !plList ) return NULL;
+	 if ( !curr->next )
+	  {
+	   if ( curr->path ) free( curr->path );
+	   if ( curr->name ) free( curr->name );
+	   free( curr ); 
+	  }
+	  else
+	   {
+	    while ( curr->next )
+	     {
+	      next=curr->next;
+	      if ( curr->path ) free( curr->path );
+	      if ( curr->name ) free( curr->name );
+	      free( curr ); 
+	      curr=next;
+	     }
+	   }
+	  plList=NULL; plCurrent=NULL;
+	}
+        return NULL;
+// --- set equalizers
    case gtkSetContrast:
 	mp_cmd->id=MP_CMD_CONTRAST;   mp_cmd->name=strdup( "contrast" );
 	gtkContrast=fparam;
@@ -328,10 +412,11 @@
 	    for ( j=0;j<10;j++ )
 	     { tmp.channel=i; tmp.band=j; audio_plugin_eq.control( AOCONTROL_PLUGIN_EQ_SET_GAIN,(int)&tmp ); }
 	  }
-	return;
-   default: free( mp_cmd ); return;
+	return NULL;
+   default: free( mp_cmd ); return NULL;
   }
  mp_cmd->args[0].v.i=(int)fparam;
  mp_cmd->args[1].v.i=1;
  mp_input_queue_cmd( mp_cmd );
+ return NULL;
 }

Index: interface.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/interface.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- interface.h	3 Jul 2002 18:57:50 -0000	1.14
+++ interface.h	12 Jul 2002 00:53:25 -0000	1.15
@@ -130,11 +130,28 @@
 extern void guiGetEvent( int type,char * arg );
 extern void guiEventHandling( void );
 
+typedef struct _plItem 
+{
+ struct _plItem * prev,* next;
+ int       played;
+ char    * path;
+ char    * name;
+} plItem;
+
+extern plItem * plList;
+extern plItem * plCurrent;
+extern plItem * plLastPlayed;
+
 #define gtkSetContrast   0
 #define gtkSetBrightness 1
 #define gtkSetHue	 2
 #define gtkSetSaturation 3
 #define gtkSetEqualizer  4
+#define gtkAddPlItem     5
+#define gtkGetNextPlItem 6
+#define gtkGetPrevPlItem 7
+#define gtkGetCurrPlItem 8
+#define gtkDelPl         9
 
 extern float gtkContrast;
 extern float gtkBrightness;
@@ -143,7 +160,7 @@
 
 extern float gtkEquChannels[6][10];
 
-extern void gtkSet( int cmd,float param, void * vparam );
+extern void * gtkSet( int cmd,float param, void * vparam );
 
 #define gstrdup( s,ss ) { s=malloc( strlen( ss ) + 3 ); strcpy( s,ss ); }
 




More information about the MPlayer-cvslog mailing list