]> git.sesse.net Git - vlc/commitdiff
Reinstate duration times on playlist item for CD-DA. Done via adding
authorRocky Bernstein <rocky@videolan.org>
Tue, 6 Jan 2004 04:57:34 +0000 (04:57 +0000)
committerRocky Bernstein <rocky@videolan.org>
Tue, 6 Jan 2004 04:57:34 +0000 (04:57 +0000)
an interface to allow setting the duration on adding a playlist item.

include/vlc_playlist.h
modules/access/cdda/access.c
src/playlist/item-ext.c

index e268aa550d7571f2466e56ac48105ff905bf99b5..14387d0968a1c48d5dd2190df524923ed0018277 100644 (file)
@@ -2,7 +2,7 @@
  * vlc_playlist.h : Playlist functions
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
- * $Id: vlc_playlist.h,v 1.19 2004/01/05 12:59:43 zorglub Exp $
+ * $Id: vlc_playlist.h,v 1.20 2004/01/06 04:57:34 rocky Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -65,7 +65,7 @@ struct playlist_item_t
     char *     psz_name;       /**< text describing this item */
     char *     psz_uri;        /**< mrl of this item */
     mtime_t    i_duration;     /**< A hint about the duration of this
-                                * item, in miliseconds*/
+                                * item, in milliseconds*/
     int i_categories;          /**< Number of info categories */
     item_info_category_t **pp_categories;
                                /**< Pointer to the first info category */
@@ -154,6 +154,7 @@ VLC_EXPORT( void, playlist_Command, ( playlist_t *, playlist_command_t, int ) );
 
 /* Item functions */
 VLC_EXPORT( int,  playlist_Add,    ( playlist_t *, const char *, const char *, int, int ) );
+VLC_EXPORT( int,  playlist_AddWDuration, ( playlist_t *, const char *, const char *, int, int, mtime_t ) );
 /* For internal use. Do not use this one anymore */
 VLC_EXPORT( int,  playlist_AddItem, ( playlist_t *, playlist_item_t *, int, int ) );
 VLC_EXPORT( int,  playlist_Delete, ( playlist_t *, int ) );
index 1683b79b05032200668137c8c11f6f970bd70889..e6647e0ed65c316d7146bfc990a95dd527391f35 100644 (file)
@@ -2,7 +2,7 @@
  * cddax.c : CD digital audio input module for vlc using libcdio
  *****************************************************************************
  * Copyright (C) 2000,2003 VideoLAN
- * $Id: access.c,v 1.20 2004/01/05 13:07:02 zorglub Exp $
+ * $Id: access.c,v 1.21 2004/01/06 04:57:34 rocky Exp $
  *
  * Authors: Rocky Bernstein <rocky@panix.com>
  *          Laurent Aimar <fenrir@via.ecp.fr>
@@ -640,8 +640,8 @@ CDDACreatePlayListItem(const input_thread_t *p_input, cdda_data_t *p_cdda,
                        int i_pos)
 {
   mtime_t i_duration =
-    (p_cdda->p_sectors[i_track] - p_cdda->p_sectors[i_track-1])
-    / CDIO_CD_FRAMES_PER_SEC;
+    ((p_cdda->p_sectors[i_track] - p_cdda->p_sectors[i_track-1])
+     / CDIO_CD_FRAMES_PER_SEC) * 1000000;
   char *p_author;
   char *p_title;
   char *config_varname = MODULE_STRING "-title-format";
@@ -660,10 +660,9 @@ CDDACreatePlayListItem(const input_thread_t *p_input, cdda_data_t *p_cdda,
                           psz_mrl, i_track);
 
   dbg_print( INPUT_DBG_META, "mrl: %s, title: %s, duration, %ld, pos %d",
-             psz_mrl, p_title, (long int) i_duration, i_pos );
-  playlist_Add( p_playlist, psz_mrl, p_title, playlist_operation, i_pos );
-
-  /* XXX Set the duration ! */
+             psz_mrl, p_title, (long int) i_duration / 1000000 , i_pos );
+  playlist_AddWDuration( p_playlist, psz_mrl, p_title, playlist_operation, 
+                        i_pos, i_duration );
 
   p_author =
     CDDAFormatStr( p_input, p_cdda,
index d8f876a89684a28e106c3307ec524aa606f37ff8..20f70aea25773817298d9d09a8a62e332820de83 100644 (file)
@@ -2,7 +2,7 @@
  * item-ext.c : Exported playlist item functions
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: item-ext.c,v 1.2 2004/01/05 14:42:14 zorglub Exp $
+ * $Id: item-ext.c,v 1.3 2004/01/06 04:57:34 rocky Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          ClĂ©ment Stenac <zorglub@videolan.org>
  * \param i_pos the position in the playlist where to add. If this is
  *        PLAYLIST_END the item will be added at the end of the playlist
  *        regardless of it's size
+ * \param i_duration length of the item in milliseconds.
  * \return the position of the new item
 */
-int playlist_Add( playlist_t *p_playlist, const char * psz_uri,
-                     const char *psz_name, int i_mode, int i_pos )
+int playlist_AddWDuration( playlist_t *p_playlist, const char * psz_uri,
+                          const char *psz_name, int i_mode, int i_pos,
+                          mtime_t i_duration )
 {
     playlist_item_t * p_item;
 
@@ -71,7 +73,7 @@ int playlist_Add( playlist_t *p_playlist, const char * psz_uri,
     p_item->b_autodeletion = VLC_FALSE;
     p_item->b_enabled = VLC_TRUE;
     p_item->i_group = PLAYLIST_TYPE_MANUAL;
-    p_item->i_duration = -1;
+    p_item->i_duration = i_duration;
 
     p_item->pp_categories = NULL;
     p_item->i_categories = 0;
@@ -81,6 +83,25 @@ int playlist_Add( playlist_t *p_playlist, const char * psz_uri,
     return playlist_AddItem( p_playlist, p_item, i_mode, i_pos );
 }
 
+/**
+ * Add a MRL into the playlist.
+ *
+ * \param p_playlist the playlist to add into
+ * \param psz_uri the mrl to add to the playlist
+ * \param psz_name a text giving a name or description of this item
+ * \param i_mode the mode used when adding
+ * \param i_pos the position in the playlist where to add. If this is
+ *        PLAYLIST_END the item will be added at the end of the playlist
+ *        regardless of it's size
+ * \return the position of the new item
+*/
+int playlist_Add( playlist_t *p_playlist, const char * psz_uri,
+                     const char *psz_name, int i_mode, int i_pos )
+{
+  return playlist_AddWDuration ( p_playlist, psz_uri, psz_name, i_mode, i_pos, 
+                                -1 );
+}
+
 /**
  * Search the position of an item by its id
  * \param p_playlist the playlist