diff options
author | Andreas Huber <andih@google.com> | 2011-11-29 15:14:44 -0800 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2011-11-29 15:14:44 -0800 |
commit | eca36b5a1759970bc3d0373d72d6fec7c9b7e944 (patch) | |
tree | b7926335dcc15adaec73e4cfd4b53068c32a74f5 /media/libstagefright/mpeg2ts/AnotherPacketSource.cpp | |
parent | 404a123bed7f180724ead17f10e037b3eb347701 (diff) | |
parent | b19386fe52b727524de59a7673b2f56b2e707d51 (diff) | |
download | frameworks_av-eca36b5a1759970bc3d0373d72d6fec7c9b7e944.zip frameworks_av-eca36b5a1759970bc3d0373d72d6fec7c9b7e944.tar.gz frameworks_av-eca36b5a1759970bc3d0373d72d6fec7c9b7e944.tar.bz2 |
resolved conflicts for merge of 998a929a to master
Change-Id: Id5cfbcf20e5ec28782cc88075040cf9edebfdfe8
Diffstat (limited to 'media/libstagefright/mpeg2ts/AnotherPacketSource.cpp')
-rw-r--r-- | media/libstagefright/mpeg2ts/AnotherPacketSource.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp index 0f614a2..d708ba6 100644 --- a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp +++ b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp @@ -29,8 +29,17 @@ namespace android { AnotherPacketSource::AnotherPacketSource(const sp<MetaData> &meta) - : mFormat(meta), + : mIsAudio(false), + mFormat(meta), mEOSResult(OK) { + const char *mime; + CHECK(meta->findCString(kKeyMIMEType, &mime)); + + if (!strncasecmp("audio/", mime, 6)) { + mIsAudio = true; + } else { + CHECK(!strncasecmp("video/", mime, 6)); + } } void AnotherPacketSource::setFormat(const sp<MetaData> &meta) { @@ -67,8 +76,7 @@ status_t AnotherPacketSource::dequeueAccessUnit(sp<ABuffer> *buffer) { int32_t discontinuity; if ((*buffer)->meta()->findInt32("discontinuity", &discontinuity)) { - - if (discontinuity == ATSParser::DISCONTINUITY_FORMATCHANGE) { + if (wasFormatChange(discontinuity)) { mFormat.clear(); } @@ -96,7 +104,7 @@ status_t AnotherPacketSource::read( int32_t discontinuity; if (buffer->meta()->findInt32("discontinuity", &discontinuity)) { - if (discontinuity == ATSParser::DISCONTINUITY_FORMATCHANGE) { + if (wasFormatChange(discontinuity)) { mFormat.clear(); } @@ -117,6 +125,15 @@ status_t AnotherPacketSource::read( return mEOSResult; } +bool AnotherPacketSource::wasFormatChange( + int32_t discontinuityType) const { + if (mIsAudio) { + return (discontinuityType & ATSParser::DISCONTINUITY_AUDIO_FORMAT) != 0; + } + + return (discontinuityType & ATSParser::DISCONTINUITY_VIDEO_FORMAT) != 0; +} + void AnotherPacketSource::queueAccessUnit(const sp<ABuffer> &buffer) { int32_t damaged; if (buffer->meta()->findInt32("damaged", &damaged) && damaged) { |