]> git.sesse.net Git - vlc/blobdiff - lib/vlm.c
mediacodec: process input buffers in only one place
[vlc] / lib / vlm.c
index c6d5f368107480c99f11d997353aea497d3f871e..4f808c8158252d683a3523e5c8acec8a2c1e96ef 100644 (file)
--- a/lib/vlm.c
+++ b/lib/vlm.c
@@ -1,24 +1,24 @@
 /*****************************************************************************
  * vlm.c: libvlc new API VLM handling functions
  *****************************************************************************
- * Copyright (C) 2005 the VideoLAN team
+ * Copyright (C) 2005 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #ifdef HAVE_CONFIG_H
@@ -263,11 +263,16 @@ static char* recurse_answer( vlm_message_t *p_answer, const char* psz_delim,
              * inside a list), create a property of its name as if it
              * had a name value node
              */
+            free( psz_nametag );
             if( i_list )
             {
                 i_success = asprintf( &psz_nametag, "\"name\": \"%s\",%s",
                               aw_child->psz_name, psz_childdelim );
-                if( i_success == -1 ) break;
+                if( i_success == -1 )
+                {
+                    psz_nametag = NULL;
+                    break;
+                }
             }
             else
             {
@@ -281,7 +286,7 @@ static char* recurse_answer( vlm_message_t *p_answer, const char* psz_delim,
                 strcmp( aw_child->psz_name, "inputs" ) == 0 ||
                 strcmp( aw_child->psz_name, "options" ) == 0 )
             {
-                char *psz_recurse = recurse_answer( aw_child, psz_childdelim, 1 ),
+                char *psz_recurse = recurse_answer( aw_child, psz_childdelim, 1 );
                 i_success = asprintf( &psz_tmp, "%s[%s%s%s]%c%s",
                                       psz_response, psz_childdelim, psz_recurse,
                                       psz_delim, c_comma, psz_delim );
@@ -295,7 +300,7 @@ static char* recurse_answer( vlm_message_t *p_answer, const char* psz_delim,
              */
             else
             {
-                char *psz_recurse = recurse_answer( aw_child, psz_childdelim, 0 ),
+                char *psz_recurse = recurse_answer( aw_child, psz_childdelim, 0 );
                 i_success = asprintf( &psz_tmp, "%s{%s%s%s%s}%c%s",
                                       psz_response, psz_childdelim, psz_nametag,
                                       psz_recurse, psz_delim, c_comma, psz_delim );
@@ -391,6 +396,7 @@ const char* libvlc_vlm_show_media( libvlc_instance_t *p_instance,
         }
         free( psz_tmp );
     }
+    vlm_MessageDelete( answer );
     free( psz_message );
     return( psz_response );
 }
@@ -762,7 +768,7 @@ int libvlc_vlm_get_media_instance_seekable( libvlc_instance_t *p_instance,
 libvlc_event_manager_t *
 libvlc_vlm_get_event_manager( libvlc_instance_t *p_instance )
 {
-    vlm_t *p_vlm;
-    VLM_RET( p_vlm, NULL);
+    if( libvlc_vlm_init( p_instance ) )
+        return NULL;
     return p_instance->libvlc_vlm.p_event_manager;
 }