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_SECTOR_H_
22 #define _VCD_SECTOR_H_
23 
24 #include <libvcd/types.h>
25 
26 /*!
27    \file sector.h
28 
29 \verbatim
30 
31   SVCD 1.0
32   ~~~~~~~~
33 
34    empty sector:  fn=0 cn=0 sm=%00100000 ci=0
35    data sector:   fn=0 cn=0 sm=%x0001000 ci=0
36    mpeg sector:   fn=1 cn=1 sm=%x11x001x ci=0x80
37 
38   VCD 2.0
39   ~~~~~~~
40 
41    /MPEGAV/AVSEQyy.DAT
42     empty sector: fn=yy cn=0 sm=%x11x000x ci=0
43     video sector: fn=yy cn=1 sm=%x11x001x ci=0x0f
44     audio sector: fn=yy cn=1 sm=%x11x010x ci=0x7f
45 
46    /SEGMENT/ITEMzzzz.DAT
47     empty sector: fn=1 cn=0  sm=%x11x000x ci=0
48     video sector: fn=1 cn=1  sm=%x11x001x ci=0x0f
49     lores still:  fn=1 cn=2  sm=%x11x001x ci=0x1f
50     hires still:  fn=1 cn=3  sm=%x11x001x ci=0x3f
51     audio sector: fn=1 cn=1  sm=%x11x010x ci=0x7f
52 
53    /VCD/ *.VCD
54     data sector:  fn=0 cn=0  sm=%x000100x ci=0
55 
56    *.*
57     data sector:  fn=1 cn=0  sm=%x0001000 ci=0
58 
59  \endverbatim
60 
61 */
62 
63 /* file numbers */
64 
65 /* dynamic */
66 
67 /** channel numbers */
68 #define CN_VIDEO   0x01
69 #define CN_STILL   0x02
70 #define CN_STILL2  0x03
71 #define CN_AUDIO   0x01
72 #define CN_AUDIO2  0x02
73 #define CN_OGT     0x02 /**< fixme -- is it 0x04 ?? */
74 #define CN_PAD     0x00
75 #define CN_EMPTY   0x00
76 
77 /** submode byte */
78 #define SM_EOF    (1<<7)
79 #define SM_REALT  (1<<6)
80 #define SM_FORM2  (1<<5)
81 #define SM_TRIG   (1<<4)
82 #define SM_DATA   (1<<3)
83 #define SM_AUDIO  (1<<2)
84 #define SM_VIDEO  (1<<1)
85 #define SM_EOR    (1<<0)
86 
87 /** coding information */
88 #define CI_VIDEO   0x0f
89 #define CI_STILL   0x1f
90 #define CI_STILL2  0x3f
91 #define CI_AUDIO   0x7f
92 #define CI_AUDIO2  0x7f
93 #define CI_OGT     0x0f
94 #define CI_PAD     0x1f
95 #define CI_MPEG2   0x80
96 #define CI_EMPTY   0x00
97 
98 /** make mode 2 form 1/2 sector
99  *
100  * data must be a buffer of size 2048 or 2324 for SM_FORM2
101  * raw_sector must be a writable buffer of size 2352
102  */
103 void
104 _vcd_make_mode2 (void *raw_sector, const void *data, uint32_t extent,
105                  uint8_t fnum, uint8_t cnum, uint8_t sm, uint8_t ci);
106 
107 /* ...data must be a buffer of size 2336 */
108 
109 void
110 _vcd_make_raw_mode2 (void *raw_sector, const void *data, uint32_t extent);
111 
112 #endif /* _VCD_SECTOR_H_ */
113 
114 
115 /*
116  * Local variables:
117  *  c-file-style: "gnu"
118  *  tab-width: 8
119  *  indent-tabs-mode: nil
120  * End:
121  */
122