libcdio  2.1.0
About: GNU libcdio is a library for CD-ROM and CD image access.
  Fossies Dox: libcdio-2.1.0.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

disc.c
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003, 2004, 2005, 2008, 2011, 2012, 2014
3  Rocky Bernstein <rocky@gnu.org>
4  Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 
21 #ifdef HAVE_CONFIG_H
22 # include "config.h"
23 # define __CDIO_CONFIG_H__ 1
24 #endif
25 
26 #ifdef HAVE_STDBOOL_H
27 # include <stdbool.h>
28 #endif
29 
30 #include <cdio/cdio.h>
31 #include "cdio_private.h"
32 
33 /* Must match discmode enumeration */
34 const char *discmode2str[] = {
35  "CD-DA",
36  "CD-DATA (Mode 1)",
37  "CD DATA (Mode 2)",
38  "CD-ROM Mixed",
39  "DVD-ROM",
40  "DVD-RAM",
41  "DVD-R",
42  "DVD-RW",
43  "HD DVD ROM",
44  "HD_DVD RAM",
45  "HD DVD-R",
46  "DVD+R",
47  "DVD+RW",
48  "DVD+RW DL",
49  "DVD+R DL",
50  "Unknown/unclassified DVD",
51  "No information",
52  "Error in getting information",
53  "CD-i"
54 };
55 
63 cdtext_t *
65 {
66  if (obj == NULL) return NULL;
67 
68  if (NULL != obj->op.get_cdtext) {
69  return obj->op.get_cdtext (obj->env);
70  } else {
71  return NULL;
72  }
73 }
74 
83 uint8_t *
85 {
86  if (obj == NULL) return NULL;
87 
88  if (NULL != obj->op.get_cdtext_raw) {
89  return obj->op.get_cdtext_raw (obj->env);
90  } else {
91  return NULL;
92  }
93 }
94 
101 lsn_t
103 {
104  if (!p_cdio) return CDIO_INVALID_LSN;
105  return p_cdio->op.get_disc_last_lsn (p_cdio->env);
106 }
107 
113 {
114  if (!cd_obj) return CDIO_DISC_MODE_ERROR;
115 
116  if (cd_obj->op.get_discmode) {
117  return cd_obj->op.get_discmode (cd_obj->env);
118  } else {
119  return CDIO_DISC_MODE_NO_INFO;
120  }
121 }
122 
128 char *
129 cdio_get_mcn (const CdIo_t *p_cdio)
130 {
131  if (p_cdio && p_cdio->op.get_mcn) {
132  return p_cdio->op.get_mcn (p_cdio->env);
133  } else {
134  return NULL;
135  }
136 }
137 
138 bool
140 {
141  switch (discmode) {
147  return true;
148  default:
149  return false;
150  }
151 }
152 
153 bool
155 {
156  switch (discmode) {
164  return true;
165  default:
166  return false;
167  }
168 }
CDIO_INVALID_LSN
#define CDIO_INVALID_LSN
Definition: types.h:296
CDIO_DISC_MODE_DVD_RW
Definition: disc.h:45
cdio_get_disc_last_lsn
lsn_t cdio_get_disc_last_lsn(const CdIo_t *p_cdio)
Definition: disc.c:102
cdio.h
The top-level header for libcdio: the CD Input and Control library. Applications include this for any...
CDIO_DISC_MODE_CD_MIXED
Definition: disc.h:41
lsn_t
int32_t lsn_t
Definition: types.h:266
cdio_is_discmode_dvd
bool cdio_is_discmode_dvd(discmode_t discmode)
Definition: disc.c:154
CDIO_DISC_MODE_ERROR
Definition: disc.h:55
CDIO_DISC_MODE_DVD_RAM
Definition: disc.h:43
CDIO_DISC_MODE_DVD_R
Definition: disc.h:44
_CdIo
Definition: cdio_private.h:472
cdio_private.h
discmode_t
discmode_t
Definition: disc.h:37
_CdIo::env
void * env
Definition: cdio_private.h:476
CDIO_DISC_MODE_DVD_OTHER
Definition: disc.h:53
NULL
#define NULL
Definition: types.h:184
cdio_get_discmode
discmode_t cdio_get_discmode(CdIo_t *cd_obj)
Definition: disc.c:112
CDIO_DISC_MODE_CD_DA
Definition: disc.h:38
discmode2str
const char * discmode2str[]
Definition: disc.c:34
cdio_is_discmode_cdrom
bool cdio_is_discmode_cdrom(discmode_t discmode)
Definition: disc.c:139
cdio_funcs_t::get_discmode
discmode_t(* get_discmode)(void *p_env)
Definition: cdio_private.h:234
cdio_funcs_t::get_disc_last_lsn
lsn_t(* get_disc_last_lsn)(void *p_env)
Definition: cdio_private.h:229
CDIO_DISC_MODE_CD_DATA
Definition: disc.h:39
CDIO_DISC_MODE_NO_INFO
Definition: disc.h:54
cdio_funcs_t::get_mcn
char *(* get_mcn)(const void *p_env)
Definition: cdio_private.h:279
_CdIo::op
cdio_funcs_t op
Definition: cdio_private.h:474
CDIO_DISC_MODE_CD_XA
Definition: disc.h:40
config.h
cdio_get_cdtext_raw
uint8_t * cdio_get_cdtext_raw(CdIo *obj)
Definition: disc.c:84
CDIO_DISC_MODE_DVD_PRW
Definition: disc.h:50
cdtext_s
Definition: cdtext_private.h:127
cdio_get_mcn
char * cdio_get_mcn(const CdIo_t *p_cdio)
Definition: disc.c:129
CDIO_DISC_MODE_DVD_ROM
Definition: disc.h:42
CdIo
#define CdIo
Definition: cdio.h:44
CDIO_DISC_MODE_DVD_PR
Definition: disc.h:49
cdio_get_cdtext
cdtext_t * cdio_get_cdtext(CdIo *obj)
Definition: disc.c:64