2003-03-24 19:01:09 +00:00
|
|
|
|
/*
|
2005-02-03 07:35:14 +00:00
|
|
|
|
$Id: cdio.c,v 1.13 2005/02/03 07:35:15 rocky Exp $
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
2005-01-04 04:33:36 +00:00
|
|
|
|
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
2003-03-24 19:01:09 +00:00
|
|
|
|
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
|
|
|
|
|
|
|
|
|
|
|
|
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-1307 USA
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2003-04-12 03:38:00 +00:00
|
|
|
|
|
2003-03-24 19:01:09 +00:00
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
|
# include "config.h"
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2003-04-12 03:38:00 +00:00
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
#include <sys/stat.h>
|
2004-06-19 19:15:15 +00:00
|
|
|
|
#ifdef HAVE_UNISTD_H
|
2003-04-12 03:38:00 +00:00
|
|
|
|
#include <unistd.h>
|
2004-06-19 19:15:15 +00:00
|
|
|
|
#endif
|
2003-04-12 03:38:00 +00:00
|
|
|
|
|
2003-03-24 19:01:09 +00:00
|
|
|
|
#include "cdio_assert.h"
|
2003-09-28 17:14:20 +00:00
|
|
|
|
#include <cdio/cdio.h>
|
2003-04-22 12:09:08 +00:00
|
|
|
|
#include <cdio/util.h>
|
2003-03-24 19:01:09 +00:00
|
|
|
|
#include "cdio_private.h"
|
|
|
|
|
|
|
2005-02-03 07:35:14 +00:00
|
|
|
|
static const char _rcsid[] = "$Id: cdio.c,v 1.13 2005/02/03 07:35:15 rocky Exp $";
|
2003-09-28 17:14:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
2003-03-24 19:01:09 +00:00
|
|
|
|
/*!
|
2003-05-18 01:50:51 +00:00
|
|
|
|
Return the value associatied with key. NULL is returned if obj is NULL
|
|
|
|
|
|
or "key" does not exist.
|
2003-03-24 19:01:09 +00:00
|
|
|
|
*/
|
|
|
|
|
|
const char *
|
|
|
|
|
|
cdio_get_arg (const CdIo *obj, const char key[])
|
|
|
|
|
|
{
|
2003-05-18 01:50:51 +00:00
|
|
|
|
if (obj == NULL) return NULL;
|
|
|
|
|
|
|
2003-03-24 19:01:09 +00:00
|
|
|
|
if (obj->op.get_arg) {
|
2003-09-25 09:38:15 +00:00
|
|
|
|
return obj->op.get_arg (obj->env, key);
|
2003-03-24 19:01:09 +00:00
|
|
|
|
} else {
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2004-07-15 02:24:29 +00:00
|
|
|
|
/*!
|
|
|
|
|
|
Get cdtext information for a CdIo object .
|
|
|
|
|
|
|
|
|
|
|
|
@param obj the CD object that may contain CD-TEXT information.
|
|
|
|
|
|
@return the CD-TEXT object or NULL if obj is NULL
|
|
|
|
|
|
or CD-TEXT information does not exist.
|
|
|
|
|
|
*/
|
2005-01-27 03:10:06 +00:00
|
|
|
|
cdtext_t *
|
2004-07-17 02:18:26 +00:00
|
|
|
|
cdio_get_cdtext (CdIo *obj, track_t i_track)
|
2004-07-11 14:25:07 +00:00
|
|
|
|
{
|
|
|
|
|
|
if (obj == NULL) return NULL;
|
|
|
|
|
|
|
|
|
|
|
|
if (obj->op.get_cdtext) {
|
2004-07-17 02:18:26 +00:00
|
|
|
|
return obj->op.get_cdtext (obj->env, i_track);
|
2004-07-11 14:25:07 +00:00
|
|
|
|
} else {
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2005-01-02 22:43:41 +00:00
|
|
|
|
CdIo_t *
|
2005-01-17 17:20:09 +00:00
|
|
|
|
cdio_new (generic_img_private_t *p_env, cdio_funcs_t *p_funcs)
|
2003-03-24 19:01:09 +00:00
|
|
|
|
{
|
2005-02-03 07:35:14 +00:00
|
|
|
|
CdIo_t *p_new_cdio = calloc(1, sizeof (CdIo_t));
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
2004-07-26 02:54:37 +00:00
|
|
|
|
if (NULL == p_new_cdio) return NULL;
|
|
|
|
|
|
|
|
|
|
|
|
p_new_cdio->env = p_env; /* This is the private "environment" that
|
|
|
|
|
|
driver-dependent routines use. */
|
|
|
|
|
|
p_new_cdio->op = *p_funcs;
|
|
|
|
|
|
p_env->cdio = p_new_cdio; /* A way for the driver-dependent routines
|
|
|
|
|
|
to access the higher-level general cdio
|
|
|
|
|
|
object. */
|
|
|
|
|
|
return p_new_cdio;
|
2003-03-24 19:01:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
|
Set the arg "key" with "value" in the source device.
|
|
|
|
|
|
*/
|
2005-01-19 09:23:24 +00:00
|
|
|
|
driver_return_code_t
|
|
|
|
|
|
cdio_set_arg (CdIo_t *p_cdio, const char key[], const char value[])
|
2003-03-24 19:01:09 +00:00
|
|
|
|
{
|
2005-01-20 00:36:38 +00:00
|
|
|
|
if (!p_cdio) return DRIVER_OP_UNINIT;
|
2005-01-19 09:23:24 +00:00
|
|
|
|
if (!p_cdio->op.set_arg) return DRIVER_OP_UNSUPPORTED;
|
|
|
|
|
|
if (!key) return DRIVER_OP_ERROR;
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
2005-01-19 09:23:24 +00:00
|
|
|
|
return p_cdio->op.set_arg (p_cdio->env, key, value);
|
2003-04-10 04:13:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2004-12-30 11:13:49 +00:00
|
|
|
|
|
2003-03-24 19:01:09 +00:00
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
* Local variables:
|
|
|
|
|
|
* c-file-style: "gnu"
|
|
|
|
|
|
* tab-width: 8
|
|
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
|
|
* End:
|
|
|
|
|
|
*/
|