Commit 6bff1cc9 authored by Srikanth Raju's avatar Srikanth Raju

ML: Media Library Core

Core functions and singleton media library object
parent 49fd520a
...@@ -77,6 +77,7 @@ pluginsinclude_HEADERS = \ ...@@ -77,6 +77,7 @@ pluginsinclude_HEADERS = \
../include/vlc_md5.h \ ../include/vlc_md5.h \
../include/vlc_messages.h \ ../include/vlc_messages.h \
../include/vlc_meta.h \ ../include/vlc_meta.h \
../include/vlc_media_library.h \
../include/vlc_modules.h \ ../include/vlc_modules.h \
../include/vlc_mouse.h \ ../include/vlc_mouse.h \
../include/vlc_mtime.h \ ../include/vlc_mtime.h \
...@@ -452,6 +453,7 @@ SOURCES_libvlc_common = \ ...@@ -452,6 +453,7 @@ SOURCES_libvlc_common = \
misc/update.c \ misc/update.c \
misc/update_crypto.c \ misc/update_crypto.c \
misc/xml.c \ misc/xml.c \
misc/media_library.c \
extras/libc.c \ extras/libc.c \
extras/tdestroy.c \ extras/tdestroy.c \
misc/filter.c \ misc/filter.c \
......
...@@ -1259,6 +1259,10 @@ static const char *const ppsz_albumart_descriptions[] = ...@@ -1259,6 +1259,10 @@ static const char *const ppsz_albumart_descriptions[] =
"The media library is automatically saved and reloaded each time you " \ "The media library is automatically saved and reloaded each time you " \
"start VLC." ) "start VLC." )
#define LOAD_ML_TEXT N_( "Load Media Library" )
#define LOAD_ML_LONGTEXT N_( \
"Enable this option to load the SQL-based Media Library at VLC startup" )
#define PLTREE_TEXT N_("Display playlist tree") #define PLTREE_TEXT N_("Display playlist tree")
#define PLTREE_LONGTEXT N_( \ #define PLTREE_LONGTEXT N_( \
"The playlist can use a tree to categorize some items, like the " \ "The playlist can use a tree to categorize some items, like the " \
...@@ -2123,6 +2127,10 @@ vlc_module_begin () ...@@ -2123,6 +2127,10 @@ vlc_module_begin ()
add_bool( "play-and-pause", 0, NULL, PAP_TEXT, PAP_LONGTEXT, true ) add_bool( "play-and-pause", 0, NULL, PAP_TEXT, PAP_LONGTEXT, true )
change_safe() change_safe()
add_bool( "media-library", 1, NULL, ML_TEXT, ML_LONGTEXT, false ) add_bool( "media-library", 1, NULL, ML_TEXT, ML_LONGTEXT, false )
#if defined( MEDIA_LIBRARY )
add_bool( "load-media-library-on-startup", 1, NULL, LOAD_ML_TEXT,
LOAD_ML_LONGTEXT, false )
#endif
add_bool( "playlist-tree", 0, NULL, PLTREE_TEXT, PLTREE_LONGTEXT, false ) add_bool( "playlist-tree", 0, NULL, PLTREE_TEXT, PLTREE_LONGTEXT, false )
add_string( "open", "", NULL, OPEN_TEXT, OPEN_LONGTEXT, false ) add_string( "open", "", NULL, OPEN_TEXT, OPEN_LONGTEXT, false )
......
...@@ -68,6 +68,8 @@ ...@@ -68,6 +68,8 @@
# include <dbus/dbus.h> # include <dbus/dbus.h>
#endif #endif
#include <vlc_media_library.h>
#include <vlc_playlist.h> #include <vlc_playlist.h>
#include <vlc_interface.h> #include <vlc_interface.h>
...@@ -251,6 +253,7 @@ libvlc_int_t * libvlc_InternalCreate( void ) ...@@ -251,6 +253,7 @@ libvlc_int_t * libvlc_InternalCreate( void )
priv = libvlc_priv (p_libvlc); priv = libvlc_priv (p_libvlc);
priv->p_playlist = NULL; priv->p_playlist = NULL;
priv->p_ml = NULL;
priv->p_dialog_provider = NULL; priv->p_dialog_provider = NULL;
priv->p_vlm = NULL; priv->p_vlm = NULL;
...@@ -819,6 +822,23 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, ...@@ -819,6 +822,23 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
/* System specific configuration */ /* System specific configuration */
system_Configure( p_libvlc, i_argc - vlc_optind, ppsz_argv + vlc_optind ); system_Configure( p_libvlc, i_argc - vlc_optind, ppsz_argv + vlc_optind );
#if defined(MEDIA_LIBRARY)
/* Get the ML */
if( var_GetBool( p_libvlc, "load-media-library-on-startup" ) == true )
{
priv->p_ml = __ml_Create( VLC_OBJECT( p_libvlc ), NULL );
if( !priv->p_ml )
{
msg_Err( p_libvlc, "ML initialization failed" );
return VLC_EGENERIC;
}
}
else
{
priv->p_ml = NULL;
}
#endif
/* Add service discovery modules */ /* Add service discovery modules */
psz_modules = var_InheritString( p_libvlc, "services-discovery" ); psz_modules = var_InheritString( p_libvlc, "services-discovery" );
if( psz_modules ) if( psz_modules )
...@@ -1014,6 +1034,22 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc ) ...@@ -1014,6 +1034,22 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
/* Free playlist now, all threads are gone */ /* Free playlist now, all threads are gone */
playlist_Destroy( p_playlist ); playlist_Destroy( p_playlist );
/* Free playlist now */
#if defined(MEDIA_LIBRARY)
media_library_t* p_ml = priv->p_ml;
if( p_ml )
{
__ml_Destroy( VLC_OBJECT( p_ml ) );
vlc_object_release( p_ml );
libvlc_priv(p_playlist->p_libvlc)->p_ml = NULL;
}
#endif
/* Free playlist */
/* Any thread still running must not assume pl_Hold() succeeds. */
msg_Dbg( p_libvlc, "removing playlist" );
vlc_object_release( p_playlist );
stats_TimersDumpAll( p_libvlc ); stats_TimersDumpAll( p_libvlc );
stats_TimersCleanAll( p_libvlc ); stats_TimersCleanAll( p_libvlc );
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#ifndef LIBVLC_LIBVLC_H #ifndef LIBVLC_LIBVLC_H
# define LIBVLC_LIBVLC_H 1 # define LIBVLC_LIBVLC_H 1
#include<vlc_media_library.h>
typedef struct variable_t variable_t; typedef struct variable_t variable_t;
/* Actions (hot keys) */ /* Actions (hot keys) */
...@@ -211,7 +213,8 @@ typedef struct libvlc_priv_t ...@@ -211,7 +213,8 @@ typedef struct libvlc_priv_t
/* Singleton objects */ /* Singleton objects */
module_t *p_memcpy_module; ///< Fast memcpy plugin used module_t *p_memcpy_module; ///< Fast memcpy plugin used
playlist_t *p_playlist; //< the playlist singleton playlist_t *p_playlist; ///< the playlist singleton
media_library_t *p_ml; ///< the ML singleton
vlm_t *p_vlm; ///< the VLM singleton (or NULL) vlm_t *p_vlm; ///< the VLM singleton (or NULL)
vlc_object_t *p_dialog_provider; ///< dialog provider vlc_object_t *p_dialog_provider; ///< dialog provider
httpd_t *p_httpd; ///< HTTP daemon (src/network/httpd.c) httpd_t *p_httpd; ///< HTTP daemon (src/network/httpd.c)
......
...@@ -241,6 +241,20 @@ LocaleFree ...@@ -241,6 +241,20 @@ LocaleFree
make_URI make_URI
make_path make_path
mdate mdate
__ml_Create
__ml_Destroy
__ml_Hold
__ml_Release
media_Destroy
media_New
ml_OpConnectChilds
__ml_FtreeSpec
__ml_UpdateSimple
ml_GetPersonsFromMedia
ml_DeletePersonTypeFromMedia
ml_PlaySmartPlaylistBasedOn
ml_gc_decref
ml_gc_incref
module_config_free module_config_free
module_config_get module_config_get
module_exists module_exists
......
This diff is collapsed.
...@@ -395,3 +395,60 @@ vlm_t *vlm_New (vlc_object_t *obj) ...@@ -395,3 +395,60 @@ vlm_t *vlm_New (vlc_object_t *obj)
return NULL; return NULL;
} }
#endif /* !ENABLE_VLM */ #endif /* !ENABLE_VLM */
#ifndef MEDIA_LIBRARY
#include<vlc_media_library.h>
media_library_t* __ml_Hold ( vlc_object_t* p_this )
{
return NULL;
}
void __ml_Release ( vlc_object_t* p_this )
{
assert( 0 );
}
media_library_t* __ml_Create ( vlc_object_t *p_this, char* psz_name )
{
return NULL;
}
void __ml_Destroy( vlc_object_t * p_this )
{
assert( 0 );
}
ml_media_t* media_New( media_library_t* p_ml, int id, ml_select_e select, bool reload )
{
assert( 0 );
}
int __ml_UpdateSimple( media_library_t *p_media_library, ml_select_e selected_type,
const char* psz_lvalue, int id, ... )
{
assert( 0 );
}
ml_ftree_t* ml_OpConnectChilds( ml_op_e op, ml_ftree_t* left, ml_ftree_t* right )
{
assert( 0 );
}
ml_ftree_t* __ml_FtreeSpec( ml_ftree_t* tree, ml_select_e crit, int limit,
char* sort )
{
assert( 0 );
}
void ml_PlaySmartPlaylistBasedOn( media_library_t* p_ml,
ml_ftree_t* p_tree )
{
assert( 0 );
}
void ml_DeletePersonTypeFromMedia( ml_media_t* p_media, const char *psz_role )
{
assert( 0 );
}
#endif /* !MEDIA_LIBRARY */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment