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