[vlc-commits] dialog: correctly change dialog_provider init/deinit functions
Thomas Guillem
git at videolan.org
Fri Feb 19 15:17:09 CET 2016
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Feb 19 15:09:40 2016 +0100| [867e58a385b85d511d8547f588393c8e610e4aa5] | committer: Thomas Guillem
dialog: correctly change dialog_provider init/deinit functions
In order to behave like libvlc_Internal* functions.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=867e58a385b85d511d8547f588393c8e610e4aa5
---
include/vlc_dialog.h | 6 +++---
src/interface/dialog.c | 18 +++++++++++-------
src/libvlc.c | 5 ++---
src/libvlccore.sym | 4 ++--
4 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/include/vlc_dialog.h b/include/vlc_dialog.h
index 786da22..038e300 100644
--- a/include/vlc_dialog.h
+++ b/include/vlc_dialog.h
@@ -28,12 +28,12 @@ typedef struct vlc_dialog_id vlc_dialog_id;
typedef struct extension_dialog_t extension_dialog_t;
/* Called from src/libvlc.c */
-vlc_dialog_provider *
-vlc_dialog_provider_new(void);
+int
+libvlc_InternalDialogInit(libvlc_int_t *p_libvlc);
/* Called from src/libvlc.c */
void
-vlc_dialog_provider_release(vlc_dialog_provider *p_provider);
+libvlc_InternalDialogClean(libvlc_int_t *p_libvlc);
/**
* @defgroup vlc_dialog VLC dialog
diff --git a/src/interface/dialog.c b/src/interface/dialog.c
index 7cb9cd6..9968469 100644
--- a/src/interface/dialog.c
+++ b/src/interface/dialog.c
@@ -145,12 +145,13 @@ dialog_id_release(vlc_dialog_id *p_id)
free(p_id);
}
-vlc_dialog_provider *
-vlc_dialog_provider_new(void)
+int
+libvlc_InternalDialogInit(libvlc_int_t *p_libvlc)
{
+ assert(p_libvlc != NULL);
vlc_dialog_provider *p_provider = malloc(sizeof(*p_provider));
- if( p_provider == NULL )
- return NULL;
+ if (p_provider == NULL)
+ return VLC_EGENERIC;
vlc_mutex_init(&p_provider->lock);
vlc_array_init(&p_provider->dialog_array);
@@ -160,8 +161,9 @@ vlc_dialog_provider_new(void)
p_provider->pf_ext_update = NULL;
p_provider->p_ext_data = NULL;
+ libvlc_priv(p_libvlc)->p_dialog_provider = p_provider;
- return p_provider;
+ return VLC_SUCCESS;
}
static int
@@ -239,9 +241,10 @@ dialog_clear_all_locked(vlc_dialog_provider *p_provider)
}
void
-vlc_dialog_provider_release(vlc_dialog_provider *p_provider)
+libvlc_InternalDialogClean(libvlc_int_t *p_libvlc)
{
- assert(p_provider != NULL);
+ assert(p_libvlc != NULL);
+ vlc_dialog_provider *p_provider = libvlc_priv(p_libvlc)->p_dialog_provider;
vlc_mutex_lock(&p_provider->lock);
dialog_clear_all_locked(p_provider);
@@ -249,6 +252,7 @@ vlc_dialog_provider_release(vlc_dialog_provider *p_provider)
vlc_mutex_destroy(&p_provider->lock);
free(p_provider);
+ libvlc_priv(p_libvlc)->p_dialog_provider = NULL;
}
#undef vlc_dialog_provider_set_callbacks
diff --git a/src/libvlc.c b/src/libvlc.c
index ff0b618..301b987 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -235,8 +235,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
}
#endif
- priv->p_dialog_provider = vlc_dialog_provider_new();
- if( priv->p_dialog_provider == NULL )
+ if( libvlc_InternalDialogInit( p_libvlc ) != VLC_SUCCESS )
{
vlc_LogDeinit (p_libvlc);
module_EndBank (true);
@@ -511,7 +510,7 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
libvlc_Quit( p_libvlc );
intf_DestroyAll( p_libvlc );
- vlc_dialog_provider_release( priv->p_dialog_provider );
+ libvlc_InternalDialogClean( p_libvlc );
#ifdef ENABLE_VLM
/* Destroy VLM if created in libvlc_InternalInit */
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 9491a18..fa0aa71 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -222,6 +222,8 @@ input_vaControl
input_Close
intf_Create
libvlc_InternalAddIntf
+libvlc_InternalDialogInit
+libvlc_InternalDialogClean
libvlc_InternalPlay
libvlc_InternalCleanup
libvlc_InternalCreate
@@ -525,8 +527,6 @@ vlc_dialog_id_post_action
vlc_dialog_id_post_login
vlc_dialog_id_set_context
vlc_dialog_is_cancelled
-vlc_dialog_provider_new
-vlc_dialog_provider_release
vlc_dialog_provider_set_callbacks
vlc_dialog_provider_set_ext_callback
vlc_dialog_release
More information about the vlc-commits
mailing list