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