
forgot somthing importen i think :)

Sigmund Augdal

On Mon, Feb 04, 2002 at 11:40:42PM +0100, Sigmund Augdal wrote:
> On Sun, Feb 03, 2002 at 09:05:45PM +0100, Jean-Paul Saman wrote:
> > Sigmund,
> > 
> > Great work!
> > 
> > Sigmund Augdal wrote:
> > > 
> > > As i could not find it anywere, I wrote an lirc interface-plugin that
> > > lets you controll vlc using an IR remote control. The following
> > > functions can be asigned to buttons on the remote.
> > > *play
> > > *pause
> > > *next in playlist
> > > *prev in playlist
> > > *fast playback
> > > *slow motion
> > > *stop
> > > *exit
> > > 
> > > Somone should have a look at my changes to the configure.in file,
> > > because i do not know the syntax.
> > > 
> > > Please CC me any comments as I'm not on the list.
> > <
> > > Sigmund Augdal
> > >
> > 
> > A few constructive comments on your patch:
> > + It is better to make changes in Makefile.opts.in because configure
> > rewrites Makefile.opts
> > + For listing only changes I use "diff -urN" this limits the output. If
> > you do a make distclean first, then changes will be against a clean
> > tree. The generated files will then not be included in the patch.
> > 
> > Greetings,
> > Jean-Paul Saman.
> 
> 
> Maybe this this patch will be better liked, the code isn't changed at 
> all but the patch is mush smaller. And still someone should check my 
> changes to configure.in.
> 
> And, is it possible to run to interfaceplugins at once? that would be 
> nice with this thing :)
> 
> I think I'm on the list now, som no CC required.
> 
> Sigmund Augdal


-- Attached file included as plaintext by Listar --

diff -urN vlc-0.2.92/configure.in vlc-0.2.92-lirc/configure.in
--- vlc-0.2.92/configure.in	Mon Dec 31 19:35:02 2001
+++ vlc-0.2.92-lirc/configure.in	Sun Feb  3 13:33:12 2002
@@ -1184,6 +1184,35 @@
   CPPFLAGS=$saved_CPPFLAGS
 fi
 
+dnl Check for LIRC client support
+dnl This really is not worth making a separate file for it. 
+
+have_lirc=yes
+AC_REQUIRE_CPP
+AC_CHECK_LIB(lirc_client,lirc_init,
+  AC_CHECK_HEADER(lirc/lirc_client.h,true,have_lirc=no),have_lirc=no) 
+
+if test "$have_lirc" = "yes"; then
+dnl  AC_DEFINE(HAVE_LIRC);
+  true;
+else
+  AC_MSG_ERROR([*** LIRC client support not available ***]);
+fi
+
+dnl
+dnl  Lirc plugin
+dnl
+AC_ARG_ENABLE(lirc,
+  [  --disable-lirc		lirc support (default enable)])
+if test x$enable_lirc != xno
+then
+  if test x$have_lirc = "xyes"
+  then
+    PLUGINS="${PLUGINS} lirc"
+    LIB="${LIB} -llirc_client"
+  fi
+fi
+
 dnl
 dnl  ALSA module
 dnl
diff -urN vlc-0.2.92/doc/lirc/example.lircrc vlc-0.2.92-lirc/doc/lirc/example.lircrc
--- vlc-0.2.92/doc/lirc/example.lircrc	Thu Jan  1 01:00:00 1970
+++ vlc-0.2.92-lirc/doc/lirc/example.lircrc	Sun Feb  3 13:33:37 2002
@@ -0,0 +1,48 @@
+begin
+  prog = vlc
+  button = PLAY_UP
+  config = PLAY
+  config = PAUSE
+end
+
+begin
+  prog = vlc
+  button = STOP_UP
+  config = STOP
+end
+
+begin
+  prog = vlc
+  button = POWER_UP
+  config = QUIT
+end
+
+begin
+  prog = vlc
+  button = SKIP_FORWARD_UP
+  config = NEXT
+end
+
+begin
+  prog = vlc
+  button = SKIP_BACKWARD
+  config = LAST
+end
+
+begin
+  prog = vlc
+  button = RED_BUTTON_UP
+  config = FULLSCREEN
+end
+
+begin
+  prog = vlc
+  button = REWIND_UP
+  config = SLOW
+end
+
+begin
+  prog = vlc
+  button = FORWARD_UP
+  config = FAST
+end
diff -urN vlc-0.2.92/plugins/lirc/Makefile vlc-0.2.92-lirc/plugins/lirc/Makefile
--- vlc-0.2.92/plugins/lirc/Makefile	Thu Jan  1 01:00:00 1970
+++ vlc-0.2.92-lirc/plugins/lirc/Makefile	Sun Feb  3 13:32:49 2002
@@ -0,0 +1,31 @@
+###############################################################################
+# vlc (VideoLAN Client) dummy and null module makefile
+# (c)2001 VideoLAN
+###############################################################################
+
+#
+# Objects
+#
+
+PLUGIN_LIRC = intf_lirc.o lirc.o
+BUILTIN_LIRC = $(PLUGIN_LIRC:%.o=BUILTIN_%.o)
+PLUGIN_C = $(PLUGIN_LIRC)
+BUILTIN_C = $(BUILTIN_LIRC)
+ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C)
+
+#
+# Virtual targets
+#
+
+include ../../Makefile.modules
+
+#
+# Real targets
+#
+
+../lirc.so: $(PLUGIN_LIRC)
+	$(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) -llirc_client 
+
+../lirc.a: $(BUILTIN_LIRC)
+	ar r $@ $^
+	$(RANLIB) $@
diff -urN vlc-0.2.92/plugins/lirc/intf_lirc.c vlc-0.2.92-lirc/plugins/lirc/intf_lirc.c
--- vlc-0.2.92/plugins/lirc/intf_lirc.c	Thu Jan  1 01:00:00 1970
+++ vlc-0.2.92-lirc/plugins/lirc/intf_lirc.c	Sun Feb  3 13:32:49 2002
@@ -0,0 +1,279 @@
+/*****************************************************************************
+ * intf_lirc.c: remotecontrol interface plugin
+ *****************************************************************************
+ * Copyright (C) 2000, 2001 VideoLAN
+ * $Id: intf_dummy.c,v 1.12 2001/12/07 18:33:07 sam Exp $
+ *
+ * Authors: Sigmund Augdal (sigmunau@idi.ntnu.no)
+ *
+ * This program 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.
+ * 
+ * This program 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, USA.
+ *****************************************************************************/
+
+#define MODULE_NAME lirc
+#include "modules_inner.h"
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <stdlib.h>                                      /* malloc(), free() */
+#include <string.h>
+
+#include "common.h"
+#include "intf_msg.h"
+#include "threads.h"
+#include "mtime.h"
+#include "tests.h"
+
+#include "stream_control.h"
+#include "input_ext-intf.h"
+#include "intf_msg.h"
+#include "interface.h"
+#include "intf_playlist.h"
+
+#include "video.h"
+#include "video_output.h"
+
+#include "modules.h"
+#include "modules_export.h"
+#include <lirc/lirc_client.h>
+
+/*****************************************************************************
+ * intf_sys_t: description and status of FB interface
+ *****************************************************************************/
+typedef struct intf_sys_s
+{
+    struct lirc_config *config;
+    vlc_mutex_t         change_lock;
+} intf_sys_t;
+
+/*****************************************************************************
+ * Local prototypes.
+ *****************************************************************************/
+static int  intf_Probe     ( probedata_t *p_data );
+static int  intf_Open      ( intf_thread_t *p_intf );
+static void intf_Close     ( intf_thread_t *p_intf );
+static void intf_Run       ( intf_thread_t *p_intf );
+
+/*****************************************************************************
+ * Functions exported as capabilities. They are declared as static so that
+ * we don't pollute the namespace too much.
+ *****************************************************************************/
+void _M( intf_getfunctions )( function_list_t * p_function_list )
+{
+    p_function_list->pf_probe = intf_Probe;
+    p_function_list->functions.intf.pf_open  = intf_Open;
+    p_function_list->functions.intf.pf_close = intf_Close;
+    p_function_list->functions.intf.pf_run   = intf_Run;
+}
+
+/*****************************************************************************
+ * intf_Probe: probe the interface and return a score
+ *****************************************************************************
+ * This function tries to initialize Gnome and returns a score to the
+ * plugin manager so that it can select the best plugin.
+ *****************************************************************************/
+static int intf_Probe( probedata_t *p_data )
+{
+    intf_Msg("Probing lirc module");
+    if( TestMethod( INTF_METHOD_VAR, "lirc" ) )
+    {
+        return( 999 );
+    }
+
+    return( 8 );
+}
+
+/*****************************************************************************
+ * intf_Open: initialize dummy interface
+ *****************************************************************************/
+static int intf_Open( intf_thread_t *p_intf )
+{
+    /* Non-buffered stdout */
+    setvbuf( stdout, (char *)NULL, _IOLBF, 0 );
+
+    /* Allocate instance and initialize some members */
+    p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
+    if( p_intf->p_sys == NULL )
+    {
+	intf_ErrMsg("no mem?");
+        return( 1 );
+    };
+
+    if(lirc_init("vlc", 1)==-1) 
+	{
+	    intf_ErrMsg("lirc failed to initilize");
+	    return (1);
+	}
+
+    if(lirc_readconfig(NULL,&p_intf->p_sys->config,NULL)!=0) {
+	intf_ErrMsg("lirc_readconfig faild");
+	return(1);
+    }
+    return( 0 );
+}
+
+/*****************************************************************************
+ * intf_Close: destroy dummy interface
+ *****************************************************************************/
+static void intf_Close( intf_thread_t *p_intf )
+{
+    /* Destroy structure */
+    intf_ErrMsg("closing lirc-plugin");
+    lirc_freeconfig(p_intf->p_sys->config);
+    lirc_deinit();
+    free( p_intf->p_sys );
+}
+
+
+/*****************************************************************************
+ * intf_Run: main loop
+ *****************************************************************************/
+static void intf_Run( intf_thread_t *p_intf )
+{
+    intf_Msg("%i items in playlist", p_main->p_playlist->i_size);
+    while( !p_intf->b_die )
+    {
+        char *code;
+	char *c;
+	int ret;
+	p_intf->pf_manage( p_intf );
+	/* Manage core vlc functions through the callback */
+	while (!p_intf->b_die && lirc_nextcode(&code)==0 ) {
+	    if(code==NULL) continue;
+	    while ((ret=lirc_code2char(p_intf->p_sys->config,code,&c))==0 && c!=NULL &&  !p_intf->b_die ) {
+		intf_Msg("Got config \"%s\"\n",c);
+		//handle configstrings from .lircrc
+
+		if (!strcmp(c,"PLAY")) {
+		    if( p_intf->p_input != NULL )
+			{
+			    input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
+			    p_main->p_playlist->b_stopped = 0;
+			}
+		    else
+			{
+			    vlc_mutex_lock( &p_main->p_playlist->change_lock );
+
+			    if( p_main->p_playlist->b_stopped )
+				{
+				    if( p_main->p_playlist->i_size )
+					{
+					    vlc_mutex_unlock( &p_main->p_playlist->change_lock );
+					    intf_PlaylistJumpto( p_main->p_playlist,
+								 p_main->p_playlist->i_index );
+					}
+				}
+			    else
+				{
+
+				    vlc_mutex_unlock( &p_main->p_playlist->change_lock );
+				}
+
+			}
+		}
+
+		if (!strcmp(c,"PAUSE")) {
+		    if( p_intf->p_input != NULL )
+			{
+			    input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
+			    
+			    vlc_mutex_lock( &p_main->p_playlist->change_lock );
+			    p_main->p_playlist->b_stopped = 0;
+			    vlc_mutex_unlock( &p_main->p_playlist->change_lock );
+			}
+		}
+
+		if (!strcmp(c,"NEXT")) {
+		    if (p_intf->p_input != NULL) {
+			p_intf->p_input->b_eof = 1;
+		    }
+		}
+
+		if (!strcmp(c,"LAST")) {
+		    if (p_intf->p_input != NULL) {
+			/* FIXME: temporary hack */
+			intf_PlaylistPrev( p_main->p_playlist );
+			intf_PlaylistPrev( p_main->p_playlist );
+			p_intf->p_input->b_eof = 1;
+		    }
+		}
+
+		if (!strcmp(c,"STOP")) {
+		    if( p_intf->p_input != NULL )
+			{
+			    /* end playing item */
+			    p_intf->p_input->b_eof = 1;
+			    
+			    /* update playlist */
+			    vlc_mutex_lock( &p_main->p_playlist->change_lock );
+			    
+			    p_main->p_playlist->i_index--;
+			    p_main->p_playlist->b_stopped = 1;
+			    
+			    vlc_mutex_unlock( &p_main->p_playlist->change_lock );
+			    
+			}
+		}
+
+		if (!strcmp(c,"QUIT")) {
+		    p_intf->b_die = 1;
+		}
+
+		if (!strcmp(c,"FULLSCREEN")) {
+		    vlc_mutex_lock( &p_vout_bank->lock );
+		    /* XXX: only fullscreen the first video output */
+		    if( p_vout_bank->i_count )
+			{
+			    p_vout_bank->pp_vout[0]->i_changes
+				|= VOUT_FULLSCREEN_CHANGE;
+			}
+		    vlc_mutex_unlock( &p_vout_bank->lock );
+		}
+
+		if (!strcmp(c,"FAST")) {
+		    if( p_intf->p_input != NULL )
+			{
+			    input_SetStatus( p_intf->p_input, INPUT_STATUS_FASTER );
+			    
+			    vlc_mutex_lock( &p_main->p_playlist->change_lock );
+			    p_main->p_playlist->b_stopped = 0;
+			    vlc_mutex_unlock( &p_main->p_playlist->change_lock );
+			}
+		    
+		}
+
+		if(!strcmp(c,"SLOW")) {
+		    if( p_intf->p_input != NULL )
+			{
+			    input_SetStatus( p_intf->p_input, INPUT_STATUS_SLOWER );
+			    
+			    vlc_mutex_lock( &p_main->p_playlist->change_lock );
+			    p_main->p_playlist->b_stopped = 0;
+			    vlc_mutex_unlock( &p_main->p_playlist->change_lock );
+			}
+		}
+	    }
+
+	    p_intf->pf_manage( p_intf );
+	    free(code);
+	    if(ret==-1) break;
+	}
+	
+    }
+    
+}
+
diff -urN vlc-0.2.92/plugins/lirc/lirc.c vlc-0.2.92-lirc/plugins/lirc/lirc.c
--- vlc-0.2.92/plugins/lirc/lirc.c	Thu Jan  1 01:00:00 1970
+++ vlc-0.2.92-lirc/plugins/lirc/lirc.c	Sun Feb  3 13:32:49 2002
@@ -0,0 +1,74 @@
+/*****************************************************************************
+ * dummy.c : dummy plugin for vlc
+ *****************************************************************************
+ * Copyright (C) 2000, 2001 VideoLAN
+ * $Id: dummy.c,v 1.11 2001/11/28 15:08:05 massiot Exp $
+ *
+ * Authors: Samuel Hocevar <sam@zoy.org>
+ *
+ * This program 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.
+ * 
+ * This program 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, USA.
+ *****************************************************************************/
+
+#define MODULE_NAME lirc
+#include "modules_inner.h"
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <stdlib.h>                                      /* malloc(), free() */
+#include <string.h>
+
+#include "config.h"
+#include "common.h"                                     /* boolean_t, byte_t */
+#include "intf_msg.h"
+#include "threads.h"
+#include "mtime.h"
+
+#include "modules.h"
+#include "modules_export.h"
+
+/*****************************************************************************
+ * Capabilities defined in the other files.
+ *****************************************************************************/
+//void _M( input_getfunctions ) ( function_list_t * p_function_list );
+//void _M( aout_getfunctions )  ( function_list_t * p_function_list );
+//void _M( vout_getfunctions )  ( function_list_t * p_function_list );
+void _M( intf_getfunctions )  ( function_list_t * p_function_list );
+
+/*****************************************************************************
+ * Build configuration tree.
+ *****************************************************************************/
+MODULE_CONFIG_START
+ADD_WINDOW( "Configuration for dummy module" )
+    ADD_COMMENT( "use ~/.lircrc" )
+MODULE_CONFIG_STOP
+
+MODULE_INIT_START
+    p_module->i_capabilities = MODULE_CAPABILITY_INTF;
+    p_module->psz_longname = "remote control module";
+MODULE_INIT_STOP
+
+MODULE_ACTIVATE_START
+//    _M( input_getfunctions )( &p_module->p_functions->input );
+//    _M( aout_getfunctions )( &p_module->p_functions->aout );
+//    _M( vout_getfunctions )( &p_module->p_functions->vout );
+    _M( intf_getfunctions )( &p_module->p_functions->intf );
+MODULE_ACTIVATE_STOP
+
+MODULE_DEACTIVATE_START
+MODULE_DEACTIVATE_STOP
+


-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://www.videolan.org/lists.html

