DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerator
box_definitions_comparison.h
1 // Copyright 2014 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 //
7 // Overloads operator== for mp4 boxes, mainly used for testing.
8 
9 #ifndef MEDIA_FORMATS_MP4_BOX_DEFINITIONS_COMPARISON_H_
10 #define MEDIA_FORMATS_MP4_BOX_DEFINITIONS_COMPARISON_H_
11 
12 #include "packager/media/formats/mp4/box_definitions.h"
13 
14 namespace edash_packager {
15 namespace media {
16 namespace mp4 {
17 
18 inline bool operator==(const FileType& lhs, const FileType& rhs) {
19  return lhs.major_brand == rhs.major_brand &&
20  lhs.minor_version == rhs.minor_version &&
21  lhs.compatible_brands == rhs.compatible_brands;
22 }
23 
24 inline bool operator==(const ProtectionSystemSpecificHeader& lhs,
25  const ProtectionSystemSpecificHeader& rhs) {
26  return lhs.system_id == rhs.system_id && lhs.data == rhs.data;
27 }
28 
29 inline bool operator==(const SampleAuxiliaryInformationOffset& lhs,
30  const SampleAuxiliaryInformationOffset& rhs) {
31  return lhs.offsets == rhs.offsets;
32 }
33 
34 inline bool operator==(const SampleAuxiliaryInformationSize& lhs,
35  const SampleAuxiliaryInformationSize& rhs) {
36  return lhs.default_sample_info_size == rhs.default_sample_info_size &&
37  lhs.sample_count == rhs.sample_count &&
38  lhs.sample_info_sizes == rhs.sample_info_sizes;
39 }
40 
41 inline bool operator==(const OriginalFormat& lhs, const OriginalFormat& rhs) {
42  return lhs.format == rhs.format;
43 }
44 
45 inline bool operator==(const SchemeType& lhs, const SchemeType& rhs) {
46  return lhs.type == rhs.type && lhs.version == rhs.version;
47 }
48 
49 inline bool operator==(const TrackEncryption& lhs, const TrackEncryption& rhs) {
50  return lhs.is_encrypted == rhs.is_encrypted &&
51  lhs.default_iv_size == rhs.default_iv_size &&
52  lhs.default_kid == rhs.default_kid;
53 }
54 
55 inline bool operator==(const SchemeInfo& lhs, const SchemeInfo& rhs) {
56  return lhs.track_encryption == rhs.track_encryption;
57 }
58 
59 inline bool operator==(const ProtectionSchemeInfo& lhs,
60  const ProtectionSchemeInfo& rhs) {
61  return lhs.format == rhs.format && lhs.type == rhs.type &&
62  lhs.info == rhs.info;
63 }
64 
65 inline bool operator==(const MovieHeader& lhs, const MovieHeader& rhs) {
66  return lhs.creation_time == rhs.creation_time &&
67  lhs.modification_time == rhs.modification_time &&
68  lhs.timescale == rhs.timescale && lhs.duration == rhs.duration &&
69  lhs.rate == rhs.rate && lhs.volume == rhs.volume &&
70  lhs.next_track_id == rhs.next_track_id;
71 }
72 
73 inline bool operator==(const TrackHeader& lhs, const TrackHeader& rhs) {
74  return lhs.creation_time == rhs.creation_time &&
75  lhs.modification_time == rhs.modification_time &&
76  lhs.track_id == rhs.track_id && lhs.duration == rhs.duration &&
77  lhs.layer == rhs.layer && lhs.alternate_group == rhs.alternate_group &&
78  lhs.volume == rhs.volume && lhs.width == rhs.width &&
79  lhs.height == rhs.height;
80 }
81 
82 inline bool operator==(const SampleDescription& lhs,
83  const SampleDescription& rhs) {
84  return lhs.type == rhs.type && lhs.video_entries == rhs.video_entries &&
85  lhs.audio_entries == rhs.audio_entries;
86 }
87 
88 inline bool operator==(const DecodingTime& lhs, const DecodingTime& rhs) {
89  return lhs.sample_count == rhs.sample_count &&
90  lhs.sample_delta == rhs.sample_delta;
91 }
92 
93 inline bool operator==(const DecodingTimeToSample& lhs,
94  const DecodingTimeToSample& rhs) {
95  return lhs.decoding_time == rhs.decoding_time;
96 }
97 
98 inline bool operator==(const CompositionOffset& lhs,
99  const CompositionOffset& rhs) {
100  return lhs.sample_count == rhs.sample_count &&
101  lhs.sample_offset == rhs.sample_offset;
102 }
103 
104 inline bool operator==(const CompositionTimeToSample& lhs,
105  const CompositionTimeToSample& rhs) {
106  return lhs.composition_offset == rhs.composition_offset;
107 }
108 
109 inline bool operator==(const ChunkInfo& lhs, const ChunkInfo& rhs) {
110  return lhs.first_chunk == rhs.first_chunk &&
111  lhs.samples_per_chunk == rhs.samples_per_chunk &&
112  lhs.sample_description_index == rhs.sample_description_index;
113 }
114 
115 inline bool operator==(const SampleToChunk& lhs, const SampleToChunk& rhs) {
116  return lhs.chunk_info == rhs.chunk_info;
117 }
118 
119 inline bool operator==(const SampleSize& lhs, const SampleSize& rhs) {
120  return lhs.sample_size == rhs.sample_size &&
121  lhs.sample_count == rhs.sample_count && lhs.sizes == rhs.sizes;
122 }
123 
124 inline bool operator==(const CompactSampleSize& lhs,
125  const CompactSampleSize& rhs) {
126  return lhs.field_size == rhs.field_size && lhs.sizes == rhs.sizes;
127 }
128 
129 inline bool operator==(const ChunkLargeOffset& lhs,
130  const ChunkLargeOffset& rhs) {
131  return lhs.offsets == rhs.offsets;
132 }
133 
134 inline bool operator==(const SyncSample& lhs, const SyncSample& rhs) {
135  return lhs.sample_number == rhs.sample_number;
136 }
137 
138 inline bool operator==(const SampleTable& lhs, const SampleTable& rhs) {
139  return lhs.description == rhs.description &&
140  lhs.decoding_time_to_sample == rhs.decoding_time_to_sample &&
141  lhs.composition_time_to_sample == rhs.composition_time_to_sample &&
142  lhs.sample_to_chunk == rhs.sample_to_chunk &&
143  lhs.sample_size == rhs.sample_size &&
144  lhs.chunk_large_offset == rhs.chunk_large_offset &&
145  lhs.sync_sample == rhs.sync_sample;
146 }
147 
148 inline bool operator==(const EditListEntry& lhs, const EditListEntry& rhs) {
149  return lhs.segment_duration == rhs.segment_duration &&
150  lhs.media_time == rhs.media_time &&
151  lhs.media_rate_integer == rhs.media_rate_integer &&
152  lhs.media_rate_fraction == rhs.media_rate_fraction;
153 }
154 
155 inline bool operator==(const EditList& lhs, const EditList& rhs) {
156  return lhs.edits == rhs.edits;
157 }
158 
159 inline bool operator==(const Edit& lhs, const Edit& rhs) {
160  return lhs.list == rhs.list;
161 }
162 
163 inline bool operator==(const HandlerReference& lhs,
164  const HandlerReference& rhs) {
165  return lhs.type == rhs.type;
166 }
167 
168 inline bool operator==(const CodecConfigurationRecord& lhs,
169  const CodecConfigurationRecord& rhs) {
170  return lhs.data == rhs.data;
171 }
172 
173 inline bool operator==(const PixelAspectRatioBox& lhs,
174  const PixelAspectRatioBox& rhs) {
175  return lhs.h_spacing == rhs.h_spacing && lhs.v_spacing == rhs.v_spacing;
176 }
177 
178 inline bool operator==(const VideoSampleEntry& lhs,
179  const VideoSampleEntry& rhs) {
180  return lhs.format == rhs.format &&
181  lhs.data_reference_index == rhs.data_reference_index &&
182  lhs.width == rhs.width && lhs.height == rhs.height &&
183  lhs.pixel_aspect == rhs.pixel_aspect && lhs.sinf == rhs.sinf &&
184  lhs.codec_config_record == rhs.codec_config_record;
185 }
186 
187 inline bool operator==(const ESDescriptor& lhs, const ESDescriptor& rhs) {
188  return lhs.esid() == rhs.esid() && lhs.object_type() == rhs.object_type() &&
189  lhs.decoder_specific_info() == rhs.decoder_specific_info();
190 }
191 
192 inline bool operator==(const ElementaryStreamDescriptor& lhs,
193  const ElementaryStreamDescriptor& rhs) {
194  return lhs.es_descriptor == rhs.es_descriptor;
195 }
196 
197 inline bool operator==(const AudioSampleEntry& lhs,
198  const AudioSampleEntry& rhs) {
199  return lhs.format == rhs.format &&
200  lhs.data_reference_index == rhs.data_reference_index &&
201  lhs.channelcount == rhs.channelcount &&
202  lhs.samplesize == rhs.samplesize && lhs.samplerate == rhs.samplerate &&
203  lhs.sinf == rhs.sinf && lhs.esds == rhs.esds;
204 }
205 
206 inline bool operator==(const MediaHeader& lhs, const MediaHeader& rhs) {
207  return lhs.creation_time == rhs.creation_time &&
208  lhs.modification_time == rhs.modification_time &&
209  lhs.timescale == rhs.timescale && lhs.duration == rhs.duration &&
210  strcmp(lhs.language, rhs.language) == 0;
211 }
212 
213 inline bool operator==(const VideoMediaHeader& lhs,
214  const VideoMediaHeader& rhs) {
215  return lhs.graphicsmode == rhs.graphicsmode &&
216  lhs.opcolor_red == rhs.opcolor_red &&
217  lhs.opcolor_green == rhs.opcolor_green &&
218  lhs.opcolor_blue == rhs.opcolor_blue;
219 }
220 
221 inline bool operator==(const SoundMediaHeader& lhs,
222  const SoundMediaHeader& rhs) {
223  return lhs.balance == rhs.balance;
224 }
225 
226 inline bool operator==(const DataEntryUrl& lhs, const DataEntryUrl& rhs) {
227  return lhs.flags == rhs.flags && lhs.location == rhs.location;
228 }
229 
230 inline bool operator==(const DataReference& lhs, const DataReference& rhs) {
231  return lhs.data_entry == rhs.data_entry;
232 }
233 
234 inline bool operator==(const DataInformation& lhs, const DataInformation& rhs) {
235  return lhs.dref == rhs.dref;
236 }
237 
238 inline bool operator==(const MediaInformation& lhs,
239  const MediaInformation& rhs) {
240  return lhs.dinf == rhs.dinf && lhs.sample_table == rhs.sample_table &&
241  lhs.vmhd == rhs.vmhd && lhs.smhd == rhs.smhd;
242 }
243 
244 inline bool operator==(const Media& lhs, const Media& rhs) {
245  return lhs.header == rhs.header && lhs.handler == rhs.handler &&
246  lhs.information == rhs.information;
247 }
248 
249 inline bool operator==(const Track& lhs, const Track& rhs) {
250  return lhs.header == rhs.header && lhs.media == rhs.media &&
251  lhs.edit == rhs.edit;
252 }
253 
254 inline bool operator==(const MovieExtendsHeader& lhs,
255  const MovieExtendsHeader& rhs) {
256  return lhs.fragment_duration == rhs.fragment_duration;
257 }
258 
259 inline bool operator==(const TrackExtends& lhs, const TrackExtends& rhs) {
260  return lhs.track_id == rhs.track_id &&
261  lhs.default_sample_description_index ==
262  rhs.default_sample_description_index &&
263  lhs.default_sample_duration == rhs.default_sample_duration &&
264  lhs.default_sample_size == rhs.default_sample_size &&
265  lhs.default_sample_flags == rhs.default_sample_flags;
266 }
267 
268 inline bool operator==(const MovieExtends& lhs, const MovieExtends& rhs) {
269  return lhs.header == rhs.header && lhs.tracks == rhs.tracks;
270 }
271 
272 inline bool operator==(const Movie& lhs, const Movie& rhs) {
273  return lhs.header == rhs.header && lhs.extends == rhs.extends &&
274  lhs.tracks == rhs.tracks && lhs.pssh == rhs.pssh;
275 }
276 
277 inline bool operator==(const TrackFragmentDecodeTime& lhs,
278  const TrackFragmentDecodeTime& rhs) {
279  return lhs.decode_time == rhs.decode_time;
280 }
281 
282 inline bool operator==(const MovieFragmentHeader& lhs,
283  const MovieFragmentHeader& rhs) {
284  return lhs.sequence_number == rhs.sequence_number;
285 }
286 
287 inline bool operator==(const TrackFragmentHeader& lhs,
288  const TrackFragmentHeader& rhs) {
289  return lhs.flags == rhs.flags && lhs.track_id == rhs.track_id &&
290  lhs.sample_description_index == rhs.sample_description_index &&
291  lhs.default_sample_duration == rhs.default_sample_duration &&
292  lhs.default_sample_size == rhs.default_sample_size &&
293  lhs.default_sample_flags == rhs.default_sample_flags;
294 }
295 
296 inline bool operator==(const TrackFragmentRun& lhs,
297  const TrackFragmentRun& rhs) {
298  return lhs.flags == rhs.flags && lhs.sample_count == rhs.sample_count &&
299  lhs.data_offset == rhs.data_offset &&
300  lhs.sample_flags == rhs.sample_flags &&
301  lhs.sample_sizes == rhs.sample_sizes &&
302  lhs.sample_durations == rhs.sample_durations &&
303  lhs.sample_composition_time_offsets ==
304  rhs.sample_composition_time_offsets;
305 }
306 
307 inline bool operator==(const SampleToGroupEntry& lhs,
308  const SampleToGroupEntry& rhs) {
309  return lhs.sample_count == rhs.sample_count &&
310  lhs.group_description_index == rhs.group_description_index;
311 }
312 
313 inline bool operator==(const SampleToGroup& lhs,
314  const SampleToGroup& rhs) {
315  return lhs.grouping_type == rhs.grouping_type &&
316  lhs.grouping_type_parameter == rhs.grouping_type_parameter &&
317  lhs.entries == rhs.entries;
318 }
319 
320 inline bool operator==(const CencSampleEncryptionInfoEntry& lhs,
321  const CencSampleEncryptionInfoEntry& rhs) {
322  return lhs.is_encrypted == rhs.is_encrypted &&
323  lhs.iv_size == rhs.iv_size &&
324  lhs.key_id == rhs.key_id;
325 }
326 
327 inline bool operator==(const SampleGroupDescription& lhs,
328  const SampleGroupDescription& rhs) {
329  return lhs.grouping_type == rhs.grouping_type &&
330  lhs.entries == rhs.entries;
331 }
332 
333 inline bool operator==(const TrackFragment& lhs, const TrackFragment& rhs) {
334  return lhs.header == rhs.header && lhs.runs == rhs.runs &&
335  lhs.decode_time == rhs.decode_time &&
336  lhs.auxiliary_offset == rhs.auxiliary_offset &&
337  lhs.auxiliary_size == rhs.auxiliary_size;
338 }
339 
340 inline bool operator==(const MovieFragment& lhs, const MovieFragment& rhs) {
341  return lhs.header == rhs.header && lhs.tracks == rhs.tracks &&
342  lhs.pssh == rhs.pssh;
343 }
344 
345 inline bool operator==(const SegmentReference& lhs,
346  const SegmentReference& rhs) {
347  return lhs.reference_type == rhs.reference_type &&
348  lhs.referenced_size == rhs.referenced_size &&
349  lhs.subsegment_duration == rhs.subsegment_duration &&
350  lhs.starts_with_sap == rhs.starts_with_sap &&
351  lhs.sap_type == rhs.sap_type &&
352  lhs.sap_delta_time == rhs.sap_delta_time;
353 }
354 
355 inline bool operator==(const SegmentIndex& lhs, const SegmentIndex& rhs) {
356  return lhs.reference_id == rhs.reference_id &&
357  lhs.timescale == rhs.timescale &&
358  lhs.earliest_presentation_time == rhs.earliest_presentation_time &&
359  lhs.first_offset == rhs.first_offset &&
360  lhs.references == rhs.references;
361 }
362 
363 } // namespace mp4
364 } // namespace media
365 } // namespace edash_packager
366 
367 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_COMPARISON_H_