Problem about adding a new interface module

This forum is about all development around libVLC.
jionghui
New Cone
New Cone
Posts: 5
Joined: 08 Feb 2012 07:59

Problem about adding a new interface module

Postby jionghui » 25 Feb 2012 20:34

Hi,

I'm a new developer, learning how to add a new module into the VLC.

I followed the instruction on Developer Corner. I make a new.c as following:
#include <errno.h>
/*****************************************************************************
* Preamble
*****************************************************************************/

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

#include <stdlib.h>

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


/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
static int Quit ( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );

/* Status Callbacks */
static void RegisterCallbacks( intf_thread_t * );

static void Help ( intf_thread_t *, bool );
static int VolumeChanged( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static int InputEvent( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );

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

vlc_module_begin ()
set_shortname( N_("Hello"))
set_category( CAT_INTERFACE )
set_subcategory( SUBCAT_INTERFACE_CONTROL )
set_description( N_("Hello interface from writer") )
add_string( "hello, who.", NULL, NULL, "writer", "Who to say hello to", true )
set_capability( "interface", 0 )
set_callbacks( Activate, Deactivate )
vlc_module_end ()

/*Internal state for an instance of the module*/
struct inf_sys_t
{
char *who;
}

/*****************************************************************************
* Activate: initialize and create stuff
*****************************************************************************/
static int Open( vlc_object_t *obj )
{
intf_thread_t *intf = (intf_thread_t*)obj;
/* Allocate internal state */
inf_sys_t *sys = malloc (sizeof (*sys));
if (unlikely(sys = NULL))
return VLC_ENOMEM;
intf->p_sys = sys;
/* Read settings */
char *who = var_InheritString(intf, "hello-who");
if (who == NULL)
{
msg_Err(intf, "Nobody to say hello to!");
goto error;
}
sys->who = who;

msg_Info(intf, "Hello %s!", who);
return VLC_SUCCESS;

error:
free(sys);
return VLC_EGENERIC;
}

/*****************************************************************************
* Deactivate: uninitialize and stop the interface
*****************************************************************************/
static void Close( vlc_object_t *obj )
{
intf_thread_t *intf = (intf_thread_t *)obj;
intf_sys_t *sys = intf->p_sys;

msg_Info(intf, "Good bye %s!");

/* Free internal state */
free(sys->who);
free(sys);
}
I put it into ~/modules/control. And then add the following line in the file modules/control/Modules.am:
SOURCES_new = new.c
Then, I add the following lines to extend confiure.ac:
dnl
dnl new
dnl
VLC_ADD_PLUGIN([new])
Finishing these, I used the command line:
./bootstrap
./configure
After configure, I checked the Makefile.am in ~/modules/control. The following lines were added:
# The new plugin
libnew_plugin_la_SOURCES = $(SOURCES_new)
nodist_libnew_plugin_la_SOURCES = $(nodist_SOURCES_new)
# Force per-target objects:
libnew_plugin_la_CFLAGS = $(AM_CFLAGS)
libnew_plugin_la_CXXFLAGS = $(AM_CXXFLAGS)
libnew_plugin_la_OBJCFLAGS = $(AM_OBJCFLAGS)
# Set LIBADD and DEPENDENCIES manually:
libnew_plugin_la_LIBADD = $(AM_LIBADD)
libnew_plugin_la_DEPENDENCIES = $(top_srcdir)/src/libvlccore.sym
Then,
make
./vlc --reset-plugins-cache
./vlc -vvv --color --list
It passed the compile, but the new module cannot be shown in the list. I failed to add this new interface module to VLC. :?

Could anyone please help me find the problem? Thank you very much.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Problem about adding a new interface module

Postby Jean-Baptiste Kempf » 26 Feb 2012 00:54

Was the shared object built in modules/control/.libs/ ?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

jionghui
New Cone
New Cone
Posts: 5
Joined: 08 Feb 2012 07:59

Re: Problem about adding a new interface module

Postby jionghui » 26 Feb 2012 19:59

Was the shared object built in modules/control/.libs/ ?
Thank you very much for reply. But, could you please explain what is the "shared object". Sorry, I'm a beginner.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Problem about adding a new interface module

Postby Jean-Baptiste Kempf » 27 Feb 2012 11:30

Depending on the OS, you should have .so, .dll. .dylibs in the .libs subfolders.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

liyake825
Blank Cone
Blank Cone
Posts: 19
Joined: 26 Jul 2012 04:42

Re: Problem about adding a new interface module

Postby liyake825 » 03 Sep 2012 12:43

Depending on the OS, you should have .so, .dll. .dylibs in the .libs subfolders.

Yes, my module have these dll , but i still can not see them in the list.
Because my module depends on a decoder library( libdecode.a ).I wonder whether my libdecode.a is not good ?
And nothing happens when i hit the the order :
./vlc --reset-plugins-cache
./vlc -vvv --color --list

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Problem about adding a new interface module

Postby Jean-Baptiste Kempf » 07 Sep 2012 18:26

Did you correctly link to your library?

./vlc -vvv --color --list

Should give you a list of plugins and errors too.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

liyake825
Blank Cone
Blank Cone
Posts: 19
Joined: 26 Jul 2012 04:42

Re: Problem about adding a new interface module

Postby liyake825 » 14 Sep 2012 06:24

Did you correctly link to your library?

./vlc -vvv --color --list

Should give you a list of plugins and errors too.
Thank you for reply , i have solved this problem. There is something wrong withmy library.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 4 guests