1

私はwiiリモコンでそれを制御するためにvlcモジュールを書こうとしています。 http://wiki.videolan.org/Hacker_Guide/How_To_Write_a_Module

ライブラリcwiid.hを使用していますhttp://abstrakraft.org/cwiid/wiki/libcwiidKubuntu11.10 を使用しており、モジュールを./vlc -vvv--extraintfwiimoteでコンパイルしている場合はこれを使用していますメッセージ :

メインインターフェイスの警告:モジュール `/home/staross/vlc/modules/control/.libs/libwiimote_plugin.so'をロードできません(/home/staross/vlc/modules/control/.libs/libwiimote_plugin.so:未定義のシンボル:cwiid_find_wiimote)

コンパイラーがライブラリーを見つけることができません。リンクに問題があります。

ライブラリは次のディレクトリにインストールされます:/usr/local/include/cwiid.h

私はすでにたくさんのことを試しました:

絶対パスを#include<>に入れます

cwiid.hのパスを変更します:/ home / staross / vlc / include /

ファイルld.so.confを変更し、次の行を追加します。

include /etc/ld.so.conf.d/*.conf
include /usr/local/lib/*.h

configure.acファイルを変更し、これらの行を追加します

dnl
dnl  Wiimote plugin
dnl
AC_ARG_ENABLE(wiimote,
  [  --enable-wiimote           wiimote support (default disabled)])
if test "${enable_wiimote}" = "yes"
then
  AC_CHECK_HEADER(cwiid.h, AC_CHECK_LIB(cwiid, cwiid_open, have_cwiid="true", have_cwiid="false"), have_cwiid="false")
  if test "${have_cwiid}" = "true"
  then
    VLC_ADD_PLUGIN([wiimote])
    VLC_ADD_LIBS([wiimote],[-lcwiid])
  fi
fi

Modules.amをそのように変更します

SOURCES_hello = hello.c
SOURCES_wiimote = wiimote.c

SUBDIRS = globalhotkeys dbus
SOURCES_dummy = dummy.c
SOURCES_gestures = gestures.c
SOURCES_netsync = netsync.c
SOURCES_ntservice = ntservice.c
SOURCES_hotkeys = hotkeys.c
SOURCES_lirc = lirc.c
SOURCES_oldrc = rc.c
if HAVE_DARWIN
motion_extra = unimotion.c unimotion.h
else
motion_extra = $(NULL)
endif
SOURCES_motion = \
        motion.c \
        $(motion_extra) \
        $(NULL)

libvlc_LTLIBRARIES += \
    libdummy_plugin.la \
    libgestures_plugin.la \
    libnetsync_plugin.la \
    libhotkeys_plugin.la \
    libhello_plugin.la \
    libwiimote_plugin.la
if !HAVE_WINCE
libvlc_LTLIBRARIES += \
    liboldrc_plugin.la
if !HAVE_WIN32
libvlc_LTLIBRARIES += \
    libmotion_plugin.la
else
libvlc_LTLIBRARIES += \
    libntservice_plugin.la
endif
endif

そしてもちろん、wiimote.cからのコード

#include <fcntl.h>

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

/* VLC core API headers */
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_interface.h>

#include <stdlib.h>
#include <vlc_input.h>
#include <vlc_vout.h>
#include <vlc_aout.h>
#include <vlc_osd.h>
#include <vlc_playlist.h>
#include <cwiid.h>

#define BATTERY_STR_LEN 14
#define CHANNELS_NUMBER 4
#define VOLUME_TEXT_CHAN     p_global_intf->p_sys->p_channels[ 0 ]
#define VOLUME_WIDGET_CHAN   p_global_intf->p_sys->p_channels[ 1 ]

/* Forward declarations */
static int  Open    ( vlc_object_t * );
static void Close   ( vlc_object_t * );

/*****************************************************************************
 * Module descriptor
 *****************************************************************************/

vlc_module_begin ()
    set_shortname( N_("Wiimote") )
    set_description( N_("Wiimote control interface") )
    set_category( CAT_INTERFACE )
    set_subcategory( SUBCAT_INTERFACE_CONTROL )
    set_capability( "interface", 0 )
    set_callbacks( Open, Close )
vlc_module_end ()

/*****************************************************************************
 * intf_sys_t: description and status of interface
 *****************************************************************************/
struct intf_sys_t
{
    cwiid_wiimote_t* p_wiimote;        /* wiimote handle */
    struct cwiid_state state;          /* wiimote state */
    bdaddr_t bdaddr;                   /* bluetooth device address */
    int p_channels[ CHANNELS_NUMBER ]; /* contains registered
                                        * channel IDs */
    uint16_t status;
};

/*****************************************************************************
 * Local prototypes
 *****************************************************************************/
static void Run( intf_thread_t * );
void cwiid_callback(cwiid_wiimote_t *wiimote, int mesg_count, union cwiid_mesg mesg[], struct timespec *timestamp);
void cwiid_btn(struct cwiid_btn_mesg *mesg);

static void DisplayVolume( intf_thread_t *p_intf, vout_thread_t *p_vout,
                         audio_volume_t i_vol );
static void ClearChannels( intf_thread_t *p_intf, vout_thread_t *p_vout );

/*****************************************************************************
 * Open: initialize interface
 *****************************************************************************/
static int Open( vlc_object_t *obj )
{   
    intf_thread_t *p_intf = (intf_thread_t *)obj; /* déclaration d'un Thread */
    intf_sys_t *p_sys; /* déclaration d'un pointeur p_sys de type intf_sys_t */

    p_intf->p_sys = p_sys = malloc( sizeof( intf_sys_t ) );
    if( p_sys == NULL )
    {
    msg_Info(p_intf, "VLC_ENOMEM\n");
        return VLC_ENOMEM;
    }
    /* #define BDADDR_ANY   (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}}) */
    p_sys->bdaddr = *BDADDR_ANY; 
    p_intf->pf_run = Run;

    msg_Info(p_intf, "VLC_SUCCESS\n");
    return VLC_SUCCESS;
}

/*****************************************************************************
 * Close: destroy interface
 *****************************************************************************/
static void Close( vlc_object_t *obj )
{
    intf_thread_t *p_intf = (intf_thread_t *)obj;
    intf_sys_t *p_sys = p_intf->p_sys;

    free( p_sys );
}

intf_thread_t *p_global_intf = NULL;

/*****************************************************************************
 * Run: main loop
 *****************************************************************************/
static void Run( intf_thread_t *p_intf )
{
    p_global_intf = p_intf;
    intf_sys_t *p_sys = p_intf->p_sys; /* déclaration d'un pointeur p_sys de type intf_sys_t */
    struct cwiid_state state;
    p_sys->status = 0;

    msg_Err(p_intf, "Put Wiimote in discoverable mode (press 1+2) to connect it...\n");
    cwiid_find_wiimote(&p_sys->bdaddr, 0);
    msg_Info(p_intf, "Test\n");
}

したがって、ここでの質問は、コンパイル者がライブラリを見つけてcwiid.h関数を認識することを期待するために今何ができるかということです。ありがとうございました!

4

1 に答える 1

0

私は問題を解決しました:

objdump -T libwiimote_plugin.so

vlc / modules / control / MakefileからMakefileを変更し、次を追加しました:LIBS_wiimote = -lcwiid

rm *wiimote*

で再構築

make V=1 libwiimote_plugin.la

問題が解決しました :)

于 2012-05-01T12:58:36.123 に答える