Commit be7869a0 authored by Rocky Bernstein's avatar Rocky Bernstein

Bugs in calculating duration. Thanks Sigmund for fixing the GTK+

interface!

Some doc improvements. CDDARead: Let playlist now cycle through
entries rather than intercept.
parent 92566ba1
...@@ -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.6 2003/12/01 01:08:42 rocky Exp $ * $Id: access.c,v 1.7 2003/12/01 03:34:30 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>
...@@ -419,7 +419,7 @@ static int CDDARead( input_thread_t * p_input, byte_t * p_buffer, ...@@ -419,7 +419,7 @@ static int CDDARead( input_thread_t * p_input, byte_t * p_buffer,
dbg_print( (INPUT_DBG_LSN|INPUT_DBG_CALL), dbg_print( (INPUT_DBG_LSN|INPUT_DBG_CALL),
"end of track, cur: %u", p_cdda->i_sector ); "end of track, cur: %u", p_cdda->i_sector );
if ( p_cdda->i_track >= p_cdda->i_nb_tracks - 1 ) /*???? if ( p_cdda->i_track >= p_cdda->i_nb_tracks - 1 )*/
return 0; /* EOF */ return 0; /* EOF */
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
...@@ -584,13 +584,12 @@ static void InformationCreate( input_thread_t *p_input ) ...@@ -584,13 +584,12 @@ static void InformationCreate( input_thread_t *p_input )
if (!use_cddb) if (!use_cddb)
{ {
lba_t i_sec = cdio_get_track_lba(p_cdda->p_cddev->cdio, track_t i_track = p_cdda->i_nb_tracks;
CDIO_CDROM_LEADOUT_TRACK) ; mtime_t i_duration =
(p_cdda->p_sectors[i_track] - p_cdda->p_sectors[i_track-1])
i_sec /= CDIO_CD_FRAMES_PER_SEC; / CDIO_CD_FRAMES_PER_SEC;
if ( i_sec > 1000 ) input_AddInfo( p_cat, _("Duration"), "%s", secs2TimeStr( i_duration ) );
input_AddInfo( p_cat, _("Duration"), "%s", secs2TimeStr( i_sec ) );
} }
} }
...@@ -727,18 +726,19 @@ GetCDDBInfo( const input_thread_t *p_input, cdda_data_t *p_cdda ) ...@@ -727,18 +726,19 @@ GetCDDBInfo( const input_thread_t *p_input, cdda_data_t *p_cdda )
begin with %, with information from the current CD. begin with %, with information from the current CD.
The expanded string is returned. Here is a list of escape sequences: The expanded string is returned. Here is a list of escape sequences:
%a : The album artist %a : The album artist **
%A : The album information %A : The album information **
%C : Category %C : Category **
%I : CDDB disk ID %I : CDDB disk ID **
%G : Genre %G : Genre **
%M : The current MRL %M : The current MRL
%m : The CD-DA Media Catalog Number (MCN) %m : The CD-DA Media Catalog Number (MCN)
%p : The artist/performer/composer in the track %n : The number of tracks on the CD
%T : The track number %p : The artist/performer/composer in the track **
%T : The track number **
%s : Number of seconds in this track %s : Number of seconds in this track
%t : The name %t : The name **
%Y : The year 19xx or 20xx %Y : The year 19xx or 20xx **
%% : a % %% : a %
*/ */
static char * static char *
...@@ -811,26 +811,31 @@ CDDAFormatStr(const input_thread_t *p_input, cdda_data_t *p_cdda, ...@@ -811,26 +811,31 @@ CDDAFormatStr(const input_thread_t *p_input, cdda_data_t *p_cdda,
add_format_str_info(t->artist); add_format_str_info(t->artist);
} else goto not_special; } else goto not_special;
break; break;
case 's':
if (p_cdda->i_cddb_enabled) {
cddb_track_t *t=cddb_disc_get_track(p_cdda->cddb.disc,
i_track-1);
if (t != NULL && t->length > 1000 ) {
add_format_str_info(secs2TimeStr(t->length));
}
} else goto not_special;
break;
#endif #endif
case 'M': case 'M':
add_format_str_info(mrl); add_format_str_info(mrl);
break; break;
#if FINISHED #if FINISHED
case 'm': case 'm':
add_format_str_info(p_cdda->mcn); add_format_str_info(p_cdda->mcn);
break; break;
#endif #endif
case 'n':
add_format_num_info(p_cdda->i_nb_tracks, "%d");
break;
case 's':
if (p_cdda->i_cddb_enabled) {
mtime_t i_duration =
(p_cdda->p_sectors[i_track] - p_cdda->p_sectors[i_track-1])
/ CDIO_CD_FRAMES_PER_SEC;
add_format_str_info(secs2TimeStr(i_duration));
} else goto not_special;
break;
case 'T': case 'T':
add_format_num_info(i_track, "%d"); add_format_num_info(i_track, "%d");
break; break;
...@@ -855,7 +860,7 @@ CDDACreatePlayListItem(const input_thread_t *p_input, cdda_data_t *p_cdda, ...@@ -855,7 +860,7 @@ CDDACreatePlayListItem(const input_thread_t *p_input, cdda_data_t *p_cdda,
{ {
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])
* 1000 / CDIO_CD_FRAMES_PER_SEC; / CDIO_CD_FRAMES_PER_SEC;
char *p_title; char *p_title;
snprintf(psz_mrl, psz_mrl_max, "%s%s@T%u", snprintf(psz_mrl, psz_mrl_max, "%s%s@T%u",
......
...@@ -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: cdda.c,v 1.5 2003/12/01 01:08:42 rocky Exp $ * $Id: cdda.c,v 1.6 2003/12/01 03:34:30 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>
...@@ -76,22 +76,24 @@ int E_(DebugCallback) ( vlc_object_t *p_this, const char *psz_name, ...@@ -76,22 +76,24 @@ int E_(DebugCallback) ( vlc_object_t *p_this, const char *psz_name,
#define TITLE_FMT_LONGTEXT N_( \ #define TITLE_FMT_LONGTEXT N_( \
"Format used in the GUI Playlist Title. Similar to the Unix date \n" \ "Format used in the GUI Playlist Title. Similar to the Unix date \n" \
"Format specifiers that start with a percent sign. Specifiers are: \n" \ "Format specifiers that start with a percent sign. Specifiers are: \n" \
" %a : The artist\n" \ " %a : The artist **\n" \
" %A : The album information \n" \ " %A : The album information **\n" \
" %C : Category\n" \ " %C : Category **\n" \
" %I : CDDB disk ID\n" \ " %I : CDDB disk ID\n" \
" %G : Genre\n" \ " %G : Genre **\n" \
" %M : The current MRL\n" \ " %M : The current MRL\n" \
" %m : The CD-DA Media Catalog Number (MCN)\n" \ " %m : The CD-DA Media Catalog Number (MCN)\n" \
" %p : The artist/performer/composer in the track \n" \ " %n : The number of tracks on the CD\n" \
" %p : The artist/performer/composer in the track **\n" \
" %T : The track number\n" \ " %T : The track number\n" \
" %s : Number of seconds in this track \n" \ " %s : Number of seconds in this track \n" \
" %t : The name\n" \ " %t : The title **\n" \
" %Y : The year 19xx or 20xx\n" \ " %Y : The year 19xx or 20xx\n **\n" \
" %% : a %\n") " %% : a % \n" \
"\n\n ** Only available if CDDB is enabled")
#ifdef HAVE_LIBCDDB #ifdef HAVE_LIBCDDB
#define DEFAULT_TITLE_FORMAT "Track %T. %t - %p %s", #define DEFAULT_TITLE_FORMAT "Track %T. %t - %p",
#else #else
#define DEFAULT_TITLE_FORMAT "%T %M", #define DEFAULT_TITLE_FORMAT "%T %M",
#endif #endif
......
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