From ee4e1b1a63758941460ae79a064249d3a5189443 Mon Sep 17 00:00:00 2001 From: Lajos Molnar Date: Fri, 17 Apr 2015 13:46:19 -0700 Subject: stagefright: warnings be gone, some are now errors, use clang Change-Id: I81f438ae444f04c12ae27ae4ef6d073033de172c --- .../libmediaplayerservice/nuplayer/GenericSource.h | 6 +- media/libmediaplayerservice/nuplayer/NuPlayer.h | 2 +- .../nuplayer/NuPlayerDecoderBase.h | 2 +- .../nuplayer/NuPlayerSource.h | 2 +- media/libstagefright/AACExtractor.cpp | 2 +- media/libstagefright/ACodec.cpp | 81 +++++++++++++--------- media/libstagefright/Android.mk | 3 +- media/libstagefright/AwesomePlayer.cpp | 8 +-- media/libstagefright/CallbackDataSource.cpp | 2 +- media/libstagefright/CameraSource.cpp | 8 +-- media/libstagefright/FLACExtractor.cpp | 4 +- media/libstagefright/FileSource.cpp | 2 +- media/libstagefright/HTTPBase.cpp | 4 +- media/libstagefright/MP3Extractor.cpp | 10 +-- media/libstagefright/MPEG4Extractor.cpp | 22 +++--- media/libstagefright/MPEG4Writer.cpp | 4 +- media/libstagefright/MediaCodec.cpp | 4 +- media/libstagefright/MediaCodecListOverrides.cpp | 4 +- media/libstagefright/MediaCodecListOverrides.h | 2 +- media/libstagefright/MidiExtractor.cpp | 2 +- media/libstagefright/NuCachedSource2.cpp | 10 +-- media/libstagefright/OMXCodec.cpp | 81 +++++++++++++--------- media/libstagefright/OggExtractor.cpp | 18 ++--- media/libstagefright/SampleTable.cpp | 2 +- media/libstagefright/VBRISeeker.cpp | 4 +- media/libstagefright/codecs/avcdec/SoftAVCDec.cpp | 4 +- media/libstagefright/codecs/avcenc/SoftAVCEnc.cpp | 4 +- media/libstagefright/codecs/avcenc/SoftAVCEnc.h | 2 +- media/libstagefright/codecs/hevcdec/SoftHEVC.cpp | 4 +- media/libstagefright/codecs/mpeg2dec/SoftMPEG2.cpp | 4 +- media/libstagefright/colorconversion/Android.mk | 3 + media/libstagefright/filters/Android.mk | 3 +- media/libstagefright/filters/ColorConvert.cpp | 4 +- .../filters/GraphicBufferListener.cpp | 2 +- media/libstagefright/filters/MediaFilter.cpp | 2 +- media/libstagefright/foundation/Android.mk | 1 + media/libstagefright/http/Android.mk | 1 + media/libstagefright/httplive/Android.mk | 1 + media/libstagefright/httplive/LiveSession.h | 2 +- media/libstagefright/httplive/PlaylistFetcher.h | 2 +- media/libstagefright/id3/Android.mk | 2 + media/libstagefright/include/AwesomePlayer.h | 10 +-- media/libstagefright/include/MPEG2PSExtractor.h | 2 +- media/libstagefright/include/MPEG2TSExtractor.h | 2 +- media/libstagefright/include/OMX.h | 2 +- media/libstagefright/include/OMXNodeInstance.h | 2 +- media/libstagefright/include/SampleIterator.h | 2 +- .../include/StagefrightMetadataRetriever.h | 2 +- media/libstagefright/include/TimedEventQueue.h | 2 +- media/libstagefright/include/VBRISeeker.h | 2 +- media/libstagefright/include/XINGSeeker.h | 2 +- media/libstagefright/matroska/Android.mk | 1 + media/libstagefright/mpeg2ts/Android.mk | 1 + media/libstagefright/omx/Android.mk | 2 + media/libstagefright/omx/FrameDropper.cpp | 9 ++- media/libstagefright/omx/GraphicBufferSource.h | 4 +- .../libstagefright/omx/SimpleSoftOMXComponent.cpp | 10 +-- media/libstagefright/omx/tests/Android.mk | 4 ++ .../libstagefright/omx/tests/FrameDropper_test.cpp | 3 +- media/libstagefright/rtsp/ARTPWriter.h | 2 +- media/libstagefright/rtsp/Android.mk | 4 +- media/libstagefright/tests/Android.mk | 9 +++ media/libstagefright/tests/DummyRecorder.h | 2 +- .../tests/MediaCodecListOverrides_test.cpp | 4 +- media/libstagefright/timedtext/Android.mk | 1 + media/libstagefright/timedtext/test/Android.mk | 3 + .../timedtext/test/TimedTextSRTSource_test.cpp | 4 +- media/libstagefright/webm/Android.mk | 6 +- media/libstagefright/wifi-display/Android.mk | 3 + media/libstagefright/wifi-display/VideoFormats.cpp | 6 +- .../libstagefright/wifi-display/rtp/RTPSender.cpp | 6 +- .../wifi-display/source/Converter.cpp | 2 +- .../libstagefright/wifi-display/source/Converter.h | 2 +- .../wifi-display/source/PlaybackSession.cpp | 4 +- .../wifi-display/source/PlaybackSession.h | 2 +- .../wifi-display/source/WifiDisplaySource.cpp | 2 +- media/libstagefright/yuv/Android.mk | 2 +- 77 files changed, 262 insertions(+), 194 deletions(-) (limited to 'media') diff --git a/media/libmediaplayerservice/nuplayer/GenericSource.h b/media/libmediaplayerservice/nuplayer/GenericSource.h index 2f6e78e..7fab051 100644 --- a/media/libmediaplayerservice/nuplayer/GenericSource.h +++ b/media/libmediaplayerservice/nuplayer/GenericSource.h @@ -31,13 +31,13 @@ class DecryptHandle; class DrmManagerClient; struct AnotherPacketSource; struct ARTSPController; -struct DataSource; -struct IDataSource; +class DataSource; +class IDataSource; struct IMediaHTTPService; struct MediaSource; class MediaBuffer; struct NuCachedSource2; -struct WVMExtractor; +class WVMExtractor; struct NuPlayer::GenericSource : public NuPlayer::Source { GenericSource(const sp ¬ify, bool uidValid, uid_t uid); diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.h b/media/libmediaplayerservice/nuplayer/NuPlayer.h index c0205b6..14bdb01 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayer.h +++ b/media/libmediaplayerservice/nuplayer/NuPlayer.h @@ -26,7 +26,7 @@ namespace android { struct ABuffer; struct AMessage; -struct IDataSource; +class IDataSource; class MetaData; struct NuPlayerDriver; diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDecoderBase.h b/media/libmediaplayerservice/nuplayer/NuPlayerDecoderBase.h index 97e9269..331a2a8 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerDecoderBase.h +++ b/media/libmediaplayerservice/nuplayer/NuPlayerDecoderBase.h @@ -26,7 +26,7 @@ namespace android { struct ABuffer; struct MediaCodec; -struct MediaBuffer; +class MediaBuffer; struct NuPlayer::DecoderBase : public AHandler { DecoderBase(const sp ¬ify); diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerSource.h b/media/libmediaplayerservice/nuplayer/NuPlayerSource.h index 1b0c2df..ef1ba13 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerSource.h +++ b/media/libmediaplayerservice/nuplayer/NuPlayerSource.h @@ -28,7 +28,7 @@ namespace android { struct ABuffer; -struct MediaBuffer; +class MediaBuffer; struct NuPlayer::Source : public AHandler { enum Flags { diff --git a/media/libstagefright/AACExtractor.cpp b/media/libstagefright/AACExtractor.cpp index 196f6ee..45e8a30 100644 --- a/media/libstagefright/AACExtractor.cpp +++ b/media/libstagefright/AACExtractor.cpp @@ -360,7 +360,7 @@ bool SniffAAC( pos += len; ALOGV("skipped ID3 tag, new starting offset is %lld (0x%016llx)", - pos, pos); + (long long)pos, (long long)pos); } uint8_t header[2]; diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index 45f6339..da22f11 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -629,14 +629,23 @@ status_t ACodec::configureOutputBuffersFromNativeWindow( return err; } - err = native_window_set_buffers_geometry( + err = native_window_set_buffers_dimensions( mNativeWindow.get(), def.format.video.nFrameWidth, - def.format.video.nFrameHeight, + def.format.video.nFrameHeight); + + if (err != 0) { + ALOGE("native_window_set_buffers_dimensions failed: %s (%d)", + strerror(-err), -err); + return err; + } + + err = native_window_set_buffers_format( + mNativeWindow.get(), def.format.video.eColorFormat); if (err != 0) { - ALOGE("native_window_set_buffers_geometry failed: %s (%d)", + ALOGE("native_window_set_buffers_format failed: %s (%d)", strerror(-err), -err); return err; } @@ -990,7 +999,7 @@ ACodec::BufferInfo *ACodec::dequeueBufferFromNativeWindow() { CHECK_EQ(metaData->eType, kMetadataBufferTypeGrallocSource); ALOGV("replaced oldest buffer #%u with age %u (%p/%p stored in %p)", - oldest - &mBuffers[kPortIndexOutput][0], + (unsigned)(oldest - &mBuffers[kPortIndexOutput][0]), mDequeueCounter - oldest->mDequeuedAt, metaData->pHandle, oldest->mGraphicBuffer->handle, oldest->mData->base()); @@ -1598,7 +1607,7 @@ status_t ACodec::configureCodec( err = setupG711Codec(encoder, sampleRate, numChannels); } } else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_FLAC)) { - int32_t numChannels, sampleRate, compressionLevel = -1; + int32_t numChannels = 0, sampleRate = 0, compressionLevel = -1; if (encoder && (!msg->findInt32("channel-count", &numChannels) || !msg->findInt32("sample-rate", &sampleRate))) { @@ -3926,9 +3935,7 @@ void ACodec::sendFormatChange(const sp &reply) { if (mSkipCutBuffer != NULL) { size_t prevbufsize = mSkipCutBuffer->size(); if (prevbufsize != 0) { - ALOGW("Replacing SkipCutBuffer holding %d " - "bytes", - prevbufsize); + ALOGW("Replacing SkipCutBuffer holding %zu bytes", prevbufsize); } } mSkipCutBuffer = new SkipCutBuffer( @@ -3984,10 +3991,16 @@ status_t ACodec::pushBlankBuffersToNativeWindow() { return err; } - err = native_window_set_buffers_geometry(mNativeWindow.get(), 1, 1, - HAL_PIXEL_FORMAT_RGBX_8888); + err = native_window_set_buffers_dimensions(mNativeWindow.get(), 1, 1); + if (err != NO_ERROR) { + ALOGE("error pushing blank frames: set_buffers_dimensions failed: %s (%d)", + strerror(-err), -err); + goto error; + } + + err = native_window_set_buffers_format(mNativeWindow.get(), HAL_PIXEL_FORMAT_RGBX_8888); if (err != NO_ERROR) { - ALOGE("error pushing blank frames: set_buffers_geometry failed: %s (%d)", + ALOGE("error pushing blank frames: set_buffers_format failed: %s (%d)", strerror(-err), -err); goto error; } @@ -4218,7 +4231,7 @@ bool ACodec::BaseState::onOMXMessage(const sp &msg) { // there is a possibility that this is an outstanding message for a // codec that we have already destroyed - if (mCodec->mNode == NULL) { + if (mCodec->mNode == 0) { ALOGI("ignoring message as already freed component: %s", msg->debugString().c_str()); return true; @@ -4290,13 +4303,13 @@ bool ACodec::BaseState::onOMXMessage(const sp &msg) { bool ACodec::BaseState::onOMXEvent( OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) { if (event != OMX_EventError) { - ALOGV("[%s] EVENT(%d, 0x%08lx, 0x%08lx)", + ALOGV("[%s] EVENT(%d, 0x%08x, 0x%08x)", mCodec->mComponentName.c_str(), event, data1, data2); return false; } - ALOGE("[%s] ERROR(0x%08lx)", mCodec->mComponentName.c_str(), data1); + ALOGE("[%s] ERROR(0x%08x)", mCodec->mComponentName.c_str(), data1); // verify OMX component sends back an error we expect. OMX_ERRORTYPE omxError = (OMX_ERRORTYPE)data1; @@ -4310,7 +4323,7 @@ bool ACodec::BaseState::onOMXEvent( } bool ACodec::BaseState::onOMXEmptyBufferDone(IOMX::buffer_id bufferID) { - ALOGV("[%s] onOMXEmptyBufferDone %p", + ALOGV("[%s] onOMXEmptyBufferDone %u", mCodec->mComponentName.c_str(), bufferID); BufferInfo *info = @@ -4436,7 +4449,7 @@ void ACodec::BaseState::onInputBufferFilled(const sp &msg) { } if (buffer != info->mData) { - ALOGV("[%s] Needs to copy input data for buffer %p. (%p != %p)", + ALOGV("[%s] Needs to copy input data for buffer %u. (%p != %p)", mCodec->mComponentName.c_str(), bufferID, buffer.get(), info->mData.get()); @@ -4446,18 +4459,18 @@ void ACodec::BaseState::onInputBufferFilled(const sp &msg) { } if (flags & OMX_BUFFERFLAG_CODECCONFIG) { - ALOGV("[%s] calling emptyBuffer %p w/ codec specific data", + ALOGV("[%s] calling emptyBuffer %u w/ codec specific data", mCodec->mComponentName.c_str(), bufferID); } else if (flags & OMX_BUFFERFLAG_EOS) { - ALOGV("[%s] calling emptyBuffer %p w/ EOS", + ALOGV("[%s] calling emptyBuffer %u w/ EOS", mCodec->mComponentName.c_str(), bufferID); } else { #if TRACK_BUFFER_TIMING - ALOGI("[%s] calling emptyBuffer %p w/ time %lld us", - mCodec->mComponentName.c_str(), bufferID, timeUs); + ALOGI("[%s] calling emptyBuffer %u w/ time %lld us", + mCodec->mComponentName.c_str(), bufferID, (long long)timeUs); #else - ALOGV("[%s] calling emptyBuffer %p w/ time %lld us", - mCodec->mComponentName.c_str(), bufferID, timeUs); + ALOGV("[%s] calling emptyBuffer %u w/ time %lld us", + mCodec->mComponentName.c_str(), bufferID, (long long)timeUs); #endif } @@ -4511,7 +4524,7 @@ void ACodec::BaseState::onInputBufferFilled(const sp &msg) { mCodec->mComponentName.c_str()); } - ALOGV("[%s] calling emptyBuffer %p signalling EOS", + ALOGV("[%s] calling emptyBuffer %u signalling EOS", mCodec->mComponentName.c_str(), bufferID); CHECK_EQ(mCodec->mOMX->emptyBuffer( @@ -4812,7 +4825,7 @@ void ACodec::UninitializedState::stateEntered() { } mCodec->mNativeWindow.clear(); - mCodec->mNode = NULL; + mCodec->mNode = 0; mCodec->mOMX.clear(); mCodec->mQuirks = 0; mCodec->mFlags = 0; @@ -4890,7 +4903,7 @@ void ACodec::UninitializedState::onSetup( bool ACodec::UninitializedState::onAllocateComponent(const sp &msg) { ALOGV("onAllocateComponent"); - CHECK(mCodec->mNode == NULL); + CHECK(mCodec->mNode == 0); OMXClient client; CHECK_EQ(client.connect(), (status_t)OK); @@ -4938,7 +4951,7 @@ bool ACodec::UninitializedState::onAllocateComponent(const sp &msg) { } sp observer = new CodecObserver; - IOMX::node_id node = NULL; + IOMX::node_id node = 0; status_t err = OMX_ErrorComponentNotFound; for (size_t matchIndex = 0; matchIndex < matchingCodecs.size(); @@ -4958,10 +4971,10 @@ bool ACodec::UninitializedState::onAllocateComponent(const sp &msg) { ALOGW("Allocating component '%s' failed, try next one.", componentName.c_str()); } - node = NULL; + node = 0; } - if (node == NULL) { + if (node == 0) { if (!mime.empty()) { ALOGE("Unable to instantiate a %scoder for type '%s' with err %#x.", encoder ? "en" : "de", mime.c_str(), err); @@ -5109,7 +5122,7 @@ bool ACodec::LoadedState::onConfigureComponent( const sp &msg) { ALOGV("onConfigureComponent"); - CHECK(mCodec->mNode != NULL); + CHECK(mCodec->mNode != 0); AString mime; CHECK(msg->findString("mime", &mime)); @@ -5449,7 +5462,7 @@ void ACodec::ExecutingState::submitRegularOutputBuffers() { CHECK_EQ((int)info->mStatus, (int)BufferInfo::OWNED_BY_US); } - ALOGV("[%s] calling fillBuffer %p", + ALOGV("[%s] calling fillBuffer %u", mCodec->mComponentName.c_str(), info->mBufferID); CHECK_EQ(mCodec->mOMX->fillBuffer(mCodec->mNode, info->mBufferID), @@ -5523,7 +5536,7 @@ bool ACodec::ExecutingState::onMessageReceived(const sp &msg) { case kWhatFlush: { ALOGV("[%s] ExecutingState flushing now " - "(codec owns %d/%d input, %d/%d output).", + "(codec owns %zu/%zu input, %zu/%zu output).", mCodec->mComponentName.c_str(), mCodec->countBuffersOwnedByComponent(kPortIndexInput), mCodec->mBuffers[kPortIndexInput].size(), @@ -5705,7 +5718,7 @@ bool ACodec::ExecutingState::onOMXEvent( } else if (data2 == OMX_IndexConfigCommonOutputCrop) { mCodec->mSentFormat = false; } else { - ALOGV("[%s] OMX_EventPortSettingsChanged 0x%08lx", + ALOGV("[%s] OMX_EventPortSettingsChanged 0x%08x", mCodec->mComponentName.c_str(), data2); } @@ -6035,8 +6048,8 @@ bool ACodec::FlushingState::onMessageReceived(const sp &msg) { bool ACodec::FlushingState::onOMXEvent( OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) { - ALOGV("[%s] FlushingState onOMXEvent(%d,%ld)", - mCodec->mComponentName.c_str(), event, data1); + ALOGV("[%s] FlushingState onOMXEvent(%u,%d)", + mCodec->mComponentName.c_str(), event, (OMX_S32)data1); switch (event) { case OMX_EventCmdComplete: diff --git a/media/libstagefright/Android.mk b/media/libstagefright/Android.mk index 0ba6743..85ef401 100644 --- a/media/libstagefright/Android.mk +++ b/media/libstagefright/Android.mk @@ -123,7 +123,8 @@ LOCAL_SHARED_LIBRARIES += \ libdl \ libRScpp \ -LOCAL_CFLAGS += -Wno-multichar +LOCAL_CFLAGS += -Wno-multichar -Werror +LOCAL_CLANG := true LOCAL_MODULE:= libstagefright diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index 87eef1e..c14625d 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -360,7 +360,7 @@ status_t AwesomePlayer::setDataSource( return setDataSource_l(dataSource); } -status_t AwesomePlayer::setDataSource(const sp &source) { +status_t AwesomePlayer::setDataSource(const sp &source __unused) { return INVALID_OPERATION; } @@ -422,7 +422,7 @@ status_t AwesomePlayer::setDataSource_l(const sp &extractor) { mBitrate = totalBitRate; - ALOGV("mBitrate = %lld bits/sec", mBitrate); + ALOGV("mBitrate = %lld bits/sec", (long long)mBitrate); { Mutex::Autolock autoLock(mStatsLock); @@ -1722,7 +1722,7 @@ void AwesomePlayer::finishSeekIfNecessary(int64_t videoTimeUs) { // we are now resuming. Signal new position to media time provider. // Cannot signal another SEEK_COMPLETE, as existing clients may not expect // multiple SEEK_COMPLETE responses to a single seek() request. - if (mSeekNotificationSent && abs(mSeekTimeUs - videoTimeUs) > 10000) { + if (mSeekNotificationSent && llabs((long long)(mSeekTimeUs - videoTimeUs)) > 10000) { // notify if we are resuming more than 10ms away from desired seek time notifyListener_l(MEDIA_SKIPPED); } @@ -2358,7 +2358,7 @@ status_t AwesomePlayer::finishSetDataSource_l() { } CHECK_GE(metaDataSize, 0ll); - ALOGV("metaDataSize = %lld bytes", metaDataSize); + ALOGV("metaDataSize = %lld bytes", (long long)metaDataSize); } usleep(200000); diff --git a/media/libstagefright/CallbackDataSource.cpp b/media/libstagefright/CallbackDataSource.cpp index e16cef7..2e0745f 100644 --- a/media/libstagefright/CallbackDataSource.cpp +++ b/media/libstagefright/CallbackDataSource.cpp @@ -72,7 +72,7 @@ ssize_t CallbackDataSource::readAt(off64_t offset, void* data, size_t size) { } // Sanity check. CHECK((size_t)numRead <= numToRead && numRead >= 0 && - numRead <= bufferSize); + (size_t)numRead <= bufferSize); memcpy(((uint8_t*)data) + totalNumRead, mMemory->pointer(), numRead); numLeft -= numRead; totalNumRead += numRead; diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp index ad12bdd..1b788f3 100644 --- a/media/libstagefright/CameraSource.cpp +++ b/media/libstagefright/CameraSource.cpp @@ -851,11 +851,11 @@ status_t CameraSource::read( } void CameraSource::dataCallbackTimestamp(int64_t timestampUs, - int32_t msgType, const sp &data) { - ALOGV("dataCallbackTimestamp: timestamp %" PRId64 " us", timestampUs); + int32_t msgType __unused, const sp &data) { + ALOGV("dataCallbackTimestamp: timestamp %lld us", (long long)timestampUs); Mutex::Autolock autoLock(mLock); if (!mStarted || (mNumFramesReceived == 0 && timestampUs < mStartTimeUs)) { - ALOGV("Drop frame at %" PRId64 "/%" PRId64 " us", timestampUs, mStartTimeUs); + ALOGV("Drop frame at %lld/%lld us", (long long)timestampUs, (long long)mStartTimeUs); releaseOneRecordingFrame(data); return; } @@ -913,7 +913,7 @@ void CameraSource::ProxyListener::dataCallbackTimestamp( mSource->dataCallbackTimestamp(timestamp / 1000, msgType, dataPtr); } -void CameraSource::DeathNotifier::binderDied(const wp& who) { +void CameraSource::DeathNotifier::binderDied(const wp& who __unused) { ALOGI("Camera recording proxy died"); } diff --git a/media/libstagefright/FLACExtractor.cpp b/media/libstagefright/FLACExtractor.cpp index fa7251c..8b972b7 100644 --- a/media/libstagefright/FLACExtractor.cpp +++ b/media/libstagefright/FLACExtractor.cpp @@ -651,10 +651,10 @@ MediaBuffer *FLACParser::readBuffer(bool doSeek, FLAC__uint64 sample) if (doSeek) { // We implement the seek callback, so this works without explicit flush if (!FLAC__stream_decoder_seek_absolute(mDecoder, sample)) { - ALOGE("FLACParser::readBuffer seek to sample %llu failed", sample); + ALOGE("FLACParser::readBuffer seek to sample %lld failed", (long long)sample); return NULL; } - ALOGV("FLACParser::readBuffer seek to sample %llu succeeded", sample); + ALOGV("FLACParser::readBuffer seek to sample %lld succeeded", (long long)sample); } else { if (!FLAC__stream_decoder_process_single(mDecoder)) { ALOGE("FLACParser::readBuffer process_single failed"); diff --git a/media/libstagefright/FileSource.cpp b/media/libstagefright/FileSource.cpp index f0db76b..565f156 100644 --- a/media/libstagefright/FileSource.cpp +++ b/media/libstagefright/FileSource.cpp @@ -111,7 +111,7 @@ ssize_t FileSource::readAt(off64_t offset, void *data, size_t size) { } else { off64_t result = lseek64(mFd, offset + mOffset, SEEK_SET); if (result == -1) { - ALOGE("seek to %lld failed", offset + mOffset); + ALOGE("seek to %lld failed", (long long)(offset + mOffset)); return UNKNOWN_ERROR; } diff --git a/media/libstagefright/HTTPBase.cpp b/media/libstagefright/HTTPBase.cpp index 77a652a..068a77f 100644 --- a/media/libstagefright/HTTPBase.cpp +++ b/media/libstagefright/HTTPBase.cpp @@ -34,10 +34,10 @@ HTTPBase::HTTPBase() : mNumBandwidthHistoryItems(0), mTotalTransferTimeUs(0), mTotalTransferBytes(0), + mMaxBandwidthHistoryItems(100), mPrevBandwidthMeasureTimeUs(0), mPrevEstimatedBandWidthKbps(0), - mBandWidthCollectFreqMs(5000), - mMaxBandwidthHistoryItems(100) { + mBandWidthCollectFreqMs(5000) { } void HTTPBase::addBandwidthMeasurement( diff --git a/media/libstagefright/MP3Extractor.cpp b/media/libstagefright/MP3Extractor.cpp index 4a63152..55e3c19 100644 --- a/media/libstagefright/MP3Extractor.cpp +++ b/media/libstagefright/MP3Extractor.cpp @@ -82,7 +82,7 @@ static bool Resync( *inout_pos += len; ALOGV("skipped ID3 tag, new starting offset is %lld (0x%016llx)", - *inout_pos, *inout_pos); + (long long)*inout_pos, (long long)*inout_pos); } if (post_id3_pos != NULL) { @@ -103,9 +103,9 @@ static bool Resync( uint8_t *tmp = buf; do { - if (pos >= *inout_pos + kMaxBytesChecked) { + if (pos >= (off64_t)(*inout_pos + kMaxBytesChecked)) { // Don't scan forever. - ALOGV("giving up at offset %lld", pos); + ALOGV("giving up at offset %lld", (long long)pos); break; } @@ -155,7 +155,7 @@ static bool Resync( continue; } - ALOGV("found possible 1st frame at %lld (header = 0x%08x)", pos, header); + ALOGV("found possible 1st frame at %lld (header = 0x%08x)", (long long)pos, header); // We found what looks like a valid frame, // now find its successors. @@ -186,7 +186,7 @@ static bool Resync( break; } - ALOGV("found subsequent frame #%d at %lld", j + 2, test_pos); + ALOGV("found subsequent frame #%d at %lld", j + 2, (long long)test_pos); test_pos += test_frame_size; } diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp index 28a9ed9..6573afc 100644 --- a/media/libstagefright/MPEG4Extractor.cpp +++ b/media/libstagefright/MPEG4Extractor.cpp @@ -503,7 +503,7 @@ status_t MPEG4Extractor::readMetaData() { } else if (offset <= orig_offset) { // only continue parsing if the offset was advanced, // otherwise we might end up in an infinite loop - ALOGE("did not advance: 0x%lld->0x%lld", orig_offset, offset); + ALOGE("did not advance: %lld->%lld", (long long)orig_offset, (long long)offset); err = ERROR_MALFORMED; break; } else if (err == UNKNOWN_ERROR) { @@ -761,7 +761,7 @@ static void convertTimeToDate(int64_t time_1904, String8 *s) { } status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) { - ALOGV("entering parseChunk %lld/%d", *offset, depth); + ALOGV("entering parseChunk %lld/%d", (long long)*offset, depth); uint32_t hdr[2]; if (mDataSource->readAt(*offset, hdr, 8) < 8) { return ERROR_IO; @@ -805,7 +805,7 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) { char chunk[5]; MakeFourCCString(chunk_type, chunk); - ALOGV("chunk: %s @ %lld, %d", chunk, *offset, depth); + ALOGV("chunk: %s @ %lld, %d", chunk, (long long)*offset, depth); if (kUseHexDump) { static const char kWhitespace[] = " "; @@ -1724,7 +1724,7 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) { char buffer[23]; if (chunk_data_size != 7 && chunk_data_size != 23) { - ALOGE("Incorrect D263 box size %lld", chunk_data_size); + ALOGE("Incorrect D263 box size %lld", (long long)chunk_data_size); return ERROR_MALFORMED; } @@ -2015,7 +2015,7 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) { if (mFileMetaData != NULL) { ALOGV("chunk_data_size = %lld and data_offset = %lld", - chunk_data_size, data_offset); + (long long)chunk_data_size, (long long)data_offset); sp buffer = new ABuffer(chunk_data_size + 1); if (mDataSource->readAt( data_offset, buffer->data(), chunk_data_size) != (ssize_t)chunk_data_size) { @@ -2433,7 +2433,7 @@ status_t MPEG4Extractor::parseITunesMetaData(off64_t offset, size_t size) { uint32_t metadataKey = 0; char chunk[5]; MakeFourCCString(mPath[4], chunk); - ALOGV("meta: %s @ %lld", chunk, offset); + ALOGV("meta: %s @ %lld", chunk, (long long)offset); switch ((int32_t)mPath[4]) { case FOURCC(0xa9, 'a', 'l', 'b'): { @@ -2937,7 +2937,7 @@ status_t MPEG4Extractor::updateAudioTrackInfoFromESDS_MPEG4Audio( } if (kUseHexDump) { - printf("ESD of size %d\n", csd_size); + printf("ESD of size %zu\n", csd_size); hexdump(csd, csd_size); } @@ -3344,7 +3344,7 @@ status_t MPEG4Source::parseChunk(off64_t *offset) { char chunk[5]; MakeFourCCString(chunk_type, chunk); - ALOGV("MPEG4Source chunk %s @ %llx", chunk, *offset); + ALOGV("MPEG4Source chunk %s @ %#llx", chunk, (long long)*offset); off64_t chunk_data_size = *offset + chunk_size - data_offset; @@ -3801,7 +3801,7 @@ status_t MPEG4Source::parseTrackFragmentRun(off64_t offset, off64_t size) { sampleCtsOffset = 0; } - if (size < (off64_t)sampleCount * bytesPerSample) { + if (size < (off64_t)(sampleCount * bytesPerSample)) { return -EINVAL; } @@ -4553,7 +4553,7 @@ static bool BetterSniffMPEG4( char chunkstring[5]; MakeFourCCString(chunkType, chunkstring); - ALOGV("saw chunk type %s, size %" PRIu64 " @ %lld", chunkstring, chunkSize, offset); + ALOGV("saw chunk type %s, size %" PRIu64 " @ %lld", chunkstring, chunkSize, (long long)offset); switch (chunkType) { case FOURCC('f', 't', 'y', 'p'): { @@ -4616,7 +4616,7 @@ static bool BetterSniffMPEG4( *meta = new AMessage; (*meta)->setInt64("meta-data-size", moovAtomEndOffset); - ALOGV("found metadata size: %lld", moovAtomEndOffset); + ALOGV("found metadata size: %lld", (long long)moovAtomEndOffset); } return true; diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp index 3d83e83..003b09a 100644 --- a/media/libstagefright/MPEG4Writer.cpp +++ b/media/libstagefright/MPEG4Writer.cpp @@ -372,8 +372,8 @@ MPEG4Writer::MPEG4Writer(int fd) mLatitudex10000(0), mLongitudex10000(0), mAreGeoTagsAvailable(false), - mMetaKeys(new AMessage()), - mStartTimeOffsetMs(-1) { + mStartTimeOffsetMs(-1), + mMetaKeys(new AMessage()) { addDeviceMeta(); } diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp index 8688d9b..5ae79e6 100644 --- a/media/libstagefright/MediaCodec.cpp +++ b/media/libstagefright/MediaCodec.cpp @@ -308,10 +308,10 @@ MediaCodec::MediaCodec(const sp &looper) mCodec(NULL), mReplyID(0), mFlags(0), - mResourceManagerClient(new ResourceManagerClient(this)), - mResourceManagerService(new ResourceManagerServiceProxy()), mStickyError(OK), mSoftRenderer(NULL), + mResourceManagerClient(new ResourceManagerClient(this)), + mResourceManagerService(new ResourceManagerServiceProxy()), mBatteryStatNotified(false), mIsVideo(false), mVideoWidth(0), diff --git a/media/libstagefright/MediaCodecListOverrides.cpp b/media/libstagefright/MediaCodecListOverrides.cpp index 3c54f34..867a223 100644 --- a/media/libstagefright/MediaCodecListOverrides.cpp +++ b/media/libstagefright/MediaCodecListOverrides.cpp @@ -130,7 +130,7 @@ static size_t doProfileCodecs( while (err == OK && codecs.size() < kMaxInstances) { sp looper = new ALooper; looper->setName("MediaCodec_looper"); - ALOGV("doProfileCodecs for codec #%u", codecs.size()); + ALOGV("doProfileCodecs for codec #%zu", codecs.size()); ALOGV("doProfileCodecs start looper"); looper->start( false /* runOnCallingThread */, false /* canCallJava */, ANDROID_PRIORITY_AUDIO); @@ -234,7 +234,7 @@ void profileCodecs( if (max > 0) { CodecSettings settings; char maxStr[32]; - sprintf(maxStr, "%u", max); + sprintf(maxStr, "%zu", max); settings.add("max-supported-instances", maxStr); AString key = name; diff --git a/media/libstagefright/MediaCodecListOverrides.h b/media/libstagefright/MediaCodecListOverrides.h index f97ce63..c6cc2ea 100644 --- a/media/libstagefright/MediaCodecListOverrides.h +++ b/media/libstagefright/MediaCodecListOverrides.h @@ -26,7 +26,7 @@ namespace android { -class MediaCodecInfo; +struct MediaCodecInfo; bool splitString(const AString &s, const AString &delimiter, AString *s1, AString *s2); diff --git a/media/libstagefright/MidiExtractor.cpp b/media/libstagefright/MidiExtractor.cpp index 66fab77..f6b8c84 100644 --- a/media/libstagefright/MidiExtractor.cpp +++ b/media/libstagefright/MidiExtractor.cpp @@ -217,7 +217,7 @@ status_t MidiEngine::releaseBuffers() { } status_t MidiEngine::seekTo(int64_t positionUs) { - ALOGV("seekTo %lld", positionUs); + ALOGV("seekTo %lld", (long long)positionUs); EAS_RESULT result = EAS_Locate(mEasData, mEasHandle, positionUs / 1000, false); return result == EAS_SUCCESS ? OK : UNKNOWN_ERROR; } diff --git a/media/libstagefright/NuCachedSource2.cpp b/media/libstagefright/NuCachedSource2.cpp index 8d70e50..1c53b40 100644 --- a/media/libstagefright/NuCachedSource2.cpp +++ b/media/libstagefright/NuCachedSource2.cpp @@ -503,7 +503,7 @@ void NuCachedSource2::restartPrefetcherIfNecessary_l( ssize_t NuCachedSource2::readAt(off64_t offset, void *data, size_t size) { Mutex::Autolock autoSerializer(mSerializer); - ALOGV("readAt offset %lld, size %zu", offset, size); + ALOGV("readAt offset %lld, size %zu", (long long)offset, size); Mutex::Autolock autoLock(mLock); if (mDisconnecting) { @@ -579,7 +579,7 @@ size_t NuCachedSource2::approxDataRemaining_l(status_t *finalStatus) const { ssize_t NuCachedSource2::readInternal(off64_t offset, void *data, size_t size) { CHECK_LE(size, (size_t)mHighwaterThresholdBytes); - ALOGV("readInternal offset %lld size %zu", offset, size); + ALOGV("readInternal offset %lld size %zu", (long long)offset, size); Mutex::Autolock autoLock(mLock); @@ -640,7 +640,7 @@ status_t NuCachedSource2::seekInternal_l(off64_t offset) { return OK; } - ALOGI("new range: offset= %lld", offset); + ALOGI("new range: offset= %lld", (long long)offset); mCacheOffset = offset; @@ -719,10 +719,10 @@ void NuCachedSource2::updateCacheParamsFromString(const char *s) { mKeepAliveIntervalUs = kDefaultKeepAliveIntervalUs; } - ALOGV("lowwater = %zu bytes, highwater = %zu bytes, keepalive = %" PRId64 " us", + ALOGV("lowwater = %zu bytes, highwater = %zu bytes, keepalive = %lld us", mLowwaterThresholdBytes, mHighwaterThresholdBytes, - mKeepAliveIntervalUs); + (long long)mKeepAliveIntervalUs); } // static diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp index 4d30069..8d4bab8 100644 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp @@ -1057,7 +1057,7 @@ status_t OMXCodec::getVideoProfileLevel( const sp& meta, const CodecProfileLevel& defaultProfileLevel, CodecProfileLevel &profileLevel) { - CODEC_LOGV("Default profile: %ld, level %ld", + CODEC_LOGV("Default profile: %u, level #x%x", defaultProfileLevel.mProfile, defaultProfileLevel.mLevel); // Are the default profile and level overwriten? @@ -1283,7 +1283,7 @@ status_t OMXCodec::setVideoOutputFormat( success = success && meta->findInt32(kKeyHeight, &height); CHECK(success); - CODEC_LOGV("setVideoOutputFormat width=%ld, height=%ld", width, height); + CODEC_LOGV("setVideoOutputFormat width=%d, height=%d", width, height); OMX_VIDEO_CODINGTYPE compressionFormat = OMX_VIDEO_CodingUnused; if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_AVC, mime)) { @@ -1650,7 +1650,7 @@ status_t OMXCodec::allocateBuffersOnPort(OMX_U32 portIndex) { return err; } - CODEC_LOGV("allocating %lu buffers of size %lu on %s port", + CODEC_LOGV("allocating %u buffers of size %u on %s port", def.nBufferCountActual, def.nBufferSize, portIndex == kPortIndexInput ? "input" : "output"); @@ -1723,7 +1723,7 @@ status_t OMXCodec::allocateBuffersOnPort(OMX_U32 portIndex) { mPortBuffers[portIndex].push(info); - CODEC_LOGV("allocated buffer %p on %s port", buffer, + CODEC_LOGV("allocated buffer %u on %s port", buffer, portIndex == kPortIndexInput ? "input" : "output"); } @@ -1745,7 +1745,7 @@ status_t OMXCodec::allocateBuffersOnPort(OMX_U32 portIndex) { if (mSkipCutBuffer != NULL) { size_t prevbuffersize = mSkipCutBuffer->size(); if (prevbuffersize != 0) { - ALOGW("Replacing SkipCutBuffer holding %d bytes", prevbuffersize); + ALOGW("Replacing SkipCutBuffer holding %zu bytes", prevbuffersize); } } mSkipCutBuffer = new SkipCutBuffer(delay * frameSize, padding * frameSize); @@ -1825,14 +1825,23 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() { return err; } - err = native_window_set_buffers_geometry( + err = native_window_set_buffers_dimensions( mNativeWindow.get(), def.format.video.nFrameWidth, - def.format.video.nFrameHeight, + def.format.video.nFrameHeight); + + if (err != 0) { + ALOGE("native_window_set_buffers_dimensions failed: %s (%d)", + strerror(-err), -err); + return err; + } + + err = native_window_set_buffers_format( + mNativeWindow.get(), def.format.video.eColorFormat); if (err != 0) { - ALOGE("native_window_set_buffers_geometry failed: %s (%d)", + ALOGE("native_window_set_buffers_format failed: %s (%d)", strerror(-err), -err); return err; } @@ -1873,7 +1882,7 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() { } } - ALOGV("native_window_set_usage usage=0x%lx", usage); + ALOGV("native_window_set_usage usage=0x%x", usage); err = native_window_set_usage( mNativeWindow.get(), usage | GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_EXTERNAL_DISP); if (err != 0) { @@ -2069,10 +2078,16 @@ status_t OMXCodec::pushBlankBuffersToNativeWindow() { return err; } - err = native_window_set_buffers_geometry(mNativeWindow.get(), 1, 1, - HAL_PIXEL_FORMAT_RGBX_8888); + err = native_window_set_buffers_dimensions(mNativeWindow.get(), 1, 1); + if (err != NO_ERROR) { + ALOGE("error pushing blank frames: set_buffers_dimensions failed: %s (%d)", + strerror(-err), -err); + goto error; + } + + err = native_window_set_buffers_format(mNativeWindow.get(), HAL_PIXEL_FORMAT_RGBX_8888); if (err != NO_ERROR) { - ALOGE("error pushing blank frames: set_buffers_geometry failed: %s (%d)", + ALOGE("error pushing blank frames: set_buffers_format failed: %s (%d)", strerror(-err), -err); goto error; } @@ -2708,7 +2723,7 @@ void OMXCodec::onCmdComplete(OMX_COMMANDTYPE cmd, OMX_U32 data) { default: { - CODEC_LOGV("CMD_COMPLETE(%d, %ld)", cmd, data); + CODEC_LOGV("CMD_COMPLETE(%d, %u)", cmd, data); break; } } @@ -2734,7 +2749,7 @@ void OMXCodec::onStateChange(OMX_STATETYPE newState) { if (countBuffersWeOwn(mPortBuffers[kPortIndexInput]) != mPortBuffers[kPortIndexInput].size()) { ALOGE("Codec did not return all input buffers " - "(received %d / %d)", + "(received %zu / %zu)", countBuffersWeOwn(mPortBuffers[kPortIndexInput]), mPortBuffers[kPortIndexInput].size()); TRESPASS(); @@ -2743,7 +2758,7 @@ void OMXCodec::onStateChange(OMX_STATETYPE newState) { if (countBuffersWeOwn(mPortBuffers[kPortIndexOutput]) != mPortBuffers[kPortIndexOutput].size()) { ALOGE("Codec did not return all output buffers " - "(received %d / %d)", + "(received %zu / %zu)", countBuffersWeOwn(mPortBuffers[kPortIndexOutput]), mPortBuffers[kPortIndexOutput].size()); TRESPASS(); @@ -2847,7 +2862,7 @@ status_t OMXCodec::freeBuffersOnPort( CHECK(info->mStatus == OWNED_BY_US || info->mStatus == OWNED_BY_NATIVE_WINDOW); - CODEC_LOGV("freeing buffer %p on port %ld", info->mBuffer, portIndex); + CODEC_LOGV("freeing buffer %u on port %u", info->mBuffer, portIndex); status_t err = freeBuffer(portIndex, i); @@ -2894,7 +2909,7 @@ status_t OMXCodec::freeBuffer(OMX_U32 portIndex, size_t bufIndex) { } void OMXCodec::onPortSettingsChanged(OMX_U32 portIndex) { - CODEC_LOGV("PORT_SETTINGS_CHANGED(%ld)", portIndex); + CODEC_LOGV("PORT_SETTINGS_CHANGED(%u)", portIndex); CHECK(mState == EXECUTING || mState == EXECUTING_TO_IDLE); CHECK_EQ(portIndex, (OMX_U32)kPortIndexOutput); @@ -2921,7 +2936,7 @@ bool OMXCodec::flushPortAsync(OMX_U32 portIndex) { CHECK(mState == EXECUTING || mState == RECONFIGURING || mState == EXECUTING_TO_IDLE); - CODEC_LOGV("flushPortAsync(%ld): we own %d out of %d buffers already.", + CODEC_LOGV("flushPortAsync(%u): we own %zu out of %zu buffers already.", portIndex, countBuffersWeOwn(mPortBuffers[portIndex]), mPortBuffers[portIndex].size()); @@ -2950,7 +2965,7 @@ void OMXCodec::disablePortAsync(OMX_U32 portIndex) { CHECK_EQ((int)mPortStatus[portIndex], (int)ENABLED); mPortStatus[portIndex] = DISABLING; - CODEC_LOGV("sending OMX_CommandPortDisable(%ld)", portIndex); + CODEC_LOGV("sending OMX_CommandPortDisable(%u)", portIndex); status_t err = mOMX->sendCommand(mNode, OMX_CommandPortDisable, portIndex); CHECK_EQ(err, (status_t)OK); @@ -2964,7 +2979,7 @@ status_t OMXCodec::enablePortAsync(OMX_U32 portIndex) { CHECK_EQ((int)mPortStatus[portIndex], (int)DISABLED); mPortStatus[portIndex] = ENABLING; - CODEC_LOGV("sending OMX_CommandPortEnable(%ld)", portIndex); + CODEC_LOGV("sending OMX_CommandPortEnable(%u)", portIndex); return mOMX->sendCommand(mNode, OMX_CommandPortEnable, portIndex); } @@ -3037,7 +3052,7 @@ OMXCodec::BufferInfo *OMXCodec::findInputBufferByDataPointer(void *ptr) { if (info->mData == ptr) { CODEC_LOGV( - "input buffer data ptr = %p, buffer_id = %p", + "input buffer data ptr = %p, buffer_id = %u", ptr, info->mBuffer); @@ -3147,7 +3162,7 @@ bool OMXCodec::drainInputBuffer(BufferInfo *info) { if (srcBuffer->meta_data()->findInt64( kKeyTargetTime, &targetTimeUs) && targetTimeUs >= 0) { - CODEC_LOGV("targetTimeUs = %lld us", targetTimeUs); + CODEC_LOGV("targetTimeUs = %lld us", (long long)targetTimeUs); mTargetTimeUs = targetTimeUs; } else { mTargetTimeUs = -1; @@ -3181,7 +3196,7 @@ bool OMXCodec::drainInputBuffer(BufferInfo *info) { if (offset == 0) { CODEC_LOGE( "Codec's input buffers are too small to accomodate " - "buffer read from source (info->mSize = %d, srcLength = %d)", + "buffer read from source (info->mSize = %zu, srcLength = %zu)", info->mSize, srcBuffer->range_length()); srcBuffer->release(); @@ -3287,10 +3302,10 @@ bool OMXCodec::drainInputBuffer(BufferInfo *info) { info = findEmptyInputBuffer(); } - CODEC_LOGV("Calling emptyBuffer on buffer %p (length %d), " + CODEC_LOGV("Calling emptyBuffer on buffer %u (length %zu), " "timestamp %lld us (%.2f secs)", info->mBuffer, offset, - timestampUs, timestampUs / 1E6); + (long long)timestampUs, timestampUs / 1E6); err = mOMX->emptyBuffer( mNode, info->mBuffer, 0, offset, @@ -3315,7 +3330,7 @@ void OMXCodec::fillOutputBuffer(BufferInfo *info) { return; } - CODEC_LOGV("Calling fillBuffer on buffer %p", info->mBuffer); + CODEC_LOGV("Calling fillBuffer on buffer %u", info->mBuffer); status_t err = mOMX->fillBuffer(mNode, info->mBuffer); if (err != OK) { @@ -3372,7 +3387,7 @@ status_t OMXCodec::waitForBufferFilled_l() { } status_t err = mBufferFilled.waitRelative(mLock, kBufferFilledEventTimeOutNs); if (err != OK) { - CODEC_LOGE("Timed out waiting for output buffers: %d/%d", + CODEC_LOGE("Timed out waiting for output buffers: %zu/%zu", countBuffersWeOwn(mPortBuffers[kPortIndexInput]), countBuffersWeOwn(mPortBuffers[kPortIndexOutput])); } @@ -3627,7 +3642,7 @@ void OMXCodec::setG711Format(int32_t sampleRate, int32_t numChannels) { void OMXCodec::setImageOutputFormat( OMX_COLOR_FORMATTYPE format, OMX_U32 width, OMX_U32 height) { - CODEC_LOGV("setImageOutputFormat(%ld, %ld)", width, height); + CODEC_LOGV("setImageOutputFormat(%u, %u)", width, height); #if 0 OMX_INDEXTYPE index; @@ -4281,14 +4296,14 @@ void OMXCodec::initOutputFormat(const sp &inputFormat) { if ((OMX_U32)numChannels != params.nChannels) { ALOGV("Codec outputs a different number of channels than " "the input stream contains (contains %d channels, " - "codec outputs %ld channels).", + "codec outputs %u channels).", numChannels, params.nChannels); } if (sampleRate != (int32_t)params.nSamplingRate) { ALOGV("Codec outputs at different sampling rate than " "what the input stream contains (contains data at " - "%d Hz, codec outputs %lu Hz)", + "%d Hz, codec outputs %u Hz)", sampleRate, params.nSamplingRate); } @@ -4390,8 +4405,7 @@ void OMXCodec::initOutputFormat(const sp &inputFormat) { mNode, OMX_IndexConfigCommonOutputCrop, &rect, sizeof(rect)); - CODEC_LOGI( - "video dimensions are %ld x %ld", + CODEC_LOGI("video dimensions are %u x %u", video_def->nFrameWidth, video_def->nFrameHeight); if (err == OK) { @@ -4409,8 +4423,7 @@ void OMXCodec::initOutputFormat(const sp &inputFormat) { rect.nLeft + rect.nWidth - 1, rect.nTop + rect.nHeight - 1); - CODEC_LOGI( - "Crop rect is %ld x %ld @ (%ld, %ld)", + CODEC_LOGI("Crop rect is %u x %u @ (%d, %d)", rect.nWidth, rect.nHeight, rect.nLeft, rect.nTop); } else { mOutputFormat->setRect( diff --git a/media/libstagefright/OggExtractor.cpp b/media/libstagefright/OggExtractor.cpp index 6e32494..d577034 100644 --- a/media/libstagefright/OggExtractor.cpp +++ b/media/libstagefright/OggExtractor.cpp @@ -250,7 +250,7 @@ status_t MyVorbisExtractor::findNextPage( if (!memcmp(signature, "OggS", 4)) { if (*pageOffset > startOffset) { ALOGV("skipped %lld bytes of junk to reach next frame", - *pageOffset - startOffset); + (long long)(*pageOffset - startOffset)); } return OK; @@ -277,7 +277,7 @@ status_t MyVorbisExtractor::findPrevGranulePosition( prevGuess = 0; } - ALOGV("backing up %lld bytes", pageOffset - prevGuess); + ALOGV("backing up %lld bytes", (long long)(pageOffset - prevGuess)); status_t err = findNextPage(prevGuess, &prevPageOffset); if (err != OK) { @@ -295,7 +295,7 @@ status_t MyVorbisExtractor::findPrevGranulePosition( } ALOGV("prevPageOffset at %lld, pageOffset at %lld", - prevPageOffset, pageOffset); + (long long)prevPageOffset, (long long)pageOffset); for (;;) { Page prevPage; @@ -320,7 +320,7 @@ status_t MyVorbisExtractor::seekToTime(int64_t timeUs) { off64_t pos = timeUs * approxBitrate() / 8000000ll; - ALOGV("seeking to offset %lld", pos); + ALOGV("seeking to offset %lld", (long long)pos); return seekToOffset(pos); } @@ -348,7 +348,7 @@ status_t MyVorbisExtractor::seekToTime(int64_t timeUs) { const TOCEntry &entry = mTableOfContents.itemAt(left); ALOGV("seeking to entry %zu / %zu at offset %lld", - left, mTableOfContents.size(), entry.mPageOffset); + left, mTableOfContents.size(), (long long)entry.mPageOffset); return seekToOffset(entry.mPageOffset); } @@ -391,8 +391,8 @@ ssize_t MyVorbisExtractor::readPage(off64_t offset, Page *page) { ssize_t n; if ((n = mSource->readAt(offset, header, sizeof(header))) < (ssize_t)sizeof(header)) { - ALOGV("failed to read %zu bytes at offset 0x%016llx, got %zd bytes", - sizeof(header), offset, n); + ALOGV("failed to read %zu bytes at offset %#016llx, got %zd bytes", + sizeof(header), (long long)offset, n); if (n < 0) { return n; @@ -505,8 +505,8 @@ status_t MyVorbisExtractor::readNextPacket(MediaBuffer **out, bool conf) { packetSize); if (n < (ssize_t)packetSize) { - ALOGV("failed to read %zu bytes at 0x%016llx, got %zd bytes", - packetSize, dataOffset, n); + ALOGV("failed to read %zu bytes at %#016llx, got %zd bytes", + packetSize, (long long)dataOffset, n); return ERROR_IO; } diff --git a/media/libstagefright/SampleTable.cpp b/media/libstagefright/SampleTable.cpp index aba64d5..7f98485 100644 --- a/media/libstagefright/SampleTable.cpp +++ b/media/libstagefright/SampleTable.cpp @@ -230,7 +230,7 @@ status_t SampleTable::setSampleToChunkParams( return ERROR_MALFORMED; } - if (SIZE_MAX / sizeof(SampleToChunkEntry) <= mNumSampleToChunkOffsets) + if (SIZE_MAX / sizeof(SampleToChunkEntry) <= (size_t)mNumSampleToChunkOffsets) return ERROR_OUT_OF_RANGE; mSampleToChunkEntries = diff --git a/media/libstagefright/VBRISeeker.cpp b/media/libstagefright/VBRISeeker.cpp index e988f6d..8a0fcac 100644 --- a/media/libstagefright/VBRISeeker.cpp +++ b/media/libstagefright/VBRISeeker.cpp @@ -122,7 +122,7 @@ sp VBRISeeker::CreateFromSource( seeker->mSegments.push(numBytes); - ALOGV("entry #%zu: %u offset 0x%016llx", i, numBytes, offset); + ALOGV("entry #%zu: %u offset %#016llx", i, numBytes, (long long)offset); offset += numBytes; } @@ -163,7 +163,7 @@ bool VBRISeeker::getOffsetForTime(int64_t *timeUs, off64_t *pos) { *pos += mSegments.itemAt(segmentIndex++); } - ALOGV("getOffsetForTime %" PRId64 " us => 0x%016llx", *timeUs, *pos); + ALOGV("getOffsetForTime %lld us => 0x%016llx", (long long)*timeUs, (long long)*pos); *timeUs = nowUs; diff --git a/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp b/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp index 8388472..08e956a 100644 --- a/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp +++ b/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp @@ -191,7 +191,7 @@ status_t SoftAVC::setParams(size_t stride) { s_ctl_ip.u4_size = sizeof(ivd_ctl_set_config_ip_t); s_ctl_op.u4_size = sizeof(ivd_ctl_set_config_op_t); - ALOGV("Set the run-time (dynamic) parameters stride = %u", stride); + ALOGV("Set the run-time (dynamic) parameters stride = %zu", stride); status = ivdec_api_function(mCodecCtx, (void *)&s_ctl_ip, (void *)&s_ctl_op); if (status != IV_SUCCESS) { @@ -452,7 +452,7 @@ status_t SoftAVC::initDecoder() { uint32_t bufferSize = displaySizeY * 3 / 2; mFlushOutBuffer = (uint8_t *)ivd_aligned_malloc(128, bufferSize); if (NULL == mFlushOutBuffer) { - ALOGE("Could not allocate flushOutputBuffer of size %zu", bufferSize); + ALOGE("Could not allocate flushOutputBuffer of size %u", bufferSize); return NO_MEMORY; } diff --git a/media/libstagefright/codecs/avcenc/SoftAVCEnc.cpp b/media/libstagefright/codecs/avcenc/SoftAVCEnc.cpp index bf5e353..06b2163 100644 --- a/media/libstagefright/codecs/avcenc/SoftAVCEnc.cpp +++ b/media/libstagefright/codecs/avcenc/SoftAVCEnc.cpp @@ -681,7 +681,7 @@ OMX_ERRORTYPE SoftAVC::initEncoder() { /* Allocate array to hold memory records */ mMemRecords = (iv_mem_rec_t *)malloc(mNumMemRecords * sizeof(iv_mem_rec_t)); if (NULL == mMemRecords) { - ALOGE("Unable to allocate memory for hold memory records: Size %d", + ALOGE("Unable to allocate memory for hold memory records: Size %zu", mNumMemRecords * sizeof(iv_mem_rec_t)); mSignalledError = true; notify(OMX_EventError, OMX_ErrorUndefined, 0, 0); @@ -744,7 +744,7 @@ OMX_ERRORTYPE SoftAVC::initEncoder() { ps_mem_rec->pv_base = ive_aligned_malloc( ps_mem_rec->u4_mem_alignment, ps_mem_rec->u4_mem_size); if (ps_mem_rec->pv_base == NULL) { - ALOGE("Allocation failure for mem record id %d size %d\n", i, + ALOGE("Allocation failure for mem record id %zu size %u\n", i, ps_mem_rec->u4_mem_size); mSignalledError = true; notify(OMX_EventError, OMX_ErrorUndefined, 0, 0); diff --git a/media/libstagefright/codecs/avcenc/SoftAVCEnc.h b/media/libstagefright/codecs/avcenc/SoftAVCEnc.h index c4e26a9..2b35d45 100644 --- a/media/libstagefright/codecs/avcenc/SoftAVCEnc.h +++ b/media/libstagefright/codecs/avcenc/SoftAVCEnc.h @@ -25,7 +25,7 @@ namespace android { -struct MediaBuffer; +class MediaBuffer; #define CODEC_MAX_CORES 4 #define LEN_STATUS_BUFFER (10 * 1024) diff --git a/media/libstagefright/codecs/hevcdec/SoftHEVC.cpp b/media/libstagefright/codecs/hevcdec/SoftHEVC.cpp index cddd176..5c05a0e 100644 --- a/media/libstagefright/codecs/hevcdec/SoftHEVC.cpp +++ b/media/libstagefright/codecs/hevcdec/SoftHEVC.cpp @@ -143,7 +143,7 @@ status_t SoftHEVC::setParams(size_t stride) { s_ctl_ip.u4_size = sizeof(ivd_ctl_set_config_ip_t); s_ctl_op.u4_size = sizeof(ivd_ctl_set_config_op_t); - ALOGV("Set the run-time (dynamic) parameters stride = %u", stride); + ALOGV("Set the run-time (dynamic) parameters stride = %zu", stride); status = ivdec_api_function(mCodecCtx, (void *)&s_ctl_ip, (void *)&s_ctl_op); @@ -408,7 +408,7 @@ status_t SoftHEVC::initDecoder() { uint32_t bufferSize = displaySizeY * 3 / 2; mFlushOutBuffer = (uint8_t *)ivd_aligned_malloc(128, bufferSize); if (NULL == mFlushOutBuffer) { - ALOGE("Could not allocate flushOutputBuffer of size %zu", bufferSize); + ALOGE("Could not allocate flushOutputBuffer of size %u", bufferSize); return NO_MEMORY; } diff --git a/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.cpp b/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.cpp index fb7394b..e382f4c 100644 --- a/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.cpp +++ b/media/libstagefright/codecs/mpeg2dec/SoftMPEG2.cpp @@ -156,7 +156,7 @@ status_t SoftMPEG2::setParams(size_t stride) { s_ctl_ip.u4_size = sizeof(ivd_ctl_set_config_ip_t); s_ctl_op.u4_size = sizeof(ivd_ctl_set_config_op_t); - ALOGV("Set the run-time (dynamic) parameters stride = %u", stride); + ALOGV("Set the run-time (dynamic) parameters stride = %zu", stride); status = ivdec_api_function(mCodecCtx, (void *)&s_ctl_ip, (void *)&s_ctl_op); if (status != IV_SUCCESS) { @@ -394,7 +394,7 @@ status_t SoftMPEG2::initDecoder() { uint32_t bufferSize = displaySizeY * 3 / 2; mFlushOutBuffer = (uint8_t *)ivd_aligned_malloc(128, bufferSize); if (NULL == mFlushOutBuffer) { - ALOGE("Could not allocate flushOutputBuffer of size %zu", bufferSize); + ALOGE("Could not allocate flushOutputBuffer of size %u", bufferSize); return NO_MEMORY; } diff --git a/media/libstagefright/colorconversion/Android.mk b/media/libstagefright/colorconversion/Android.mk index 59a64ba..4f7c48f 100644 --- a/media/libstagefright/colorconversion/Android.mk +++ b/media/libstagefright/colorconversion/Android.mk @@ -9,6 +9,9 @@ LOCAL_C_INCLUDES := \ $(TOP)/frameworks/native/include/media/openmax \ $(TOP)/hardware/msm7k +LOCAL_CFLAGS += -Werror +LOCAL_CLANG := true + LOCAL_MODULE:= libstagefright_color_conversion include $(BUILD_STATIC_LIBRARY) diff --git a/media/libstagefright/filters/Android.mk b/media/libstagefright/filters/Android.mk index 36ab444..c3eaa54 100644 --- a/media/libstagefright/filters/Android.mk +++ b/media/libstagefright/filters/Android.mk @@ -20,7 +20,8 @@ LOCAL_C_INCLUDES := \ intermediates := $(call intermediates-dir-for,STATIC_LIBRARIES,libRS,TARGET,) LOCAL_C_INCLUDES += $(intermediates) -LOCAL_CFLAGS += -Wno-multichar +LOCAL_CFLAGS += -Wno-multichar -Werror +LOCAL_CLANG := true LOCAL_MODULE:= libstagefright_mediafilter diff --git a/media/libstagefright/filters/ColorConvert.cpp b/media/libstagefright/filters/ColorConvert.cpp index a5039f9..a8d5dd2 100644 --- a/media/libstagefright/filters/ColorConvert.cpp +++ b/media/libstagefright/filters/ColorConvert.cpp @@ -93,8 +93,8 @@ void convertYUV420spToRGB888( void convertRGBAToARGB( uint8_t *src, int32_t width, int32_t height, uint32_t stride, uint8_t *dest) { - for (size_t i = 0; i < height; ++i) { - for (size_t j = 0; j < width; ++j) { + for (int32_t i = 0; i < height; ++i) { + for (int32_t j = 0; j < width; ++j) { uint8_t r = *src++; uint8_t g = *src++; uint8_t b = *src++; diff --git a/media/libstagefright/filters/GraphicBufferListener.cpp b/media/libstagefright/filters/GraphicBufferListener.cpp index 66374ba..a606315 100644 --- a/media/libstagefright/filters/GraphicBufferListener.cpp +++ b/media/libstagefright/filters/GraphicBufferListener.cpp @@ -40,7 +40,7 @@ status_t GraphicBufferListener::init( status_t err = mConsumer->setMaxAcquiredBufferCount(bufferCount); if (err != NO_ERROR) { - ALOGE("Unable to set BQ max acquired buffer count to %u: %d", + ALOGE("Unable to set BQ max acquired buffer count to %zu: %d", bufferCount, err); return err; } diff --git a/media/libstagefright/filters/MediaFilter.cpp b/media/libstagefright/filters/MediaFilter.cpp index 0a09575..ecbda36 100644 --- a/media/libstagefright/filters/MediaFilter.cpp +++ b/media/libstagefright/filters/MediaFilter.cpp @@ -804,7 +804,7 @@ void MediaFilter::onSignalEndOfInputStream() { eosBuf->mGeneration = mGeneration; eosBuf->mData->setRange(0, 0); postDrainThisBuffer(eosBuf); - ALOGV("Posted EOS on output buffer %zu", eosBuf->mBufferID); + ALOGV("Posted EOS on output buffer %u", eosBuf->mBufferID); } mPortEOS[kPortIndexOutput] = true; diff --git a/media/libstagefright/foundation/Android.mk b/media/libstagefright/foundation/Android.mk index 08355c7..3c95f0b 100644 --- a/media/libstagefright/foundation/Android.mk +++ b/media/libstagefright/foundation/Android.mk @@ -30,6 +30,7 @@ LOCAL_SHARED_LIBRARIES := \ libpowermanager LOCAL_CFLAGS += -Wno-multichar -Werror +LOCAL_CLANG := true LOCAL_MODULE:= libstagefright_foundation diff --git a/media/libstagefright/http/Android.mk b/media/libstagefright/http/Android.mk index 7f3307d..a627898 100644 --- a/media/libstagefright/http/Android.mk +++ b/media/libstagefright/http/Android.mk @@ -22,6 +22,7 @@ LOCAL_MODULE:= libstagefright_http_support LOCAL_CFLAGS += -Wno-multichar LOCAL_CFLAGS += -Werror +LOCAL_CLANG := true include $(BUILD_SHARED_LIBRARY) diff --git a/media/libstagefright/httplive/Android.mk b/media/libstagefright/httplive/Android.mk index 93b7935..a30be66 100644 --- a/media/libstagefright/httplive/Android.mk +++ b/media/libstagefright/httplive/Android.mk @@ -13,6 +13,7 @@ LOCAL_C_INCLUDES:= \ $(TOP)/frameworks/native/include/media/openmax LOCAL_CFLAGS += -Werror +LOCAL_CLANG := true LOCAL_SHARED_LIBRARIES := \ libbinder \ diff --git a/media/libstagefright/httplive/LiveSession.h b/media/libstagefright/httplive/LiveSession.h index 86d0498..56cd702 100644 --- a/media/libstagefright/httplive/LiveSession.h +++ b/media/libstagefright/httplive/LiveSession.h @@ -30,7 +30,7 @@ namespace android { struct ABuffer; struct AReplyToken; struct AnotherPacketSource; -struct DataSource; +class DataSource; struct HTTPBase; struct IMediaHTTPService; struct LiveDataSource; diff --git a/media/libstagefright/httplive/PlaylistFetcher.h b/media/libstagefright/httplive/PlaylistFetcher.h index bb14a0d..95de9c3 100644 --- a/media/libstagefright/httplive/PlaylistFetcher.h +++ b/media/libstagefright/httplive/PlaylistFetcher.h @@ -27,7 +27,7 @@ namespace android { struct ABuffer; struct AnotherPacketSource; -struct DataSource; +class DataSource; struct HTTPBase; struct LiveDataSource; struct M3UParser; diff --git a/media/libstagefright/id3/Android.mk b/media/libstagefright/id3/Android.mk index 2194c38..f791899 100644 --- a/media/libstagefright/id3/Android.mk +++ b/media/libstagefright/id3/Android.mk @@ -5,6 +5,7 @@ LOCAL_SRC_FILES := \ ID3.cpp LOCAL_CFLAGS += -Werror +LOCAL_CLANG := true LOCAL_MODULE := libstagefright_id3 @@ -18,6 +19,7 @@ LOCAL_SRC_FILES := \ testid3.cpp LOCAL_CFLAGS += -Werror +LOCAL_CLANG := true LOCAL_SHARED_LIBRARIES := \ libstagefright libutils liblog libbinder libstagefright_foundation diff --git a/media/libstagefright/include/AwesomePlayer.h b/media/libstagefright/include/AwesomePlayer.h index 4704ad3..8bba804 100644 --- a/media/libstagefright/include/AwesomePlayer.h +++ b/media/libstagefright/include/AwesomePlayer.h @@ -31,20 +31,20 @@ namespace android { -struct AudioPlayer; +class AudioPlayer; struct ClockEstimator; -struct IDataSource; -struct MediaBuffer; +class IDataSource; +class MediaBuffer; struct MediaExtractor; struct MediaSource; struct NuCachedSource2; -struct IGraphicBufferProducer; +class IGraphicBufferProducer; class DrmManagerClinet; class DecryptHandle; class TimedTextDriver; -struct WVMExtractor; +class WVMExtractor; struct AwesomeRenderer : public RefBase { AwesomeRenderer() {} diff --git a/media/libstagefright/include/MPEG2PSExtractor.h b/media/libstagefright/include/MPEG2PSExtractor.h index fb76564..22cb02d 100644 --- a/media/libstagefright/include/MPEG2PSExtractor.h +++ b/media/libstagefright/include/MPEG2PSExtractor.h @@ -28,7 +28,7 @@ namespace android { struct ABuffer; struct AMessage; struct Track; -struct String8; +class String8; struct MPEG2PSExtractor : public MediaExtractor { MPEG2PSExtractor(const sp &source); diff --git a/media/libstagefright/include/MPEG2TSExtractor.h b/media/libstagefright/include/MPEG2TSExtractor.h index db1187d..4dd340c 100644 --- a/media/libstagefright/include/MPEG2TSExtractor.h +++ b/media/libstagefright/include/MPEG2TSExtractor.h @@ -30,7 +30,7 @@ struct AnotherPacketSource; struct ATSParser; class DataSource; struct MPEG2TSSource; -struct String8; +class String8; struct MPEG2TSExtractor : public MediaExtractor { MPEG2TSExtractor(const sp &source); diff --git a/media/libstagefright/include/OMX.h b/media/libstagefright/include/OMX.h index e8c4970..b5487fa 100644 --- a/media/libstagefright/include/OMX.h +++ b/media/libstagefright/include/OMX.h @@ -24,7 +24,7 @@ namespace android { struct OMXMaster; -class OMXNodeInstance; +struct OMXNodeInstance; class OMX : public BnOMX, public IBinder::DeathRecipient { diff --git a/media/libstagefright/include/OMXNodeInstance.h b/media/libstagefright/include/OMXNodeInstance.h index 104dcfc..d87b408 100644 --- a/media/libstagefright/include/OMXNodeInstance.h +++ b/media/libstagefright/include/OMXNodeInstance.h @@ -27,7 +27,7 @@ namespace android { class IOMXObserver; struct OMXMaster; -struct GraphicBufferSource; +class GraphicBufferSource; struct OMXNodeInstance { OMXNodeInstance( diff --git a/media/libstagefright/include/SampleIterator.h b/media/libstagefright/include/SampleIterator.h index 60c9e7e..7053247 100644 --- a/media/libstagefright/include/SampleIterator.h +++ b/media/libstagefright/include/SampleIterator.h @@ -18,7 +18,7 @@ namespace android { -struct SampleTable; +class SampleTable; struct SampleIterator { SampleIterator(SampleTable *table); diff --git a/media/libstagefright/include/StagefrightMetadataRetriever.h b/media/libstagefright/include/StagefrightMetadataRetriever.h index 96a35f3..fd739d0 100644 --- a/media/libstagefright/include/StagefrightMetadataRetriever.h +++ b/media/libstagefright/include/StagefrightMetadataRetriever.h @@ -25,7 +25,7 @@ namespace android { -struct DataSource; +class DataSource; class MediaExtractor; struct StagefrightMetadataRetriever : public MediaMetadataRetrieverInterface { diff --git a/media/libstagefright/include/TimedEventQueue.h b/media/libstagefright/include/TimedEventQueue.h index 2963150..890f7e8 100644 --- a/media/libstagefright/include/TimedEventQueue.h +++ b/media/libstagefright/include/TimedEventQueue.h @@ -46,7 +46,7 @@ struct TimedEventQueue { virtual void fire(TimedEventQueue *queue, int64_t now_us) = 0; private: - friend class TimedEventQueue; + friend struct TimedEventQueue; event_id mEventID; diff --git a/media/libstagefright/include/VBRISeeker.h b/media/libstagefright/include/VBRISeeker.h index 1a2bf9f..c57d571 100644 --- a/media/libstagefright/include/VBRISeeker.h +++ b/media/libstagefright/include/VBRISeeker.h @@ -24,7 +24,7 @@ namespace android { -struct DataSource; +class DataSource; struct VBRISeeker : public MP3Seeker { static sp CreateFromSource( diff --git a/media/libstagefright/include/XINGSeeker.h b/media/libstagefright/include/XINGSeeker.h index c408576..cce04f0 100644 --- a/media/libstagefright/include/XINGSeeker.h +++ b/media/libstagefright/include/XINGSeeker.h @@ -22,7 +22,7 @@ namespace android { -struct DataSource; +class DataSource; struct XINGSeeker : public MP3Seeker { static sp CreateFromSource( diff --git a/media/libstagefright/matroska/Android.mk b/media/libstagefright/matroska/Android.mk index 446ff8c..771952b 100644 --- a/media/libstagefright/matroska/Android.mk +++ b/media/libstagefright/matroska/Android.mk @@ -9,6 +9,7 @@ LOCAL_C_INCLUDES:= \ $(TOP)/frameworks/native/include/media/openmax \ LOCAL_CFLAGS += -Wno-multichar -Werror +LOCAL_CLANG := true LOCAL_MODULE:= libstagefright_matroska diff --git a/media/libstagefright/mpeg2ts/Android.mk b/media/libstagefright/mpeg2ts/Android.mk index c17a0b7..0dcb3c5 100644 --- a/media/libstagefright/mpeg2ts/Android.mk +++ b/media/libstagefright/mpeg2ts/Android.mk @@ -14,6 +14,7 @@ LOCAL_C_INCLUDES:= \ $(TOP)/frameworks/native/include/media/openmax LOCAL_CFLAGS += -Werror +LOCAL_CLANG := true LOCAL_MODULE:= libstagefright_mpeg2ts diff --git a/media/libstagefright/omx/Android.mk b/media/libstagefright/omx/Android.mk index 07ea605..71cbcfc 100644 --- a/media/libstagefright/omx/Android.mk +++ b/media/libstagefright/omx/Android.mk @@ -31,6 +31,8 @@ LOCAL_SHARED_LIBRARIES := \ libdl LOCAL_MODULE:= libstagefright_omx +LOCAL_CFLAGS += -Werror +LOCAL_CLANG := true include $(BUILD_SHARED_LIBRARY) diff --git a/media/libstagefright/omx/FrameDropper.cpp b/media/libstagefright/omx/FrameDropper.cpp index 9fba0b7..9a4952e 100644 --- a/media/libstagefright/omx/FrameDropper.cpp +++ b/media/libstagefright/omx/FrameDropper.cpp @@ -50,20 +50,23 @@ bool FrameDropper::shouldDrop(int64_t timeUs) { if (mDesiredMinTimeUs < 0) { mDesiredMinTimeUs = timeUs + mMinIntervalUs; - ALOGV("first frame %lld, next desired frame %lld", timeUs, mDesiredMinTimeUs); + ALOGV("first frame %lld, next desired frame %lld", + (long long)timeUs, (long long)mDesiredMinTimeUs); return false; } if (timeUs < (mDesiredMinTimeUs - kMaxJitterUs)) { ALOGV("drop frame %lld, desired frame %lld, diff %lld", - timeUs, mDesiredMinTimeUs, mDesiredMinTimeUs - timeUs); + (long long)timeUs, (long long)mDesiredMinTimeUs, + (long long)(mDesiredMinTimeUs - timeUs)); return true; } int64_t n = (timeUs - mDesiredMinTimeUs + kMaxJitterUs) / mMinIntervalUs; mDesiredMinTimeUs += (n + 1) * mMinIntervalUs; ALOGV("keep frame %lld, next desired frame %lld, diff %lld", - timeUs, mDesiredMinTimeUs, mDesiredMinTimeUs - timeUs); + (long long)timeUs, (long long)mDesiredMinTimeUs, + (long long)(mDesiredMinTimeUs - timeUs)); return false; } diff --git a/media/libstagefright/omx/GraphicBufferSource.h b/media/libstagefright/omx/GraphicBufferSource.h index 1067472..718d2ee 100644 --- a/media/libstagefright/omx/GraphicBufferSource.h +++ b/media/libstagefright/omx/GraphicBufferSource.h @@ -30,7 +30,7 @@ namespace android { -class FrameDropper; +struct FrameDropper; /* * This class is used to feed OMX codecs from a Surface via BufferQueue. @@ -240,7 +240,7 @@ private: Vector mCodecBuffers; //// - friend class AHandlerReflector; + friend struct AHandlerReflector; enum { kWhatRepeatLastFrame, diff --git a/media/libstagefright/omx/SimpleSoftOMXComponent.cpp b/media/libstagefright/omx/SimpleSoftOMXComponent.cpp index 801a1bd..04303c4 100644 --- a/media/libstagefright/omx/SimpleSoftOMXComponent.cpp +++ b/media/libstagefright/omx/SimpleSoftOMXComponent.cpp @@ -598,7 +598,7 @@ void SimpleSoftOMXComponent::checkTransitions() { if (port->mTransition == PortInfo::DISABLING) { if (port->mBuffers.empty()) { - ALOGV("Port %d now disabled.", i); + ALOGV("Port %zu now disabled.", i); port->mTransition = PortInfo::NONE; notify(OMX_EventCmdComplete, OMX_CommandPortDisable, i, NULL); @@ -607,7 +607,7 @@ void SimpleSoftOMXComponent::checkTransitions() { } } else if (port->mTransition == PortInfo::ENABLING) { if (port->mDef.bPopulated == OMX_TRUE) { - ALOGV("Port %d now enabled.", i); + ALOGV("Port %zu now enabled.", i); port->mTransition = PortInfo::NONE; port->mDef.bEnabled = OMX_TRUE; @@ -628,14 +628,14 @@ void SimpleSoftOMXComponent::addPort(const OMX_PARAM_PORTDEFINITIONTYPE &def) { info->mTransition = PortInfo::NONE; } -void SimpleSoftOMXComponent::onQueueFilled(OMX_U32 portIndex) { +void SimpleSoftOMXComponent::onQueueFilled(OMX_U32 portIndex __unused) { } -void SimpleSoftOMXComponent::onPortFlushCompleted(OMX_U32 portIndex) { +void SimpleSoftOMXComponent::onPortFlushCompleted(OMX_U32 portIndex __unused) { } void SimpleSoftOMXComponent::onPortEnableCompleted( - OMX_U32 portIndex, bool enabled) { + OMX_U32 portIndex __unused, bool enabled __unused) { } List & diff --git a/media/libstagefright/omx/tests/Android.mk b/media/libstagefright/omx/tests/Android.mk index 9be637a..f7280f6 100644 --- a/media/libstagefright/omx/tests/Android.mk +++ b/media/libstagefright/omx/tests/Android.mk @@ -12,6 +12,7 @@ LOCAL_C_INCLUDES := \ $(TOP)/frameworks/native/include/media/openmax LOCAL_CFLAGS += -Werror +LOCAL_CLANG := true LOCAL_MODULE := omx_tests @@ -37,4 +38,7 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_C_INCLUDES := \ frameworks/av/media/libstagefright/omx \ +LOCAL_CFLAGS += -Werror +LOCAL_CLANG := true + include $(BUILD_NATIVE_TEST) diff --git a/media/libstagefright/omx/tests/FrameDropper_test.cpp b/media/libstagefright/omx/tests/FrameDropper_test.cpp index 4ac72c4..f966b5e 100644 --- a/media/libstagefright/omx/tests/FrameDropper_test.cpp +++ b/media/libstagefright/omx/tests/FrameDropper_test.cpp @@ -100,7 +100,8 @@ protected: for (size_t i = 0; i < size; ++i) { int jitter = GetJitter(i); int64_t testTimeUs = frames[i].timeUs + jitter; - printf("time %lld, testTime %lld, jitter %d\n", frames[i].timeUs, testTimeUs, jitter); + printf("time %lld, testTime %lld, jitter %d\n", + (long long)frames[i].timeUs, (long long)testTimeUs, jitter); EXPECT_EQ(frames[i].shouldDrop, mFrameDropper->shouldDrop(testTimeUs)); } } diff --git a/media/libstagefright/rtsp/ARTPWriter.h b/media/libstagefright/rtsp/ARTPWriter.h index fdc8d23..be8bc13 100644 --- a/media/libstagefright/rtsp/ARTPWriter.h +++ b/media/libstagefright/rtsp/ARTPWriter.h @@ -32,7 +32,7 @@ namespace android { struct ABuffer; -struct MediaBuffer; +class MediaBuffer; struct ARTPWriter : public MediaWriter { ARTPWriter(int fd); diff --git a/media/libstagefright/rtsp/Android.mk b/media/libstagefright/rtsp/Android.mk index 9fedb71..12a946c 100644 --- a/media/libstagefright/rtsp/Android.mk +++ b/media/libstagefright/rtsp/Android.mk @@ -32,6 +32,7 @@ ifeq ($(TARGET_ARCH),arm) endif LOCAL_CFLAGS += -Werror +LOCAL_CLANG := true LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk @@ -54,7 +55,8 @@ LOCAL_C_INCLUDES:= \ frameworks/av/media/libstagefright \ $(TOP)/frameworks/native/include/media/openmax -LOCAL_CFLAGS += -Wno-multichar +LOCAL_CFLAGS += -Wno-multichar -Werror +LOCAL_CLANG := true LOCAL_MODULE_TAGS := optional diff --git a/media/libstagefright/tests/Android.mk b/media/libstagefright/tests/Android.mk index 51e1c78..532106b 100644 --- a/media/libstagefright/tests/Android.mk +++ b/media/libstagefright/tests/Android.mk @@ -31,6 +31,9 @@ LOCAL_C_INCLUDES := \ frameworks/av/media/libstagefright/include \ $(TOP)/frameworks/native/include/media/openmax \ +LOCAL_CFLAGS += -Werror +LOCAL_CLANG := true + LOCAL_32_BIT_ONLY := true include $(BUILD_NATIVE_TEST) @@ -60,6 +63,9 @@ LOCAL_C_INCLUDES := \ frameworks/av/media/libstagefright/include \ $(TOP)/frameworks/native/include/media/openmax \ +LOCAL_CFLAGS += -Werror +LOCAL_CLANG := true + include $(BUILD_NATIVE_TEST) include $(CLEAR_VARS) @@ -87,6 +93,9 @@ LOCAL_C_INCLUDES := \ LOCAL_32_BIT_ONLY := true +LOCAL_CFLAGS += -Werror +LOCAL_CLANG := true + include $(BUILD_NATIVE_TEST) # Include subdirectory makefiles diff --git a/media/libstagefright/tests/DummyRecorder.h b/media/libstagefright/tests/DummyRecorder.h index 1cbea1b..cd4d0ee 100644 --- a/media/libstagefright/tests/DummyRecorder.h +++ b/media/libstagefright/tests/DummyRecorder.h @@ -24,7 +24,7 @@ namespace android { -class MediaSource; +struct MediaSource; class MediaBuffer; class DummyRecorder { diff --git a/media/libstagefright/tests/MediaCodecListOverrides_test.cpp b/media/libstagefright/tests/MediaCodecListOverrides_test.cpp index cacaa84..170cde3 100644 --- a/media/libstagefright/tests/MediaCodecListOverrides_test.cpp +++ b/media/libstagefright/tests/MediaCodecListOverrides_test.cpp @@ -278,7 +278,7 @@ TEST_F(MediaCodecListOverridesTest, exportResultsToExistingFile) { rewind(f); char *buf = (char *)malloc(size); - EXPECT_EQ(1, fread(buf, size, 1, f)); + EXPECT_EQ((size_t)1, fread(buf, size, 1, f)); overrides.setTo(buf, size); fclose(f); free(buf); @@ -303,7 +303,7 @@ TEST_F(MediaCodecListOverridesTest, exportResultsToEmptyFile) { rewind(f); char *buf = (char *)malloc(size); - EXPECT_EQ(1, fread(buf, size, 1, f)); + EXPECT_EQ((size_t)1, fread(buf, size, 1, f)); overrides.setTo(buf, size); fclose(f); free(buf); diff --git a/media/libstagefright/timedtext/Android.mk b/media/libstagefright/timedtext/Android.mk index 6a8b9fc..1202a4d 100644 --- a/media/libstagefright/timedtext/Android.mk +++ b/media/libstagefright/timedtext/Android.mk @@ -10,6 +10,7 @@ LOCAL_SRC_FILES:= \ TimedTextPlayer.cpp LOCAL_CFLAGS += -Wno-multichar -Werror +LOCAL_CLANG := true LOCAL_C_INCLUDES:= \ $(TOP)/frameworks/av/include/media/stagefright/timedtext \ diff --git a/media/libstagefright/timedtext/test/Android.mk b/media/libstagefright/timedtext/test/Android.mk index 9a9fde2..06ea307 100644 --- a/media/libstagefright/timedtext/test/Android.mk +++ b/media/libstagefright/timedtext/test/Android.mk @@ -26,4 +26,7 @@ LOCAL_SHARED_LIBRARIES := \ libstagefright_foundation \ libutils +LOCAL_CFLAGS += -Werror +LOCAL_CLANG := true + include $(BUILD_NATIVE_TEST) diff --git a/media/libstagefright/timedtext/test/TimedTextSRTSource_test.cpp b/media/libstagefright/timedtext/test/TimedTextSRTSource_test.cpp index 3a06d61..211e732 100644 --- a/media/libstagefright/timedtext/test/TimedTextSRTSource_test.cpp +++ b/media/libstagefright/timedtext/test/TimedTextSRTSource_test.cpp @@ -63,10 +63,10 @@ public: } virtual ssize_t readAt(off64_t offset, void *data, size_t size) { - if (offset >= mSize) return 0; + if ((size_t)offset >= mSize) return 0; ssize_t avail = mSize - offset; - if (avail > size) { + if ((size_t)avail > size) { avail = size; } memcpy(data, mData + offset, avail); diff --git a/media/libstagefright/webm/Android.mk b/media/libstagefright/webm/Android.mk index 7081463..c9fb83c 100644 --- a/media/libstagefright/webm/Android.mk +++ b/media/libstagefright/webm/Android.mk @@ -1,8 +1,10 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) -LOCAL_CPPFLAGS += -D__STDINT_LIMITS \ - -Werror +LOCAL_CPPFLAGS += -D__STDINT_LIMITS + +LOCAL_CFLAGS += -Werror +LOCAL_CLANG := true LOCAL_SRC_FILES:= EbmlUtil.cpp \ WebmElement.cpp \ diff --git a/media/libstagefright/wifi-display/Android.mk b/media/libstagefright/wifi-display/Android.mk index f70454a..0d9ba6f 100644 --- a/media/libstagefright/wifi-display/Android.mk +++ b/media/libstagefright/wifi-display/Android.mk @@ -30,6 +30,9 @@ LOCAL_SHARED_LIBRARIES:= \ libui \ libutils \ +LOCAL_CFLAGS += -Wno-multichar -Werror +LOCAL_CLANG := true + LOCAL_MODULE:= libstagefright_wfd LOCAL_MODULE_TAGS:= optional diff --git a/media/libstagefright/wifi-display/VideoFormats.cpp b/media/libstagefright/wifi-display/VideoFormats.cpp index 2f4af5b..27393fb 100644 --- a/media/libstagefright/wifi-display/VideoFormats.cpp +++ b/media/libstagefright/wifi-display/VideoFormats.cpp @@ -248,8 +248,8 @@ void VideoFormats::getProfileLevel( } if (bestProfile == -1 || bestLevel == -1) { - ALOGE("Profile or level not set for resolution type %d, index %d", - type, index); + ALOGE("Profile or level not set for resolution type %d, index %zu", + type, index); bestProfile = PROFILE_CBP; bestLevel = LEVEL_31; } @@ -507,7 +507,7 @@ bool VideoFormats::PickBestFormat( continue; } - ALOGV("type %u, index %u, %u x %u %c%u supported", + ALOGV("type %zu, index %zu, %zu x %zu %c%zu supported", i, j, width, height, interlaced ? 'i' : 'p', framesPerSecond); uint32_t score = width * height * framesPerSecond; diff --git a/media/libstagefright/wifi-display/rtp/RTPSender.cpp b/media/libstagefright/wifi-display/rtp/RTPSender.cpp index 4e72533..a4eb378 100644 --- a/media/libstagefright/wifi-display/rtp/RTPSender.cpp +++ b/media/libstagefright/wifi-display/rtp/RTPSender.cpp @@ -672,8 +672,8 @@ status_t RTPSender::onRTCPData(const sp &buffer) { default: { - ALOGW("Unknown RTCP packet type %u of size %d", - (unsigned)data[1], headerLength); + ALOGW("Unknown RTCP packet type %u of size %zu", + (unsigned)data[1], headerLength); break; } } @@ -764,7 +764,7 @@ status_t RTPSender::parseTSFB(const uint8_t *data, size_t size) { return OK; } -status_t RTPSender::parseAPP(const uint8_t *data, size_t size) { +status_t RTPSender::parseAPP(const uint8_t *data, size_t size __unused) { if (!memcmp("late", &data[8], 4)) { int64_t avgLatencyUs = (int64_t)U64_AT(&data[12]); int64_t maxLatencyUs = (int64_t)U64_AT(&data[20]); diff --git a/media/libstagefright/wifi-display/source/Converter.cpp b/media/libstagefright/wifi-display/source/Converter.cpp index 8368945..471152e 100644 --- a/media/libstagefright/wifi-display/source/Converter.cpp +++ b/media/libstagefright/wifi-display/source/Converter.cpp @@ -747,7 +747,7 @@ status_t Converter::doMoreWork() { buffer->meta()->setInt64("timeUs", timeUs); ALOGV("[%s] time %lld us (%.2f secs)", - mIsVideo ? "video" : "audio", timeUs, timeUs / 1E6); + mIsVideo ? "video" : "audio", (long long)timeUs, timeUs / 1E6); memcpy(buffer->data(), outbuf->base() + offset, size); diff --git a/media/libstagefright/wifi-display/source/Converter.h b/media/libstagefright/wifi-display/source/Converter.h index 5876e07..b182990 100644 --- a/media/libstagefright/wifi-display/source/Converter.h +++ b/media/libstagefright/wifi-display/source/Converter.h @@ -23,7 +23,7 @@ namespace android { struct ABuffer; -struct IGraphicBufferProducer; +class IGraphicBufferProducer; struct MediaCodec; #define ENABLE_SILENCE_DETECTION 0 diff --git a/media/libstagefright/wifi-display/source/PlaybackSession.cpp b/media/libstagefright/wifi-display/source/PlaybackSession.cpp index 6080943..b37a46c 100644 --- a/media/libstagefright/wifi-display/source/PlaybackSession.cpp +++ b/media/libstagefright/wifi-display/source/PlaybackSession.cpp @@ -508,7 +508,7 @@ void WifiDisplaySource::PlaybackSession::onMessageReceived( } else if (what == Converter::kWhatEOS) { CHECK_EQ(what, Converter::kWhatEOS); - ALOGI("output EOS on track %d", trackIndex); + ALOGI("output EOS on track %zu", trackIndex); ssize_t index = mTracks.indexOfKey(trackIndex); CHECK_GE(index, 0); @@ -581,7 +581,7 @@ void WifiDisplaySource::PlaybackSession::onMessageReceived( CHECK(msg->findSize("trackIndex", &trackIndex)); if (what == Track::kWhatStopped) { - ALOGI("Track %d stopped", trackIndex); + ALOGI("Track %zu stopped", trackIndex); sp track = mTracks.valueFor(trackIndex); looper()->unregisterHandler(track->id()); diff --git a/media/libstagefright/wifi-display/source/PlaybackSession.h b/media/libstagefright/wifi-display/source/PlaybackSession.h index 2824143..4cd1a75 100644 --- a/media/libstagefright/wifi-display/source/PlaybackSession.h +++ b/media/libstagefright/wifi-display/source/PlaybackSession.h @@ -26,7 +26,7 @@ namespace android { struct ABuffer; struct IHDCP; -struct IGraphicBufferProducer; +class IGraphicBufferProducer; struct MediaPuller; struct MediaSource; struct MediaSender; diff --git a/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp b/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp index 14d0951..332fe16 100644 --- a/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp +++ b/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp @@ -881,7 +881,7 @@ status_t WifiDisplaySource::onReceiveM3Response( &framesPerSecond, &interlaced)); - ALOGI("Picked video resolution %u x %u %c%u", + ALOGI("Picked video resolution %zu x %zu %c%zu", width, height, interlaced ? 'i' : 'p', framesPerSecond); ALOGI("Picked AVC profile %d, level %d", diff --git a/media/libstagefright/yuv/Android.mk b/media/libstagefright/yuv/Android.mk index bb86dfc..5b36825 100644 --- a/media/libstagefright/yuv/Android.mk +++ b/media/libstagefright/yuv/Android.mk @@ -13,6 +13,6 @@ LOCAL_MODULE:= libstagefright_yuv LOCAL_CFLAGS += -Werror - +LOCAL_CLANG := true include $(BUILD_SHARED_LIBRARY) -- cgit v1.1