Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0eb0c1da authored by Praveen Chavan's avatar Praveen Chavan Committed by Linux Build Service Account
Browse files

mediaplayerservice: fix 64-bit compliation errors

Use correct format specifiers to fix 64-bit compilation.

Conflicts:
	media/libmediaplayerservice/StagefrightRecorder.cpp
	media/libstagefright/VideoFrameScheduler.cpp

Change-Id: Ic2238db525a23710716558015ca152871b4c549f
parent 37576618
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#define LOG_TAG "MediaPlayerService"
#include <utils/Log.h>

#include <inttypes.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
@@ -148,7 +149,7 @@ bool unmarshallFilter(const Parcel& p,

    if (p.dataAvail() < size)
    {
        ALOGE("Filter too short expected %d but got %d", size, p.dataAvail());
        ALOGE("Filter too short expected %zu but got %zu", size, p.dataAvail());
        *status = NOT_ENOUGH_DATA;
        return false;
    }
@@ -733,7 +734,7 @@ status_t MediaPlayerService::Client::setDataSource(

status_t MediaPlayerService::Client::setDataSource(int fd, int64_t offset, int64_t length)
{
    ALOGV("setDataSource fd=%d, offset=%lld, length=%lld", fd, offset, length);
    ALOGV("setDataSource fd=%d, offset=%" PRId64 ", length=%" PRId64 "", fd, offset, length);
    struct stat sb;
    int ret = fstat(fd, &sb);
    if (ret != 0) {
@@ -741,11 +742,11 @@ status_t MediaPlayerService::Client::setDataSource(int fd, int64_t offset, int64
        return UNKNOWN_ERROR;
    }

    ALOGV("st_dev  = %llu", static_cast<uint64_t>(sb.st_dev));
    ALOGV("st_dev  = %" PRIu64 "", static_cast<uint64_t>(sb.st_dev));
    ALOGV("st_mode = %u", sb.st_mode);
    ALOGV("st_uid  = %lu", static_cast<unsigned long>(sb.st_uid));
    ALOGV("st_gid  = %lu", static_cast<unsigned long>(sb.st_gid));
    ALOGV("st_size = %llu", sb.st_size);
    ALOGV("st_size = %" PRId64 "", sb.st_size);

    if (offset >= sb.st_size) {
        ALOGE("offset error");
@@ -754,7 +755,7 @@ status_t MediaPlayerService::Client::setDataSource(int fd, int64_t offset, int64
    }
    if (offset + length > sb.st_size) {
        length = sb.st_size - offset;
        ALOGV("calculated length = %lld", length);
        ALOGV("calculated length = %" PRId64 "", length);
    }

    player_type playerType = MediaPlayerFactory::getPlayerType(this,
@@ -1702,7 +1703,7 @@ status_t MediaPlayerService::AudioOutput::open(

        if (!bothOffloaded) {
            if (mRecycledTrack->frameCount() != t->frameCount()) {
                ALOGV("framecount differs: %u/%u frames",
                ALOGV("framecount differs: %zu/%zu frames",
                      mRecycledTrack->frameCount(), t->frameCount());
                reuse = false;
            }
+2 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#define LOG_TAG "MediaRecorderService"
#include <utils/Log.h>

#include <inttypes.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
@@ -166,7 +167,7 @@ status_t MediaRecorderClient::setAudioEncoder(int ae)

status_t MediaRecorderClient::setOutputFile(int fd, int64_t offset, int64_t length)
{
    ALOGV("setOutputFile(%d, %lld, %lld)", fd, offset, length);
    ALOGV("setOutputFile(%d, %" PRId64 ", %" PRId64 ")", fd, offset, length);
    Mutex::Autolock lock(mLock);
    if (mRecorder == NULL) {
        ALOGE("recorder is not initialized");
+9 −8
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#define LOG_TAG "MetadataRetrieverClient"
#include <utils/Log.h>

#include <inttypes.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
@@ -133,7 +134,7 @@ status_t MetadataRetrieverClient::setDataSource(

status_t MetadataRetrieverClient::setDataSource(int fd, int64_t offset, int64_t length)
{
    ALOGV("setDataSource fd=%d, offset=%lld, length=%lld", fd, offset, length);
    ALOGV("setDataSource fd=%d, offset=%" PRId64 ", length=%" PRId64 "", fd, offset, length);
    Mutex::Autolock lock(mLock);
    struct stat sb;
    int ret = fstat(fd, &sb);
@@ -141,20 +142,20 @@ status_t MetadataRetrieverClient::setDataSource(int fd, int64_t offset, int64_t
        ALOGE("fstat(%d) failed: %d, %s", fd, ret, strerror(errno));
        return BAD_VALUE;
    }
    ALOGV("st_dev  = %llu", static_cast<uint64_t>(sb.st_dev));
    ALOGV("st_dev  = %" PRIu64 "", static_cast<uint64_t>(sb.st_dev));
    ALOGV("st_mode = %u", sb.st_mode);
    ALOGV("st_uid  = %lu", static_cast<unsigned long>(sb.st_uid));
    ALOGV("st_gid  = %lu", static_cast<unsigned long>(sb.st_gid));
    ALOGV("st_size = %llu", sb.st_size);
    ALOGV("st_size = %" PRIu64 "", sb.st_size);

    if (offset >= sb.st_size) {
        ALOGE("offset (%lld) bigger than file size (%llu)", offset, sb.st_size);
        ALOGE("offset (%" PRId64 ") bigger than file size (%" PRIu64 ")", offset, sb.st_size);
        ::close(fd);
        return BAD_VALUE;
    }
    if (offset + length > sb.st_size) {
        length = sb.st_size - offset;
        ALOGV("calculated length = %lld", length);
        ALOGV("calculated length = %" PRId64 "", length);
    }

    player_type playerType =
@@ -195,7 +196,7 @@ Mutex MetadataRetrieverClient::sLock;

sp<IMemory> MetadataRetrieverClient::getFrameAtTime(int64_t timeUs, int option)
{
    ALOGV("getFrameAtTime: time(%lld us) option(%d)", timeUs, option);
    ALOGV("getFrameAtTime: time(%" PRId64 " us) option(%d)", timeUs, option);
    Mutex::Autolock lock(mLock);
    Mutex::Autolock glock(sLock);
    mThumbnail.clear();
@@ -217,7 +218,7 @@ sp<IMemory> MetadataRetrieverClient::getFrameAtTime(int64_t timeUs, int option)
    }
    mThumbnail = new MemoryBase(heap, 0, size);
    if (mThumbnail == NULL) {
        ALOGE("not enough memory for VideoFrame size=%u", size);
        ALOGE("not enough memory for VideoFrame size=%zu", size);
        delete frame;
        return NULL;
    }
@@ -258,7 +259,7 @@ sp<IMemory> MetadataRetrieverClient::extractAlbumArt()
    }
    mAlbumArt = new MemoryBase(heap, 0, size);
    if (mAlbumArt == NULL) {
        ALOGE("not enough memory for MediaAlbumArt size=%u", size);
        ALOGE("not enough memory for MediaAlbumArt size=%zu", size);
        delete albumArt;
        return NULL;
    }
+2 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#define LOG_TAG "StagefrightPlayer"
#include <utils/Log.h>

#include <inttypes.h>
#include "StagefrightPlayer.h"

#include "AwesomePlayer.h"
@@ -63,7 +64,7 @@ status_t StagefrightPlayer::setDataSource(
// Warning: The filedescriptor passed into this method will only be valid until
// the method returns, if you want to keep it, dup it!
status_t StagefrightPlayer::setDataSource(int fd, int64_t offset, int64_t length) {
    ALOGV("setDataSource(%d, %lld, %lld)", fd, offset, length);
    ALOGV("setDataSource(%d, %" PRId64 ", %" PRId64 ")", fd, offset, length);
    return mPlayer->setDataSource(dup(fd), offset, length);
}

+15 −14
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <inttypes.h>
#include <utils/Log.h>

#include <inttypes.h>
#include "WebmWriter.h"
#include "StagefrightRecorder.h"

@@ -249,7 +250,7 @@ status_t StagefrightRecorder::setInputSurface(
}

status_t StagefrightRecorder::setOutputFile(int fd, int64_t offset, int64_t length) {
    ALOGV("setOutputFile: %d, %lld, %lld", fd, offset, length);
    ALOGV("setOutputFile: %d, %" PRId64 ", %" PRId64 "", fd, offset, length);
    // These don't make any sense, do they?
    CHECK_EQ(offset, 0ll);
    CHECK_EQ(length, 0ll);
@@ -416,39 +417,39 @@ status_t StagefrightRecorder::setParamVideoRotation(int32_t degrees) {
}

status_t StagefrightRecorder::setParamMaxFileDurationUs(int64_t timeUs) {
    ALOGV("setParamMaxFileDurationUs: %lld us", timeUs);
    ALOGV("setParamMaxFileDurationUs: %" PRId64 " us", timeUs);

    // This is meant for backward compatibility for MediaRecorder.java
    if (timeUs <= 0) {
        ALOGW("Max file duration is not positive: %lld us. Disabling duration limit.", timeUs);
        ALOGW("Max file duration is not positive: %" PRId64 " us. Disabling duration limit.", timeUs);
        timeUs = 0; // Disable the duration limit for zero or negative values.
    } else if (timeUs <= 100000LL) {  // XXX: 100 milli-seconds
        ALOGE("Max file duration is too short: %lld us", timeUs);
        ALOGE("Max file duration is too short: %" PRId64 " us", timeUs);
        return BAD_VALUE;
    }

    if (timeUs <= 15 * 1000000LL) {
        ALOGW("Target duration (%lld us) too short to be respected", timeUs);
        ALOGW("Target duration (%" PRId64 " us) too short to be respected", timeUs);
    }
    mMaxFileDurationUs = timeUs;
    return OK;
}

status_t StagefrightRecorder::setParamMaxFileSizeBytes(int64_t bytes) {
    ALOGV("setParamMaxFileSizeBytes: %lld bytes", bytes);
    ALOGV("setParamMaxFileSizeBytes: %" PRId64 " bytes", bytes);

    // This is meant for backward compatibility for MediaRecorder.java
    if (bytes <= 0) {
        ALOGW("Max file size is not positive: %lld bytes. "
        ALOGW("Max file size is not positive: %" PRId64 " bytes. "
             "Disabling file size limit.", bytes);
        bytes = 0; // Disable the file size limit for zero or negative values.
    } else if (bytes <= 1024) {  // XXX: 1 kB
        ALOGE("Max file size is too small: %lld bytes", bytes);
        ALOGE("Max file size is too small: %" PRId64 " bytes", bytes);
        return BAD_VALUE;
    }

    if (bytes <= 100 * 1024) {
        ALOGW("Target file size (%lld bytes) is too small to be respected", bytes);
        ALOGW("Target file size (%" PRId64 " bytes) is too small to be respected", bytes);
    }

    mMaxFileSizeBytes = bytes;
@@ -500,9 +501,9 @@ status_t StagefrightRecorder::setParamVideoCameraId(int32_t cameraId) {
}

status_t StagefrightRecorder::setParamTrackTimeStatus(int64_t timeDurationUs) {
    ALOGV("setParamTrackTimeStatus: %lld", timeDurationUs);
    ALOGV("setParamTrackTimeStatus: %" PRId64 "", timeDurationUs);
    if (timeDurationUs < 20000) {  // Infeasible if shorter than 20 ms?
        ALOGE("Tracking time duration too short: %lld us", timeDurationUs);
        ALOGE("Tracking time duration too short: %" PRId64 " us", timeDurationUs);
        return BAD_VALUE;
    }
    mTrackEveryTimeDurationUs = timeDurationUs;
@@ -585,7 +586,7 @@ status_t StagefrightRecorder::setParamCaptureFps(float fps) {

    // Not allowing time more than a day
    if (timeUs <= 0 || timeUs > 86400*1E6) {
        ALOGE("Time between frame capture (%lld) is out of range [0, 1 Day]", timeUs);
        ALOGE("Time between frame capture (%" PRId64 ") is out of range [0, 1 Day]", timeUs);
        return BAD_VALUE;
    }

@@ -1440,7 +1441,7 @@ status_t StagefrightRecorder::setupCameraSource(
    videoSize.height = mVideoHeight;
    if (mCaptureFpsEnable) {
        if (mTimeBetweenCaptureUs < 0) {
            ALOGE("Invalid mTimeBetweenTimeLapseFrameCaptureUs value: %lld",
            ALOGE("Invalid mTimeBetweenTimeLapseFrameCaptureUs value: %" PRId64 "",
                mTimeBetweenCaptureUs);
            return BAD_VALUE;
        }
@@ -1541,7 +1542,7 @@ status_t StagefrightRecorder::setupVideoEncoder(
        // set up time lapse/slow motion for surface source
        if (mCaptureFpsEnable) {
            if (mTimeBetweenCaptureUs <= 0) {
                ALOGE("Invalid mTimeBetweenCaptureUs value: %lld",
                ALOGE("Invalid mTimeBetweenCaptureUs value: %" PRId64 "",
                        mTimeBetweenCaptureUs);
                return BAD_VALUE;
            }
Loading