* ./plugins/lirc/lirc.c: IR remote control plugin by Sigmund Augdal

<sigmunau@stud.ntnu.no>, activate with --enable-lirc.
  * ./configure.in: put liba52_adec in a builtin for PIC/non-PIC reasons.
This commit is contained in:
Sam Hocevar 2002-02-06 02:37:18 +00:00
parent 5e7b466d87
commit f5c0a050bd
14 changed files with 896 additions and 419 deletions

View File

@ -10,6 +10,10 @@ C: marcari
E: marcari@via.ecp.fr
D: communication with channel server
N: Sigmund Augdal
E: sigmunau@idi.ntnu.no
D: lirc plugin
N: Pierre Baillet
E: oct@zoy.org
C: octplane

View File

@ -35,6 +35,7 @@ PLUGINS_DIR := ac3_adec \
imdct \
kde \
liba52_adec \
lirc \
lpcm_adec \
macosx \
mad \
@ -95,6 +96,7 @@ PLUGINS_TARGETS := ac3_adec/ac3_adec \
imdct/imdctsse \
kde/kde \
liba52_adec/liba52_adec \
lirc/lirc \
lpcm_adec/lpcm_adec \
macosx/macosx \
mad/mad \

View File

@ -87,6 +87,7 @@ LIB_KDE = @LIB_KDE@
LIB_LIBA52_ADEC = @LIB_LIBA52_ADEC@
LIB_LIBDVDCSS = @LIB_LIBDVDCSS@
LIB_LIBDVDREAD = @LIB_LIBDVDREAD@
LIB_LIRC = @LIB_LIRC@
LIB_MACOSX = @LIB_MACOSX@
LIB_MAD = @LIB_MAD@
LIB_MOTIONALTIVEC = @LIB_MOTIONALTIVEC@

883
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -851,7 +851,7 @@ AC_ARG_WITH(dvdread,
CFLAGS_DVDREAD="${CFLAGS_DVDREAD} ${CFLAGS_DVD} -I../../extras/libdvdread"
LIB_DVDREAD="${LIB_DVDREAD} lib/libdvdread.a ${LIB_DVD}"
else
AC_MSG_ERROR([Can't link static dvdread with shared dvdcss])
AC_MSG_ERROR([Can't link static dvdread with shared dvdcss])
fi
;;
xno)
@ -879,7 +879,7 @@ AC_ARG_WITH(dvdread,
fi
if test x${STATIC_LIBDVDCSS} = x1
then
AC_MSG_ERROR([Can't link shared dvdread with static dvdcss])
AC_MSG_ERROR([Can't link shared dvdread with static dvdcss])
else
PLUGINS="${PLUGINS} dvdread"
CFLAGS_DVDREAD="${CFLAGS_DVDREAD} ${CFLAGS_DVD}"
@ -1068,8 +1068,8 @@ AC_ARG_ENABLE(liba52,
if ((test "x$enableval" != "xno") && (test x$SYS != xmingw32))
then
AC_CHECK_HEADERS(a52dec/a52.h, [
PLUGINS="${PLUGINS} liba52_adec"
LIB_LIBA52_ADEC="-la52"
BUILTINS="${BUILTINS} liba52_adec"
LIB_LIBA52_ADEC="${LIB_LIBA52_ADEC} -la52"
],[])
fi
@ -1407,6 +1407,21 @@ if test x$enable_xvideo != xno &&
CPPFLAGS=$saved_CPPFLAGS)
fi
dnl
dnl Lirc plugin
dnl
AC_ARG_ENABLE(lirc,
[ --enable-lirc lirc support (default disabled)])
if test x$enable_lirc = xyes
then
AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
if test x$have_lirc = xtrue
then
PLUGINS="${PLUGINS} lirc"
LIB_LIRC="${LIB_LIRC} -llirc_client"
fi
fi
dnl
dnl ALSA module
dnl
@ -1514,6 +1529,7 @@ AC_SUBST(LIB_KDE)
AC_SUBST(LIB_LIBA52_ADEC)
AC_SUBST(LIB_LIBDVDCSS)
AC_SUBST(LIB_LIBDVDREAD)
AC_SUBST(LIB_LIRC)
AC_SUBST(LIB_MACOSX)
AC_SUBST(LIB_MAD)
AC_SUBST(LIB_MOTIONALTIVEC)

2
debian/changelog vendored
View File

@ -2,7 +2,7 @@ vlc (0.2.92cvs-1) unstable; urgency=low
* Development branch.
-- Christophe Massiot <massiot@via.ecp.fr> Fri, 7 Dec 2001 20:18:56 +0100
-- Samuel Hocevar <sam@zoy.org> Fri, 7 Dec 2001 20:18:56 +0100
vlc (0.2.92-8) unstable; urgency=high

25
debian/control vendored
View File

@ -10,9 +10,11 @@ Build-Depends: debhelper (>=2.2.0),
libesd0-dev,
libsdl1.2-dev (>=1.2.2-3.1),
libqt-dev,
libasound2-dev [alpha arm hppa i386 ia64 m68k mips mipsel powerpc s390 sparc] (>=0.9.0beta7),
libasound2-dev (>=0.9.0beta10a),
libarts-dev,
libmad0-dev
libmad0-dev,
liblircclient-dev,
a52dec-dev
Standards-Version: 3.5.6
Package: vlc
@ -77,7 +79,7 @@ Description: Esound plugin for vlc
vlc, the VideoLAN Client.
Package: vlc-alsa
Architecture: alpha arm hppa i386 ia64 m68k mips mipsel powerpc s390 sparc
Architecture: any
Depends: vlc (= ${Source-Version}), ${shlibs:Depends}
Description: ALSA plugin for vlc
VideoLAN is a free MPEG, MPEG2 and DVD software solution.
@ -136,3 +138,20 @@ Description: aRts plugin for vlc
.
This plugin adds support for the aRts Sound System to vlc, the
VideoLAN Client.
Package: vlc-a52
Architecture: any
Depends: vlc (= ${Source-Version}), ${shlibs:Depends}
Description: A52 plugin for vlc
VideoLAN is a free MPEG, MPEG2 and DVD software solution.
.
This plugin adds support for liba52 to vlc, the VideoLAN Client.
Package: vlc-lirc
Architecture: any
Depends: vlc (= ${Source-Version}), ${shlibs:Depends}
Description: lirc plugin for vlc
VideoLAN is a free MPEG, MPEG2 and DVD software solution.
.
This plugin is an infrared lirc interface for vlc, the
VideoLAN Client.

20
debian/rules vendored
View File

@ -9,7 +9,7 @@
export DH_COMPAT=3
# Compilation options
export CONFIG_FLAGS="--enable-release --prefix=/usr --enable-gnome --enable-gtk --enable-fb --with-ggi --enable-sdl --enable-esd --enable-qt --with-mad --enable-arts"
export CONFIG_FLAGS="--enable-release --prefix=/usr --enable-gnome --enable-gtk --enable-fb --with-ggi --enable-sdl --enable-esd --enable-qt --with-mad --enable-arts --enable-alsa --enable-lirc --enable-liba52"
export LIBDVDCSS_FLAGS="--with-dvdcss=local-shared"
export VIDDIR="usr/share/videolan"
export PIXDIR="usr/share/pixmaps"
@ -25,9 +25,7 @@ build-stamp:
case $(DEB_BUILD_ARCH) in \
i386) \
ARCH_FLAGS="--enable-alsa --with-glide" ;; \
alpha|arm|hppa|ia64|m68k|mips|mipsel|powerpc|s390|sparc) \
ARCH_FLAGS="--enable-alsa" ;; \
ARCH_FLAGS="--with-glide" ;; \
*) \
ARCH_FLAGS="" ;; \
esac ;\
@ -59,11 +57,9 @@ install: build
# make symlinks for packages and install plugins
case $(DEB_BUILD_ARCH) in \
i386) \
ARCH_ALIASES="ggi gtk gnome esd sdl qt arts mad alsa glide" ;; \
alpha|ia64|m68k|powerpc) \
ARCH_ALIASES="ggi gtk gnome esd sdl qt arts mad alsa" ;; \
ARCH_ALIASES="ggi gtk gnome esd sdl qt arts mad alsa a52 lirc glide" ;; \
*) \
ARCH_ALIASES="ggi gtk gnome esd sdl qt arts mad" ;; \
ARCH_ALIASES="ggi gtk gnome esd sdl qt arts mad alsa a52 lirc" ;; \
esac ;\
for alias in $$ARCH_ALIASES ; do \
ln -s vlc debian/vlc-$$alias/usr/share/doc/vlc-$$alias ; \
@ -121,9 +117,9 @@ binary-arch: build install
dh_installman doc/vlc.1
# dh_installinfo
# dh_undocumented
dh_installchangelogs -Nvlc-gnome -Nvlc-gtk -Nvlc-ggi -Nvlc-glide -Nvlc-esd -Nvlc-alsa -Nvlc-sdl -Nvlc-qt -Nvlc-arts -Nvlc-mad ChangeLog
dh_installchangelogs -Nvlc-gnome -Nvlc-gtk -Nvlc-ggi -Nvlc-glide -Nvlc-esd -Nvlc-alsa -Nvlc-sdl -Nvlc-qt -Nvlc-arts -Nvlc-mad -Nvlc-lirc -Nvlc-a52 ChangeLog
# libdvdcss start
dh_installchangelogs -Nvlc-gnome -Nvlc-gtk -Nvlc-ggi -Nvlc-glide -Nvlc-esd -Nvlc-alsa -Nvlc-sdl -Nvlc-qt -Nvlc-arts -Nvlc-mad ChangeLog.libdvdcss
dh_installchangelogs -Nvlc-gnome -Nvlc-gtk -Nvlc-ggi -Nvlc-glide -Nvlc-esd -Nvlc-alsa -Nvlc-sdl -Nvlc-qt -Nvlc-arts -Nvlc-mad -Nvlc-lirc -Nvlc-a52 ChangeLog.libdvdcss
# libdvdcss stop
dh_link
dh_strip
@ -136,10 +132,8 @@ binary-arch: build install
case $(DEB_BUILD_ARCH) in \
i386) \
ARCH_EXCLUDE="" ;; \
alpha|arm|hppa|ia64|m68k|mips|mipsel|powerpc|s390|sparc) \
ARCH_EXCLUDE="-Nvlc-glide" ;; \
*) \
ARCH_EXCLUDE="-Nvlc-glide -Nvlc-alsa" ;; \
ARCH_EXCLUDE="-Nvlc-glide" ;; \
esac ;\
dh_shlibdeps $$ARCH_EXCLUDE ;\
dh_gencontrol $$ARCH_EXCLUDE ;\

2
debian/vlc-lirc.dirs vendored Normal file
View File

@ -0,0 +1,2 @@
usr/lib/videolan/vlc
usr/share/doc

48
doc/lirc/example.lircrc Normal file
View File

@ -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

View File

@ -175,6 +175,12 @@
/* Define if you have the <X11/extensions/Xv.h> header file. */
#undef HAVE_X11_EXTENSIONS_XV_H
/* Define if you have the <X11/extensions/dpms.h> header file. */
#undef HAVE_X11_EXTENSIONS_DPMS_H
/* Define if you have the <a52dec/a52.h> header file. */
#undef HAVE_A52DEC_A52_H
/* Define if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H
@ -341,6 +347,9 @@
/* Define if <strings.h> defines strncasecmp. */
#undef STRNCASECMP_IN_STRINGS_H
/* Define if <X11/extensions/dpms.h> defines DPMSInfo. */
#undef DPMSINFO_IN_DPMS_H
/* Define if <sys/param.h> defines ntohl. */
#undef NTOHL_IN_SYS_PARAM_H
@ -404,6 +413,3 @@
/* Indicate whether we should use SDL/SDL.h or SDL11/SDL.h */
#undef SDL_INCLUDE_FILE
/* Define if <X11/extensions/dmps.h> defines DPMSInfo. */
#undef DPMSINFO_IN_DPMS_H

4
plugins/lirc/.cvsignore Normal file
View File

@ -0,0 +1,4 @@
.dep
*.lo
*.o.*
*.lo.*

1
plugins/lirc/Makefile Normal file
View File

@ -0,0 +1 @@
lirc_SOURCES = lirc.c

287
plugins/lirc/lirc.c Normal file
View File

@ -0,0 +1,287 @@
/*****************************************************************************
* lirc.c : lirc plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: lirc.c,v 1.1 2002/02/06 02:37:18 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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
#include <string.h>
#include <videolan/vlc.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 <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 void intf_getfunctions( function_list_t * p_function_list );
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 );
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START
ADD_WINDOW( "Configuration for lirc module" )
ADD_COMMENT( "use ~/.lircrc" )
MODULE_CONFIG_STOP
MODULE_INIT_START
SET_DESCRIPTION( "infrared remote control module" )
ADD_CAPABILITY( INTF, 8 )
ADD_SHORTCUT( "lirc" )
MODULE_INIT_STOP
MODULE_ACTIVATE_START
intf_getfunctions( &p_module->p_functions->intf );
MODULE_ACTIVATE_STOP
MODULE_DEACTIVATE_START
MODULE_DEACTIVATE_STOP
/*****************************************************************************
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
static void 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
*****************************************************************************/
static int intf_Probe( probedata_t *p_data )
{
return( 1 );
}
/*****************************************************************************
* 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( "intf error: lirc_init failed" );
free( p_intf->p_sys );
return 1;
}
if( lirc_readconfig( NULL, &p_intf->p_sys->config, NULL ) != 0 )
{
intf_ErrMsg( "intf error: lirc_readconfig failed" );
lirc_deinit();
free( p_intf->p_sys );
return 1;
}
return 0;
}
/*****************************************************************************
* intf_Close: destroy dummy interface
*****************************************************************************/
static void intf_Close( intf_thread_t *p_intf )
{
/* Destroy structure */
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;
/* Manage core vlc functions through the callback */
p_intf->pf_manage( p_intf );
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\"",c);
//handle configstrings from .lircrc
vlc_mutex_lock( &p_input_bank->lock );
if( !strcmp( c, "PLAY" ) )
{
if( p_input_bank->pp_input[0] != NULL )
{
input_SetStatus( p_input_bank->pp_input[0], 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" ) && p_input_bank->pp_input[0] != NULL )
{
input_SetStatus( p_input_bank->pp_input[0], 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" ) && p_input_bank->pp_input[0] != NULL )
{
p_input_bank->pp_input[0]->b_eof = 1;
}
if( !strcmp( c, "LAST" ) && p_input_bank->pp_input[0] != NULL )
{
/* FIXME: temporary hack */
intf_PlaylistPrev( p_main->p_playlist );
intf_PlaylistPrev( p_main->p_playlist );
p_input_bank->pp_input[0]->b_eof = 1;
}
if( !strcmp( c, "STOP" ) && p_input_bank->pp_input[0] != NULL )
{
/* end playing item */
p_input_bank->pp_input[0]->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" ) && p_input_bank->pp_input[0] != NULL )
{
input_SetStatus( p_input_bank->pp_input[0], 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" ) && p_input_bank->pp_input[0] != NULL )
{
input_SetStatus( p_input_bank->pp_input[0], 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 );
}
vlc_mutex_unlock( &p_input_bank->lock );
}
free( code );
}
}
}