Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
c818ae89
Commit
c818ae89
authored
Dec 25, 2004
by
Rocky Bernstein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a disc-mode and navigation-style control.
parent
ea6b3450
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
247 additions
and
152 deletions
+247
-152
modules/access/cdda/access.c
modules/access/cdda/access.c
+68
-23
modules/access/cdda/access.h
modules/access/cdda/access.h
+2
-2
modules/access/cdda/callback.c
modules/access/cdda/callback.c
+27
-8
modules/access/cdda/callback.h
modules/access/cdda/callback.h
+9
-5
modules/access/cdda/cdda.c
modules/access/cdda/cdda.c
+18
-7
modules/access/cdda/cdda.h
modules/access/cdda/cdda.h
+1
-0
modules/access/cdda/info.c
modules/access/cdda/info.c
+120
-97
modules/access/cdda/info.h
modules/access/cdda/info.h
+2
-10
No files found.
modules/access/cdda/access.c
View file @
c818ae89
...
...
@@ -200,12 +200,20 @@ static block_t * CDDAReadBlocks( access_t * p_access )
return
NULL
;
}
p_access
->
info
.
i_update
|=
INPUT_UPDATE_TITLE
|
INPUT_UPDATE_SIZE
;
p_access
->
info
.
i_update
|=
INPUT_UPDATE_TITLE
;
p_access
->
info
.
i_title
++
;
p_access
->
info
.
i_size
=
p_cdda
->
p_title
[
p_access
->
info
.
i_title
]
->
i_size
;
p_access
->
info
.
i_pos
=
0
;
p_cdda
->
i_track
++
;
if
(
p_cdda
->
b_nav_mode
)
{
char
*
psz_title
=
CDDAFormatTitle
(
p_access
,
p_cdda
->
i_track
);
input_Control
(
p_cdda
->
p_input
,
INPUT_SET_NAME
,
psz_title
);
free
(
psz_title
);
}
else
{
p_access
->
info
.
i_size
=
p_cdda
->
p_title
[
p_access
->
info
.
i_title
]
->
i_size
;
p_access
->
info
.
i_pos
=
0
;
p_access
->
info
.
i_update
|=
INPUT_UPDATE_SIZE
;
}
}
/* Possibly adjust i_blocks so we don't read past the end of a track. */
...
...
@@ -255,8 +263,30 @@ static int CDDASeek( access_t * p_access, int64_t i_pos )
{
cdda_data_t
*
p_cdda
=
(
cdda_data_t
*
)
p_access
->
p_sys
;
p_cdda
->
i_lsn
=
cdio_get_track_lsn
(
p_cdda
->
p_cdio
,
p_cdda
->
i_track
)
+
(
i_pos
/
CDIO_CD_FRAMESIZE_RAW
);
p_cdda
->
i_lsn
=
(
i_pos
/
CDIO_CD_FRAMESIZE_RAW
);
if
(
!
p_cdda
->
b_nav_mode
)
p_cdda
->
i_lsn
+=
cdio_get_track_lsn
(
p_cdda
->
p_cdio
,
p_cdda
->
i_track
);
/* Seeked backwards and we are doing disc mode. */
if
(
p_cdda
->
b_nav_mode
&&
p_access
->
info
.
i_pos
>
i_pos
)
{
track_t
i_track
;
char
*
psz_title
;
for
(
i_track
=
p_cdda
->
i_track
;
i_track
>
1
&&
p_cdda
->
i_lsn
<
cdio_get_track_lsn
(
p_cdda
->
p_cdio
,
i_track
);
i_track
--
,
p_access
->
info
.
i_title
--
)
;
p_cdda
->
i_track
=
i_track
;
p_access
->
info
.
i_update
|=
INPUT_UPDATE_TITLE
;
psz_title
=
CDDAFormatTitle
(
p_access
,
p_cdda
->
i_track
);
input_Control
(
p_cdda
->
p_input
,
INPUT_SET_NAME
,
psz_title
);
free
(
psz_title
);
}
p_access
->
info
.
i_pos
=
i_pos
;
dbg_print
(
(
INPUT_DBG_CALL
|
INPUT_DBG_EXT
|
INPUT_DBG_SEEK
),
...
...
@@ -273,7 +303,8 @@ static int CDDASeek( access_t * p_access, int64_t i_pos )
* Open: open cdda device or image file and initialize structures
* for subsequent operations.
*****************************************************************************/
int
E_
(
CDDAOpen
)(
vlc_object_t
*
p_this
)
int
CDDAOpen
(
vlc_object_t
*
p_this
)
{
access_t
*
p_access
=
(
access_t
*
)
p_this
;
char
*
psz_source
=
NULL
;
...
...
@@ -379,7 +410,10 @@ int E_(CDDAOpen)( vlc_object_t *p_this )
p_cdda
->
i_tracks
=
0
;
p_cdda
->
i_titles
=
0
;
p_cdda
->
i_track
=
i_track
;
p_cdda
->
i_debug
=
config_GetInt
(
p_this
,
MODULE_STRING
"-debug"
);
p_cdda
->
i_debug
=
config_GetInt
(
p_this
,
MODULE_STRING
"-debug"
);
p_cdda
->
b_nav_mode
=
config_GetInt
(
p_this
,
MODULE_STRING
"-navigation-mode"
);
p_cdda
->
i_blocks_per_read
=
config_GetInt
(
p_this
,
MODULE_STRING
"-blocks-per-read"
);
...
...
@@ -466,7 +500,8 @@ int E_(CDDAOpen)( vlc_object_t *p_this )
/*****************************************************************************
* CDDAClose: closes cdda and frees any resources associded with it.
*****************************************************************************/
void
E_
(
CDDAClose
)(
vlc_object_t
*
p_this
)
void
CDDAClose
(
vlc_object_t
*
p_this
)
{
access_t
*
p_access
=
(
access_t
*
)
p_this
;
cdda_data_t
*
p_cdda
=
(
cdda_data_t
*
)
p_access
->
p_sys
;
...
...
@@ -562,11 +597,8 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args )
case
ACCESS_GET_TITLE_INFO
:
{
unsigned
int
psz_mrl_max
=
strlen
(
CDDA_MRL_PREFIX
)
+
strlen
(
p_cdda
->
psz_source
)
+
1
;
input_title_t
***
ppp_title
=
(
input_title_t
***
)
va_arg
(
args
,
input_title_t
***
);
char
*
psz_mrl
=
malloc
(
psz_mrl_max
);
pi_int
=
(
int
*
)
va_arg
(
args
,
int
*
);
*
((
int
*
)
va_arg
(
args
,
int
*
))
=
1
;
/* Title offset */
...
...
@@ -575,13 +607,14 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args )
"GET TITLE: i_tracks %d, i_tracks %d"
,
p_cdda
->
i_tracks
,
p_cdda
->
i_tracks
);
if
(
psz_mrl
==
NULL
)
{
msg_Warn
(
p_access
,
"out of memory"
);
}
else
{
snprintf
(
psz_mrl
,
psz_mrl_max
,
"%s%s"
,
CDDA_MRL_PREFIX
,
p_cdda
->
psz_source
);
CDDAMetaInfo
(
p_access
,
CDIO_INVALID_TRACK
,
psz_mrl
);
free
(
psz_mrl
);
CDDAMetaInfo
(
p_access
,
CDIO_INVALID_TRACK
);
if
(
p_cdda
->
b_nav_mode
)
{
char
*
psz_title
=
CDDAFormatTitle
(
p_access
,
p_cdda
->
i_track
);
input_Control
(
p_cdda
->
p_input
,
INPUT_SET_NAME
,
psz_title
);
free
(
psz_title
);
}
/* Duplicate title info */
...
...
@@ -613,11 +646,23 @@ static int CDDAControl( access_t *p_access, int i_query, va_list args )
if
(
i
!=
p_access
->
info
.
i_title
)
{
/* Update info */
p_access
->
info
.
i_update
|=
INPUT_UPDATE_TITLE
|
INPUT_UPDATE_SIZE
;
p_access
->
info
.
i_update
|=
INPUT_UPDATE_TITLE
;
p_access
->
info
.
i_title
=
i
;
p_access
->
info
.
i_size
=
p_cdda
->
p_title
[
i
]
->
i_size
;
p_access
->
info
.
i_pos
=
0
;
if
(
p_cdda
->
b_nav_mode
)
{
char
*
psz_title
=
CDDAFormatTitle
(
p_access
,
i
+
1
);
input_Control
(
p_cdda
->
p_input
,
INPUT_SET_NAME
,
psz_title
);
free
(
psz_title
);
p_cdda
->
i_track
=
i
+
1
;
p_access
->
info
.
i_pos
=
cdio_get_track_lsn
(
p_cdda
->
p_cdio
,
p_cdda
->
i_track
)
*
CDIO_CD_FRAMESIZE_RAW
;
}
else
{
p_access
->
info
.
i_update
|=
INPUT_UPDATE_SIZE
;
p_access
->
info
.
i_size
=
p_cdda
->
p_title
[
i
]
->
i_size
;
p_access
->
info
.
i_pos
=
0
;
}
/* Next sector to read */
p_cdda
->
i_lsn
=
...
...
modules/access/cdda/access.h
View file @
c818ae89
...
...
@@ -25,9 +25,9 @@
* Open: open cdda device or image file and initialize structures
* for subsequent operations.
*****************************************************************************/
int
E_
(
CDDAOpen
)
(
vlc_object_t
*
);
int
CDDAOpen
(
vlc_object_t
*
);
/*****************************************************************************
* CDDAClose: closes cdda and frees any resources associded with it.
*****************************************************************************/
void
E_
(
CDDAClose
)
(
vlc_object_t
*
);
void
CDDAClose
(
vlc_object_t
*
);
modules/access/cdda/callback.c
View file @
c818ae89
...
...
@@ -25,7 +25,7 @@
#include "cdda.h"
int
E_
(
CDDADebugCB
)
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
CDDADebugCB
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
vlc_value_t
oldval
,
vlc_value_t
val
,
void
*
p_data
)
{
cdda_data_t
*
p_cdda
;
...
...
@@ -46,7 +46,7 @@ E_(CDDADebugCB) ( vlc_object_t *p_this, const char *psz_name,
/* FIXME: could probably shorten some of the below boilerplate code...
*/
int
E_
(
CDDBEnabledCB
)
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
CDDBEnabledCB
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
vlc_value_t
oldval
,
vlc_value_t
val
,
void
*
p_data
)
{
cdda_data_t
*
p_cdda
;
...
...
@@ -68,7 +68,7 @@ E_(CDDBEnabledCB) ( vlc_object_t *p_this, const char *psz_name,
}
int
E_
(
CDTextEnabledCB
)
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
CDTextEnabledCB
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
vlc_value_t
oldval
,
vlc_value_t
val
,
void
*
p_data
)
{
cdda_data_t
*
p_cdda
;
...
...
@@ -79,16 +79,35 @@ E_(CDTextEnabledCB) ( vlc_object_t *p_this, const char *psz_name,
if
(
p_cdda
->
i_debug
&
(
INPUT_DBG_CALL
|
INPUT_DBG_EXT
))
{
msg_Dbg
(
p_cdda_input
,
"Old CDText Enabled (x%0x) %d, new (x%0x) %d"
,
p_cdda
->
b_cdtext_enabled
,
p_cdda
->
b_cdtext_enabled
,
val
.
b_bool
,
val
.
b_bool
);
msg_Dbg
(
p_cdda_input
,
"Old CDText Enabled %d, new %d"
,
p_cdda
->
b_cdtext_enabled
,
val
.
b_bool
);
}
p_cdda
->
b_cdtext_enabled
=
val
.
b_bool
;
return
VLC_SUCCESS
;
}
int
E_
(
CDTextPreferCB
)
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
CDDANavModeCB
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
vlc_value_t
oldval
,
vlc_value_t
val
,
void
*
p_data
)
{
cdda_data_t
*
p_cdda
;
if
(
NULL
==
p_cdda_input
)
return
VLC_EGENERIC
;
p_cdda
=
(
cdda_data_t
*
)
p_cdda_input
->
p_sys
;
if
(
p_cdda
->
i_debug
&
(
INPUT_DBG_CALL
|
INPUT_DBG_EXT
))
{
msg_Dbg
(
p_cdda_input
,
"Old Navigation Mode Enabled %d, new %d"
,
p_cdda
->
b_nav_mode
,
val
.
b_bool
);
}
p_cdda
->
b_nav_mode
=
val
.
b_bool
;
return
VLC_SUCCESS
;
}
int
CDTextPreferCB
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
vlc_value_t
oldval
,
vlc_value_t
val
,
void
*
p_data
)
{
cdda_data_t
*
p_cdda
;
...
...
@@ -110,7 +129,7 @@ E_(CDTextPreferCB) ( vlc_object_t *p_this, const char *psz_name,
}
int
E_
(
CDDABlocksPerReadCB
)
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
CDDABlocksPerReadCB
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
vlc_value_t
oldval
,
vlc_value_t
val
,
void
*
p_data
)
{
cdda_data_t
*
p_cdda
;
...
...
modules/access/cdda/callback.h
View file @
c818ae89
...
...
@@ -30,25 +30,29 @@
#define MAX_BLOCKS_PER_READ 25
#define DEFAULT_BLOCKS_PER_READ 20
int
E_
(
CDDADebugCB
)
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
int
CDDADebugCB
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
vlc_value_t
oldval
,
vlc_value_t
val
,
void
*
p_data
);
int
E_
(
CDDBEnabledCB
)
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
int
CDDBEnabledCB
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
vlc_value_t
oldval
,
vlc_value_t
val
,
void
*
p_data
);
int
E_
(
CDTextEnabledCB
)
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
int
CDTextEnabledCB
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
vlc_value_t
oldval
,
vlc_value_t
val
,
void
*
p_data
);
int
E_
(
CDTextPreferCB
)
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
int
CDTextPreferCB
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
vlc_value_t
oldval
,
vlc_value_t
val
,
void
*
p_data
);
int
CDDANavModeCB
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
vlc_value_t
oldval
,
vlc_value_t
val
,
void
*
p_data
);
int
E_
(
CDDABlocksPerReadCB
)
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
int
CDDABlocksPerReadCB
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
vlc_value_t
oldval
,
vlc_value_t
val
,
void
*
p_data
);
modules/access/cdda/cdda.c
View file @
c818ae89
...
...
@@ -99,14 +99,14 @@ vlc_module_begin();
set_description
(
_
(
"Compact Disc Digital Audio (CD-DA) input"
)
);
set_capability
(
"access2"
,
10
/* compare with priority of cdda */
);
set_shortname
(
N_
(
"Audio CD"
));
set_callbacks
(
E_
(
CDDAOpen
),
E_
(
CDDAClose
)
);
set_callbacks
(
CDDAOpen
,
CDDAClose
);
add_shortcut
(
"cddax"
);
add_shortcut
(
"cd"
);
set_category
(
CAT_INPUT
);
set_subcategory
(
SUBCAT_INPUT_ACCESS
);
/* Configuration options */
add_integer
(
MODULE_STRING
"-debug"
,
0
,
E_
(
CDDADebugCB
)
,
add_integer
(
MODULE_STRING
"-debug"
,
0
,
CDDADebugCB
,
N_
(
"If nonzero, this gives additional debug information."
),
DEBUG_LONGTEXT
,
VLC_TRUE
);
...
...
@@ -116,7 +116,7 @@ vlc_module_begin();
CACHING_LONGTEXT
,
VLC_TRUE
);
add_integer
(
MODULE_STRING
"-blocks-per-read"
,
DEFAULT_BLOCKS_PER_READ
,
E_
(
CDDABlocksPerReadCB
)
,
DEFAULT_BLOCKS_PER_READ
,
CDDABlocksPerReadCB
,
N_
(
"Number of blocks per CD read"
),
BLOCKS_PER_READ_LONGTEXT
,
VLC_TRUE
);
...
...
@@ -132,11 +132,11 @@ vlc_module_begin();
#ifdef HAVE_LIBCDDB
add_string
(
MODULE_STRING
"-cddb-title-format"
,
"Track %T. %t - %p"
,
NULL
,
"Track %T. %t - %p
%A
"
,
NULL
,
N_
(
"Format to use in playlist
\"
title
\"
field when using CDDB"
),
CDDB_TITLE_FMT_LONGTEXT
,
VLC_TRUE
);
add_bool
(
MODULE_STRING
"-cddb-enabled"
,
1
,
E_
(
CDDBEnabledCB
)
,
add_bool
(
MODULE_STRING
"-cddb-enabled"
,
1
,
CDDBEnabledCB
,
N_
(
"Do CDDB lookups?"
),
N_
(
"If set, lookup CD-DA track information using the CDDB "
"protocol"
),
...
...
@@ -179,7 +179,7 @@ vlc_module_begin();
N_
(
"Directory to cache CDDB requests"
),
VLC_TRUE
);
add_bool
(
MODULE_STRING
"-cdtext-prefer"
,
VLC_TRUE
,
E_
(
CDTextPreferCB
)
,
add_bool
(
MODULE_STRING
"-cdtext-prefer"
,
VLC_TRUE
,
CDTextPreferCB
,
N_
(
"Prefer CD-Text info to CDDB info?"
),
N_
(
"If set, CD-Text information will be preferred "
"to CDDB information when both are available"
),
...
...
@@ -187,9 +187,20 @@ vlc_module_begin();
#endif
add_bool
(
MODULE_STRING
"-cdtext-enabled"
,
VLC_TRUE
,
E_
(
CDTextEnabledCB
)
,
add_bool
(
MODULE_STRING
"-cdtext-enabled"
,
VLC_TRUE
,
CDTextEnabledCB
,
N_
(
"Do CD-Text lookups?"
),
N_
(
"If set, get CD-Text information"
),
VLC_FALSE
);
add_bool
(
MODULE_STRING
"-navigation-mode"
,
VLC_TRUE
,
#if FIXED
CDDANavModeCB
,
#else
NULL
,
#endif
N_
(
"Use Navigation-style playback?"
),
N_
(
"If set, tracks are navigated via Navagation rather than "
"a playlist entries"
),
VLC_FALSE
);
vlc_module_end
();
modules/access/cdda/cdda.h
View file @
c818ae89
...
...
@@ -107,6 +107,7 @@ typedef struct cdda_data_s
WAVEHEADER
waveheader
;
/* Wave header for the output data */
vlc_bool_t
b_header
;
vlc_bool_t
b_nav_mode
;
input_thread_t
*
p_input
;
...
...
modules/access/cdda/info.c
View file @
c818ae89
...
...
@@ -42,6 +42,8 @@ static char *CDDAFormatStr( const access_t *p_access, cdda_data_t *p_cdda,
const
char
format_str
[],
const
char
*
psz_mrl
,
track_t
i_track
);
static
char
*
CDDAFormatMRL
(
const
access_t
*
p_access
,
track_t
i_track
);
#ifdef HAVE_LIBCDDB
#define free_and_dup(var, val) \
...
...
@@ -259,13 +261,11 @@ CDDAMetaInfoInit( access_t *p_access )
CD.
*/
void
CDDAMetaInfo
(
access_t
*
p_access
,
track_t
i_track
,
/*const*/
char
*
psz_mrl
)
CDDAMetaInfo
(
access_t
*
p_access
,
track_t
i_track
)
{
cdda_data_t
*
p_cdda
=
(
cdda_data_t
*
)
p_access
->
p_sys
;
char
*
psz_meta_title
=
psz_mrl
;
char
*
psz_meta_title
=
CDDAFormatMRL
(
p_access
,
i_track
)
;
char
*
psz_meta_artist
=
NULL
;
char
*
psz_name
=
NULL
;
char
*
config_varname
=
MODULE_STRING
"-title-format"
;
if
(
!
p_cdda
)
return
;
...
...
@@ -274,11 +274,6 @@ CDDAMetaInfo( access_t *p_access, track_t i_track, /*const*/ char *psz_mrl )
/* Set up for Meta and name for CDDB access. */
if
(
p_cdda
->
b_cddb_enabled
&&
p_cdda
->
cddb
.
disc
)
{
if
(
p_cdda
->
b_cddb_enabled
)
{
config_varname
=
MODULE_STRING
"-cddb-title-format"
;
}
if
(
CDIO_INVALID_TRACK
==
i_track
)
{
...
...
@@ -384,7 +379,7 @@ CDDAMetaInfo( access_t *p_access, track_t i_track, /*const*/ char *psz_mrl )
cdio_get_track_lsn
(
p_cdda
->
p_cdio
,
i_track
);
mtime_t
i_duration
=
i_track_frames
/
CDIO_CD_FRAMES_PER_SEC
;
char
*
psz_mrl
;
char
*
psz_mrl
=
CDDAFormatMRL
(
p_access
,
i_track
)
;
snprintf
(
psz_track
,
TITLE_MAX
,
"%s %02d"
,
_
(
"Track"
),
i_track
);
...
...
@@ -392,9 +387,6 @@ CDDAMetaInfo( access_t *p_access, track_t i_track, /*const*/ char *psz_mrl )
_
(
"Duration"
),
"%s"
,
secstotimestr
(
psz_buffer
,
i_duration
)
);
asprintf
(
&
psz_mrl
,
"%s%s@T%u"
,
CDDA_MRL_PREFIX
,
p_cdda
->
psz_source
,
i_track
);
input_Control
(
p_cdda
->
p_input
,
INPUT_ADD_INFO
,
psz_track
,
_
(
"MRL"
),
"%s"
,
psz_mrl
);
free
(
psz_mrl
);
...
...
@@ -438,8 +430,6 @@ CDDAMetaInfo( access_t *p_access, track_t i_track, /*const*/ char *psz_mrl )
to CDDB or CD-Text values or the default value depending on
availablity and user preferences.
We also set above config_varname to the format used
So now add the title and artist to VLC's meta, and the
name as shown in the status bar and playlist entry.
*/
...
...
@@ -449,12 +439,9 @@ CDDAMetaInfo( access_t *p_access, track_t i_track, /*const*/ char *psz_mrl )
if
(
CDIO_INVALID_TRACK
!=
i_track
)
{
psz_name
=
CDDAFormatStr
(
p_access
,
p_cdda
,
config_GetPsz
(
p_access
,
config_varname
),
psz_mrl
,
i_track
);
char
*
psz_name
=
CDDAFormatTitle
(
p_access
,
i_track
)
;
input_Control
(
p_cdda
->
p_input
,
INPUT_SET_NAME
,
psz_name
);
free
(
psz_name
);
}
}
}
...
...
@@ -523,7 +510,7 @@ cdda_data_t *p_cdda, char *psz_cdtext)
%Y : The year 19xx or 20xx **
%% : a %
*/
static
char
*
char
*
CDDAFormatStr
(
const
access_t
*
p_access
,
cdda_data_t
*
p_cdda
,
const
char
format_str
[],
const
char
*
psz_mrl
,
track_t
i_track
)
{
...
...
@@ -748,6 +735,56 @@ CDDAFormatStr( const access_t *p_access, cdda_data_t *p_cdda,
return
strdup
(
temp_str
);
}
/* Return a MRL for the given track. The caller must free the
allocated string. */
static
char
*
CDDAFormatMRL
(
const
access_t
*
p_access
,
track_t
i_track
)
{
cdda_data_t
*
p_cdda
=
(
cdda_data_t
*
)
p_access
->
p_sys
;
const
unsigned
int
psz_mrl_max
=
strlen
(
CDDA_MRL_PREFIX
)
+
strlen
(
p_cdda
->
psz_source
)
+
+
strlen
(
"@T"
)
+
strlen
(
"100"
)
+
1
;
char
*
psz_mrl
=
malloc
(
psz_mrl_max
);
if
(
CDIO_INVALID_TRACK
==
i_track
)
snprintf
(
psz_mrl
,
psz_mrl_max
,
"%s%s"
,
CDDA_MRL_PREFIX
,
p_cdda
->
psz_source
);
else
snprintf
(
psz_mrl
,
psz_mrl_max
,
"%s%s@T%u"
,
CDDA_MRL_PREFIX
,
p_cdda
->
psz_source
,
i_track
);
return
psz_mrl
;
}
/* Return a title string as specified by the titel format string for the
given track. The caller must free the allocated string. */
char
*
CDDAFormatTitle
(
const
access_t
*
p_access
,
track_t
i_track
)
{
char
*
config_varname
=
MODULE_STRING
"-title-format"
;
cdda_data_t
*
p_cdda
=
(
cdda_data_t
*
)
p_access
->
p_sys
;
char
*
psz_mrl
=
CDDAFormatMRL
(
p_access
,
i_track
);
if
(
psz_mrl
)
{
char
*
psz_name
;
#ifdef HAVE_LIBCDDB
if
(
p_cdda
->
b_cddb_enabled
)
{
config_varname
=
MODULE_STRING
"-cddb-title-format"
;
}
#endif
/*HAVE_LIBCDDB*/
psz_name
=
CDDAFormatStr
(
p_access
,
p_cdda
,
config_GetPsz
(
p_access
,
config_varname
),
psz_mrl
,
i_track
);
free
(
psz_mrl
);
return
psz_name
;
}
return
(
NULL
);
}
/* Adds a string-valued entry to the playlist information under "Track"
if the string is not null or the null string.
*/
...
...
@@ -758,46 +795,33 @@ CDDAFormatStr( const access_t *p_access, cdda_data_t *p_cdda,
"%s", FIELD); \
}
playlist_item_t
*
static
playlist_item_t
*
CDDACreatePlaylistItem
(
const
access_t
*
p_access
,
cdda_data_t
*
p_cdda
,
playlist_t
*
p_playlist
,
playlist_item_t
*
p_item
,
track_t
i_track
,
char
*
psz_mrl
,
int
psz_mrl_max
)
track_t
i_track
)
{
unsigned
int
i_track_frames
=
cdio_get_track_lsn
(
p_cdda
->
p_cdio
,
i_track
+
1
)
-
cdio_get_track_lsn
(
p_cdda
->
p_cdio
,
i_track
);
mtime_t
i_mduration
=
i_track_frames
*
(
CLOCK_FREQ
/
CDIO_CD_FRAMES_PER_SEC
)
;
char
*
psz_title
;
char
*
config_varname
=
MODULE_STRING
"-title-format"
;
char
*
psz_title
=
NULL
;
char
*
psz_mrl
=
NULL
;
playlist_item_t
*
p_child
=
NULL
;
if
(
!
p_item
)
{
return
NULL
;
}
#ifdef HAVE_LIBCDDB
if
(
p_cdda
->
b_cddb_enabled
)
{
config_varname
=
MODULE_STRING
"-cddb-title-format"
;
}
#endif
/*HAVE_LIBCDDB*/
if
(
!
p_item
)
return
NULL
;
snprintf
(
psz_mrl
,
psz_mrl_max
,
"%s%s@T%u"
,
CDDA_MRL_PREFIX
,
p_cdda
->
psz_source
,
i_track
);
psz_title
=
CDDAFormatStr
(
p_access
,
p_cdda
,
config_GetPsz
(
p_access
,
config_varname
),
psz_mrl
,
i_track
);
psz_title
=
CDDAFormatTitle
(
p_access
,
i_track
)
;
psz_mrl
=
CDDAFormatMRL
(
p_access
,
i_track
)
;
dbg_print
(
INPUT_DBG_META
,
"mrl: %s, title: %s, duration, %ld"
,
psz_mrl
,
psz_title
,
(
long
int
)
i_mduration
/
1000000
);
p_child
=
playlist_ItemNew
(
p_playlist
,
psz_mrl
,
psz_title
);
p_child
->
input
.
i_duration
=
i_mduration
;
free
(
psz_mrl
);
free
(
psz_title
);
if
(
!
p_child
)
return
NULL
;
...
...
@@ -869,14 +893,11 @@ CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
vlc_bool_t
b_single_track
)
{
int
i
;
playlist_t
*
p_playlist
;
char
*
psz_mrl
=
NULL
;
unsigned
int
psz_mrl_max
=
strlen
(
CDDA_MRL_PREFIX
)
+
strlen
(
p_cdda
->
psz_source
)
+
+
strlen
(
"@T"
)
+
strlen
(
"100"
)
+
1
;
playlist_t
*
p_playlist
=
NULL
;
const
track_t
i_first_track
=
p_cdda
->
i_first_track
;
playlist_item_t
*
p_item
;
playlist_item_t
*
p_item
=
NULL
;
vlc_bool_t
b_play
=
VLC_FALSE
;
track_t
i_track
;
#ifdef HAVE_LIBCDDB
p_cdda
->
b_cddb_enabled
=
...
...
@@ -888,48 +909,39 @@ CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
return
VLC_SUCCESS
;
#endif
psz_mrl
=
malloc
(
psz_mrl_max
);
if
(
psz_mrl
==
NULL
)
{
msg_Warn
(
p_access
,
"out of memory"
);
return
VLC_ENOMEM
;
}
p_playlist
=
(
playlist_t
*
)
vlc_object_find
(
p_access
,
VLC_OBJECT_PLAYLIST
,
FIND_ANYWHERE
);
if
(
!
p_playlist
)
{
msg_Warn
(
p_access
,
"can't find playlist"
);
free
(
psz_mrl
);
return
VLC_EGENERIC
;
if
(
!
p_cdda
->
b_nav_mode
)
{
p_playlist
=
(
playlist_t
*
)
vlc_object_find
(
p_access
,
VLC_OBJECT_PLAYLIST
,
FIND_ANYWHERE
);
if
(
!
p_playlist
)
{
msg_Warn
(
p_access
,
"can't find playlist"
);
return
VLC_EGENERIC
;
}
}
if
(
b_single_track
)
{
snprintf
(
psz_mrl
,
psz_mrl_max
,
"%s%s@T%u"
,
CDDA_MRL_PREFIX
,
p_cdda
->
psz_source
,
p_cdda
->
i_track
);
CDDAMetaInfoInit
(
p_access
);
CDDAMetaInfo
(
p_access
,
p_cdda
->
i_track
,
psz_mrl
);
if
(
b_single_track
||
p_cdda
->
b_nav_mode
)
{
i_track
=
p_cdda
->
i_track
;
}
else
{
snprintf
(
psz_mrl
,
psz_mrl_max
,
"%s%s"
,
CDDA_MRL_PREFIX
,
p_cdda
->
psz_source
);
CDDAMetaInfoInit
(
p_access
);
CDDAMetaInfo
(
p_access
,
CDIO_INVALID_TRACK
,
psz_mrl
);
i_track
=
CDIO_INVALID_TRACK
;
}
CDDAMetaInfoInit
(
p_access
);
CDDAMetaInfo
(
p_access
,
p_cdda
->
i_track
);
p_item
=
playlist_LockItemGetByInput
(
p_playlist
,
if
(
p_playlist
)
{
p_item
=
playlist_LockItemGetByInput
(
p_playlist
,
((
input_thread_t
*
)
p_access
->
p_parent
)
->
input
.
p_item
);
if
(
p_item
==
p_playlist
->
status
.
p_item
&&
!
b_single_track
)
{
b_play
=
VLC_TRUE
;
}
else
{
b_play
=
VLC_FALSE
;
if
(
p_item
==
p_playlist
->
status
.
p_item
&&
!
b_single_track
)
{
b_play
=
VLC_TRUE
;
}
else
{
b_play
=
VLC_FALSE
;
}
}
if
(
b_single_track
)
...
...
@@ -952,20 +964,25 @@ CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
t
->
i_length
=
I64C
(
1000000
)
*
t
->
i_size
/
CDDA_FREQUENCY_SAMPLE
/
4
;
CDDAAddMetaToItem
(
p_access
,
p_cdda
,
p_item
,
i_track
,
VLC_FALSE
);
if
(
p_item
)
CDDAAddMetaToItem
(
p_access
,
p_cdda
,
p_item
,
i_track
,
VLC_FALSE
);
p_cdda
->
i_titles
=
1
;
p_access
->
info
.
i_size
=
i_track_frames
*
(
int64_t
)
CDIO_CD_FRAMESIZE_RAW
;
p_access
->
info
.
i_update
|=
INPUT_UPDATE_TITLE
|
INPUT_UPDATE_SIZE
;
p_item
->
input
.
psz_uri
=
strdup
(
psz_mrl
);
p_item
->
input
.
psz_uri
=
CDDAFormatMRL
(
p_access
,
i_track
);
p_item
->
input
.
i_duration
=
i_track_frames
*
(
CLOCK_FREQ
/
CDIO_CD_FRAMES_PER_SEC
);
}
else
{
input_title_t
*
t
;
playlist_ItemToNode
(
p_playlist
,
p_item
);
input_title_t
*
t
;
if
(
!
p_cdda
->
b_nav_mode
)
playlist_ItemToNode
(
p_playlist
,
p_item
);
for
(
i
=
0
;
i
<
p_cdda
->
i_tracks
;
i
++
)
{
playlist_item_t
*
p_child
;
...
...
@@ -979,13 +996,16 @@ CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
asprintf
(
&
t
->
psz_name
,
_
(
"Track %i"
),
i_track
);
t
->
i_size
=
i_track_frames
*
(
int64_t
)
CDIO_CD_FRAMESIZE_RAW
;
t
->
i_length
=
I64C
(
1000000
)
*
t
->
i_size
/
CDDA_FREQUENCY_SAMPLE
/
4
;
t
->
i_length
=
I64C
(
1000000
)
*
t
->
i_size
/
CDDA_FREQUENCY_SAMPLE
/
4
;
p_child
=
CDDACreatePlaylistItem
(
p_access
,
p_cdda
,
p_playlist
,
p_item
,
i_track
,
psz_mrl
,
psz_mrl_max
)
;
CDDAAddMetaToItem
(
p_access
,
p_cdda
,
p_child
,
i_track
,
VLC_TRUE
);
if
(
!
p_cdda
->
b_nav_mode
)
{
p_child
=
CDDACreatePlaylistItem
(
p_access
,
p_cdda
,
p_playlist
,
p_item
,
i_track
);
CDDAAddMetaToItem
(
p_access
,
p_cdda
,
p_child
,
i_track
,
VLC_TRUE
);
}
}
p_cdda
->
i_titles
=
p_cdda
->
i_tracks
;
...
...
@@ -993,20 +1013,23 @@ CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
cdio_get_track_lba
(
p_cdda
->
p_cdio
,
CDIO_CDROM_LEADOUT_TRACK
)
*
(
int64_t
)
CDIO_CD_FRAMESIZE_RAW
;
p_access
->
info
.
i_update
|=
INPUT_UPDATE_TITLE
|
INPUT_UPDATE_SIZE
;
p_item
->
input
.
i_duration
=
p_access
->
info
.
i_size
*
(
CLOCK_FREQ
/
CDIO_CD_FRAMES_PER_SEC
)
;
p_item
->
input
.
psz_uri
=
strdup
(
psz_mrl
);
if
(
p_item
)
{
p_item
->
input
.
i_duration
=
p_access
->
info
.
i_size
*
(
CLOCK_FREQ
/
CDIO_CD_FRAMES_PER_SEC
)
;
p_item
->
input
.
psz_uri
=
CDDAFormatMRL
(
p_access
,
p_cdda
->
i_track
);
}
}
if
(
b_play
)
{
playlist_Control
(
p_playlist
,
PLAYLIST_VIEWPLAY
,
p_playlist
->
status
.
i_view
,
p_playlist
->
status
.
p_item
,
NULL
);
vlc_object_release
(
p_playlist
);
}
vlc_object_release
(
p_playlist
);
return
VLC_SUCCESS
;
}
...
...
modules/access/cdda/info.h
View file @
c818ae89
...
...
@@ -32,8 +32,7 @@ int CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
we handle Meta Information requests and basically copy what we've
saved here.
*/
void
CDDAMetaInfo
(
access_t
*
p_access
,
track_t
i_track
,
/*const*/
char
*
psz_mrl
);
void
CDDAMetaInfo
(
access_t
*
p_access
,
track_t
i_track
);
/*
Saves Meta Information about the CD-DA.
...
...
@@ -43,12 +42,5 @@ void CDDAMetaInfo( access_t *p_access, track_t i_track,
*/
void
CDDAMetaInfoInit
(
access_t
*
p_access
);
char
*
CDDAFormatTitle
(
const
access_t
*
p_access
,
track_t
i_track
);
/*
Creates a playlist item filling the meta information about that playlist
item.
*/
playlist_item_t
*
CDDACreatePlaylistItem
(
const
access_t
*
p_access
,
cdda_data_t
*
p_cdda
,
playlist_t
*
p_playlist
,
playlist_item_t
*
p_item
,
track_t
i_track
,
char
*
psz_mrl
,
int
psz_mrl_max
);
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