]> git.sesse.net Git - vlc/blobdiff - src/input/input_info.c
* ./Makefile.am: added a "update-vlc.dsp" rule to create the MSVC project
[vlc] / src / input / input_info.c
index b58c158e76ea1c6e2c11e445af640965d1565865..e795ada082a9566c5dd545edbe94e829c3375de3 100644 (file)
@@ -2,7 +2,7 @@
  * input_info.c: Convenient functions to handle the input info structures
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: input_info.c,v 1.3 2002/07/23 00:30:22 sam Exp $
+ * $Id: input_info.c,v 1.7 2002/11/09 16:34:53 sam Exp $
  *
  * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
  *
 #include "input_ext-intf.h"
 #include "interface.h"
 
-input_info_category_t * input_InfoCategory( input_thread_t * p_this,
+/**
+ * \brief Find info category by name.
+ *
+ * Returns a pointer to the info category with the given name, and
+ * creates it if necessary
+ *
+ * \param p_input pointer to the input thread in which the info is to be found
+ * \param psz_name the name of the category to be found
+ * \returns a pointer to the category with the given name
+ */
+input_info_category_t * input_InfoCategory( input_thread_t * p_input,
                                             char * psz_name)
 {
     input_info_category_t * p_category, * p_prev;
     p_prev = NULL;
-    msg_Dbg( p_this, "searching for category");
-    for ( p_category = p_this->stream.p_info;
+    for ( p_category = p_input->stream.p_info;
           (p_category != NULL) && strcmp( p_category->psz_name, psz_name ); 
           p_category = p_category->p_next)
     {
@@ -50,18 +59,15 @@ input_info_category_t * input_InfoCategory( input_thread_t * p_this,
     }
     if ( p_category )
     {
-        msg_Dbg(p_this, "found category at %p, with name %s", p_category
-            ,p_category->psz_name);
         return p_category;
     }
     else
     {
-        msg_Dbg( p_this, "creating new input category");
         p_category = malloc( sizeof( input_info_category_t ) );
         if ( !p_category )
         {
-            msg_Err( p_this, "No mem" );
-            return 0;
+            msg_Err( p_input, "No mem" );
+            return NULL;
         }
         p_category->psz_name = strdup( psz_name );
         p_category->p_next = NULL;
@@ -71,6 +77,14 @@ input_info_category_t * input_InfoCategory( input_thread_t * p_this,
     }
 }
 
+/**
+ * \brief Add a info item to a category
+ *
+ * \param p_category Pointer to the category to put this info in
+ * \param psz_name Name of the info item to add
+ * \param psz_format printf style format string for the value.
+ * \return a negative number on error. 0 on success.
+ */
 int input_AddInfo( input_info_category_t * p_category, char * psz_name,
                    char * psz_format, ...)
 {
@@ -89,7 +103,7 @@ int input_AddInfo( input_info_category_t * p_category, char * psz_name,
     /*
      * Convert message to string
      */
-#ifdef HAVE_VASPRINTF
+#if defined(HAVE_VASPRINTF) && !defined(SYS_DARWIN)
     vasprintf( &psz_str, psz_format, args );
 #else
     psz_str = (char*) malloc( strlen(psz_format) + INTF_MAX_MSG_SIZE );
@@ -127,6 +141,13 @@ int input_AddInfo( input_info_category_t * p_category, char * psz_name,
     return 0;
 }
 
+/**
+ * \brief Destroy info structures
+ * \internal
+ *
+ * \param p_input The input thread to be cleaned for info
+ * \returns for the moment 0
+ */
 int input_DelInfo( input_thread_t * p_input )
 {
     input_info_category_t * p_category, * p_prev_category;