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 PixelAspectRatio& lhs,
174  const PixelAspectRatio& 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 DTSSpecific& lhs,
198  const DTSSpecific& rhs) {
199  return lhs.data == rhs.data;
200 }
201 
202 inline bool operator==(const AudioSampleEntry& lhs,
203  const AudioSampleEntry& rhs) {
204  return lhs.format == rhs.format &&
205  lhs.data_reference_index == rhs.data_reference_index &&
206  lhs.channelcount == rhs.channelcount &&
207  lhs.samplesize == rhs.samplesize && lhs.samplerate == rhs.samplerate &&
208  lhs.sinf == rhs.sinf && lhs.esds == rhs.esds &&
209  lhs.ddts == rhs.ddts;
210 }
211 
212 inline bool operator==(const WebVTTConfigurationBox& lhs,
213  const WebVTTConfigurationBox& rhs) {
214  return lhs.config == rhs.config;
215 }
216 
217 inline bool operator==(const WebVTTSourceLabelBox& lhs,
218  const WebVTTSourceLabelBox& rhs) {
219  return lhs.source_label == rhs.source_label;
220 }
221 
222 inline bool operator==(const WVTTSampleEntry& lhs,
223  const WVTTSampleEntry& rhs) {
224  return lhs.config == rhs.config && lhs.label == rhs.label;
225 }
226 
227 inline bool operator==(const MediaHeader& lhs, const MediaHeader& rhs) {
228  return lhs.creation_time == rhs.creation_time &&
229  lhs.modification_time == rhs.modification_time &&
230  lhs.timescale == rhs.timescale && lhs.duration == rhs.duration &&
231  strcmp(lhs.language, rhs.language) == 0;
232 }
233 
234 inline bool operator==(const VideoMediaHeader& lhs,
235  const VideoMediaHeader& rhs) {
236  return lhs.graphicsmode == rhs.graphicsmode &&
237  lhs.opcolor_red == rhs.opcolor_red &&
238  lhs.opcolor_green == rhs.opcolor_green &&
239  lhs.opcolor_blue == rhs.opcolor_blue;
240 }
241 
242 inline bool operator==(const SoundMediaHeader& lhs,
243  const SoundMediaHeader& rhs) {
244  return lhs.balance == rhs.balance;
245 }
246 
247 inline bool operator==(const SubtitleMediaHeader& lhs,
248  const SubtitleMediaHeader& rhs) {
249  return true;
250 }
251 
252 inline bool operator==(const DataEntryUrl& lhs, const DataEntryUrl& rhs) {
253  return lhs.flags == rhs.flags && lhs.location == rhs.location;
254 }
255 
256 inline bool operator==(const DataReference& lhs, const DataReference& rhs) {
257  return lhs.data_entry == rhs.data_entry;
258 }
259 
260 inline bool operator==(const DataInformation& lhs, const DataInformation& rhs) {
261  return lhs.dref == rhs.dref;
262 }
263 
264 inline bool operator==(const MediaInformation& lhs,
265  const MediaInformation& rhs) {
266  return lhs.dinf == rhs.dinf && lhs.sample_table == rhs.sample_table &&
267  lhs.vmhd == rhs.vmhd && lhs.smhd == rhs.smhd;
268 }
269 
270 inline bool operator==(const Media& lhs, const Media& rhs) {
271  return lhs.header == rhs.header && lhs.handler == rhs.handler &&
272  lhs.information == rhs.information;
273 }
274 
275 inline bool operator==(const Track& lhs, const Track& rhs) {
276  return lhs.header == rhs.header && lhs.media == rhs.media &&
277  lhs.edit == rhs.edit;
278 }
279 
280 inline bool operator==(const MovieExtendsHeader& lhs,
281  const MovieExtendsHeader& rhs) {
282  return lhs.fragment_duration == rhs.fragment_duration;
283 }
284 
285 inline bool operator==(const TrackExtends& lhs, const TrackExtends& rhs) {
286  return lhs.track_id == rhs.track_id &&
287  lhs.default_sample_description_index ==
288  rhs.default_sample_description_index &&
289  lhs.default_sample_duration == rhs.default_sample_duration &&
290  lhs.default_sample_size == rhs.default_sample_size &&
291  lhs.default_sample_flags == rhs.default_sample_flags;
292 }
293 
294 inline bool operator==(const MovieExtends& lhs, const MovieExtends& rhs) {
295  return lhs.header == rhs.header && lhs.tracks == rhs.tracks;
296 }
297 
298 inline bool operator==(const Movie& lhs, const Movie& rhs) {
299  return lhs.header == rhs.header && lhs.extends == rhs.extends &&
300  lhs.tracks == rhs.tracks && lhs.pssh == rhs.pssh;
301 }
302 
303 inline bool operator==(const TrackFragmentDecodeTime& lhs,
304  const TrackFragmentDecodeTime& rhs) {
305  return lhs.decode_time == rhs.decode_time;
306 }
307 
308 inline bool operator==(const MovieFragmentHeader& lhs,
309  const MovieFragmentHeader& rhs) {
310  return lhs.sequence_number == rhs.sequence_number;
311 }
312 
313 inline bool operator==(const TrackFragmentHeader& lhs,
314  const TrackFragmentHeader& rhs) {
315  return lhs.flags == rhs.flags && lhs.track_id == rhs.track_id &&
316  lhs.sample_description_index == rhs.sample_description_index &&
317  lhs.default_sample_duration == rhs.default_sample_duration &&
318  lhs.default_sample_size == rhs.default_sample_size &&
319  lhs.default_sample_flags == rhs.default_sample_flags;
320 }
321 
322 inline bool operator==(const TrackFragmentRun& lhs,
323  const TrackFragmentRun& rhs) {
324  return lhs.flags == rhs.flags && lhs.sample_count == rhs.sample_count &&
325  lhs.data_offset == rhs.data_offset &&
326  lhs.sample_flags == rhs.sample_flags &&
327  lhs.sample_sizes == rhs.sample_sizes &&
328  lhs.sample_durations == rhs.sample_durations &&
329  lhs.sample_composition_time_offsets ==
330  rhs.sample_composition_time_offsets;
331 }
332 
333 inline bool operator==(const SampleToGroupEntry& lhs,
334  const SampleToGroupEntry& rhs) {
335  return lhs.sample_count == rhs.sample_count &&
336  lhs.group_description_index == rhs.group_description_index;
337 }
338 
339 inline bool operator==(const SampleToGroup& lhs,
340  const SampleToGroup& rhs) {
341  return lhs.grouping_type == rhs.grouping_type &&
342  lhs.grouping_type_parameter == rhs.grouping_type_parameter &&
343  lhs.entries == rhs.entries;
344 }
345 
346 inline bool operator==(const CencSampleEncryptionInfoEntry& lhs,
347  const CencSampleEncryptionInfoEntry& rhs) {
348  return lhs.is_encrypted == rhs.is_encrypted &&
349  lhs.iv_size == rhs.iv_size &&
350  lhs.key_id == rhs.key_id;
351 }
352 
353 inline bool operator==(const SampleGroupDescription& lhs,
354  const SampleGroupDescription& rhs) {
355  return lhs.grouping_type == rhs.grouping_type &&
356  lhs.entries == rhs.entries;
357 }
358 
359 inline bool operator==(const TrackFragment& lhs, const TrackFragment& rhs) {
360  return lhs.header == rhs.header && lhs.runs == rhs.runs &&
361  lhs.decode_time == rhs.decode_time &&
362  lhs.auxiliary_offset == rhs.auxiliary_offset &&
363  lhs.auxiliary_size == rhs.auxiliary_size;
364 }
365 
366 inline bool operator==(const MovieFragment& lhs, const MovieFragment& rhs) {
367  return lhs.header == rhs.header && lhs.tracks == rhs.tracks &&
368  lhs.pssh == rhs.pssh;
369 }
370 
371 inline bool operator==(const SegmentReference& lhs,
372  const SegmentReference& rhs) {
373  return lhs.reference_type == rhs.reference_type &&
374  lhs.referenced_size == rhs.referenced_size &&
375  lhs.subsegment_duration == rhs.subsegment_duration &&
376  lhs.starts_with_sap == rhs.starts_with_sap &&
377  lhs.sap_type == rhs.sap_type &&
378  lhs.sap_delta_time == rhs.sap_delta_time;
379 }
380 
381 inline bool operator==(const SegmentIndex& lhs, const SegmentIndex& rhs) {
382  return lhs.reference_id == rhs.reference_id &&
383  lhs.timescale == rhs.timescale &&
384  lhs.earliest_presentation_time == rhs.earliest_presentation_time &&
385  lhs.first_offset == rhs.first_offset &&
386  lhs.references == rhs.references;
387 }
388 
389 inline bool operator==(const CueSourceIDBox& lhs,
390  const CueSourceIDBox& rhs) {
391  return lhs.source_id == rhs.source_id;
392 }
393 
394 inline bool operator==(const CueTimeBox& lhs,
395  const CueTimeBox& rhs) {
396  return lhs.cue_current_time == rhs.cue_current_time;
397 }
398 
399 inline bool operator==(const CueIDBox& lhs,
400  const CueIDBox& rhs) {
401  return lhs.cue_id == rhs.cue_id;
402 }
403 
404 inline bool operator==(const CueSettingsBox& lhs,
405  const CueSettingsBox& rhs) {
406  return lhs.settings == rhs.settings;
407 }
408 
409 inline bool operator==(const CuePayloadBox& lhs,
410  const CuePayloadBox& rhs) {
411  return lhs.cue_text == rhs.cue_text;
412 }
413 
414 inline bool operator==(const VTTEmptyCueBox& lhs, const VTTEmptyCueBox& rhs) {
415  return true;
416 }
417 
418 inline bool operator==(const VTTAdditionalTextBox& lhs,
419  const VTTAdditionalTextBox& rhs) {
420  return lhs.cue_additional_text == rhs.cue_additional_text;
421 }
422 
423 inline bool operator==(const VTTCueBox& lhs,
424  const VTTCueBox& rhs) {
425  return lhs.cue_source_id == rhs.cue_source_id && lhs.cue_id == rhs.cue_id &&
426  lhs.cue_time == rhs.cue_time && lhs.cue_settings == rhs.cue_settings &&
427  lhs.cue_payload == rhs.cue_payload;
428 }
429 
430 } // namespace mp4
431 } // namespace media
432 } // namespace edash_packager
433 
434 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_COMPARISON_H_