Commit 12dc6ed7 authored by Rocky Bernstein's avatar Rocky Bernstein

Reinstate duration times on playlist item for CD-DA. Done via adding

an interface to allow setting the duration on adding a playlist item.
parent 0ba65be5
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vlc_playlist.h : Playlist functions * vlc_playlist.h : Playlist functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN * 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> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -65,7 +65,7 @@ struct playlist_item_t ...@@ -65,7 +65,7 @@ struct playlist_item_t
char * psz_name; /**< text describing this item */ char * psz_name; /**< text describing this item */
char * psz_uri; /**< mrl of this item */ char * psz_uri; /**< mrl of this item */
mtime_t i_duration; /**< A hint about the duration of this mtime_t i_duration; /**< A hint about the duration of this
* item, in miliseconds*/ * item, in milliseconds*/
int i_categories; /**< Number of info categories */ int i_categories; /**< Number of info categories */
item_info_category_t **pp_categories; item_info_category_t **pp_categories;
/**< Pointer to the first info category */ /**< Pointer to the first info category */
...@@ -154,6 +154,7 @@ VLC_EXPORT( void, playlist_Command, ( playlist_t *, playlist_command_t, int ) ); ...@@ -154,6 +154,7 @@ VLC_EXPORT( void, playlist_Command, ( playlist_t *, playlist_command_t, int ) );
/* Item functions */ /* Item functions */
VLC_EXPORT( int, playlist_Add, ( playlist_t *, const char *, const char *, int, int ) ); 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 */ /* 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_AddItem, ( playlist_t *, playlist_item_t *, int, int ) );
VLC_EXPORT( int, playlist_Delete, ( playlist_t *, int ) ); VLC_EXPORT( int, playlist_Delete, ( playlist_t *, int ) );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* cddax.c : CD digital audio input module for vlc using libcdio * cddax.c : CD digital audio input module for vlc using libcdio
***************************************************************************** *****************************************************************************
* Copyright (C) 2000,2003 VideoLAN * 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> * Authors: Rocky Bernstein <rocky@panix.com>
* Laurent Aimar <fenrir@via.ecp.fr> * Laurent Aimar <fenrir@via.ecp.fr>
...@@ -640,8 +640,8 @@ CDDACreatePlayListItem(const input_thread_t *p_input, cdda_data_t *p_cdda, ...@@ -640,8 +640,8 @@ CDDACreatePlayListItem(const input_thread_t *p_input, cdda_data_t *p_cdda,
int i_pos) int i_pos)
{ {
mtime_t i_duration = mtime_t i_duration =
(p_cdda->p_sectors[i_track] - p_cdda->p_sectors[i_track-1]) ((p_cdda->p_sectors[i_track] - p_cdda->p_sectors[i_track-1])
/ CDIO_CD_FRAMES_PER_SEC; / CDIO_CD_FRAMES_PER_SEC) * 1000000;
char *p_author; char *p_author;
char *p_title; char *p_title;
char *config_varname = MODULE_STRING "-title-format"; char *config_varname = MODULE_STRING "-title-format";
...@@ -660,10 +660,9 @@ CDDACreatePlayListItem(const input_thread_t *p_input, cdda_data_t *p_cdda, ...@@ -660,10 +660,9 @@ CDDACreatePlayListItem(const input_thread_t *p_input, cdda_data_t *p_cdda,
psz_mrl, i_track); psz_mrl, i_track);
dbg_print( INPUT_DBG_META, "mrl: %s, title: %s, duration, %ld, pos %d", dbg_print( INPUT_DBG_META, "mrl: %s, title: %s, duration, %ld, pos %d",
psz_mrl, p_title, (long int) i_duration, i_pos ); psz_mrl, p_title, (long int) i_duration / 1000000 , i_pos );
playlist_Add( p_playlist, psz_mrl, p_title, playlist_operation, i_pos ); playlist_AddWDuration( p_playlist, psz_mrl, p_title, playlist_operation,
i_pos, i_duration );
/* XXX Set the duration ! */
p_author = p_author =
CDDAFormatStr( p_input, p_cdda, CDDAFormatStr( p_input, p_cdda,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* item-ext.c : Exported playlist item functions * item-ext.c : Exported playlist item functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * 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> * Authors: Samuel Hocevar <sam@zoy.org>
* Clment Stenac <zorglub@videolan.org> * Clment Stenac <zorglub@videolan.org>
...@@ -41,10 +41,12 @@ ...@@ -41,10 +41,12 @@
* \param i_pos the position in the playlist where to add. If this is * \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 * PLAYLIST_END the item will be added at the end of the playlist
* regardless of it's size * regardless of it's size
* \param i_duration length of the item in milliseconds.
* \return the position of the new item * \return the position of the new item
*/ */
int playlist_Add( playlist_t *p_playlist, const char * psz_uri, int playlist_AddWDuration( playlist_t *p_playlist, const char * psz_uri,
const char *psz_name, int i_mode, int i_pos ) const char *psz_name, int i_mode, int i_pos,
mtime_t i_duration )
{ {
playlist_item_t * p_item; playlist_item_t * p_item;
...@@ -71,7 +73,7 @@ int playlist_Add( playlist_t *p_playlist, const char * psz_uri, ...@@ -71,7 +73,7 @@ int playlist_Add( playlist_t *p_playlist, const char * psz_uri,
p_item->b_autodeletion = VLC_FALSE; p_item->b_autodeletion = VLC_FALSE;
p_item->b_enabled = VLC_TRUE; p_item->b_enabled = VLC_TRUE;
p_item->i_group = PLAYLIST_TYPE_MANUAL; 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->pp_categories = NULL;
p_item->i_categories = 0; p_item->i_categories = 0;
...@@ -81,6 +83,25 @@ int playlist_Add( playlist_t *p_playlist, const char * psz_uri, ...@@ -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 ); 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 * Search the position of an item by its id
* \param p_playlist the playlist * \param p_playlist the playlist
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment