summaryrefslogtreecommitdiff
path: root/src/input/vcd/libcdio/cdio/cdtext.h
blob: 4b397a3ffc671424b7a691749afbd8b8a395248b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
    $Id: cdtext.h,v 1.1 2005/01/01 02:43:58 rockyb Exp $

    Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
    adapted from cuetools
    Copyright (C) 2003 Svend Sanjay Sorensen <ssorensen@fastmail.fm>

    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
*/
/*!
 * \file cdtext.h 
 * \brief Header CD-Text information
*/


#ifndef __CDIO_CDTEXT_H__
#define __CDIO_CDTEXT_H__

#include <cdio/cdio.h>

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#define MAX_CDTEXT_FIELDS 13
  
  /*! \brief structure for holding CD-Text information

  @see cdtext_init, cdtext_destroy, cdtext_get, and cdtext_set.
  */
  struct cdtext {
    char *field[MAX_CDTEXT_FIELDS];
  };
  
  /*! \brief A list of all of the CD-Text fields */
  typedef enum {
    CDTEXT_ARRANGER   =  0,   /**< name(s) of the arranger(s) */
    CDTEXT_COMPOSER   =  1,   /**< name(s) of the composer(s) */
    CDTEXT_DISCID     =  2,   /**< disc identification information */
    CDTEXT_GENRE      =  3,   /**< genre identification and genre information */
    CDTEXT_MESSAGE    =  4,   /**< ISRC code of each track */
    CDTEXT_ISRC       =  5,   /**< message(s) from the content provider or artist */
    CDTEXT_PERFORMER  =  6,   /**< name(s) of the performer(s) */
    CDTEXT_SIZE_INFO  =  7,   /**< size information of the block */
    CDTEXT_SONGWRITER =  8,   /**< name(s) of the songwriter(s) */
    CDTEXT_TITLE      =  9,   /**< title of album name or track titles */
    CDTEXT_TOC_INFO   = 10,   /**< table of contents information */
    CDTEXT_TOC_INFO2  = 11,   /**< second table of contents information */
    CDTEXT_UPC_EAN    = 12,
    CDTEXT_INVALID    = MAX_CDTEXT_FIELDS
  } cdtext_field_t;

  /*! Return string representation of the enum values above */
  const char *cdtext_field2str (cdtext_field_t i);
  
  /*! Initialize a new cdtext structure.
    When the structure is no longer needed, release the 
    resources using cdtext_delete.
  */
  void cdtext_init (cdtext_t *cdtext);
  
  /*! Free memory assocated with cdtext*/
  void cdtext_destroy (cdtext_t *cdtext);
  
  /*! returns the string associated with the given field.  NULL is
    returned if key is CDTEXT_INVALID or the field is not set.

    @see cdio_get_cdtext to retrieve the cdtext structure used as
    input here.
  */
  const char *cdtext_get (cdtext_field_t key, const cdtext_t *cdtext);
  
  /*!
    returns enum of keyword if key is a CD-Text keyword, 
    returns MAX_CDTEXT_FIELDS non-zero otherwise.
  */
  cdtext_field_t cdtext_is_keyword (const char *key);
  
  /*! 
    sets cdtext's keyword entry to field 
  */
  void cdtext_set (cdtext_field_t key, const char *value, cdtext_t *cdtext);
  
#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* __CDIO_CDTEXT_H__ */

/* 
 * Local variables:
 *  c-file-style: "gnu"
 *  tab-width: 8
 *  indent-tabs-mode: nil
 * End:
 */