Commit ff8e7223 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

playlist: add playlist-independent functions for meta data handling

This really only depends on the input item(s) and the core.
parent a49e110a
...@@ -279,6 +279,9 @@ VLC_API void input_item_Release(input_item_t *); ...@@ -279,6 +279,9 @@ VLC_API void input_item_Release(input_item_t *);
#define vlc_gc_incref(i) input_item_Hold(i) #define vlc_gc_incref(i) input_item_Hold(i)
#define vlc_gc_decref(i) input_item_Release(i) #define vlc_gc_decref(i) input_item_Release(i)
VLC_API int libvlc_MetaRequest(libvlc_int_t *, input_item_t *);
VLC_API int libvlc_ArtRequest(libvlc_int_t *, input_item_t *);
/****************** /******************
* Input stats * Input stats
******************/ ******************/
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "modules/modules.h" #include "modules/modules.h"
#include "config/configuration.h" #include "config/configuration.h"
#include "playlist/preparser.h"
#include <stdio.h> /* sprintf() */ #include <stdio.h> /* sprintf() */
#include <string.h> #include <string.h>
...@@ -367,6 +368,11 @@ dbus_out: ...@@ -367,6 +368,11 @@ dbus_out:
*/ */
priv->actions = vlc_InitActions( p_libvlc ); priv->actions = vlc_InitActions( p_libvlc );
/*
* Meta data handling
*/
priv->parser = playlist_preparser_New(VLC_OBJECT(p_libvlc));
/* Create a variable for showing the fullscreen interface */ /* Create a variable for showing the fullscreen interface */
var_Create( p_libvlc, "intf-toggle-fscontrol", VLC_VAR_BOOL ); var_Create( p_libvlc, "intf-toggle-fscontrol", VLC_VAR_BOOL );
var_SetBool( p_libvlc, "intf-toggle-fscontrol", true ); var_SetBool( p_libvlc, "intf-toggle-fscontrol", true );
...@@ -569,6 +575,9 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc ) ...@@ -569,6 +575,9 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
} }
#endif #endif
if (priv->parser != NULL)
playlist_preparser_Delete(priv->parser);
vlc_DeinitActions( p_libvlc, priv->actions ); vlc_DeinitActions( p_libvlc, priv->actions );
/* Save the configuration */ /* Save the configuration */
...@@ -675,3 +684,33 @@ static void GetFilenames( libvlc_int_t *p_vlc, unsigned n, ...@@ -675,3 +684,33 @@ static void GetFilenames( libvlc_int_t *p_vlc, unsigned n,
free( mrl ); free( mrl );
} }
} }
/**
* Requests extraction of the meta data for an input item (a.k.a. preparsing).
* The actual extraction is asynchronous.
*/
int libvlc_MetaRequest(libvlc_int_t *libvlc, input_item_t *item)
{
libvlc_priv_t *priv = libvlc_priv(libvlc);
if (unlikely(priv->parser == NULL))
return VLC_ENOMEM;
playlist_preparser_Push(priv->parser, item);
return VLC_SUCCESS;
}
/**
* Requests retrieving/downloading art for an input item.
* The retrieval is performed asynchronously.
*/
int libvlc_ArtRequest(libvlc_int_t *libvlc, input_item_t *item)
{
libvlc_priv_t *priv = libvlc_priv(libvlc);
if (unlikely(priv->parser == NULL))
return VLC_ENOMEM;
playlist_preparser_fetcher_Push(priv->parser, item);
return VLC_SUCCESS;
}
...@@ -163,6 +163,7 @@ typedef struct libvlc_priv_t ...@@ -163,6 +163,7 @@ typedef struct libvlc_priv_t
#ifdef ENABLE_SOUT #ifdef ENABLE_SOUT
sap_handler_t *p_sap; ///< SAP SDP advertiser sap_handler_t *p_sap; ///< SAP SDP advertiser
#endif #endif
struct playlist_preparser_t *parser; ///< Input item meta data handler
struct vlc_actions *actions; ///< Hotkeys handler struct vlc_actions *actions; ///< Hotkeys handler
/* Interfaces */ /* Interfaces */
......
...@@ -230,6 +230,8 @@ libvlc_InternalDestroy ...@@ -230,6 +230,8 @@ libvlc_InternalDestroy
libvlc_InternalInit libvlc_InternalInit
libvlc_Quit libvlc_Quit
libvlc_SetExitHandler libvlc_SetExitHandler
libvlc_MetaRequest
libvlc_ArtRequest
vlc_UrlParse vlc_UrlParse
vlc_UrlClean vlc_UrlClean
vlc_path2uri vlc_path2uri
......
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