Commit bea3eda7 authored by Rocky Bernstein's avatar Rocky Bernstein

First attempt at adding CD-Text.

Break out meta-info gathering.
Various fixes and cleanups, but more work is still needed.
Some conceptual work on how things *should* work may be in order.
parent 53dee7b9
......@@ -5,4 +5,6 @@ SOURCES_cddax = \
callback.h \
cdda.c \
cdda.h \
info.c \
info.h \
$(NULL)
This diff is collapsed.
......@@ -42,6 +42,8 @@ E_(CDDADebugCB) ( vlc_object_t *p_this, const char *psz_name,
return VLC_SUCCESS;
}
/* FIXME: could probably shorten some of the below boilerplate code...
*/
int
E_(CDDBEnabledCB) ( vlc_object_t *p_this, const char *psz_name,
vlc_value_t oldval, vlc_value_t val, void *p_data )
......@@ -55,10 +57,50 @@ E_(CDDBEnabledCB) ( vlc_object_t *p_this, const char *psz_name,
#ifdef HAVE_LIBCDDB
if (p_cdda->i_debug & (INPUT_DBG_CALL|INPUT_DBG_EXT)) {
msg_Dbg( p_cdda_input, "Old CDDB Enabled (x%0x) %d, new (x%0x) %d",
p_cdda->i_cddb_enabled, p_cdda->i_cddb_enabled,
val.i_int, val.i_int);
p_cdda->b_cddb_enabled, p_cdda->b_cddb_enabled,
val.b_bool, val.b_bool);
}
p_cdda->i_cddb_enabled = val.i_int;
p_cdda->b_cddb_enabled = val.b_bool;
#endif
return VLC_SUCCESS;
}
int
E_(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;
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 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);
}
p_cdda->b_cdtext_enabled = val.b_bool;
return VLC_SUCCESS;
}
int
E_(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;
if (NULL == p_cdda_input) return VLC_EGENERIC;
p_cdda = (cdda_data_t *)p_cdda_input->p_sys;
#ifdef HAVE_LIBCDDB
if (p_cdda->i_debug & (INPUT_DBG_CALL|INPUT_DBG_EXT)) {
msg_Dbg( p_cdda_input, "Old CDText Prefer (x%0x) %d, new (x%0x) %d",
p_cdda->b_cdtext_prefer, p_cdda->b_cdtext_prefer,
val.b_bool, val.b_bool);
}
p_cdda->b_cdtext_prefer = val.b_bool;
#endif
return VLC_SUCCESS;
}
......
......@@ -39,6 +39,15 @@ int E_(CDDBEnabledCB)( vlc_object_t *p_this, const char *psz_name,
void *p_data );
int E_(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,
vlc_value_t oldval, vlc_value_t val,
void *p_data );
int E_(CDDABlocksPerReadCB) ( vlc_object_t *p_this, const char *psz_name,
vlc_value_t oldval, vlc_value_t val,
void *p_data );
......
......@@ -5,8 +5,6 @@
* $Id$
*
* Authors: Rocky Bernstein <rocky@panix.com>
* Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -153,12 +151,12 @@ vlc_module_begin();
N_("email address reported to CDDB server"),
VLC_TRUE );
add_bool( MODULE_STRING "-cddb-enable-cache", 1, NULL,
add_bool( MODULE_STRING "-cddb-enable-cache", VLC_TRUE, NULL,
N_("Cache CDDB lookups?"),
N_("If set cache CDDB information about this CD"),
VLC_FALSE );
add_bool( MODULE_STRING "-cddb-httpd", 0, NULL,
add_bool( MODULE_STRING "-cddb-httpd", VLC_FALSE, NULL,
N_("Contact CDDB via the HTTP protocol?"),
N_("If set, the CDDB server gets information via the CDDB HTTP "
"protocol"),
......@@ -175,6 +173,17 @@ vlc_module_begin();
N_("Directory to cache CDDB requests"),
VLC_TRUE );
add_bool( MODULE_STRING "-cdtext-prefer", VLC_TRUE, E_(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"),
VLC_FALSE );
#endif
add_bool( MODULE_STRING "-cdtext-enabled", VLC_TRUE, E_(CDTextEnabledCB),
N_("Do CD-Text lookups?"),
N_("If set, get CD-Text information"),
VLC_FALSE );
vlc_module_end();
......@@ -31,6 +31,9 @@
#include <cddb/cddb.h>
#endif
/* Frequency of sample in bits per second. */
#define CDDA_FREQUENCY_SAMPLE 44100
/*****************************************************************************
* Debugging
*****************************************************************************/
......@@ -59,13 +62,17 @@
typedef struct cdda_data_s
{
CdIo *p_cdio; /* libcdio CD device */
track_t i_tracks; /* # of tracks (titles) */
track_t i_tracks; /* # of tracks */
track_t i_first_track; /* # of first track */
track_t i_titles; /* # of titles in playlist */
/* Current position */
track_t i_track; /* Current track */
lsn_t i_lsn; /* Current Logical Sector Number */
lsn_t * p_lsns; /* Track LSNs */
lsn_t lsn[CDIO_CD_MAX_TRACKS]; /* Track LSNs. Origin is NOT
0 origin but origin of track
number (usually 1).
*/
int i_blocks_per_read; /* # blocks to get in a read */
int i_debug; /* Debugging mask */
......@@ -73,12 +80,12 @@ typedef struct cdda_data_s
/* Information about CD */
vlc_meta_t *p_meta;
char * psz_mcn; /* Media Catalog Number */
cdtext_t *cdtext; /* CD-Text info */
input_title_t *p_title[CDIO_CD_MAX_TRACKS];
input_title_t *p_title[CDIO_CD_MAX_TRACKS]; /* This *is* 0 origin, not
track number origin */
#ifdef HAVE_LIBCDDB
int i_cddb_enabled;
vlc_bool_t b_cddb_enabled; /* Use CDDB at all? */
struct {
vlc_bool_t have_info; /* True if we have any info */
cddb_disc_t *disc; /* libcdio uses this to get disc
......@@ -88,11 +95,22 @@ typedef struct cdda_data_s
} cddb;
#endif
WAVEHEADER waveheader; /* Wave header for the output data */
vlc_bool_t b_header;
vlc_bool_t b_cdtext_enabled; /* Use CD-Text at all? If not,
cdtext_preferred is meaningless. */
vlc_bool_t b_cdtext_prefer; /* Prefer CD-Text info over
CDDB? If no CDDB, the issue
is moot. */
input_thread_t *p_input;
const cdtext_t *p_cdtext[CDIO_CD_MAX_TRACKS]; /* CD-Text info. Origin is NOT
0 origin but origin of track
number (usually 1).
*/
WAVEHEADER waveheader; /* Wave header for the output data */
vlc_bool_t b_header;
input_thread_t *p_input;
} cdda_data_t;
/* FIXME: This variable is a hack. Would be nice to eliminate. */
......
This diff is collapsed.
/*****************************************************************************
* info.h : CD digital audio input information routine headers
*****************************************************************************
* Copyright (C) 2004 VideoLAN
* $Id: info.h 8606 2004-08-31 18:32:54Z rocky $
*
* Authors: Rocky Bernstein <rocky@panix.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*
Fills out playlist information.
*/
int CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
const char *psz_source,
vlc_bool_t b_single_track );
/*
Gets and saves CDDA Meta Information. In the Control routine,
we handle Meta Information requests and basically copy what we've
saved here.
*/
void CDDAMetaInfo( access_t *p_access );
/*
Creates a playlist item filling the meta information about that playlist
item.
*/
void CDDACreatePlaylistItem(const access_t *p_access,
cdda_data_t *p_cdda,
playlist_t *p_playlist,
track_t i_track,
char *psz_mrl, int psz_mrl_max,
const char *psz_source,
int playlist_operation,
int i_pos);
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