[vlc-commits] vlm: use vlc_LogHeaderCreate()

Rémi Denis-Courmont git at videolan.org
Wed Feb 20 20:08:57 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Feb 19 22:42:44 2019 +0200| [52e1ffbfc7d0044549fc8d1b049df4a904976ec0] | committer: Rémi Denis-Courmont

vlm: use vlc_LogHeaderCreate()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=52e1ffbfc7d0044549fc8d1b049df4a904976ec0
---

 src/input/vlm.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/input/vlm.c b/src/input/vlm.c
index 934215851a..c99406ae4d 100644
--- a/src/input/vlm.c
+++ b/src/input/vlm.c
@@ -719,6 +719,7 @@ static int vlm_ControlMediaChange( vlm_t *p_vlm, vlm_media_t *p_cfg )
 static int vlm_ControlMediaAdd( vlm_t *p_vlm, vlm_media_t *p_cfg, int64_t *p_id )
 {
     vlm_media_sys_t *p_media;
+    char *header;
 
     if( vlm_MediaDescriptionCheck( p_vlm, p_cfg ) || vlm_ControlMediaGetByName( p_vlm, p_cfg->psz_name ) )
     {
@@ -748,10 +749,17 @@ static int vlm_ControlMediaAdd( vlm_t *p_vlm, vlm_media_t *p_cfg, int64_t *p_id
     if( !p_media )
         return VLC_ENOMEM;
 
-    if( asprintf( &p_media->obj.header, _("Media: %s"),
-                  p_cfg->psz_name ) == -1 )
+    if( asprintf( &header, _("Media: %s"), p_cfg->psz_name ) == -1 )
+    {
+        vlc_object_release( p_media );
+        return VLC_ENOMEM;
+    }
+
+    p_media->obj.logger = vlc_LogHeaderCreate( p_media->obj.logger, header );
+    free( header );
+
+    if( p_media->obj.logger == NULL )
     {
-        p_media->obj.header = NULL;
         vlc_object_release( p_media );
         return VLC_ENOMEM;
     }
@@ -803,6 +811,7 @@ static int vlm_ControlMediaDel( vlm_t *p_vlm, int64_t id )
         p_vlm->p_vod->pf_media_del( p_vlm->p_vod, p_media->vod.p_media );
 
     TAB_REMOVE( p_vlm->i_media, p_vlm->media, p_media );
+    vlc_LogDestroy( p_media->obj.logger );
     vlc_object_release( p_media );
 
     return VLC_SUCCESS;



More information about the vlc-commits mailing list