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 
17 inline bool operator==(const SubsampleEntry& lhs, const SubsampleEntry& rhs) {
18  return lhs.clear_bytes == rhs.clear_bytes &&
19  lhs.cipher_bytes == rhs.cipher_bytes;
20 }
21 
22 namespace mp4 {
23 
24 inline bool operator==(const FileType& lhs, const FileType& rhs) {
25  return lhs.major_brand == rhs.major_brand &&
26  lhs.minor_version == rhs.minor_version &&
27  lhs.compatible_brands == rhs.compatible_brands;
28 }
29 
30 inline bool operator==(const ProtectionSystemSpecificHeader& lhs,
31  const ProtectionSystemSpecificHeader& rhs) {
32  return lhs.system_id == rhs.system_id && lhs.data == rhs.data;
33 }
34 
35 inline bool operator==(const SampleAuxiliaryInformationOffset& lhs,
36  const SampleAuxiliaryInformationOffset& rhs) {
37  return lhs.offsets == rhs.offsets;
38 }
39 
40 inline bool operator==(const SampleAuxiliaryInformationSize& lhs,
41  const SampleAuxiliaryInformationSize& rhs) {
42  return lhs.default_sample_info_size == rhs.default_sample_info_size &&
43  lhs.sample_count == rhs.sample_count &&
44  lhs.sample_info_sizes == rhs.sample_info_sizes;
45 }
46 
47 inline bool operator==(const SampleEncryptionEntry& lhs,
48  const SampleEncryptionEntry& rhs) {
49  return lhs.initialization_vector == rhs.initialization_vector &&
50  lhs.subsamples == rhs.subsamples;
51 }
52 
53 inline bool operator==(const SampleEncryption& lhs,
54  const SampleEncryption& rhs) {
55  return lhs.iv_size == rhs.iv_size &&
56  lhs.sample_encryption_entries == rhs.sample_encryption_entries;
57 }
58 
59 inline bool operator==(const OriginalFormat& lhs, const OriginalFormat& rhs) {
60  return lhs.format == rhs.format;
61 }
62 
63 inline bool operator==(const SchemeType& lhs, const SchemeType& rhs) {
64  return lhs.type == rhs.type && lhs.version == rhs.version;
65 }
66 
67 inline bool operator==(const TrackEncryption& lhs, const TrackEncryption& rhs) {
68  return lhs.is_encrypted == rhs.is_encrypted &&
69  lhs.default_iv_size == rhs.default_iv_size &&
70  lhs.default_kid == rhs.default_kid;
71 }
72 
73 inline bool operator==(const SchemeInfo& lhs, const SchemeInfo& rhs) {
74  return lhs.track_encryption == rhs.track_encryption;
75 }
76 
77 inline bool operator==(const ProtectionSchemeInfo& lhs,
78  const ProtectionSchemeInfo& rhs) {
79  return lhs.format == rhs.format && lhs.type == rhs.type &&
80  lhs.info == rhs.info;
81 }
82 
83 inline bool operator==(const MovieHeader& lhs, const MovieHeader& rhs) {
84  return lhs.creation_time == rhs.creation_time &&
85  lhs.modification_time == rhs.modification_time &&
86  lhs.timescale == rhs.timescale && lhs.duration == rhs.duration &&
87  lhs.rate == rhs.rate && lhs.volume == rhs.volume &&
88  lhs.next_track_id == rhs.next_track_id;
89 }
90 
91 inline bool operator==(const TrackHeader& lhs, const TrackHeader& rhs) {
92  return lhs.creation_time == rhs.creation_time &&
93  lhs.modification_time == rhs.modification_time &&
94  lhs.track_id == rhs.track_id && lhs.duration == rhs.duration &&
95  lhs.layer == rhs.layer && lhs.alternate_group == rhs.alternate_group &&
96  lhs.volume == rhs.volume && lhs.width == rhs.width &&
97  lhs.height == rhs.height;
98 }
99 
100 inline bool operator==(const SampleDescription& lhs,
101  const SampleDescription& rhs) {
102  return lhs.type == rhs.type && lhs.video_entries == rhs.video_entries &&
103  lhs.audio_entries == rhs.audio_entries;
104 }
105 
106 inline bool operator==(const DecodingTime& lhs, const DecodingTime& rhs) {
107  return lhs.sample_count == rhs.sample_count &&
108  lhs.sample_delta == rhs.sample_delta;
109 }
110 
111 inline bool operator==(const DecodingTimeToSample& lhs,
112  const DecodingTimeToSample& rhs) {
113  return lhs.decoding_time == rhs.decoding_time;
114 }
115 
116 inline bool operator==(const CompositionOffset& lhs,
117  const CompositionOffset& rhs) {
118  return lhs.sample_count == rhs.sample_count &&
119  lhs.sample_offset == rhs.sample_offset;
120 }
121 
122 inline bool operator==(const CompositionTimeToSample& lhs,
123  const CompositionTimeToSample& rhs) {
124  return lhs.composition_offset == rhs.composition_offset;
125 }
126 
127 inline bool operator==(const ChunkInfo& lhs, const ChunkInfo& rhs) {
128  return lhs.first_chunk == rhs.first_chunk &&
129  lhs.samples_per_chunk == rhs.samples_per_chunk &&
130  lhs.sample_description_index == rhs.sample_description_index;
131 }
132 
133 inline bool operator==(const SampleToChunk& lhs, const SampleToChunk& rhs) {
134  return lhs.chunk_info == rhs.chunk_info;
135 }
136 
137 inline bool operator==(const SampleSize& lhs, const SampleSize& rhs) {
138  return lhs.sample_size == rhs.sample_size &&
139  lhs.sample_count == rhs.sample_count && lhs.sizes == rhs.sizes;
140 }
141 
142 inline bool operator==(const CompactSampleSize& lhs,
143  const CompactSampleSize& rhs) {
144  return lhs.field_size == rhs.field_size && lhs.sizes == rhs.sizes;
145 }
146 
147 inline bool operator==(const ChunkLargeOffset& lhs,
148  const ChunkLargeOffset& rhs) {
149  return lhs.offsets == rhs.offsets;
150 }
151 
152 inline bool operator==(const SyncSample& lhs, const SyncSample& rhs) {
153  return lhs.sample_number == rhs.sample_number;
154 }
155 
156 inline bool operator==(const SampleTable& lhs, const SampleTable& rhs) {
157  return lhs.description == rhs.description &&
158  lhs.decoding_time_to_sample == rhs.decoding_time_to_sample &&
159  lhs.composition_time_to_sample == rhs.composition_time_to_sample &&
160  lhs.sample_to_chunk == rhs.sample_to_chunk &&
161  lhs.sample_size == rhs.sample_size &&
162  lhs.chunk_large_offset == rhs.chunk_large_offset &&
163  lhs.sync_sample == rhs.sync_sample;
164 }
165 
166 inline bool operator==(const EditListEntry& lhs, const EditListEntry& rhs) {
167  return lhs.segment_duration == rhs.segment_duration &&
168  lhs.media_time == rhs.media_time &&
169  lhs.media_rate_integer == rhs.media_rate_integer &&
170  lhs.media_rate_fraction == rhs.media_rate_fraction;
171 }
172 
173 inline bool operator==(const EditList& lhs, const EditList& rhs) {
174  return lhs.edits == rhs.edits;
175 }
176 
177 inline bool operator==(const Edit& lhs, const Edit& rhs) {
178  return lhs.list == rhs.list;
179 }
180 
181 inline bool operator==(const HandlerReference& lhs,
182  const HandlerReference& rhs) {
183  return lhs.handler_type == rhs.handler_type;
184 }
185 
186 inline bool operator==(const Language& lhs,
187  const Language& rhs) {
188  return lhs.code == rhs.code;
189 }
190 
191 inline bool operator==(const PrivFrame& lhs, const PrivFrame& rhs) {
192  return lhs.owner == rhs.owner && lhs.value == rhs.value;
193 }
194 
195 inline bool operator==(const ID3v2& lhs, const ID3v2& rhs) {
196  return lhs.language == rhs.language && lhs.private_frame == rhs.private_frame;
197 }
198 
199 inline bool operator==(const Metadata& lhs, const Metadata& rhs) {
200  return lhs.handler == rhs.handler && lhs.id3v2 == rhs.id3v2;
201 }
202 
203 inline bool operator==(const CodecConfigurationRecord& lhs,
204  const CodecConfigurationRecord& rhs) {
205  return lhs.data == rhs.data;
206 }
207 
208 inline bool operator==(const PixelAspectRatio& lhs,
209  const PixelAspectRatio& rhs) {
210  return lhs.h_spacing == rhs.h_spacing && lhs.v_spacing == rhs.v_spacing;
211 }
212 
213 inline bool operator==(const VideoSampleEntry& lhs,
214  const VideoSampleEntry& rhs) {
215  return lhs.format == rhs.format &&
216  lhs.data_reference_index == rhs.data_reference_index &&
217  lhs.width == rhs.width && lhs.height == rhs.height &&
218  lhs.pixel_aspect == rhs.pixel_aspect && lhs.sinf == rhs.sinf &&
219  lhs.codec_config_record == rhs.codec_config_record;
220 }
221 
222 inline bool operator==(const ESDescriptor& lhs, const ESDescriptor& rhs) {
223  return lhs.esid() == rhs.esid() && lhs.object_type() == rhs.object_type() &&
224  lhs.max_bitrate() == rhs.max_bitrate() &&
225  lhs.avg_bitrate() == rhs.avg_bitrate() &&
226  lhs.decoder_specific_info() == rhs.decoder_specific_info();
227 }
228 
229 inline bool operator==(const ElementaryStreamDescriptor& lhs,
230  const ElementaryStreamDescriptor& rhs) {
231  return lhs.es_descriptor == rhs.es_descriptor;
232 }
233 
234 inline bool operator==(const DTSSpecific& lhs,
235  const DTSSpecific& rhs) {
236  return lhs.sampling_frequency == rhs.sampling_frequency &&
237  lhs.max_bitrate == rhs.max_bitrate &&
238  lhs.avg_bitrate == rhs.avg_bitrate &&
239  lhs.pcm_sample_depth == rhs.pcm_sample_depth &&
240  lhs.extra_data == rhs.extra_data;
241 }
242 
243 inline bool operator==(const AC3Specific& lhs,
244  const AC3Specific& rhs) {
245  return lhs.data == rhs.data;
246 }
247 
248 inline bool operator==(const EC3Specific& lhs,
249  const EC3Specific& rhs) {
250  return lhs.data == rhs.data;
251 }
252 
253 inline bool operator==(const AudioSampleEntry& lhs,
254  const AudioSampleEntry& rhs) {
255  return lhs.format == rhs.format &&
256  lhs.data_reference_index == rhs.data_reference_index &&
257  lhs.channelcount == rhs.channelcount &&
258  lhs.samplesize == rhs.samplesize && lhs.samplerate == rhs.samplerate &&
259  lhs.sinf == rhs.sinf && lhs.esds == rhs.esds && lhs.ddts == rhs.ddts &&
260  lhs.dac3 == rhs.dac3 && lhs.dec3 == rhs.dec3;
261 }
262 
263 inline bool operator==(const WebVTTConfigurationBox& lhs,
264  const WebVTTConfigurationBox& rhs) {
265  return lhs.config == rhs.config;
266 }
267 
268 inline bool operator==(const WebVTTSourceLabelBox& lhs,
269  const WebVTTSourceLabelBox& rhs) {
270  return lhs.source_label == rhs.source_label;
271 }
272 
273 inline bool operator==(const WVTTSampleEntry& lhs,
274  const WVTTSampleEntry& rhs) {
275  return lhs.config == rhs.config && lhs.label == rhs.label;
276 }
277 
278 inline bool operator==(const MediaHeader& lhs, const MediaHeader& rhs) {
279  return lhs.creation_time == rhs.creation_time &&
280  lhs.modification_time == rhs.modification_time &&
281  lhs.timescale == rhs.timescale && lhs.duration == rhs.duration &&
282  lhs.language == rhs.language;
283 }
284 
285 inline bool operator==(const VideoMediaHeader& lhs,
286  const VideoMediaHeader& rhs) {
287  return lhs.graphicsmode == rhs.graphicsmode &&
288  lhs.opcolor_red == rhs.opcolor_red &&
289  lhs.opcolor_green == rhs.opcolor_green &&
290  lhs.opcolor_blue == rhs.opcolor_blue;
291 }
292 
293 inline bool operator==(const SoundMediaHeader& lhs,
294  const SoundMediaHeader& rhs) {
295  return lhs.balance == rhs.balance;
296 }
297 
298 inline bool operator==(const SubtitleMediaHeader& lhs,
299  const SubtitleMediaHeader& rhs) {
300  return true;
301 }
302 
303 inline bool operator==(const DataEntryUrl& lhs, const DataEntryUrl& rhs) {
304  return lhs.flags == rhs.flags && lhs.location == rhs.location;
305 }
306 
307 inline bool operator==(const DataReference& lhs, const DataReference& rhs) {
308  return lhs.data_entry == rhs.data_entry;
309 }
310 
311 inline bool operator==(const DataInformation& lhs, const DataInformation& rhs) {
312  return lhs.dref == rhs.dref;
313 }
314 
315 inline bool operator==(const MediaInformation& lhs,
316  const MediaInformation& rhs) {
317  return lhs.dinf == rhs.dinf && lhs.sample_table == rhs.sample_table &&
318  lhs.vmhd == rhs.vmhd && lhs.smhd == rhs.smhd;
319 }
320 
321 inline bool operator==(const Media& lhs, const Media& rhs) {
322  return lhs.header == rhs.header && lhs.handler == rhs.handler &&
323  lhs.information == rhs.information;
324 }
325 
326 inline bool operator==(const Track& lhs, const Track& rhs) {
327  return lhs.header == rhs.header && lhs.media == rhs.media &&
328  lhs.edit == rhs.edit && lhs.sample_encryption == rhs.sample_encryption;
329 }
330 
331 inline bool operator==(const MovieExtendsHeader& lhs,
332  const MovieExtendsHeader& rhs) {
333  return lhs.fragment_duration == rhs.fragment_duration;
334 }
335 
336 inline bool operator==(const TrackExtends& lhs, const TrackExtends& rhs) {
337  return lhs.track_id == rhs.track_id &&
338  lhs.default_sample_description_index ==
339  rhs.default_sample_description_index &&
340  lhs.default_sample_duration == rhs.default_sample_duration &&
341  lhs.default_sample_size == rhs.default_sample_size &&
342  lhs.default_sample_flags == rhs.default_sample_flags;
343 }
344 
345 inline bool operator==(const MovieExtends& lhs, const MovieExtends& rhs) {
346  return lhs.header == rhs.header && lhs.tracks == rhs.tracks;
347 }
348 
349 inline bool operator==(const Movie& lhs, const Movie& rhs) {
350  return lhs.header == rhs.header && lhs.extends == rhs.extends &&
351  lhs.tracks == rhs.tracks && lhs.pssh == rhs.pssh;
352 }
353 
354 inline bool operator==(const TrackFragmentDecodeTime& lhs,
355  const TrackFragmentDecodeTime& rhs) {
356  return lhs.decode_time == rhs.decode_time;
357 }
358 
359 inline bool operator==(const MovieFragmentHeader& lhs,
360  const MovieFragmentHeader& rhs) {
361  return lhs.sequence_number == rhs.sequence_number;
362 }
363 
364 inline bool operator==(const TrackFragmentHeader& lhs,
365  const TrackFragmentHeader& rhs) {
366  return lhs.flags == rhs.flags && lhs.track_id == rhs.track_id &&
367  lhs.sample_description_index == rhs.sample_description_index &&
368  lhs.default_sample_duration == rhs.default_sample_duration &&
369  lhs.default_sample_size == rhs.default_sample_size &&
370  lhs.default_sample_flags == rhs.default_sample_flags;
371 }
372 
373 inline bool operator==(const TrackFragmentRun& lhs,
374  const TrackFragmentRun& rhs) {
375  return lhs.flags == rhs.flags && lhs.sample_count == rhs.sample_count &&
376  lhs.data_offset == rhs.data_offset &&
377  lhs.sample_flags == rhs.sample_flags &&
378  lhs.sample_sizes == rhs.sample_sizes &&
379  lhs.sample_durations == rhs.sample_durations &&
380  lhs.sample_composition_time_offsets ==
381  rhs.sample_composition_time_offsets;
382 }
383 
384 inline bool operator==(const SampleToGroupEntry& lhs,
385  const SampleToGroupEntry& rhs) {
386  return lhs.sample_count == rhs.sample_count &&
387  lhs.group_description_index == rhs.group_description_index;
388 }
389 
390 inline bool operator==(const SampleToGroup& lhs,
391  const SampleToGroup& rhs) {
392  return lhs.grouping_type == rhs.grouping_type &&
393  lhs.grouping_type_parameter == rhs.grouping_type_parameter &&
394  lhs.entries == rhs.entries;
395 }
396 
397 inline bool operator==(const CencSampleEncryptionInfoEntry& lhs,
398  const CencSampleEncryptionInfoEntry& rhs) {
399  return lhs.is_encrypted == rhs.is_encrypted &&
400  lhs.iv_size == rhs.iv_size &&
401  lhs.key_id == rhs.key_id;
402 }
403 
404 inline bool operator==(const SampleGroupDescription& lhs,
405  const SampleGroupDescription& rhs) {
406  return lhs.grouping_type == rhs.grouping_type &&
407  lhs.entries == rhs.entries;
408 }
409 
410 inline bool operator==(const TrackFragment& lhs, const TrackFragment& rhs) {
411  return lhs.header == rhs.header && lhs.runs == rhs.runs &&
412  lhs.decode_time == rhs.decode_time &&
413  lhs.auxiliary_offset == rhs.auxiliary_offset &&
414  lhs.auxiliary_size == rhs.auxiliary_size &&
415  lhs.sample_encryption == rhs.sample_encryption;
416 }
417 
418 inline bool operator==(const MovieFragment& lhs, const MovieFragment& rhs) {
419  return lhs.header == rhs.header && lhs.tracks == rhs.tracks &&
420  lhs.pssh == rhs.pssh;
421 }
422 
423 inline bool operator==(const SegmentReference& lhs,
424  const SegmentReference& rhs) {
425  return lhs.reference_type == rhs.reference_type &&
426  lhs.referenced_size == rhs.referenced_size &&
427  lhs.subsegment_duration == rhs.subsegment_duration &&
428  lhs.starts_with_sap == rhs.starts_with_sap &&
429  lhs.sap_type == rhs.sap_type &&
430  lhs.sap_delta_time == rhs.sap_delta_time;
431 }
432 
433 inline bool operator==(const SegmentIndex& lhs, const SegmentIndex& rhs) {
434  return lhs.reference_id == rhs.reference_id &&
435  lhs.timescale == rhs.timescale &&
436  lhs.earliest_presentation_time == rhs.earliest_presentation_time &&
437  lhs.first_offset == rhs.first_offset &&
438  lhs.references == rhs.references;
439 }
440 
441 inline bool operator==(const CueSourceIDBox& lhs,
442  const CueSourceIDBox& rhs) {
443  return lhs.source_id == rhs.source_id;
444 }
445 
446 inline bool operator==(const CueTimeBox& lhs,
447  const CueTimeBox& rhs) {
448  return lhs.cue_current_time == rhs.cue_current_time;
449 }
450 
451 inline bool operator==(const CueIDBox& lhs,
452  const CueIDBox& rhs) {
453  return lhs.cue_id == rhs.cue_id;
454 }
455 
456 inline bool operator==(const CueSettingsBox& lhs,
457  const CueSettingsBox& rhs) {
458  return lhs.settings == rhs.settings;
459 }
460 
461 inline bool operator==(const CuePayloadBox& lhs,
462  const CuePayloadBox& rhs) {
463  return lhs.cue_text == rhs.cue_text;
464 }
465 
466 inline bool operator==(const VTTEmptyCueBox& lhs, const VTTEmptyCueBox& rhs) {
467  return true;
468 }
469 
470 inline bool operator==(const VTTAdditionalTextBox& lhs,
471  const VTTAdditionalTextBox& rhs) {
472  return lhs.cue_additional_text == rhs.cue_additional_text;
473 }
474 
475 inline bool operator==(const VTTCueBox& lhs,
476  const VTTCueBox& rhs) {
477  return lhs.cue_source_id == rhs.cue_source_id && lhs.cue_id == rhs.cue_id &&
478  lhs.cue_time == rhs.cue_time && lhs.cue_settings == rhs.cue_settings &&
479  lhs.cue_payload == rhs.cue_payload;
480 }
481 
482 } // namespace mp4
483 } // namespace media
484 } // namespace edash_packager
485 
486 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_COMPARISON_H_