broken build, adding write
[asdcplib.git] / Index.h
1 /*
2 Copyright (c) 2005-2006, John Hurst
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions
7 are met:
8 1. Redistributions of source code must retain the above copyright
9    notice, this list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright
11    notice, this list of conditions and the following disclaimer in the
12    documentation and/or other materials provided with the distribution.
13 3. The name of the author may not be used to endorse or promote products
14    derived from this software without specific prior written permission.
15
16 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 /*! \file    Index.h
28     \version $Id$
29     \brief   MXF index segment objects
30 */
31
32 #ifndef _INDEX_H_
33 #define _INDEX_H_
34
35 #include "MXF.h"
36
37 namespace ASDCP
38 {
39   namespace MXF
40     {
41       //
42       class IndexTableSegment : public InterchangeObject
43         {
44           ASDCP_NO_COPY_CONSTRUCT(IndexTableSegment);
45
46         public:
47           //
48           class DeltaEntry
49             {
50             public:
51               i8_t    PosTableIndex;
52               ui8_t   Slice;
53               ui32_t  ElementData;
54
55               Result_t ReadFrom(ASDCP::MemIOReader& Reader);
56               Result_t WriteTo(ASDCP::MemIOWriter& Writer);
57               inline const char* ToString(char* str_buf) const;
58             };
59
60           //
61           class IndexEntry
62             {
63             public:
64               i8_t            TemporalOffset;
65               i8_t            KeyFrameOffset;
66               ui8_t           Flags;
67               ui64_t          StreamOffset;
68               std::list<ui32_t>  SliceOffset;
69               Array<Rational> PosTable;
70
71               Result_t ReadFrom(ASDCP::MemIOReader& Reader);
72               Result_t WriteTo(ASDCP::MemIOWriter& Writer);
73               inline const char* ToString(char* str_buf) const;
74             };
75
76           Rational    IndexEditRate;
77           ui64_t      IndexStartPosition;
78           ui64_t      IndexDuration;
79           ui32_t      EditUnitByteCount;
80           ui32_t      IndexSID;
81           ui32_t      BodySID;
82           ui8_t       SliceCount;
83           ui8_t       PosTableCount;
84           Batch<DeltaEntry> DeltaEntryArray;
85           Batch<IndexEntry> IndexEntryArray;
86
87           IndexTableSegment();
88           virtual ~IndexTableSegment();
89           virtual Result_t InitFromBuffer(const byte_t* p, ui32_t l);
90           virtual Result_t WriteToBuffer(ASDCP::FrameBuffer& Buffer);
91           virtual void     Dump(FILE* = 0);
92         };
93
94     } // namespace MXF
95 } // namespace ASDCP
96
97
98 #endif // _INDEX_H_
99
100 //
101 // end MXF.h
102 //