1 /* ///////////////////////////////////////////////////////////////////////
2 * File: adaptation_field_extension_header.h
7 * Brief: the adaptation_field_extension_header class
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
20 # error adaptation_field_extension_header.h need be supported by c++.
23 /* ///////////////////////////////////////////////////////////////////////
28 /* ///////////////////////////////////////////////////////////////////////
29 * ::extl::media::ts namespace
31 EXTL_MEDIA_TS_BEGIN_WHOLE_NAMESPACE
33 /*!brief adaptation field extension_header
35 * \ingroup extl_group_media
38 * // adaptation field extension_header
39 * struct adaptation_field_extension_header
41 adaptation_field_extension_header_length : 8 ;
43 piecewise_rate_flag : 1 ;
44 seamless_splice_flag : 1 ;
51 for (i = 0; i < N; ++i)
57 * \param AdaExt the adaptation field extension type
59 template<typename_param_k AdaExt
>
60 class adaptation_field_extension_header
62 /// \name Public Types
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
;
81 // program_clock_reference
82 // base + base1 + reseved + pcr_extension
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 ;
99 enum { en_header_size
= 2 };
102 /// \name Private Accessors
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()); }
112 /// \name Public Accessors
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
); }
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(); }
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 /* //////////////////////////////////////////////////////////////////// */