Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
e41c90dd
Commit
e41c90dd
authored
Nov 30, 2003
by
Rocky Bernstein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Customizable playlist title.
parent
7614ebe6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
190 additions
and
45 deletions
+190
-45
modules/access/cdda/access.c
modules/access/cdda/access.c
+161
-29
modules/access/cdda/cdda.c
modules/access/cdda/cdda.c
+26
-1
modules/access/cdda/cdda.h
modules/access/cdda/cdda.h
+3
-15
No files found.
modules/access/cdda/access.c
View file @
e41c90dd
...
...
@@ -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.
4 2003/11/30 18:14:20
rocky Exp $
* $Id: access.c,v 1.
5 2003/11/30 22:26:48
rocky Exp $
*
* Authors: Rocky Bernstein <rocky@panix.com>
* Laurent Aimar <fenrir@via.ecp.fr>
...
...
@@ -66,7 +66,7 @@ static int CDDASetProgram ( input_thread_t *, pgrm_descriptor_t * );
static
int
CDDAFixupPlayList
(
const
input_thread_t
*
p_input
,
cdda_data_t
*
p_cdda
,
const
char
*
psz_source
,
bool
play_single_track
,
unsigned
int
i_track
);
bool
play_single_track
);
/****************************************************************************
* Private functions
...
...
@@ -312,10 +312,10 @@ E_(Open)( vlc_object_t *p_this )
}
#undef area
CDDAFixupPlayList
(
p_input
,
p_cdda
,
psz_source
,
play_single_track
,
i_track
);
CDDAPlay
(
p_input
,
i_track
);
CDDAFixupPlayList
(
p_input
,
p_cdda
,
psz_source
,
play_single_track
);
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
if
(
!
p_input
->
psz_demux
||
!*
p_input
->
psz_demux
)
...
...
@@ -518,6 +518,12 @@ static void CDDASeek( input_thread_t * p_input, off_t i_off )
}
#ifdef HAVE_LIBCDDB
#define free_and_dup(var, val) \
if (var) free(var); \
if (val) var=strdup(val);
static
void
GetCDDBInfo
(
const
input_thread_t
*
p_input
,
cdda_data_t
*
p_cdda
)
{
...
...
@@ -600,10 +606,6 @@ GetCDDBInfo( const input_thread_t *p_input, cdda_data_t *p_cdda )
if
(
p_cdda
->
i_debug
&
INPUT_DBG_CDDB
)
cddb_disc_print
(
p_cdda
->
cddb
.
disc
);
#if FIXED
if
((
_cdda_is_cd_changed
(
this
)
==
1
))
#endif
/**** _cdda_cddb_set_info(this, this->cddb.disc); ***/
}
else
{
msg_Warn
(
p_input
,
"CDDB error: %s"
,
cddb_error_str
(
errno
));
}
...
...
@@ -615,47 +617,178 @@ GetCDDBInfo( const input_thread_t *p_input, cdda_data_t *p_cdda )
}
#endif
/*HAVE_LIBCDDB*/
#define add_format_str_info(val) \
{ \
const char *str = val; \
unsigned int len; \
if (val != NULL) { \
len=strlen(str); \
if (len != 0) { \
strncat(tp, str, TEMP_STR_LEN-(tp-temp_str)); \
tp += len; \
} \
saw_control_prefix = false; \
} \
}
#define add_format_num_info(val, fmt) \
{ \
char num_str[10]; \
unsigned int len; \
sprintf(num_str, fmt, val); \
len=strlen(num_str); \
if (len != 0) { \
strncat(tp, num_str, TEMP_STR_LEN-(tp-temp_str)); \
tp += len; \
} \
saw_control_prefix = false; \
}
/*!
Take a format string and expand escape sequences, that is sequences that
begin with %, with information from the current CD.
The expanded string is returned. Here is a list of escape sequences:
%a : The artist
%A : The album information
%C : Category
%I : CDDB disk ID
%G : Genre
%M : The current MRL
%m : The CD-DA Media Catalog Number (MCN)
%T : The track number
%t : The name
%Y : The year 19xx or 20xx
%% : a %
*/
static
char
*
CDDAFormatStr
(
const
input_thread_t
*
p_input
,
cdda_data_t
*
p_cdda
,
const
char
format_str
[],
const
char
*
mrl
,
int
i_track
)
{
#define TEMP_STR_SIZE 256
#define TEMP_STR_LEN (TEMP_STR_SIZE-1)
static
char
temp_str
[
TEMP_STR_SIZE
];
size_t
i
;
char
*
tp
=
temp_str
;
bool
saw_control_prefix
=
false
;
size_t
format_len
=
strlen
(
format_str
);
bzero
(
temp_str
,
TEMP_STR_SIZE
);
for
(
i
=
0
;
i
<
format_len
;
i
++
)
{
if
(
!
saw_control_prefix
&&
format_str
[
i
]
!=
'%'
)
{
*
tp
++
=
format_str
[
i
];
saw_control_prefix
=
false
;
continue
;
}
switch
(
format_str
[
i
])
{
case
'%'
:
if
(
saw_control_prefix
)
{
*
tp
++
=
'%'
;
}
saw_control_prefix
=
!
saw_control_prefix
;
break
;
#ifdef HAVE_LIBCDDB
case
'a'
:
if
(
!
p_cdda
->
i_cddb_enabled
)
goto
not_special
;
add_format_str_info
(
p_cdda
->
cddb
.
disc
->
artist
);
break
;
case
'A'
:
if
(
!
p_cdda
->
i_cddb_enabled
)
goto
not_special
;
add_format_str_info
(
p_cdda
->
cddb
.
disc
->
title
);
break
;
case
'C'
:
if
(
!
p_cdda
->
i_cddb_enabled
)
goto
not_special
;
add_format_str_info
(
CDDB_CATEGORY
[
p_cdda
->
cddb
.
disc
->
category
]);
break
;
case
'G'
:
if
(
!
p_cdda
->
i_cddb_enabled
)
goto
not_special
;
add_format_str_info
(
p_cdda
->
cddb
.
disc
->
genre
);
break
;
case
'I'
:
if
(
!
p_cdda
->
i_cddb_enabled
)
goto
not_special
;
add_format_num_info
(
p_cdda
->
cddb
.
disc
->
discid
,
"%x"
);
break
;
case
'Y'
:
if
(
!
p_cdda
->
i_cddb_enabled
)
goto
not_special
;
add_format_num_info
(
p_cdda
->
cddb
.
disc
->
year
,
"%5d"
);
break
;
case
't'
:
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
->
title
!=
NULL
)
add_format_str_info
(
t
->
title
);
}
else
goto
not_special
;
break
;
#endif
case
'M'
:
add_format_str_info
(
mrl
);
break
;
#if FINISHED
case
'm'
:
add_format_str_info
(
p_cdda
->
mcn
);
break
;
#endif
case
'T'
:
add_format_num_info
(
i_track
,
"%d"
);
break
;
#ifdef HAVE_LIBCDDB
not_special:
#endif
default:
*
tp
++
=
'%'
;
*
tp
++
=
format_str
[
i
];
saw_control_prefix
=
false
;
}
}
return
strdup
(
temp_str
);
}
static
void
CDDACreatePlayListItem
(
const
input_thread_t
*
p_input
,
cdda_data_t
*
p_cdda
,
playlist_t
*
p_playlist
,
unsigned
int
i_track
,
char
*
psz_mrl
,
int
psz_mrl_max
,
const
char
*
psz_source
,
int
i_cddb_enabled
,
int
playlist_operation
,
unsigned
int
i_pos
)
const
char
*
psz_source
,
int
playlist_operation
,
unsigned
int
i_pos
)
{
mtime_t
i_duration
=
(
p_cdda
->
p_sectors
[
i_track
]
-
p_cdda
->
p_sectors
[
i_track
-
1
])
*
1000
/
CDIO_CD_FRAMES_PER_SEC
;
char
*
p_title
=
psz_mrl
;
char
*
p_title
;
snprintf
(
psz_mrl
,
psz_mrl_max
,
"%s%s@T%u"
,
CDDA_MRL_PREFIX
,
psz_source
,
i_track
);
if
(
i_cddb_enabled
)
{
cddb_track_t
*
t
=
cddb_disc_get_track
(
p_cdda
->
cddb
.
disc
,
i_track
-
1
);
if
(
t
!=
NULL
&&
t
->
title
!=
NULL
)
p_title
=
t
->
title
;
}
p_title
=
CDDAFormatStr
(
p_input
,
p_cdda
,
config_GetPsz
(
p_input
,
MODULE_STRING
"-title-format"
),
psz_mrl
,
i_track
);
playlist_AddExt
(
p_playlist
,
psz_mrl
,
p_title
,
i_duration
,
0
,
0
,
playlist_operation
,
i_pos
);
}
static
int
CDDAFixupPlayList
(
const
input_thread_t
*
p_input
,
cdda_data_t
*
p_cdda
,
const
char
*
psz_source
,
bool
play_single_track
,
unsigned
int
i_track
)
const
char
*
psz_source
,
bool
play_single_track
)
{
int
i
;
playlist_t
*
p_playlist
;
char
*
psz_mrl
;
unsigned
int
psz_mrl_max
=
strlen
(
CDDA_MRL_PREFIX
)
+
strlen
(
psz_source
)
+
strlen
(
"@T"
)
+
strlen
(
"100"
)
+
1
;
int
i_cddb_enabled
=
#ifdef HAVE_LIBCDDB
p_cdda
->
i_cddb_enabled
=
config_GetInt
(
p_input
,
MODULE_STRING
"-cddb-enabled"
);
#else
0
#endif
if
(
play_single_track
&&
!
i_cddb_enabled
)
return
0
;
if
(
play_single_track
&&
!
p_cdda
->
i_cddb_enabled
)
return
0
;
psz_mrl
=
malloc
(
psz_mrl_max
);
...
...
@@ -675,7 +808,7 @@ CDDAFixupPlayList(const input_thread_t *p_input, cdda_data_t *p_cdda,
}
#ifdef HAVE_LIBCDDB
if
(
i_cddb_enabled
)
if
(
p_cdda
->
i_cddb_enabled
)
GetCDDBInfo
(
p_input
,
p_cdda
);
#endif
...
...
@@ -683,10 +816,9 @@ CDDAFixupPlayList(const input_thread_t *p_input, cdda_data_t *p_cdda,
/* May fill out more information when the playlist user interface becomes
more mature.
*/
CDDACreatePlayListItem
(
p_input
,
p_cdda
,
p_playlist
,
i_track
,
psz_mrl
,
psz_mrl_max
,
psz_source
,
i_cddb_enabled
,
PLAYLIST_REPLACE
,
p_playlist
->
i_index
);
CDDACreatePlayListItem
(
p_input
,
p_cdda
,
p_playlist
,
p_cdda
->
i_track
+
1
,
psz_mrl
,
psz_mrl_max
,
psz_source
,
PLAYLIST_REPLACE
,
p_playlist
->
i_index
);
}
else
{
playlist_Delete
(
p_playlist
,
p_playlist
->
i_index
);
...
...
@@ -694,8 +826,8 @@ CDDAFixupPlayList(const input_thread_t *p_input, cdda_data_t *p_cdda,
for
(
i
=
1
;
i
<=
p_cdda
->
i_nb_tracks
;
i
++
)
{
CDDACreatePlayListItem
(
p_input
,
p_cdda
,
p_playlist
,
i
,
psz_mrl
,
psz_mrl_max
,
psz_source
,
i_cddb_enabled
,
PLAYLIST_
APPEND
,
PLAYLIST_
END
);
psz_mrl_max
,
psz_source
,
PLAYLIST_APPEND
,
PLAYLIST_END
);
}
...
...
modules/access/cdda/cdda.c
View file @
e41c90dd
...
...
@@ -2,7 +2,7 @@
* cddax.c : CD digital audio input module for vlc using libcdio
*****************************************************************************
* Copyright (C) 2000,2003 VideoLAN
* $Id: cdda.c,v 1.
3 2003/11/30 18:14:20
rocky Exp $
* $Id: cdda.c,v 1.
4 2003/11/30 22:26:48
rocky Exp $
*
* Authors: Rocky Bernstein <rocky@panix.com>
* Laurent Aimar <fenrir@via.ecp.fr>
...
...
@@ -73,6 +73,27 @@ int E_(DebugCallback) ( vlc_object_t *p_this, const char *psz_name,
"Allows you to modify the default caching value for cdda streams. This " \
"value should be set in millisecond units." )
#define TITLE_FMT_LONGTEXT 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" \
" %a : The artist\n" \
" %A : The album information \n" \
" %C : Category\n" \
" %I : CDDB disk ID\n" \
" %G : Genre\n" \
" %M : The current MRL\n" \
" %m : The CD-DA Media Catalog Number (MCN)\n" \
" %T : The track number\n" \
" %t : The name\n" \
" %Y : The year 19xx or 20xx\n" \
" %% : a %\n")
#ifdef HAVE_LIBCDDB
#define DEFAULT_TITLE_FORMAT "%T %t",
#else
#define DEFAULT_TILTE_FORMAT "%T %M",
#endif
/*****************************************************************************
* Module descriptor
*****************************************************************************/
...
...
@@ -101,6 +122,10 @@ vlc_module_begin();
N_
(
"CD-ROM device name"
),
DEV_LONGTEXT
,
VLC_FALSE
);
add_string
(
MODULE_STRING
"-title-format"
,
DEFAULT_TITLE_FORMAT
,
NULL
,
N_
(
"Format to use in playlist 'title' field"
),
TITLE_FMT_LONGTEXT
,
VLC_TRUE
);
#ifdef HAVE_LIBCDDB
add_bool
(
MODULE_STRING
"-cddb-enabled"
,
1
,
NULL
,
N_
(
"Do CDDB lookups?"
),
...
...
modules/access/cdda/cdda.h
View file @
e41c90dd
...
...
@@ -3,7 +3,7 @@
* using libcdio, libvcd and libvcdinfo
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: cdda.h,v 1.
2 2003/11/30 18:14:20
rocky Exp $
* $Id: cdda.h,v 1.
3 2003/11/30 22:26:49
rocky Exp $
*
* Authors: Rocky Bernstein <rocky@panix.com>
*
...
...
@@ -62,28 +62,16 @@ typedef struct cdda_data_s
lsn_t
*
p_sectors
;
/* Track sectors */
vlc_bool_t
b_end_of_track
;
/* If the end of track was reached */
int
i_debug
;
/* Debugging mask */
char
*
mcn
;
/* Media Catalog Number */
intf_thread_t
*
p_intf
;
#ifdef HAVE_LIBCDDB
int
i_cddb_enabled
;
struct
{
bool
have_info
;
/* True if we have any info */
cddb_disc_t
*
disc
;
/* libcdio uses this to get disc info */
char
*
cdiscid
;
char
*
disc_title
;
char
disc_year
[
5
];
/* Year. Probably 19XX or 20XX */
char
*
disc_artist
;
char
*
disc_genre
;
cddb_cat_t
disc_category
;
/* CDDB category */
int
disc_seconds
;
/* Length in seconds listed in CDDB
catalog. May or may not match
length below.
*/
int
disc_length
;
/* Length in frames of cd. Used in
CDDB lookups */
unsigned
int
disc_id
;
/* This along with the length and
num_tracks below is what CDDB uses
to look up CD info */
}
cddb
;
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment