1 /*
2  * Copyright 2014 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 //#define LOG_NDEBUG 0
18 #define LOG_TAG "NuPlayerCCDecoder"
19 #include <utils/Log.h>
20 #include <inttypes.h>
21 
22 #include "NuPlayerCCDecoder.h"
23 
24 #include <media/stagefright/foundation/ABitReader.h>
25 #include <media/stagefright/foundation/ABuffer.h>
26 #include <media/stagefright/foundation/ADebug.h>
27 #include <media/stagefright/foundation/AMessage.h>
28 #include <media/stagefright/foundation/avc_utils.h>
29 #include <media/stagefright/MediaDefs.h>
30 
31 namespace android {
32 
33 // In CEA-708B, the maximum bandwidth of CC is set to 9600bps.
34 static const size_t kMaxBandwithSizeBytes = 9600 / 8;
35 
36 struct CCData {
CCDataandroid::CCData37     CCData(uint8_t type, uint8_t data1, uint8_t data2)
38         : mType(type), mData1(data1), mData2(data2) {
39     }
getChannelandroid::CCData40     bool getChannel(size_t *channel) const {
41         if (mData1 >= 0x10 && mData1 <= 0x1f) {
42             *channel = (mData1 >= 0x18 ? 1 : 0) + (mType ? 2 : 0);
43             return true;
44         }
45         return false;
46     }
47 
48     uint8_t mType;
49     uint8_t mData1;
50     uint8_t mData2;
51 };
52 
isNullPad(CCData * cc)53 static bool isNullPad(CCData *cc) {
54     return cc->mData1 < 0x10 && cc->mData2 < 0x10;
55 }
56 
57 static void dumpBytePair(const sp<ABuffer> &ccBuf) __attribute__ ((unused));
dumpBytePair(const sp<ABuffer> & ccBuf)58 static void dumpBytePair(const sp<ABuffer> &ccBuf) {
59     size_t offset = 0;
60     AString out;
61 
62     while (offset < ccBuf->size()) {
63         char tmp[128];
64 
65         CCData *cc = (CCData *) (ccBuf->data() + offset);
66 
67         if (isNullPad(cc)) {
68             // 1 null pad or XDS metadata, ignore
69             offset += sizeof(CCData);
70             continue;
71         }
72 
73         if (cc->mData1 >= 0x20 && cc->mData1 <= 0x7f) {
74             // 2 basic chars
75             snprintf(tmp, sizeof(tmp), "[%d]Basic: %c %c", cc->mType, cc->mData1, cc->mData2);
76         } else if ((cc->mData1 == 0x11 || cc->mData1 == 0x19)
77                  && cc->mData2 >= 0x30 && cc->mData2 <= 0x3f) {
78             // 1 special char
79             snprintf(tmp, sizeof(tmp), "[%d]Special: %02x %02x", cc->mType, cc->mData1, cc->mData2);
80         } else if ((cc->mData1 == 0x12 || cc->mData1 == 0x1A)
81                  && cc->mData2 >= 0x20 && cc->mData2 <= 0x3f){
82             // 1 Spanish/French char
83             snprintf(tmp, sizeof(tmp), "[%d]Spanish: %02x %02x", cc->mType, cc->mData1, cc->mData2);
84         } else if ((cc->mData1 == 0x13 || cc->mData1 == 0x1B)
85                  && cc->mData2 >= 0x20 && cc->mData2 <= 0x3f){
86             // 1 Portuguese/German/Danish char
87             snprintf(tmp, sizeof(tmp), "[%d]German: %02x %02x", cc->mType, cc->mData1, cc->mData2);
88         } else if ((cc->mData1 == 0x11 || cc->mData1 == 0x19)
89                  && cc->mData2 >= 0x20 && cc->mData2 <= 0x2f){
90             // Mid-Row Codes (Table 69)
91             snprintf(tmp, sizeof(tmp), "[%d]Mid-row: %02x %02x", cc->mType, cc->mData1, cc->mData2);
92         } else if (((cc->mData1 == 0x14 || cc->mData1 == 0x1c)
93                   && cc->mData2 >= 0x20 && cc->mData2 <= 0x2f)
94                   ||
95                    ((cc->mData1 == 0x17 || cc->mData1 == 0x1f)
96                   && cc->mData2 >= 0x21 && cc->mData2 <= 0x23)){
97             // Misc Control Codes (Table 70)
98             snprintf(tmp, sizeof(tmp), "[%d]Ctrl: %02x %02x", cc->mType, cc->mData1, cc->mData2);
99         } else if ((cc->mData1 & 0x70) == 0x10
100                 && (cc->mData2 & 0x40) == 0x40
101                 && ((cc->mData1 & 0x07) || !(cc->mData2 & 0x20)) ) {
102             // Preamble Address Codes (Table 71)
103             snprintf(tmp, sizeof(tmp), "[%d]PAC: %02x %02x", cc->mType, cc->mData1, cc->mData2);
104         } else {
105             snprintf(tmp, sizeof(tmp), "[%d]Invalid: %02x %02x", cc->mType, cc->mData1, cc->mData2);
106         }
107 
108         if (out.size() > 0) {
109             out.append(", ");
110         }
111 
112         out.append(tmp);
113 
114         offset += sizeof(CCData);
115     }
116 
117     ALOGI("%s", out.c_str());
118 }
119 
CCDecoder(const sp<AMessage> & notify)120 NuPlayer::CCDecoder::CCDecoder(const sp<AMessage> &notify)
121     : mNotify(notify),
122       mSelectedTrack(-1),
123       mDTVCCPacket(new ABuffer(kMaxBandwithSizeBytes)) {
124     mDTVCCPacket->setRange(0, 0);
125 
126     // In CEA-608, streams from packets which have the value 0 of cc_type contain CC1 and CC2, and
127     // streams from packets which have the value 1 of cc_type contain CC3 and CC4.
128     // The following array indicates the current transmitting channels for each value of cc_type.
129     mLine21Channels[0] = 0; // CC1
130     mLine21Channels[1] = 2; // CC3
131 }
132 
getTrackCount() const133 size_t NuPlayer::CCDecoder::getTrackCount() const {
134     return mTracks.size();
135 }
136 
getTrackInfo(size_t index) const137 sp<AMessage> NuPlayer::CCDecoder::getTrackInfo(size_t index) const {
138     if (!isTrackValid(index)) {
139         return NULL;
140     }
141 
142     sp<AMessage> format = new AMessage();
143 
144     CCTrack track = mTracks[index];
145 
146     format->setInt32("type", MEDIA_TRACK_TYPE_SUBTITLE);
147     format->setString("language", "und");
148 
149     switch (track.mTrackType) {
150         case kTrackTypeCEA608:
151             format->setString("mime", MEDIA_MIMETYPE_TEXT_CEA_608);
152             break;
153         case kTrackTypeCEA708:
154             format->setString("mime", MEDIA_MIMETYPE_TEXT_CEA_708);
155             break;
156         default:
157             ALOGE("Unknown track type: %d", track.mTrackType);
158             format->setInt32("type", MEDIA_TRACK_TYPE_UNKNOWN);
159             format->setString("mime", "application/octet-stream");
160             return format;
161     }
162 
163     // For CEA-608 CC1, field 0 channel 0
164     bool isDefaultAuto = track.mTrackType == kTrackTypeCEA608
165             && track.mTrackChannel == 0;
166     // For CEA-708, Primary Caption Service.
167     bool isDefaultOnly = track.mTrackType == kTrackTypeCEA708
168             && track.mTrackChannel == 1;
169     format->setInt32("auto", isDefaultAuto);
170     format->setInt32("default", isDefaultAuto || isDefaultOnly);
171     format->setInt32("forced", 0);
172 
173     return format;
174 }
175 
selectTrack(size_t index,bool select)176 status_t NuPlayer::CCDecoder::selectTrack(size_t index, bool select) {
177     if (!isTrackValid(index)) {
178         return BAD_VALUE;
179     }
180 
181     if (select) {
182         if (mSelectedTrack == (ssize_t)index) {
183             ALOGE("track %zu already selected", index);
184             return BAD_VALUE;
185         }
186         ALOGV("selected track %zu", index);
187         mSelectedTrack = index;
188     } else {
189         if (mSelectedTrack != (ssize_t)index) {
190             ALOGE("track %zu is not selected", index);
191             return BAD_VALUE;
192         }
193         ALOGV("unselected track %zu", index);
194         mSelectedTrack = -1;
195     }
196 
197     // Clear the previous track payloads
198     mCCMap.clear();
199 
200     return OK;
201 }
202 
getSelectedTrack(media_track_type type) const203 ssize_t NuPlayer::CCDecoder::getSelectedTrack(media_track_type type) const {
204     if (mSelectedTrack != -1) {
205         CCTrack track = mTracks[mSelectedTrack];
206         if (track.mTrackType == kTrackTypeCEA608 || track.mTrackType == kTrackTypeCEA708) {
207             return (type == MEDIA_TRACK_TYPE_SUBTITLE ? mSelectedTrack : -1);
208         }
209         return (type == MEDIA_TRACK_TYPE_UNKNOWN ? mSelectedTrack : -1);
210     }
211 
212     return -1;
213 }
214 
isSelected() const215 bool NuPlayer::CCDecoder::isSelected() const {
216     return mSelectedTrack >= 0 && mSelectedTrack < (int32_t)getTrackCount();
217 }
218 
isTrackValid(size_t index) const219 bool NuPlayer::CCDecoder::isTrackValid(size_t index) const {
220     return index < getTrackCount();
221 }
222 
223 // returns true if a new CC track is found
extractFromSEI(const sp<ABuffer> & accessUnit)224 bool NuPlayer::CCDecoder::extractFromSEI(const sp<ABuffer> &accessUnit) {
225     sp<ABuffer> sei;
226     if (!accessUnit->meta()->findBuffer("sei", &sei) || sei == NULL) {
227         return false;
228     }
229 
230     int64_t timeUs;
231     CHECK(accessUnit->meta()->findInt64("timeUs", &timeUs));
232 
233     bool trackAdded = false;
234 
235     const NALPosition *nal = (NALPosition *)sei->data();
236 
237     for (size_t i = 0; i < sei->size() / sizeof(NALPosition); ++i, ++nal) {
238         trackAdded |= parseSEINalUnit(
239                 timeUs, accessUnit->data() + nal->nalOffset, nal->nalSize);
240     }
241 
242     return trackAdded;
243 }
244 
245 // returns true if a new CC track is found
parseSEINalUnit(int64_t timeUs,const uint8_t * data,size_t size)246 bool NuPlayer::CCDecoder::parseSEINalUnit(int64_t timeUs, const uint8_t *data, size_t size) {
247     unsigned nalType = data[0] & 0x1f;
248 
249     // the buffer should only have SEI in it
250     if (nalType != 6) {
251         return false;
252     }
253 
254     bool trackAdded = false;
255     NALBitReader br(data + 1, size - 1);
256 
257     // sei_message()
258     while (br.atLeastNumBitsLeft(16)) { // at least 16-bit for sei_message()
259         uint32_t payload_type = 0;
260         size_t payload_size = 0;
261         uint8_t last_byte;
262 
263         do {
264             last_byte = br.getBits(8);
265             payload_type += last_byte;
266         } while (last_byte == 0xFF);
267 
268         do {
269             last_byte = br.getBits(8);
270             payload_size += last_byte;
271         } while (last_byte == 0xFF);
272 
273         if (payload_size > SIZE_MAX / 8
274                 || !br.atLeastNumBitsLeft(payload_size * 8)) {
275             ALOGV("Malformed SEI payload");
276             break;
277         }
278 
279         // sei_payload()
280         if (payload_type == 4) {
281             bool isCC = false;
282             if (payload_size > 1 + 2 + 4 + 1) {
283                 // user_data_registered_itu_t_t35()
284 
285                 // ATSC A/72: 6.4.2
286                 uint8_t itu_t_t35_country_code = br.getBits(8);
287                 uint16_t itu_t_t35_provider_code = br.getBits(16);
288                 uint32_t user_identifier = br.getBits(32);
289                 uint8_t user_data_type_code = br.getBits(8);
290 
291                 payload_size -= 1 + 2 + 4 + 1;
292 
293                 isCC = itu_t_t35_country_code == 0xB5
294                         && itu_t_t35_provider_code == 0x0031
295                         && user_identifier == 'GA94'
296                         && user_data_type_code == 0x3;
297             }
298 
299             if (isCC && payload_size > 2) {
300                 trackAdded |= parseMPEGCCData(timeUs, br.data(), br.numBitsLeft() / 8);
301             } else {
302                 ALOGV("Malformed SEI payload type 4");
303             }
304         } else {
305             ALOGV("Unsupported SEI payload type %d", payload_type);
306         }
307 
308         // skipping remaining bits of this payload
309         br.skipBits(payload_size * 8);
310     }
311 
312     return trackAdded;
313 }
314 
315 // returns true if a new CC track is found
extractFromMPEGUserData(const sp<ABuffer> & accessUnit)316 bool NuPlayer::CCDecoder::extractFromMPEGUserData(const sp<ABuffer> &accessUnit) {
317     sp<ABuffer> mpegUserData;
318     if (!accessUnit->meta()->findBuffer("mpeg-user-data", &mpegUserData)
319             || mpegUserData == NULL) {
320         return false;
321     }
322 
323     int64_t timeUs;
324     CHECK(accessUnit->meta()->findInt64("timeUs", &timeUs));
325 
326     bool trackAdded = false;
327 
328     const size_t *userData = (size_t *)mpegUserData->data();
329 
330     for (size_t i = 0; i < mpegUserData->size() / sizeof(size_t); ++i) {
331         if (accessUnit->size() < userData[i]) {
332             ALOGW("b/129068792, skip invalid offset for user data");
333             android_errorWriteLog(0x534e4554, "129068792");
334             continue;
335         }
336         trackAdded |= parseMPEGUserDataUnit(
337                 timeUs, accessUnit->data() + userData[i], accessUnit->size() - userData[i]);
338     }
339 
340     return trackAdded;
341 }
342 
343 // returns true if a new CC track is found
parseMPEGUserDataUnit(int64_t timeUs,const uint8_t * data,size_t size)344 bool NuPlayer::CCDecoder::parseMPEGUserDataUnit(int64_t timeUs, const uint8_t *data, size_t size) {
345     if (size < 9) {
346         ALOGW("b/129068792, MPEG user data size too small %zu", size);
347         android_errorWriteLog(0x534e4554, "129068792");
348         return false;
349     }
350 
351     ABitReader br(data + 4, 5);
352 
353     uint32_t user_identifier = br.getBits(32);
354     uint8_t user_data_type = br.getBits(8);
355 
356     if (user_identifier == 'GA94' && user_data_type == 0x3) {
357         return parseMPEGCCData(timeUs, data + 9, size - 9);
358     }
359 
360     return false;
361 }
362 
363 // returns true if a new CC track is found
parseMPEGCCData(int64_t timeUs,const uint8_t * data,size_t size)364 bool NuPlayer::CCDecoder::parseMPEGCCData(int64_t timeUs, const uint8_t *data, size_t size) {
365     bool trackAdded = false;
366 
367     // MPEG_cc_data()
368     // ATSC A/53 Part 4: 6.2.3.1
369     ABitReader br(data, size);
370 
371     if (br.numBitsLeft() <= 16) {
372         return false;
373     }
374 
375     br.skipBits(1);
376     bool process_cc_data_flag = br.getBits(1);
377     br.skipBits(1);
378     size_t cc_count = br.getBits(5);
379     br.skipBits(8);
380 
381     if (!process_cc_data_flag || 3 * 8 * cc_count >= br.numBitsLeft()) {
382         return false;
383     }
384 
385     sp<ABuffer> line21CCBuf = NULL;
386 
387     for (size_t i = 0; i < cc_count; ++i) {
388         br.skipBits(5);
389         bool cc_valid = br.getBits(1);
390         uint8_t cc_type = br.getBits(2);
391 
392         if (cc_valid) {
393             if (cc_type == 3) {
394                 if (mDTVCCPacket->size() > 0) {
395                     trackAdded |= parseDTVCCPacket(
396                             timeUs, mDTVCCPacket->data(), mDTVCCPacket->size());
397                     mDTVCCPacket->setRange(0, 0);
398                 }
399                 memcpy(mDTVCCPacket->data() + mDTVCCPacket->size(), br.data(), 2);
400                 mDTVCCPacket->setRange(0, mDTVCCPacket->size() + 2);
401                 br.skipBits(16);
402             } else if (mDTVCCPacket->size() > 0 && cc_type == 2) {
403                 if (mDTVCCPacket->capacity() - mDTVCCPacket->size() >= 2) {
404                     memcpy(mDTVCCPacket->data() + mDTVCCPacket->size(), br.data(), 2);
405                     mDTVCCPacket->setRange(0, mDTVCCPacket->size() + 2);
406                 } else {
407                     ALOGW("b/129068792, skip CC due to too much data(%zu, %zu)",
408                           mDTVCCPacket->capacity(), mDTVCCPacket->size());
409                     android_errorWriteLog(0x534e4554, "129068792");
410                 }
411                 br.skipBits(16);
412             } else if (cc_type == 0 || cc_type == 1) {
413                 uint8_t cc_data_1 = br.getBits(8) & 0x7f;
414                 uint8_t cc_data_2 = br.getBits(8) & 0x7f;
415 
416                 CCData cc(cc_type, cc_data_1, cc_data_2);
417 
418                 if (isNullPad(&cc)) {
419                     continue;
420                 }
421 
422                 size_t channel;
423                 if (cc.getChannel(&channel)) {
424                     mLine21Channels[cc_type] = channel;
425 
426                     // create a new track if it does not exist.
427                     getTrackIndex(kTrackTypeCEA608, channel, &trackAdded);
428                 }
429 
430                 if (isSelected() && mTracks[mSelectedTrack].mTrackType == kTrackTypeCEA608
431                         && mTracks[mSelectedTrack].mTrackChannel == mLine21Channels[cc_type]) {
432                     if (line21CCBuf == NULL) {
433                         line21CCBuf = new ABuffer((cc_count - i) * sizeof(CCData));
434                         line21CCBuf->setRange(0, 0);
435                     }
436                     memcpy(line21CCBuf->data() + line21CCBuf->size(), &cc, sizeof(cc));
437                     line21CCBuf->setRange(0, line21CCBuf->size() + sizeof(CCData));
438                 }
439             } else {
440                 br.skipBits(16);
441             }
442         } else {
443             if ((cc_type == 3 || cc_type == 2) && mDTVCCPacket->size() > 0) {
444                 trackAdded |= parseDTVCCPacket(timeUs, mDTVCCPacket->data(), mDTVCCPacket->size());
445                 mDTVCCPacket->setRange(0, 0);
446             }
447             br.skipBits(16);
448         }
449     }
450 
451     if (isSelected() && mTracks[mSelectedTrack].mTrackType == kTrackTypeCEA608
452             && line21CCBuf != NULL && line21CCBuf->size() > 0) {
453         mCCMap.add(timeUs, line21CCBuf);
454     }
455 
456     return trackAdded;
457 }
458 
459 // returns true if a new CC track is found
parseDTVCCPacket(int64_t timeUs,const uint8_t * data,size_t size)460 bool NuPlayer::CCDecoder::parseDTVCCPacket(int64_t timeUs, const uint8_t *data, size_t size) {
461     // CEA-708B 5 DTVCC Packet Layer.
462     ABitReader br(data, size);
463     br.skipBits(2);
464 
465     size_t packet_size = br.getBits(6);
466     if (packet_size == 0) packet_size = 64;
467     packet_size *= 2;
468 
469     if (size != packet_size) {
470         return false;
471     }
472 
473     bool trackAdded = false;
474 
475     while (br.numBitsLeft() >= 16) {
476         // CEA-708B Figure 5 and 6.
477         uint8_t service_number = br.getBits(3);
478         size_t block_size = br.getBits(5);
479 
480         if (service_number == 64) {
481             br.skipBits(2);
482             service_number = br.getBits(6);
483 
484             if (service_number < 64) {
485                 return trackAdded;
486             }
487         }
488 
489         if (br.numBitsLeft() < block_size * 8) {
490             return trackAdded;
491         }
492 
493         if (block_size > 0) {
494             size_t trackIndex = getTrackIndex(kTrackTypeCEA708, service_number, &trackAdded);
495             if (mSelectedTrack == (ssize_t)trackIndex) {
496                 sp<ABuffer> ccPacket = new ABuffer(block_size);
497                 if (ccPacket->capacity() == 0) {
498                     ALOGW("b/129068792, no memory available, %zu", block_size);
499                     android_errorWriteLog(0x534e4554, "129068792");
500                     return false;
501                 }
502                 memcpy(ccPacket->data(), br.data(), block_size);
503                 mCCMap.add(timeUs, ccPacket);
504             }
505         }
506         br.skipBits(block_size * 8);
507     }
508 
509     return trackAdded;
510 }
511 
512 // return the track index for a given type and channel.
513 // if the track does not exist, creates a new one.
getTrackIndex(int32_t trackType,size_t channel,bool * trackAdded)514 size_t NuPlayer::CCDecoder::getTrackIndex(
515         int32_t trackType, size_t channel, bool *trackAdded) {
516     CCTrack track(trackType, channel);
517     ssize_t index = mTrackIndices.indexOfKey(track);
518 
519     if (index < 0) {
520         // A new track is added.
521         index = mTracks.size();
522         mTrackIndices.add(track, index);
523         mTracks.add(track);
524         *trackAdded = true;
525         return index;
526     }
527 
528     return mTrackIndices.valueAt(index);
529 }
530 
decode(const sp<ABuffer> & accessUnit)531 void NuPlayer::CCDecoder::decode(const sp<ABuffer> &accessUnit) {
532     if (extractFromMPEGUserData(accessUnit) || extractFromSEI(accessUnit)) {
533         sp<AMessage> msg = mNotify->dup();
534         msg->setInt32("what", kWhatTrackAdded);
535         msg->post();
536     }
537     // TODO: extract CC from other sources
538 }
539 
display(int64_t timeUs)540 void NuPlayer::CCDecoder::display(int64_t timeUs) {
541     if (!isSelected()) {
542         return;
543     }
544 
545     ssize_t index = mCCMap.indexOfKey(timeUs);
546     if (index < 0) {
547         ALOGV("cc for timestamp %" PRId64 " not found", timeUs);
548         return;
549     }
550 
551     sp<ABuffer> ccBuf;
552 
553     if (index == 0) {
554         ccBuf = mCCMap.valueAt(index);
555     } else {
556         size_t size = 0;
557 
558         for (ssize_t i = 0; i <= index; ++i) {
559             size += mCCMap.valueAt(i)->size();
560         }
561 
562         ccBuf = new ABuffer(size);
563         ccBuf->setRange(0, 0);
564 
565         for (ssize_t i = 0; i <= index; ++i) {
566             sp<ABuffer> buf = mCCMap.valueAt(i);
567             memcpy(ccBuf->data() + ccBuf->size(), buf->data(), buf->size());
568             ccBuf->setRange(0, ccBuf->size() + buf->size());
569         }
570     }
571 
572     if (ccBuf->size() > 0) {
573 #if 0
574         dumpBytePair(ccBuf);
575 #endif
576 
577         ccBuf->meta()->setInt32("track-index", mSelectedTrack);
578         ccBuf->meta()->setInt64("timeUs", timeUs);
579         ccBuf->meta()->setInt64("durationUs", 0LL);
580 
581         sp<AMessage> msg = mNotify->dup();
582         msg->setInt32("what", kWhatClosedCaptionData);
583         msg->setBuffer("buffer", ccBuf);
584         msg->post();
585     }
586 
587     // remove all entries before timeUs
588     mCCMap.removeItemsAt(0, index + 1);
589 }
590 
flush()591 void NuPlayer::CCDecoder::flush() {
592     mCCMap.clear();
593     mDTVCCPacket->setRange(0, 0);
594 }
595 
compare(const NuPlayer::CCDecoder::CCTrack & rhs) const596 int32_t NuPlayer::CCDecoder::CCTrack::compare(const NuPlayer::CCDecoder::CCTrack& rhs) const {
597     int32_t cmp = mTrackType - rhs.mTrackType;
598     if (cmp != 0) return cmp;
599     return mTrackChannel - rhs.mTrackChannel;
600 }
601 
operator <(const NuPlayer::CCDecoder::CCTrack & rhs) const602 bool NuPlayer::CCDecoder::CCTrack::operator<(const NuPlayer::CCDecoder::CCTrack& rhs) const {
603     return compare(rhs) < 0;
604 }
605 
operator ==(const NuPlayer::CCDecoder::CCTrack & rhs) const606 bool NuPlayer::CCDecoder::CCTrack::operator==(const NuPlayer::CCDecoder::CCTrack& rhs) const {
607     return compare(rhs) == 0;
608 }
609 
operator !=(const NuPlayer::CCDecoder::CCTrack & rhs) const610 bool NuPlayer::CCDecoder::CCTrack::operator!=(const NuPlayer::CCDecoder::CCTrack& rhs) const {
611     return compare(rhs) != 0;
612 }
613 
614 }  // namespace android
615 
616