Add call to parent constructor.
[asdcplib-cth.git] / src / AS_DCP_DCData_internal.h
1 /*
2 Copyright (c) 2004-2013, 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    AS_DCP_DCData_internal.h
28     \version $Id: AS_DCP_DCData_internal.h,v 1.3 2014/01/02 23:29:22 jhurst Exp $
29     \brief   AS-DCP library, non-public common DCData reader and writer implementation
30 */
31
32 #ifndef _AS_DCP_DCDATA_INTERNAL_H_
33 #define _AS_DCP_DCDATA_INTERNAL_H_
34
35 #include <list>
36
37 #include "AS_DCP_internal.h"
38
39 namespace ASDCP
40 {
41
42 namespace MXF
43 {
44   class InterchangeObject;
45 }
46
47 namespace DCData
48 {
49   typedef std::list<MXF::InterchangeObject*> SubDescriptorList_t;
50
51   class h__Reader : public ASDCP::h__ASDCPReader
52   {
53     MXF::DCDataDescriptor* m_EssenceDescriptor;
54     ASDCP_NO_COPY_CONSTRUCT(h__Reader);
55     h__Reader();
56
57    public:
58     DCDataDescriptor m_DDesc;
59
60     h__Reader(const Dictionary& d) : ASDCP::h__ASDCPReader(d), m_EssenceDescriptor(0),
61                                      m_DDesc() {}
62     ~h__Reader() {}
63     Result_t    OpenRead(const std::string&);
64     Result_t    ReadFrame(ui32_t, FrameBuffer&, AESDecContext*, HMACContext*);
65     Result_t    MD_to_DCData_DDesc(DCData::DCDataDescriptor& DDesc);
66   };
67
68   class h__Writer : public ASDCP::h__ASDCPWriter
69   {
70     ASDCP_NO_COPY_CONSTRUCT(h__Writer);
71     h__Writer();
72
73    public:
74     DCDataDescriptor m_DDesc;
75     byte_t           m_EssenceUL[SMPTE_UL_LENGTH];
76
77     h__Writer(const Dictionary& d) : ASDCP::h__ASDCPWriter(d) {
78       memset(m_EssenceUL, 0, SMPTE_UL_LENGTH);
79     }
80
81     ~h__Writer(){}
82
83     Result_t OpenWrite(const std::string&, ui32_t HeaderSize, const SubDescriptorList_t& subDescriptors);
84     Result_t SetSourceStream(const DCDataDescriptor&, const byte_t*, const std::string&, const std::string&);
85     Result_t WriteFrame(const FrameBuffer&, AESEncContext* = 0, HMACContext* = 0);
86     Result_t Finalize();
87     Result_t DCData_DDesc_to_MD(DCData::DCDataDescriptor& DDesc);
88 };
89
90
91 } // namespace DCData
92 } // namespace ASDCP
93
94 #endif // _AS_DCP_DCDATA_INTERNAL_H_