File indexing completed on 2024-04-14 04:49:16

0001 #ifndef WM_CDTEXT_H
0002 #define WM_CDTEXT_H
0003 
0004 /*
0005  * This file is part of WorkMan, the civilized CD player library
0006  * Copyright (C) Alexander Kern <alex.kern@gmx.de>
0007  *
0008  * This library is free software; you can redistribute it and/or
0009  * modify it under the terms of the GNU Library General Public
0010  * License as published by the Free Software Foundation; either
0011  * version 2 of the License, or (at your option) any later version.
0012  *
0013  * This library is distributed in the hope that it will be useful,
0014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016  * Library General Public License for more details.
0017  *
0018  * You should have received a copy of the GNU Library General Public
0019  * License along with this library; if not, write to the Free
0020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0021  *
0022  *
0023  * cdtext base structure and defines
0024  */
0025 
0026 #define MAX_LENGHT_OF_CDTEXT_STRING 162 /* max 160 bytes + 2 * 0x00 by UNICODES */
0027 #define DATAFIELD_LENGHT_IN_PACK 12
0028 #define MAX_LANGUAGE_BLOCKS 8
0029 
0030 struct cdtext_pack_data_header {
0031   unsigned char header_field_id1_typ_of_pack;
0032   unsigned char header_field_id2_tracknumber;
0033   unsigned char header_field_id3_sequence;
0034   unsigned char header_field_id4_block_no;
0035   unsigned char text_data_field[DATAFIELD_LENGHT_IN_PACK];
0036   unsigned char crc_byte1;
0037   unsigned char crc_byte2;
0038 };
0039 
0040 typedef unsigned char cdtext_string[MAX_LENGHT_OF_CDTEXT_STRING];
0041 
0042 /* meke it more generic
0043    it can be up to 8 blocks with different encoding */
0044 
0045 struct cdtext_info_block {
0046   /* management */
0047   unsigned char block_code;
0048   unsigned char block_unicode; /* 0 - single chars, 1 - doublebytes */
0049   unsigned char block_encoding; /* orange book -? */
0050   cdtext_string* block_encoding_text;
0051 
0052   /* variable part of cdtext */
0053   cdtext_string* name;
0054   cdtext_string* performer;
0055   cdtext_string* songwriter;
0056   cdtext_string* composer;
0057   cdtext_string* arranger;
0058   cdtext_string* message;
0059   cdtext_string* UPC_EAN_ISRC_code;
0060 
0061   /* fix part of cdtext */
0062   unsigned char binary_disc_identification_info[DATAFIELD_LENGHT_IN_PACK];
0063   unsigned char binary_genreidentification_info[DATAFIELD_LENGHT_IN_PACK];
0064   unsigned char binary_size_information[DATAFIELD_LENGHT_IN_PACK];
0065 };
0066 
0067 struct cdtext_info {
0068   /* sometimes i get hundreds of bytes, without anyone valid pack
0069      my CDU-561 for example */
0070   int count_of_entries; /* one more because album need one too */
0071   int count_of_valid_packs;
0072   int count_of_invalid_packs;
0073   int valid;
0074 
0075   struct cdtext_info_block *blocks[MAX_LANGUAGE_BLOCKS];
0076 };
0077 
0078 #ifndef IGNORE_FEATURE_LIST
0079 
0080 struct feature_list_header {
0081   unsigned char lenght_msb;
0082   unsigned char lenght_1sb;
0083   unsigned char lenght_2sb;
0084   unsigned char lenght_lsb;
0085   unsigned char reserved1;
0086   unsigned char reserved2;
0087   unsigned char profile_msb;
0088   unsigned char profile_lsb;
0089 };
0090 
0091 struct feature_descriptor_cdread {
0092   unsigned char feature_code_msb;
0093   unsigned char feature_code_lsb;
0094   unsigned char settings;
0095   unsigned char add_lenght;
0096   unsigned char add_settings;
0097   unsigned char reserved1;
0098   unsigned char reserved2;
0099   unsigned char reserved3;
0100 };
0101 
0102 #endif /* IGNORE_FEATURE_LIST */
0103 
0104 struct cdtext_info* wm_cd_get_cdtext(void *p);
0105 
0106 #endif /* WM_CDTEXT_H */