首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >VLC模块,Cwiid,Linux,Wiimote,编译问题

VLC模块,Cwiid,Linux,Wiimote,编译问题
EN

Stack Overflow用户
提问于 2012-04-19 15:54:40
回答 1查看 629关注 0票数 1

我正在尝试写一个vlc模块来控制它。http://wiki.videolan.org/Hacker_Guide/How_To_Write_a_Module

我正在使用库cwiid.h http://abstrakraft.org/cwiid/wiki/libcwiid,我在Kubuntu11.10上,当我用./vlc -vvv -extraintf编译我的模块时,我有一条消息:

主接口警告:无法加载模块`/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并添加以下行:

代码语言:javascript
复制
include /etc/ld.so.conf.d/*.conf
include /usr/local/lib/*.h

修改configure.ac文件并添加这些行()

代码语言:javascript
复制
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

代码语言:javascript
复制
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的代码

代码语言:javascript
复制
#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函数?谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-05-01 12:58:36

我解决了问题:

代码语言:javascript
复制
objdump -T libwiimote_plugin.so

我从vlc/modules/control/Makefile修改了Makefile并添加: LIBS_wiimote = -lcwiid

之后

rm *wiimote*

make V=1 libwiimote_plugin.la

已解决的问题:)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10231983

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档