]> git.sesse.net Git - vlc/blobdiff - src/control/media.c
libvlc: Fix the comment associated to libvlc_event_manager_release().
[vlc] / src / control / media.c
index e11abeefbd671df21b562c0121f60bacee509028..6f853f8e62a84d0ad4a33dc0e50b0332d010451e 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#include "libvlc_internal.h"
-#include "libvlc.h"
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <vlc/libvlc.h>
+#include <vlc/libvlc_media.h>
+#include <vlc/libvlc_media_list.h> // For the subitems, here for convenience
+#include <vlc/libvlc_events.h>
+
+#include <vlc_common.h>
 #include <vlc_input.h>
 #include <vlc_meta.h>
+#include <vlc_playlist.h> /* For the preparser */
+
+#include "libvlc.h"
 
-/* For the preparser */
-#include <vlc_playlist.h>
+#include "libvlc_internal.h"
+#include "media_internal.h"
 
 static const vlc_meta_type_t libvlc_to_vlc_meta[] =
 {
@@ -341,13 +351,27 @@ libvlc_media_t * libvlc_media_new_as_node(
  * The options are detailled in vlc --long-help, for instance "--sout-all"
  **************************************************************************/
 void libvlc_media_add_option(
+                                   libvlc_media_t * p_md,
+                                   const char * psz_option,
+                                   libvlc_exception_t *p_e )
+{
+    VLC_UNUSED(p_e);
+    input_item_AddOption( p_md->p_input_item, psz_option,
+                          VLC_INPUT_OPTION_UNIQUE|VLC_INPUT_OPTION_TRUSTED );
+}
+
+/**************************************************************************
+ * Same as libvlc_media_add_option but with configurable flags.
+ **************************************************************************/
+void libvlc_media_add_option_flag(
                                    libvlc_media_t * p_md,
                                    const char * ppsz_option,
+                                   libvlc_media_option_t i_flags,
                                    libvlc_exception_t *p_e )
 {
     VLC_UNUSED(p_e);
     input_item_AddOption( p_md->p_input_item, ppsz_option,
-                          VLC_INPUT_OPTION_UNIQUE|VLC_INPUT_OPTION_TRUSTED );
+                          i_flags );
 }
 
 /**************************************************************************
@@ -511,7 +535,7 @@ libvlc_media_event_manager( libvlc_media_t * p_md,
 }
 
 /**************************************************************************
- * Get duration of media object.
+ * Get duration of media object (in ms)
  **************************************************************************/
 int64_t
 libvlc_media_get_duration( libvlc_media_t * p_md,
@@ -525,7 +549,7 @@ libvlc_media_get_duration( libvlc_media_t * p_md,
         return -1;
     }
 
-    return input_item_GetDuration( p_md->p_input_item );
+    return input_item_GetDuration( p_md->p_input_item ) / 1000;
 }
 
 /**************************************************************************
@@ -574,13 +598,5 @@ libvlc_media_get_user_data( libvlc_media_t * p_md,
                                        libvlc_exception_t * p_e )
 {
     VLC_UNUSED(p_e);
-
-    if( p_md )
-    {
-        return p_md->p_user_data;
-    }
-    else
-    {
-        return NULL;
-    }
+    return p_md ? p_md->p_user_data : NULL;
 }