1 /*
2     $Id$
3 
4     Copyright (C) 2000, 2005 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 2 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, write to the Free Software
18     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20 
21 #ifndef __VCD_PBC_H__
22 #define __VCD_PBC_H__
23 
24 #include <libvcd/types.h>
25 
26 /* Private includes */
27 #include "data_structures.h"
28 #include "util.h"
29 #include "vcd.h"
30 
31 typedef enum {
32   PBC_INVALID = 0,
33   PBC_PLAYLIST,
34   PBC_SELECTION,
35   PBC_END
36 } pbc_type_t;
37 
38 typedef struct psd_area_t pbc_area_t; /* fixme */
39 #define pbc_area_t_SIZEOF struct_psd_area_t_SIZEOF
40 
41 static inline pbc_area_t *
vcd_pbc_area_new(uint8_t x1,uint8_t y1,uint8_t x2,uint8_t y2)42 vcd_pbc_area_new (uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2)
43 {
44   pbc_area_t *_new_area = calloc(1, sizeof (pbc_area_t));
45 
46   _new_area->x1 = x1;
47   _new_area->y1 = y1;
48   _new_area->x2 = x2;
49   _new_area->y2 = y2;
50 
51   return _new_area;
52 }
53 
54 /* typedef struct _pbc_t pbc_t; */
55 
56 struct _pbc_t {
57   pbc_type_t type;
58 
59   char *id;
60 
61   bool rejected;
62 
63   /* pbc ref check */
64   bool referenced;
65 
66   /* used for play/selection lists */
67   char *prev_id;
68   char *next_id;
69   char *retn_id;
70 
71   /* used for play lists */
72   double playing_time;
73   int wait_time;
74   int auto_pause_time;
75   CdioList_t *item_id_list; /* char */
76 
77   /* used for selection lists */
78   enum selection_type_t {
79     _SEL_NORMAL = 0,
80     _SEL_MULTI_DEF,
81     _SEL_MULTI_DEF_NO_NUM
82   } selection_type;
83 
84   pbc_area_t *prev_area;
85   pbc_area_t *next_area;
86   pbc_area_t *return_area;
87   pbc_area_t *default_area; /* depends on selection_type */
88   CdioList_t *select_area_list; /* pbc_area_t */
89 
90   unsigned bsn;
91   char *default_id;
92   char *timeout_id;
93   int timeout_time;
94   unsigned loop_count;
95   bool jump_delayed;
96   char *item_id;
97   CdioList_t *select_id_list; /* char */
98 
99   /* used for end lists */
100   char *image_id;
101   unsigned next_disc;
102 
103   /* computed values */
104   unsigned lid;
105   unsigned offset;
106   unsigned offset_ext;
107 };
108 
109 enum item_type_t {
110   ITEM_TYPE_NOTFOUND = 0,
111   ITEM_TYPE_NOOP,
112   ITEM_TYPE_TRACK,
113   ITEM_TYPE_ENTRY,
114   ITEM_TYPE_SEGMENT,
115   ITEM_TYPE_PBC
116 };
117 
118 /* functions */
119 
120 pbc_t *
121 vcd_pbc_new (pbc_type_t type);
122 
123 pbc_t *
124 _vcd_pbc_init (pbc_t *p_pbc);
125 
126 void
127 vcd_pbc_destroy (pbc_t *p_pbc);
128 
129 unsigned
130 _vcd_pbc_lid_lookup (const VcdObj_t *p_obj, const char item_id[]);
131 
132 enum item_type_t
133 _vcd_pbc_lookup (const VcdObj_t *p_obj, const char item_id[]);
134 
135 uint16_t
136 _vcd_pbc_pin_lookup (const VcdObj_t *p_obj, const char item_id[]);
137 
138 unsigned
139 _vcd_pbc_list_calc_size (const pbc_t *_pbc, bool b_extended);
140 
141 bool
142 _vcd_pbc_finalize (VcdObj_t *p_obj);
143 
144 bool
145 _vcd_pbc_available (const VcdObj_t *p_obj);
146 
147 uint16_t
148 _vcd_pbc_max_lid (const VcdObj_t *p_obj);
149 
150 void
151 _vcd_pbc_node_write (const VcdObj_t *p_obj, const pbc_t *_pbc, void *p_buf,
152 		     bool b_extended);
153 
154 void
155 _vcd_pbc_check_unreferenced (const VcdObj_t *p_obj);
156 
157 #endif /* __VCD_PBC_H__ */
158