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
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
Expand all
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
This diff is collapsed.
Click to expand it.
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