[vlc-commits] dialog: change dialog_provider init/deinit functions
Thomas Guillem
git at videolan.org
Thu Feb 18 14:55:15 CET 2016
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Feb 18 14:53:37 2016 +0100| [f36f415200f9dc793808eca05a09076d319daaae] | committer: Thomas Guillem
dialog: 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=f36f415200f9dc793808eca05a09076d319daaae
---
include/vlc_dialog.h | 6 +++---
src/interface/dialog.c | 18 +++++++++++-------
src/libvlc.c | 5 ++---
3 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/include/vlc_dialog.h b/include/vlc_dialog.h
index 786da22..66e5229 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_dialog_provider_init(libvlc_int_t *p_libvlc);
/* Called from src/libvlc.c */
void
-vlc_dialog_provider_release(vlc_dialog_provider *p_provider);
+libvlc_dialog_provider_deinit(libvlc_int_t *p_libvlc);
/**
* @defgroup vlc_dialog VLC dialog
diff --git a/src/interface/dialog.c b/src/interface/dialog.c
index 7cb9cd6..874005a 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_dialog_provider_init(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_dialog_provider_deinit(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..fc4a59d 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_dialog_provider_init( 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_dialog_provider_deinit( p_libvlc );
#ifdef ENABLE_VLM
/* Destroy VLM if created in libvlc_InternalInit */
More information about the vlc-commits
mailing list