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 DTSSpecificBox& lhs,
198  const DTSSpecificBox& 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 MediaHeader& lhs, const MediaHeader& rhs) {
213  return lhs.creation_time == rhs.creation_time &&
214  lhs.modification_time == rhs.modification_time &&
215  lhs.timescale == rhs.timescale && lhs.duration == rhs.duration &&
216  strcmp(lhs.language, rhs.language) == 0;
217 }
218 
219 inline bool operator==(const VideoMediaHeader& lhs,
220  const VideoMediaHeader& rhs) {
221  return lhs.graphicsmode == rhs.graphicsmode &&
222  lhs.opcolor_red == rhs.opcolor_red &&
223  lhs.opcolor_green == rhs.opcolor_green &&
224  lhs.opcolor_blue == rhs.opcolor_blue;
225 }
226 
227 inline bool operator==(const SoundMediaHeader& lhs,
228  const SoundMediaHeader& rhs) {
229  return lhs.balance == rhs.balance;
230 }
231 
232 inline bool operator==(const DataEntryUrl& lhs, const DataEntryUrl& rhs) {
233  return lhs.flags == rhs.flags && lhs.location == rhs.location;
234 }
235 
236 inline bool operator==(const DataReference& lhs, const DataReference& rhs) {
237  return lhs.data_entry == rhs.data_entry;
238 }
239 
240 inline bool operator==(const DataInformation& lhs, const DataInformation& rhs) {
241  return lhs.dref == rhs.dref;
242 }
243 
244 inline bool operator==(const MediaInformation& lhs,
245  const MediaInformation& rhs) {
246  return lhs.dinf == rhs.dinf && lhs.sample_table == rhs.sample_table &&
247  lhs.vmhd == rhs.vmhd && lhs.smhd == rhs.smhd;
248 }
249 
250 inline bool operator==(const Media& lhs, const Media& rhs) {
251  return lhs.header == rhs.header && lhs.handler == rhs.handler &&
252  lhs.information == rhs.information;
253 }
254 
255 inline bool operator==(const Track& lhs, const Track& rhs) {
256  return lhs.header == rhs.header && lhs.media == rhs.media &&
257  lhs.edit == rhs.edit;
258 }
259 
260 inline bool operator==(const MovieExtendsHeader& lhs,
261  const MovieExtendsHeader& rhs) {
262  return lhs.fragment_duration == rhs.fragment_duration;
263 }
264 
265 inline bool operator==(const TrackExtends& lhs, const TrackExtends& rhs) {
266  return lhs.track_id == rhs.track_id &&
267  lhs.default_sample_description_index ==
268  rhs.default_sample_description_index &&
269  lhs.default_sample_duration == rhs.default_sample_duration &&
270  lhs.default_sample_size == rhs.default_sample_size &&
271  lhs.default_sample_flags == rhs.default_sample_flags;
272 }
273 
274 inline bool operator==(const MovieExtends& lhs, const MovieExtends& rhs) {
275  return lhs.header == rhs.header && lhs.tracks == rhs.tracks;
276 }
277 
278 inline bool operator==(const Movie& lhs, const Movie& rhs) {
279  return lhs.header == rhs.header && lhs.extends == rhs.extends &&
280  lhs.tracks == rhs.tracks && lhs.pssh == rhs.pssh;
281 }
282 
283 inline bool operator==(const TrackFragmentDecodeTime& lhs,
284  const TrackFragmentDecodeTime& rhs) {
285  return lhs.decode_time == rhs.decode_time;
286 }
287 
288 inline bool operator==(const MovieFragmentHeader& lhs,
289  const MovieFragmentHeader& rhs) {
290  return lhs.sequence_number == rhs.sequence_number;
291 }
292 
293 inline bool operator==(const TrackFragmentHeader& lhs,
294  const TrackFragmentHeader& rhs) {
295  return lhs.flags == rhs.flags && lhs.track_id == rhs.track_id &&
296  lhs.sample_description_index == rhs.sample_description_index &&
297  lhs.default_sample_duration == rhs.default_sample_duration &&
298  lhs.default_sample_size == rhs.default_sample_size &&
299  lhs.default_sample_flags == rhs.default_sample_flags;
300 }
301 
302 inline bool operator==(const TrackFragmentRun& lhs,
303  const TrackFragmentRun& rhs) {
304  return lhs.flags == rhs.flags && lhs.sample_count == rhs.sample_count &&
305  lhs.data_offset == rhs.data_offset &&
306  lhs.sample_flags == rhs.sample_flags &&
307  lhs.sample_sizes == rhs.sample_sizes &&
308  lhs.sample_durations == rhs.sample_durations &&
309  lhs.sample_composition_time_offsets ==
310  rhs.sample_composition_time_offsets;
311 }
312 
313 inline bool operator==(const SampleToGroupEntry& lhs,
314  const SampleToGroupEntry& rhs) {
315  return lhs.sample_count == rhs.sample_count &&
316  lhs.group_description_index == rhs.group_description_index;
317 }
318 
319 inline bool operator==(const SampleToGroup& lhs,
320  const SampleToGroup& rhs) {
321  return lhs.grouping_type == rhs.grouping_type &&
322  lhs.grouping_type_parameter == rhs.grouping_type_parameter &&
323  lhs.entries == rhs.entries;
324 }
325 
326 inline bool operator==(const CencSampleEncryptionInfoEntry& lhs,
327  const CencSampleEncryptionInfoEntry& rhs) {
328  return lhs.is_encrypted == rhs.is_encrypted &&
329  lhs.iv_size == rhs.iv_size &&
330  lhs.key_id == rhs.key_id;
331 }
332 
333 inline bool operator==(const SampleGroupDescription& lhs,
334  const SampleGroupDescription& rhs) {
335  return lhs.grouping_type == rhs.grouping_type &&
336  lhs.entries == rhs.entries;
337 }
338 
339 inline bool operator==(const TrackFragment& lhs, const TrackFragment& rhs) {
340  return lhs.header == rhs.header && lhs.runs == rhs.runs &&
341  lhs.decode_time == rhs.decode_time &&
342  lhs.auxiliary_offset == rhs.auxiliary_offset &&
343  lhs.auxiliary_size == rhs.auxiliary_size;
344 }
345 
346 inline bool operator==(const MovieFragment& lhs, const MovieFragment& rhs) {
347  return lhs.header == rhs.header && lhs.tracks == rhs.tracks &&
348  lhs.pssh == rhs.pssh;
349 }
350 
351 inline bool operator==(const SegmentReference& lhs,
352  const SegmentReference& rhs) {
353  return lhs.reference_type == rhs.reference_type &&
354  lhs.referenced_size == rhs.referenced_size &&
355  lhs.subsegment_duration == rhs.subsegment_duration &&
356  lhs.starts_with_sap == rhs.starts_with_sap &&
357  lhs.sap_type == rhs.sap_type &&
358  lhs.sap_delta_time == rhs.sap_delta_time;
359 }
360 
361 inline bool operator==(const SegmentIndex& lhs, const SegmentIndex& rhs) {
362  return lhs.reference_id == rhs.reference_id &&
363  lhs.timescale == rhs.timescale &&
364  lhs.earliest_presentation_time == rhs.earliest_presentation_time &&
365  lhs.first_offset == rhs.first_offset &&
366  lhs.references == rhs.references;
367 }
368 
369 } // namespace mp4
370 } // namespace media
371 } // namespace edash_packager
372 
373 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_COMPARISON_H_