summaryrefslogtreecommitdiffstats
path: root/kscd/libwm/include/wm_cdtext.h
blob: ba481be0b4aec6c9ab251f0295ff5746dab34987 (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
#ifndef WM_CDTEXT_H
#define WM_CDTEXT_H

/***************************************************************************
                          wm_cdtext.h  -  description
                             -------------------
    begin                : Mon Feb 12 2001
    copyright            : (C) 2001 by Alex Kern
    email                : alex.kern@gmx.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

/*
 * cdtext base structure and defines
 */

#define MAX_LENGHT_OF_CDTEXT_STRING 162 /* max 160 bytes + 2 * 0x00 by UNICODES */
#define DATAFIELD_LENGHT_IN_PACK 12
#define MAX_LANGUAGE_BLOCKS 8

struct cdtext_pack_data_header {
  unsigned char header_field_id1_typ_of_pack;
  unsigned char header_field_id2_tracknumber;
  unsigned char header_field_id3_sequence;
  unsigned char header_field_id4_block_no;
  unsigned char text_data_field[DATAFIELD_LENGHT_IN_PACK];
  unsigned char crc_byte1;
  unsigned char crc_byte2;
};

typedef unsigned char cdtext_string[MAX_LENGHT_OF_CDTEXT_STRING];

/* meke it more generic
   it can be up to 8 blocks with different encoding */

struct cdtext_info_block {
  /* management */
  unsigned char block_code;
  unsigned char block_tqunicode; /* 0 - single chars, 1 - doublebytes */
  unsigned char block_encoding; /* orange book -? */
  cdtext_string* block_encoding_text;

  /* variable part of cdtext */
  cdtext_string* name;
  cdtext_string* performer;
  cdtext_string* songwriter;
  cdtext_string* composer;
  cdtext_string* arranger;
  cdtext_string* message;
  cdtext_string* UPC_EAN_ISRC_code;

  /* fix part of cdtext */
  unsigned char binary_disc_identification_info[DATAFIELD_LENGHT_IN_PACK];
  unsigned char binary_genreidentification_info[DATAFIELD_LENGHT_IN_PACK];
  unsigned char binary_size_information[DATAFIELD_LENGHT_IN_PACK];
};

struct cdtext_info {
  /* somethimes i get hunderts of bytes, without anyone valid pack
     my CDU-561 for example */
  int count_of_entries; /* one more because album need one too */
  int count_of_valid_packs;
  int count_of_invalid_packs;
  int valid;

  struct cdtext_info_block *blocks[MAX_LANGUAGE_BLOCKS];
};

#ifndef IGNORE_FEATURE_LIST

struct feature_list_header {
  unsigned char lenght_msb;
  unsigned char lenght_1sb;
  unsigned char lenght_2sb;
  unsigned char lenght_lsb;
  unsigned char reserved1;
  unsigned char reserved2;
  unsigned char profile_msb;
  unsigned char profile_lsb;
};

struct feature_descriptor_cdread {
  unsigned char feature_code_msb;
  unsigned char feature_code_lsb;
  unsigned char settings;
  unsigned char add_lenght;
  unsigned char add_settings;
  unsigned char reserved1;
  unsigned char reserved2;
  unsigned char reserved3;
};

#endif /* IGNORE_FEATURE_LIST */

struct cdtext_info* wm_cd_get_cdtext( void );

#endif /* WM_CDTEXT_H */