remove \r
[extl.git] / extl / media / ts / adaptation_field_extension_header.h
blobf39e3d24bfd79122125c09bf21826080dc234f3d
1 /* ///////////////////////////////////////////////////////////////////////
2 * File: adaptation_field_extension_header.h
4 * Created: 09.03.08
5 * Updated: 09.03.08
7 * Brief: the adaptation_field_extension_header class
9 * [<Home>]
10 * Copyright (c) 2008-2020, Waruqi All rights reserved.
11 * //////////////////////////////////////////////////////////////////// */
13 #ifndef EXTL_MEDIA_TS_ADAPTATION_FIELD_EXTENSION_HEADER_H
14 #define EXTL_MEDIA_TS_ADAPTATION_FIELD_EXTENSION_HEADER_H
16 /*!\file adaptation_field_extension_header.h
17 * \brief the adaptation_field_extension_header class
19 #ifndef __cplusplus
20 # error adaptation_field_extension_header.h need be supported by c++.
21 #endif
23 /* ///////////////////////////////////////////////////////////////////////
24 * Includes
26 #include "prefix.h"
28 /* ///////////////////////////////////////////////////////////////////////
29 * ::extl::media::ts namespace
31 EXTL_MEDIA_TS_BEGIN_WHOLE_NAMESPACE
33 /*!brief adaptation field extension_header
35 * \ingroup extl_group_media
37 * \code
38 * // adaptation field extension_header
39 * struct adaptation_field_extension_header
41 adaptation_field_extension_header_length : 8 ;
42 ltw_flag : 1 ;
43 piecewise_rate_flag : 1 ;
44 seamless_splice_flag : 1 ;
45 reserved : 5 ;
47 [ltw]
48 [piecewise_rate]
49 [seamless_splice]
51 for (i = 0; i < N; ++i)
52 reserved : 8 ;
55 * \endcode
57 * \param AdaExt the adaptation field extension type
59 template<typename_param_k AdaExt>
60 class adaptation_field_extension_header
62 /// \name Public Types
63 /// @{
64 public:
65 typedef AdaExt extension_type;
66 typedef adaptation_field_extension_header class_type;
67 typedef e_byte_t byte_type;
68 typedef e_uint16_t word_type;
69 typedef e_uint32_t dword_type;
70 typedef e_uint64_t qword_type;
71 typedef byte_type* pointer;
72 typedef byte_type const* const_pointer;
73 typedef e_size_t size_type;
74 typedef size_type index_type;
75 typedef e_bool_t bool_type;
76 /// @}
78 /// \name Member Type
79 /// @{
80 private:
81 // program_clock_reference
82 // base + base1 + reseved + pcr_extension
83 // |=> 33bit <=| 6 9
84 struct members_type
86 byte_type extension_length ;
88 // \note defined in reverse order by byte_type
89 byte_type reserved : 5 ;
90 byte_type seamless_splice_flag : 1 ;
91 byte_type piecewise_rate_flag : 1 ;
92 byte_type ltw_flag : 1 ;
94 /// @}
96 /// \name Constants
97 /// @{
98 public:
99 enum { en_header_size = 2 };
100 /// @}
102 /// \name Private Accessors
103 /// @{
104 private:
105 extension_type& extension() { return static_cast<extension_type&>(*this); }
106 extension_type const& extension() const { return static_cast<extension_type const&>(*this); }
108 members_type& members() { return *reinterpret_cast<members_type*>(data()); }
109 members_type const& members() const { return *reinterpret_cast<members_type const*>(data()); }
110 /// @}
112 /// \name Public Accessors
113 /// @{
114 public:
115 pointer data() { return (extension().data()); }
116 const_pointer data() const { return (extension().data()); }
118 size_type extension_length() const { return static_cast<size_type>(members().extension_length); }
119 void extension_length(size_type value) { members().extension_length = static_cast<byte_type>(value); }
121 size_type ltw_flag() const { return static_cast<size_type>(members().ltw_flag); }
122 void ltw_flag(size_type value) { members().ltw_flag = static_cast<byte_type>(value); }
124 size_type piecewise_rate_flag() const { return static_cast<size_type>(members().piecewise_rate_flag); }
125 void piecewise_rate_flag(size_type value) { members().piecewise_rate_flag = static_cast<byte_type>(value); }
127 size_type seamless_splice_flag() const { return static_cast<size_type>(members().seamless_splice_flag); }
128 void seamless_splice_flag(size_type value) { members().seamless_splice_flag = static_cast<byte_type>(value); }
129 /// @}
131 /// \name Attributes
132 /// @{
133 public:
134 /// the adaptation_field_header size
135 size_type size() const { return en_header_size; }
137 /// return the offset at the packet
138 size_type offset() const { return extension().offset(); }
139 /// @}
143 /* ///////////////////////////////////////////////////////////////////////
144 * ::extl::media::ts namespace
146 EXTL_MEDIA_TS_END_WHOLE_NAMESPACE
148 /* //////////////////////////////////////////////////////////////////// */
149 #endif /* EXTL_MEDIA_TS_ADAPTATION_FIELD_EXTENSION_HEADER_H */
150 /* //////////////////////////////////////////////////////////////////// */