这篇教程C++ ALOGV函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ALOGV函数的典型用法代码示例。如果您正苦于以下问题:C++ ALOGV函数的具体用法?C++ ALOGV怎么用?C++ ALOGV使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ALOGV函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: iterateOverNativeFilesstatic install_status_titerateOverNativeFiles(JNIEnv *env, jstring javaFilePath, jstring javaCpuAbi, jstring javaCpuAbi2, iterFunc callFunc, void* callArg) { ScopedUtfChars filePath(env, javaFilePath); ScopedUtfChars cpuAbi(env, javaCpuAbi); ScopedUtfChars cpuAbi2(env, javaCpuAbi2); ZipFileRO zipFile; if (zipFile.open(filePath.c_str()) != NO_ERROR) { ALOGI("Couldn't open APK %s/n", filePath.c_str()); return INSTALL_FAILED_INVALID_APK; } const int N = zipFile.getNumEntries(); char fileName[PATH_MAX]; bool hasPrimaryAbi = false;#ifdef WITH_HOUDINI bool useSecondaryAbi = false; bool noMatchAbi = false;#endif for (int i = 0; i < N; i++) { const ZipEntryRO entry = zipFile.findEntryByIndex(i); if (entry == NULL) { continue; } // Make sure this entry has a filename. if (zipFile.getEntryFileName(entry, fileName, sizeof(fileName))) { continue; } // Make sure we're in the lib directory of the ZIP. if (strncmp(fileName, APK_LIB, APK_LIB_LEN)) { continue; } // Make sure the filename is at least to the minimum library name size. const size_t fileNameLen = strlen(fileName); static const size_t minLength = APK_LIB_LEN + 2 + LIB_PREFIX_LEN + 1 + LIB_SUFFIX_LEN; if (fileNameLen < minLength) { continue; } const char* lastSlash = strrchr(fileName, '/'); ALOG_ASSERT(lastSlash != NULL, "last slash was null somehow for %s/n", fileName); // Check to make sure the CPU ABI of this file is one we support. const char* cpuAbiOffset = fileName + APK_LIB_LEN; const size_t cpuAbiRegionSize = lastSlash - cpuAbiOffset; ALOGV("Comparing ABIs %s and %s versus %s/n", cpuAbi.c_str(), cpuAbi2.c_str(), cpuAbiOffset); if (cpuAbi.size() == cpuAbiRegionSize && *(cpuAbiOffset + cpuAbi.size()) == '/' && !strncmp(cpuAbiOffset, cpuAbi.c_str(), cpuAbiRegionSize)) { ALOGV("Using primary ABI %s/n", cpuAbi.c_str()); hasPrimaryAbi = true; } else if (cpuAbi2.size() == cpuAbiRegionSize && *(cpuAbiOffset + cpuAbi2.size()) == '/' && !strncmp(cpuAbiOffset, cpuAbi2.c_str(), cpuAbiRegionSize)) { /* * If this library matches both the primary and secondary ABIs, * only use the primary ABI. */ if (hasPrimaryAbi) { ALOGV("Already saw primary ABI, skipping secondary ABI %s/n", cpuAbi2.c_str()); continue; } else {#ifdef WITH_HOUDINI useSecondaryAbi = true;#endif ALOGV("Using secondary ABI %s/n", cpuAbi2.c_str()); } } else {#ifdef WITH_HOUDINI noMatchAbi = true;#endif ALOGV("abi didn't match anything: %s (end at %zd)/n", cpuAbiOffset, cpuAbiRegionSize); continue; } // If this is a .so file, check to see if we need to copy it. if ((!strncmp(fileName + fileNameLen - LIB_SUFFIX_LEN, LIB_SUFFIX, LIB_SUFFIX_LEN) && !strncmp(lastSlash, LIB_PREFIX, LIB_PREFIX_LEN) && isFilenameSafe(lastSlash + 1)) || !strncmp(lastSlash + 1, GDBSERVER, GDBSERVER_LEN)) { install_status_t ret = callFunc(env, callArg, &zipFile, entry, lastSlash + 1); if (ret != INSTALL_SUCCEEDED) { ALOGV("Failure for entry %s", lastSlash + 1); return ret; } } }#ifdef WITH_HOUDINI//.........这里部分代码省略.........
开发者ID:nctusenselab,项目名称:android_frameworks_base,代码行数:101,
示例2: ALOGVstatus_t QCameraStream_Rdi::processRdiFrame( mm_camera_ch_data_buf_t *frame){ ALOGV("%s",__func__); int err = 0; int msgType = 0; int i; camera_memory_t *data = NULL; Mutex::Autolock lock(mStopCallbackLock); if(!mActive) { ALOGE("RDI Streaming Stopped. Returning callback"); return NO_ERROR; } if(mHalCamCtrl==NULL) { ALOGE("%s: X: HAL control object not set",__func__); /*Call buf done*/ return BAD_VALUE; } mHalCamCtrl->mRdiMemoryLock.lock(); mNotifyBuffer[frame->def.idx] = *frame; mHalCamCtrl->mRdiMemoryLock.unlock(); mHalCamCtrl->mCallbackLock.lock(); camera_data_callback pcb = mHalCamCtrl->mDataCb; mHalCamCtrl->mCallbackLock.unlock(); ALOGD("Message enabled = 0x%x", mHalCamCtrl->mMsgEnabled); mHalCamCtrl->dumpFrameToFile(frame->def.frame, HAL_DUMP_FRM_RDI);#ifdef USE_ION struct ion_flush_data cache_inv_data; int ion_fd; cache_inv_data.vaddr = (void *)frame->def.frame->buffer; cache_inv_data.fd = frame->def.frame->fd; cache_inv_data.handle = frame->def.frame->fd_data.handle; cache_inv_data.length = frame->def.frame->ion_alloc.len; ion_fd = frame->def.frame->ion_dev_fd; if (mHalCamCtrl->cache_ops(ion_fd, &cache_inv_data, ION_IOC_CLEAN_CACHES) < 0) ALOGE("%s: Cache clean for RDI buffer %p fd = %d failed", __func__, cache_inv_data.vaddr, cache_inv_data.fd);#endif if (pcb != NULL) { //Sending rdi callback if corresponding Msgs are enabled if(mHalCamCtrl->mMsgEnabled & CAMERA_MSG_PREVIEW_FRAME) { msgType |= CAMERA_MSG_PREVIEW_FRAME; data = mHalCamCtrl->mRdiMemory.camera_memory[frame->def.idx]; } else { data = NULL; } if(msgType) { mStopCallbackLock.unlock(); if(mActive) pcb(msgType, data, 0, NULL, mHalCamCtrl->mCallbackCookie); } ALOGD("end of cb"); } if(MM_CAMERA_OK != cam_evt_buf_done(mCameraId, &mNotifyBuffer[frame->def.idx])) { ALOGE("BUF DONE FAILED"); } return NO_ERROR;}
开发者ID:kongan,项目名称:input--,代码行数:67,
示例3: dexFileParse/* * Parse an optimized or unoptimized .dex file sitting in memory. This is * called after the byte-ordering and structure alignment has been fixed up. * * On success, return a newly-allocated DexFile. */DexFile* dexFileParse(const u1* data, size_t length, int flags){ DexFile* pDexFile = NULL; const DexHeader* pHeader; const u1* magic; int result = -1; if (length < sizeof(DexHeader)) { ALOGE("too short to be a valid .dex"); goto bail; /* bad file format */ } pDexFile = (DexFile*) malloc(sizeof(DexFile)); if (pDexFile == NULL) goto bail; /* alloc failure */ memset(pDexFile, 0, sizeof(DexFile)); /* * Peel off the optimized header. */ if (memcmp(data, DEX_OPT_MAGIC, 4) == 0) { magic = data; if (memcmp(magic+4, DEX_OPT_MAGIC_VERS, 4) != 0) { ALOGE("bad opt version (0x%02x %02x %02x %02x)", magic[4], magic[5], magic[6], magic[7]); goto bail; } pDexFile->pOptHeader = (const DexOptHeader*) data; ALOGV("Good opt header, DEX offset is %d, flags=0x%02x", pDexFile->pOptHeader->dexOffset, pDexFile->pOptHeader->flags); /* parse the optimized dex file tables */ if (!dexParseOptData(data, length, pDexFile)) goto bail; /* ignore the opt header and appended data from here on out */ data += pDexFile->pOptHeader->dexOffset; length -= pDexFile->pOptHeader->dexOffset; if (pDexFile->pOptHeader->dexLength > length) { ALOGE("File truncated? stored len=%d, rem len=%d", pDexFile->pOptHeader->dexLength, (int) length); goto bail; } length = pDexFile->pOptHeader->dexLength; } dexFileSetupBasicPointers(pDexFile, data); pHeader = pDexFile->pHeader; if (!dexHasValidMagic(pHeader)) { goto bail; } /* * Verify the checksum(s). This is reasonably quick, but does require * touching every byte in the DEX file. The base checksum changes after * byte-swapping and DEX optimization. */ if (flags & kDexParseVerifyChecksum) { u4 adler = dexComputeChecksum(pHeader); if (adler != pHeader->checksum) { ALOGE("ERROR: bad checksum (%08x vs %08x)", adler, pHeader->checksum); if (!(flags & kDexParseContinueOnError)) goto bail; } else { ALOGV("+++ adler32 checksum (%08x) verified", adler); } const DexOptHeader* pOptHeader = pDexFile->pOptHeader; if (pOptHeader != NULL) { adler = dexComputeOptChecksum(pOptHeader); if (adler != pOptHeader->checksum) { ALOGE("ERROR: bad opt checksum (%08x vs %08x)", adler, pOptHeader->checksum); if (!(flags & kDexParseContinueOnError)) goto bail; } else { ALOGV("+++ adler32 opt checksum (%08x) verified", adler); } } } /* * Verify the SHA-1 digest. (Normally we don't want to do this -- * the digest is used to uniquely identify the original DEX file, and * can't be computed for verification after the DEX is byte-swapped * and optimized.) */ if (kVerifySignature) { unsigned char sha1Digest[kSHA1DigestLen]; const int nonSum = sizeof(pHeader->magic) + sizeof(pHeader->checksum) + kSHA1DigestLen;//.........这里部分代码省略.........
开发者ID:MIPS,项目名称:dalvik,代码行数:101,
示例4: autoLockvoid BlockIterator::seek( int64_t seekTimeUs, bool isAudio, int64_t *actualFrameTimeUs) { Mutex::Autolock autoLock(mExtractor->mLock); *actualFrameTimeUs = -1ll; const int64_t seekTimeNs = seekTimeUs * 1000ll; mkvparser::Segment* const pSegment = mExtractor->mSegment; // Special case the 0 seek to avoid loading Cues when the application // extraneously seeks to 0 before playing. if (seekTimeNs <= 0) { ALOGV("Seek to beginning: %lld", seekTimeUs); mCluster = pSegment->GetFirst(); mBlockEntryIndex = 0; do { advance_l(); } while (!eos() && block()->GetTrackNumber() != mTrackNum); return; } ALOGV("Seeking to: %lld", seekTimeUs); // If the Cues have not been located then find them. const mkvparser::Cues* pCues = pSegment->GetCues(); const mkvparser::SeekHead* pSH = pSegment->GetSeekHead(); if (!pCues && pSH) { const size_t count = pSH->GetCount(); const mkvparser::SeekHead::Entry* pEntry; ALOGV("No Cues yet"); for (size_t index = 0; index < count; index++) { pEntry = pSH->GetEntry(index); if (pEntry->id == 0x0C53BB6B) { // Cues ID long len; long long pos; pSegment->ParseCues(pEntry->pos, pos, len); pCues = pSegment->GetCues(); ALOGV("Cues found"); break; } } if (!pCues) { ALOGE("No Cues in file"); return; } } else if (!pSH) { ALOGE("No SeekHead"); return; } const mkvparser::CuePoint* pCP; while (!pCues->DoneParsing()) { pCues->LoadCuePoint(); pCP = pCues->GetLast(); if (pCP->GetTime(pSegment) >= seekTimeNs) { ALOGV("Parsed past relevant Cue"); break; } } // The Cue index is built around video keyframes mkvparser::Tracks const *pTracks = pSegment->GetTracks(); const mkvparser::Track *pTrack = NULL; for (size_t index = 0; index < pTracks->GetTracksCount(); ++index) { pTrack = pTracks->GetTrackByIndex(index); if (pTrack && pTrack->GetType() == 1) { // VIDEO_TRACK ALOGV("Video track located at %d", index); break; } } // Always *search* based on the video track, but finalize based on mTrackNum const mkvparser::CuePoint::TrackPosition* pTP; if (pTrack && pTrack->GetType() == 1) { if (!pCues->Find(seekTimeNs, pTrack, pCP, pTP)) { ALOGE("Did not find cue-point for video track at %lld", seekTimeUs); return; } } else { ALOGE("Did not locate the video track for seeking"); return; } mCluster = pSegment->FindOrPreloadCluster(pTP->m_pos); CHECK(mCluster); CHECK(!mCluster->EOS()); // mBlockEntryIndex starts at 0 but m_block starts at 1 CHECK_GT(pTP->m_block, 0); mBlockEntryIndex = pTP->m_block - 1; for (;;) { advance_l();//.........这里部分代码省略.........
开发者ID:AOSP-Argon,项目名称:android_frameworks_av,代码行数:101,
示例5: unwind_backtrace_threadssize_t unwind_backtrace_thread(pid_t tid, backtrace_frame_t* backtrace, size_t ignore_depth, size_t max_depth) { if (tid == gettid()) { return unwind_backtrace(backtrace, ignore_depth + 1, max_depth); } ALOGV("Unwinding thread %d from thread %d.", tid, gettid());#ifdef CORKSCREW_HAVE_ARCH struct sigaction act; struct sigaction oact; memset(&act, 0, sizeof(act)); act.sa_sigaction = unwind_backtrace_thread_signal_handler; act.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK; sigemptyset(&act.sa_mask); pthread_mutex_lock(&g_unwind_signal_mutex); map_info_t* milist = acquire_my_map_info_list(); ssize_t frames = -1; if (!sigaction(SIGURG, &act, &oact)) { g_unwind_signal_state.map_info_list = milist; g_unwind_signal_state.backtrace = backtrace; g_unwind_signal_state.ignore_depth = ignore_depth; g_unwind_signal_state.max_depth = max_depth; g_unwind_signal_state.returned_frames = 0; android_atomic_release_store(tid, &g_unwind_signal_state.tid_state); // Signal the specific thread that we want to dump. int32_t tid_state = tid; if (tgkill(getpid(), tid, SIGURG)) { ALOGV("Failed to send SIGURG to thread %d.", tid); } else { // Wait for the other thread to start dumping the stack, or time out. int wait_millis = 250; for (;;) { tid_state = android_atomic_acquire_load(&g_unwind_signal_state.tid_state); if (tid_state != tid) { break; } if (wait_millis--) { ALOGV("Waiting for thread %d to start dumping the stack...", tid); usleep(1000); } else { ALOGV("Timed out waiting for thread %d to start dumping the stack.", tid); break; } } } // Try to cancel the dump if it has not started yet. if (tid_state == tid) { if (!android_atomic_acquire_cas(tid, STATE_CANCEL, &g_unwind_signal_state.tid_state)) { ALOGV("Canceled thread %d stack dump.", tid); tid_state = STATE_CANCEL; } else { tid_state = android_atomic_acquire_load(&g_unwind_signal_state.tid_state); } } // Wait indefinitely for the dump to finish or be canceled. // We cannot apply a timeout here because the other thread is accessing state that // is owned by this thread, such as milist. It should not take very // long to take the dump once started. while (tid_state == STATE_DUMPING) { ALOGV("Waiting for thread %d to finish dumping the stack...", tid); usleep(1000); tid_state = android_atomic_acquire_load(&g_unwind_signal_state.tid_state); } if (tid_state == STATE_DONE) { frames = g_unwind_signal_state.returned_frames; } sigaction(SIGURG, &oact, NULL); } release_my_map_info_list(milist); pthread_mutex_unlock(&g_unwind_signal_mutex); return frames;#else return -1;#endif}
开发者ID:0omega,项目名称:platform_system_core,代码行数:84,
示例6: CHECKstatus_t WifiDisplaySource::onReceiveClientData(const sp<AMessage> &msg) { int32_t sessionID; CHECK(msg->findInt32("sessionID", &sessionID)); sp<RefBase> obj; CHECK(msg->findObject("data", &obj)); sp<ParsedMessage> data = static_cast<ParsedMessage *>(obj.get()); ALOGV("session %d received '%s'", sessionID, data->debugString().c_str()); AString method; AString uri; data->getRequestField(0, &method); int32_t cseq; if (!data->findInt32("cseq", &cseq)) { sendErrorResponse(sessionID, "400 Bad Request", -1 /* cseq */); return ERROR_MALFORMED; } if (method.startsWith("RTSP/")) { // This is a response. ResponseID id; id.mSessionID = sessionID; id.mCSeq = cseq; ssize_t index = mResponseHandlers.indexOfKey(id); if (index < 0) { ALOGW("Received unsolicited server response, cseq %d", cseq); return ERROR_MALFORMED; } HandleRTSPResponseFunc func = mResponseHandlers.valueAt(index); mResponseHandlers.removeItemsAt(index); status_t err = (this->*func)(sessionID, data); if (err != OK) { ALOGW("Response handler for session %d, cseq %d returned " "err %d (%s)", sessionID, cseq, err, strerror(-err)); return err; } return OK; } AString version; data->getRequestField(2, &version); if (!(version == AString("RTSP/1.0"))) { sendErrorResponse(sessionID, "505 RTSP Version not supported", cseq); return ERROR_UNSUPPORTED; } status_t err; if (method == "OPTIONS") { err = onOptionsRequest(sessionID, cseq, data); } else if (method == "SETUP") { err = onSetupRequest(sessionID, cseq, data); } else if (method == "PLAY") { err = onPlayRequest(sessionID, cseq, data); } else if (method == "PAUSE") { err = onPauseRequest(sessionID, cseq, data); } else if (method == "TEARDOWN") { err = onTeardownRequest(sessionID, cseq, data); } else if (method == "GET_PARAMETER") { err = onGetParameterRequest(sessionID, cseq, data); } else if (method == "SET_PARAMETER") { err = onSetParameterRequest(sessionID, cseq, data); } else { sendErrorResponse(sessionID, "405 Method Not Allowed", cseq); err = ERROR_UNSUPPORTED; } return err;}
开发者ID:G620S-HUAWEI,项目名称:platform_frameworks_av,代码行数:83,
示例7: bassboost_get_strengthint bassboost_get_strength(bassboost_context_t *context){ ALOGV("%s: ctxt %p, strength: %d", __func__, context, context->strength); return context->strength;}
开发者ID:wjfsanhe,项目名称:Android5.1_hardware,代码行数:6,
示例8: CHECKstatus_t AudioPlayer::start(bool sourceAlreadyStarted) { CHECK(!mStarted); CHECK(mSource != NULL); status_t err; if (!sourceAlreadyStarted) { mSourcePaused = false; err = mSource->start(); if (err != OK) { return err; } } ALOGD("start of Playback, useOffload %d",useOffload()); // We allow an optional INFO_FORMAT_CHANGED at the very beginning // of playback, if there is one, getFormat below will retrieve the // updated format, if there isn't, we'll stash away the valid buffer // of data to be used on the first audio callback. CHECK(mFirstBuffer == NULL); MediaSource::ReadOptions options; if (mSeeking) { options.setSeekTo(mSeekTimeUs); } do { mFirstBufferResult = mSource->read(&mFirstBuffer, &options); } while (mFirstBufferResult == -EAGAIN); if (mFirstBufferResult == INFO_FORMAT_CHANGED) { ALOGV("INFO_FORMAT_CHANGED!!!"); CHECK(mFirstBuffer == NULL); mFirstBufferResult = OK; mIsFirstBuffer = false; if (mSeeking) { mPositionTimeRealUs = 0; mPositionTimeMediaUs = mSeekTimeUs; mSeeking = false; } } else { mIsFirstBuffer = true; if (mSeeking) { mPositionTimeRealUs = 0; if (mFirstBuffer == NULL || !mFirstBuffer->meta_data()->findInt64( kKeyTime, &mPositionTimeMediaUs)) { return UNKNOWN_ERROR; } mSeeking = false; } } sp<MetaData> format = mSource->getFormat(); const char *mime; bool success = format->findCString(kKeyMIMEType, &mime); CHECK(success); CHECK(useOffload() || !strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_RAW)); success = format->findInt32(kKeySampleRate, &mSampleRate); CHECK(success); int32_t numChannels, channelMask = 0; success = format->findInt32(kKeyChannelCount, &numChannels); CHECK(success); format->findInt64(kKeyDuration, &mDurationUs); if(!format->findInt32(kKeyChannelMask, &channelMask)) { // log only when there's a risk of ambiguity of channel mask selection ALOGI_IF(numChannels > 2, "source format didn't specify channel mask, using (%d) channel order", numChannels); channelMask = CHANNEL_MASK_USE_CHANNEL_ORDER; } else if (channelMask == 0) { channelMask = audio_channel_out_mask_from_count(numChannels); ALOGV("channel mask is zero,update from channel count %d", channelMask); } audio_format_t audioFormat = AUDIO_FORMAT_PCM_16_BIT; int32_t bitWidth = 16;#if defined(ENABLE_AV_ENHANCEMENTS) || defined(ENABLE_OFFLOAD_ENHANCEMENTS) format->findInt32(kKeySampleBits, &bitWidth);#endif if (useOffload()) { if (mapMimeToAudioFormat(audioFormat, mime) != OK) { ALOGE("Couldn't map mime type /"%s/" to a valid AudioSystem::audio_format", mime); audioFormat = AUDIO_FORMAT_INVALID; } else if (audio_is_linear_pcm(audioFormat) || audio_is_offload_pcm(audioFormat)) {#if defined(QCOM_HARDWARE) || defined(ENABLE_OFFLOAD_ENHANCEMENTS) // Override audio format for PCM offload if (bitWidth >= 24) { ALOGD("24-bit PCM offload enabled format=%d", audioFormat); audioFormat = AUDIO_FORMAT_PCM_24_BIT_OFFLOAD;//.........这里部分代码省略.........
开发者ID:brianwoo,项目名称:cm11_grouper,代码行数:101,
示例9: ATRACE_CALLsize_t AudioPlayer::fillBuffer(void *data, size_t size) { ATRACE_CALL(); if (mNumFramesPlayed == 0) { ALOGV("AudioCallback"); } if (mReachedEOS) { return 0; } bool postSeekComplete = false; bool postEOS = false; int64_t postEOSDelayUs = 0; size_t size_done = 0; size_t size_remaining = size; while (size_remaining > 0) { MediaSource::ReadOptions options; bool refreshSeekTime = false; { Mutex::Autolock autoLock(mLock); if (mSeeking) { if (mIsFirstBuffer) { if (mFirstBuffer != NULL) { mFirstBuffer->release(); mFirstBuffer = NULL; } mIsFirstBuffer = false; } options.setSeekTo(mSeekTimeUs); refreshSeekTime = true; if (mInputBuffer != NULL) { mInputBuffer->release(); mInputBuffer = NULL; } mSeeking = false; if (mObserver) { postSeekComplete = true; } } } if (mInputBuffer == NULL) { status_t err; if (mIsFirstBuffer) { mInputBuffer = mFirstBuffer; mFirstBuffer = NULL; err = mFirstBufferResult; mIsFirstBuffer = false; } else { if(!mSourcePaused) { err = mSource->read(&mInputBuffer, &options); if (err == OK && mInputBuffer == NULL && mSourcePaused) { ALOGV("mSourcePaused, return 0 from fillBuffer"); return 0; } } else { break; } } if(err == -EAGAIN) { if(mSourcePaused){ break; } else { continue; } } CHECK((err == OK && mInputBuffer != NULL) || (err != OK && mInputBuffer == NULL)); Mutex::Autolock autoLock(mLock); if (err != OK && err != INFO_FORMAT_CHANGED) { if (!mReachedEOS) { if (useOffload()) { // After seek there is a possible race condition if // OffloadThread is observing state_stopping_1 before // framesReady() > 0. Ensure sink stop is called // after last buffer is released. This ensures the // partial buffer is written to the driver before // stopping one is observed.The drawback is that // there will be an unnecessary call to the parser // after parser signalled EOS. int64_t playPosition = 0; playPosition = getOutputPlayPositionUs_l(); if ((size_done > 0) && (playPosition < mDurationUs)) { ALOGW("send Partial buffer down/n"); ALOGW("skip calling stop till next fillBuffer/n"); break; }//.........这里部分代码省略.........
开发者ID:brianwoo,项目名称:cm11_grouper,代码行数:101,
示例10: offload_reverb_send_paramsint offload_reverb_send_params(struct mixer_ctl *ctl, struct reverb_params reverb, unsigned param_send_flags){ int param_values[128] = {0}; int *p_param_values = param_values; ALOGV("%s: flags 0x%x", __func__, param_send_flags); *p_param_values++ = REVERB_MODULE; *p_param_values++ = reverb.device; *p_param_values++ = 0; /* num of commands*/ if (param_send_flags & OFFLOAD_SEND_REVERB_ENABLE_FLAG) { *p_param_values++ = REVERB_ENABLE; *p_param_values++ = CONFIG_SET; *p_param_values++ = 0; /* start offset if param size if greater than 128 */ *p_param_values++ = REVERB_ENABLE_PARAM_LEN; *p_param_values++ = reverb.enable_flag; param_values[2] += 1; } if (param_send_flags & OFFLOAD_SEND_REVERB_MODE) { *p_param_values++ = REVERB_MODE; *p_param_values++ = CONFIG_SET; *p_param_values++ = 0; /* start offset if param size if greater than 128 */ *p_param_values++ = REVERB_MODE_PARAM_LEN; *p_param_values++ = reverb.mode; param_values[2] += 1; } if (param_send_flags & OFFLOAD_SEND_REVERB_PRESET) { *p_param_values++ = REVERB_PRESET; *p_param_values++ = CONFIG_SET; *p_param_values++ = 0; /* start offset if param size if greater than 128 */ *p_param_values++ = REVERB_PRESET_PARAM_LEN; *p_param_values++ = reverb.preset; param_values[2] += 1; } if (param_send_flags & OFFLOAD_SEND_REVERB_WET_MIX) { *p_param_values++ = REVERB_WET_MIX; *p_param_values++ = CONFIG_SET; *p_param_values++ = 0; /* start offset if param size if greater than 128 */ *p_param_values++ = REVERB_WET_MIX_PARAM_LEN; *p_param_values++ = reverb.wet_mix; param_values[2] += 1; } if (param_send_flags & OFFLOAD_SEND_REVERB_GAIN_ADJUST) { *p_param_values++ = REVERB_GAIN_ADJUST; *p_param_values++ = CONFIG_SET; *p_param_values++ = 0; /* start offset if param size if greater than 128 */ *p_param_values++ = REVERB_GAIN_ADJUST_PARAM_LEN; *p_param_values++ = reverb.gain_adjust; param_values[2] += 1; } if (param_send_flags & OFFLOAD_SEND_REVERB_ROOM_LEVEL) { *p_param_values++ = REVERB_ROOM_LEVEL; *p_param_values++ = CONFIG_SET; *p_param_values++ = 0; /* start offset if param size if greater than 128 */ *p_param_values++ = REVERB_ROOM_LEVEL_PARAM_LEN; *p_param_values++ = reverb.room_level; param_values[2] += 1; } if (param_send_flags & OFFLOAD_SEND_REVERB_ROOM_HF_LEVEL) { *p_param_values++ = REVERB_ROOM_HF_LEVEL; *p_param_values++ = CONFIG_SET; *p_param_values++ = 0; /* start offset if param size if greater than 128 */ *p_param_values++ = REVERB_ROOM_HF_LEVEL_PARAM_LEN; *p_param_values++ = reverb.room_hf_level; param_values[2] += 1; } if (param_send_flags & OFFLOAD_SEND_REVERB_DECAY_TIME) { *p_param_values++ = REVERB_DECAY_TIME; *p_param_values++ = CONFIG_SET; *p_param_values++ = 0; /* start offset if param size if greater than 128 */ *p_param_values++ = REVERB_DECAY_TIME_PARAM_LEN; *p_param_values++ = reverb.decay_time; param_values[2] += 1; } if (param_send_flags & OFFLOAD_SEND_REVERB_DECAY_HF_RATIO) { *p_param_values++ = REVERB_DECAY_HF_RATIO; *p_param_values++ = CONFIG_SET; *p_param_values++ = 0; /* start offset if param size if greater than 128 */ *p_param_values++ = REVERB_DECAY_HF_RATIO_PARAM_LEN; *p_param_values++ = reverb.decay_hf_ratio; param_values[2] += 1; } if (param_send_flags & OFFLOAD_SEND_REVERB_REFLECTIONS_LEVEL) { *p_param_values++ = REVERB_REFLECTIONS_LEVEL; *p_param_values++ = CONFIG_SET; *p_param_values++ = 0; /* start offset if param size if greater than 128 */ *p_param_values++ = REVERB_REFLECTIONS_LEVEL_PARAM_LEN; *p_param_values++ = reverb.reflections_level; param_values[2] += 1; } if (param_send_flags & OFFLOAD_SEND_REVERB_REFLECTIONS_DELAY) { *p_param_values++ = REVERB_REFLECTIONS_DELAY; *p_param_values++ = CONFIG_SET; *p_param_values++ = 0; /* start offset if param size if greater than 128 */ *p_param_values++ = REVERB_REFLECTIONS_DELAY_PARAM_LEN; *p_param_values++ = reverb.reflections_delay; param_values[2] += 1; }//.........这里部分代码省略.........
开发者ID:Silentlys,项目名称:CyanogenMod_hardware_qcom_audio-caf_msm8916,代码行数:101,
示例11: ALOGVvoid AudioSource::waitOutstandingEncodingFrames_l() { ALOGV("waitOutstandingEncodingFrames_l: %lld", mNumClientOwnedBuffers); while (mNumClientOwnedBuffers > 0) { mFrameEncodingCompletionCondition.wait(mLock); }}
开发者ID:Android4SAM,项目名称:platform_frameworks_av,代码行数:6,
示例12: wifi_wait_on_socketint wifi_wait_on_socket(char *buf, size_t buflen){ size_t nread = buflen - 1; int result; char *match, *match2; if (monitor_conn == NULL) { return snprintf(buf, buflen, WPA_EVENT_TERMINATING " - connection closed"); } result = wifi_ctrl_recv(buf, &nread); /* Terminate reception on exit socket */ if (result == -2) { return snprintf(buf, buflen, WPA_EVENT_TERMINATING " - connection closed"); } if (result < 0) { ALOGD("wifi_ctrl_recv failed: %s/n", strerror(errno)); return snprintf(buf, buflen, WPA_EVENT_TERMINATING " - recv error"); } buf[nread] = '/0'; /* Check for EOF on the socket */ if (result == 0 && nread == 0) { /* Fabricate an event to pass up */ ALOGD("Received EOF on supplicant socket/n"); return snprintf(buf, buflen, WPA_EVENT_TERMINATING " - signal 0 received"); } /* * Events strings are in the format * * IFNAME=iface <N>CTRL-EVENT-XXX * or * <N>CTRL-EVENT-XXX * * where N is the message level in numerical form (0=VERBOSE, 1=DEBUG, * etc.) and XXX is the event name. The level information is not useful * to us, so strip it off. */ if (strncmp(buf, IFNAME, IFNAMELEN) == 0) { match = strchr(buf, ' '); if (match != NULL) { if (match[1] == '<') { match2 = strchr(match + 2, '>'); if (match2 != NULL) { nread -= (match2 - match); memmove(match + 1, match2 + 1, nread - (match - buf) + 1); } } } else { return snprintf(buf, buflen, "%s", WPA_EVENT_IGNORE); } } else if (buf[0] == '<') { match = strchr(buf, '>'); if (match != NULL) { nread -= (match + 1 - buf); memmove(buf, match + 1, nread + 1); ALOGV("supplicant generated event without interface - %s/n", buf); } } else { /* let the event go as is! */ ALOGW("supplicant generated event without interface and without message level - %s/n", buf); } return nread;}
开发者ID:jedroid,项目名称:hardware_libhardware_legacy,代码行数:67,
示例13: memset/*=========================================================================== * FUNCTION : allocate * * DESCRIPTION: allocate requested number of buffers of certain size * * PARAMETERS : * @count : number of buffers to be allocated * @size : lenght of the buffer to be allocated * * RETURN : int32_t type of status * NO_ERROR -- success * none-zero failure code *==========================================================================*/int QCameraGrallocMemory::allocate(int count, int /*size*/){ int err = 0; status_t ret = NO_ERROR; int gralloc_usage = 0; struct ion_fd_data ion_info_fd; memset(&ion_info_fd, 0, sizeof(ion_info_fd)); ALOGI(" %s : E ", __FUNCTION__); if (!mWindow) { ALOGE("Invalid native window"); return INVALID_OPERATION; } // Increment buffer count by min undequeued buffer. err = mWindow->get_min_undequeued_buffer_count(mWindow,&mMinUndequeuedBuffers); if (err != 0) { ALOGE("get_min_undequeued_buffer_count failed: %s (%d)", strerror(-err), -err); ret = UNKNOWN_ERROR; goto end; } count += mMinUndequeuedBuffers; err = mWindow->set_buffer_count(mWindow, count); if (err != 0) { ALOGE("set_buffer_count failed: %s (%d)", strerror(-err), -err); ret = UNKNOWN_ERROR; goto end; } err = mWindow->set_buffers_geometry(mWindow, mWidth, mHeight, mFormat); if (err != 0) { ALOGE("%s: set_buffers_geometry failed: %s (%d)", __func__, strerror(-err), -err); ret = UNKNOWN_ERROR; goto end; } gralloc_usage = GRALLOC_USAGE_PRIVATE_IOMMU_HEAP; err = mWindow->set_usage(mWindow, gralloc_usage); if(err != 0) { /* set_usage error out */ ALOGE("%s: set_usage rc = %d", __func__, err); ret = UNKNOWN_ERROR; goto end; } ALOGD("%s: usage = %d, geometry: %p, %d, %d, %d", __func__, gralloc_usage, mWindow, mWidth, mHeight, mFormat); //Allocate cnt number of buffers from native window for (int cnt = 0; cnt < count; cnt++) { int stride; err = mWindow->dequeue_buffer(mWindow, &mBufferHandle[cnt], &stride); if(!err) { ALOGV("dequeue buf hdl =%p", mBufferHandle[cnt]); mLocalFlag[cnt] = BUFFER_OWNED; } else { mLocalFlag[cnt] = BUFFER_NOT_OWNED; ALOGE("%s: dequeue_buffer idx = %d err = %d", __func__, cnt, err); } ALOGV("%s: dequeue buf: %p/n", __func__, mBufferHandle[cnt]); if(err != 0) { ALOGE("%s: dequeue_buffer failed: %s (%d)", __func__, strerror(-err), -err); ret = UNKNOWN_ERROR; for(int i = 0; i < cnt; i++) { if(mLocalFlag[i] != BUFFER_NOT_OWNED) { err = mWindow->cancel_buffer(mWindow, mBufferHandle[i]); ALOGD("%s: cancel_buffer: hdl =%p", __func__, (*mBufferHandle[i])); } mLocalFlag[i] = BUFFER_NOT_OWNED; mBufferHandle[i] = NULL; } memset(&mMemInfo, 0, sizeof(mMemInfo)); goto end; } mPrivateHandle[cnt] = (struct private_handle_t *)(*mBufferHandle[cnt]); mMemInfo[cnt].main_ion_fd = open("/dev/ion", O_RDONLY); if (mMemInfo[cnt].main_ion_fd < 0) { ALOGE("%s: failed: could not open ion device", __func__);//.........这里部分代码省略.........
开发者ID:10114395,项目名称:android-5.0.0_r5,代码行数:101,
示例14: dvmGetThreadStats/* * Get some per-thread stats. * * This is currently generated by opening the appropriate "stat" file * in /proc and reading the pile of stuff that comes out. */bool dvmGetThreadStats(ProcStatData* pData, pid_t tid){ /* int pid; char comm[128]; char state; int ppid, pgrp, session, tty_nr, tpgid; unsigned long flags, minflt, cminflt, majflt, cmajflt, utime, stime; long cutime, cstime, priority, nice, zero, itrealvalue; unsigned long starttime, vsize; long rss; unsigned long rlim, startcode, endcode, startstack, kstkesp, kstkeip; unsigned long signal, blocked, sigignore, sigcatch, wchan, nswap, cnswap; int exit_signal, processor; unsigned long rt_priority, policy; scanf("%d %s %c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld " "%ld %ld %ld %lu %lu %ld %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu " "%lu %lu %lu %d %d %lu %lu", &pid, comm, &state, &ppid, &pgrp, &session, &tty_nr, &tpgid, &flags, &minflt, &cminflt, &majflt, &cmajflt, &utime, &stime, &cutime, &cstime, &priority, &nice, &zero, &itrealvalue, &starttime, &vsize, &rss, &rlim, &startcode, &endcode, &startstack, &kstkesp, &kstkeip, &signal, &blocked, &sigignore, &sigcatch, &wchan, &nswap, &cnswap, &exit_signal, &processor, &rt_priority, &policy); (new: delayacct_blkio_ticks %llu (since Linux 2.6.18)) */ char nameBuf[64]; int i, fd; /* * Open and read the appropriate file. This is expected to work on * Linux but will fail on other platforms (e.g. Mac sim). */ sprintf(nameBuf, "/proc/self/task/%d/stat", (int) tid); fd = open(nameBuf, O_RDONLY); if (fd < 0) { ALOGV("Unable to open '%s': %s", nameBuf, strerror(errno)); return false; } char lineBuf[512]; /* > 2x typical */ int cc = read(fd, lineBuf, sizeof(lineBuf)-1); if (cc <= 0) { const char* msg = (cc == 0) ? "unexpected EOF" : strerror(errno); ALOGI("Unable to read '%s': %s", nameBuf, msg); close(fd); return false; } close(fd); lineBuf[cc] = '/0'; /* * Skip whitespace-separated tokens. For the most part we can assume * that tokens do not contain spaces, and are separated by exactly one * space character. The only exception is the second field ("comm") * which may contain spaces but is surrounded by parenthesis. */ char* cp = strchr(lineBuf, ')'); if (cp == NULL) goto parse_fail; cp++; for (i = 2; i < 13; i++) { cp = strchr(cp+1, ' '); if (cp == NULL) goto parse_fail; } /* * Grab utime/stime. */ char* endp; pData->utime = strtoul(cp+1, &endp, 10); if (endp == cp+1) ALOGI("Warning: strtoul failed on utime ('%.30s...')", cp); cp = strchr(cp+1, ' '); if (cp == NULL) goto parse_fail; pData->stime = strtoul(cp+1, &endp, 10); if (endp == cp+1) ALOGI("Warning: strtoul failed on stime ('%.30s...')", cp); /* * Skip more stuff we don't care about. */ for (i = 14; i < 38; i++) { cp = strchr(cp+1, ' '); if (cp == NULL) goto parse_fail;//.........这里部分代码省略.........
开发者ID:MistaGiggles,项目名称:llvm-jit-project,代码行数:101,
示例15: dvmConvertPrimitiveValue//.........这里部分代码省略......... assert((srcType != PRIM_VOID) && (srcType != PRIM_NOT)); assert((dstType != PRIM_VOID) && (dstType != PRIM_NOT)); switch (dstType) { case PRIM_BOOLEAN: case PRIM_CHAR: case PRIM_BYTE: { conv = (srcType == dstType) ? OK4 : bad; break; } case PRIM_SHORT: { switch (srcType) { case PRIM_BYTE: case PRIM_SHORT: conv = OK4; break; default: conv = bad; break; } break; } case PRIM_INT: { switch (srcType) { case PRIM_BYTE: case PRIM_CHAR: case PRIM_SHORT: case PRIM_INT: conv = OK4; break; default: conv = bad; break; } break; } case PRIM_LONG: { switch (srcType) { case PRIM_BYTE: case PRIM_CHAR: case PRIM_SHORT: case PRIM_INT: conv = ItoJ; break; case PRIM_LONG: conv = OK8; break; default: conv = bad; break; } break; } case PRIM_FLOAT: { switch (srcType) { case PRIM_BYTE: case PRIM_CHAR: case PRIM_SHORT: case PRIM_INT: conv = ItoF; break; case PRIM_LONG: conv = JtoF; break; case PRIM_FLOAT: conv = OK4; break; default: conv = bad; break; } break; } case PRIM_DOUBLE: { switch (srcType) { case PRIM_BYTE: case PRIM_CHAR: case PRIM_SHORT: case PRIM_INT: conv = ItoD; break; case PRIM_LONG: conv = JtoD; break; case PRIM_FLOAT: conv = FtoD; break; case PRIM_DOUBLE: conv = OK8; break; default: conv = bad; break; } break; } case PRIM_VOID: case PRIM_NOT: default: { conv = bad; break; } } switch (conv) { case OK4: *dstPtr = *srcPtr; return 1; case OK8: *(s8*) dstPtr = *(s8*)srcPtr; return 2; case ItoJ: *(s8*) dstPtr = (s8) (*(s4*) srcPtr); return 2;#ifndef ARCH_HAVE_ALIGNED_DOUBLES case ItoD: *(double*) dstPtr = (double) (*(s4*) srcPtr); return 2; case JtoD: *(double*) dstPtr = (double) (*(long long*) srcPtr); return 2; case FtoD: *(double*) dstPtr = (double) (*(float*) srcPtr); return 2;#else case ItoD: ret = (double) (*(s4*) srcPtr); memcpy(dstPtr, &ret, 8); return 2; case JtoD: ret = (double) (*(long long*) srcPtr); memcpy(dstPtr, &ret, 8); return 2; case FtoD: ret = (double) (*(float*) srcPtr); memcpy(dstPtr, &ret, 8); return 2;#endif case ItoF: *(float*) dstPtr = (float) (*(int*) srcPtr); return 1; case JtoF: *(float*) dstPtr = (float) (*(long long*) srcPtr); return 1; case bad: { ALOGV("illegal primitive conversion: '%s' to '%s'", dexGetPrimitiveTypeDescriptor(srcType), dexGetPrimitiveTypeDescriptor(dstType)); return -1; } default: { dvmAbort(); return -1; // Keep the compiler happy. } }}
开发者ID:tempbottle,项目名称:aprotector,代码行数:101,
示例16: setNativeWindowSizeFormatAndUsagestatus_t setNativeWindowSizeFormatAndUsage( ANativeWindow *nativeWindow /* nonnull */, int width, int height, int format, int rotation, int usage, bool reconnect) { status_t err = NO_ERROR; // In some cases we need to reconnect so that we can dequeue all buffers if (reconnect) { err = native_window_api_disconnect(nativeWindow, NATIVE_WINDOW_API_MEDIA); if (err != NO_ERROR) { ALOGE("native_window_api_disconnect failed: %s (%d)", strerror(-err), -err); return err; } err = native_window_api_connect(nativeWindow, NATIVE_WINDOW_API_MEDIA); if (err != NO_ERROR) { ALOGE("native_window_api_connect failed: %s (%d)", strerror(-err), -err); return err; } } err = native_window_set_buffers_dimensions(nativeWindow, width, height); if (err != NO_ERROR) { ALOGE("native_window_set_buffers_dimensions failed: %s (%d)", strerror(-err), -err); return err; } err = native_window_set_buffers_format(nativeWindow, format); if (err != NO_ERROR) { ALOGE("native_window_set_buffers_format failed: %s (%d)", strerror(-err), -err); return err; } int transform = 0; if ((rotation % 90) == 0) { switch ((rotation / 90) & 3) { case 1: transform = HAL_TRANSFORM_ROT_90; break; case 2: transform = HAL_TRANSFORM_ROT_180; break; case 3: transform = HAL_TRANSFORM_ROT_270; break; default: transform = 0; break; } } err = native_window_set_buffers_transform(nativeWindow, transform); if (err != NO_ERROR) { ALOGE("native_window_set_buffers_transform failed: %s (%d)", strerror(-err), -err); return err; } int consumerUsage = 0; err = nativeWindow->query(nativeWindow, NATIVE_WINDOW_CONSUMER_USAGE_BITS, &consumerUsage); if (err != NO_ERROR) { ALOGW("failed to get consumer usage bits. ignoring"); err = NO_ERROR; } // Make sure to check whether either Stagefright or the video decoder // requested protected buffers. if (usage & GRALLOC_USAGE_PROTECTED) { // Check if the ANativeWindow sends images directly to SurfaceFlinger. int queuesToNativeWindow = 0; err = nativeWindow->query( nativeWindow, NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER, &queuesToNativeWindow); if (err != NO_ERROR) { ALOGE("error authenticating native window: %s (%d)", strerror(-err), -err); return err; } // Check if the ANativeWindow uses hardware protected buffers. if (queuesToNativeWindow != 1 && !(consumerUsage & GRALLOC_USAGE_PROTECTED)) { ALOGE("native window could not be authenticated"); return PERMISSION_DENIED; } } int finalUsage = usage | consumerUsage; ALOGV("gralloc usage: %#x(producer) + %#x(consumer) = %#x", usage, consumerUsage, finalUsage); err = native_window_set_usage(nativeWindow, finalUsage); if (err != NO_ERROR) { ALOGE("native_window_set_usage failed: %s (%d)", strerror(-err), -err); return err; } err = native_window_set_scaling_mode( nativeWindow, NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW); if (err != NO_ERROR) { ALOGE("native_window_set_scaling_mode failed: %s (%d)", strerror(-err), -err); return err; } ALOGD("set up nativeWindow %p for %dx%d, color %#x, rotation %d, usage %#x", nativeWindow, width, height, format, rotation, finalUsage); return NO_ERROR;}
开发者ID:android-source,项目名称:platform_frameworks_av,代码行数:93,
示例17: ALOGVvoid BlockIterator::advance_l() { for (;;) { long res = mCluster->GetEntry(mBlockEntryIndex, mBlockEntry); ALOGV("GetEntry returned %ld", res); long long pos; long len; if (res < 0) { // Need to parse this cluster some more CHECK_EQ(res, mkvparser::E_BUFFER_NOT_FULL); res = mCluster->Parse(pos, len); ALOGV("Parse returned %ld", res); if (res < 0) { // I/O error ALOGE("Cluster::Parse returned result %ld", res); mCluster = NULL; break; } continue; } else if (res == 0) { // We're done with this cluster const mkvparser::Cluster *nextCluster; res = mExtractor->mSegment->ParseNext( mCluster, nextCluster, pos, len); ALOGV("ParseNext returned %ld", res); if (res != 0) { // EOF or error mCluster = NULL; break; } CHECK_EQ(res, 0); CHECK(nextCluster != NULL); CHECK(!nextCluster->EOS()); mCluster = nextCluster; res = mCluster->Parse(pos, len); ALOGV("Parse (2) returned %ld", res); CHECK_GE(res, 0); mBlockEntryIndex = 0; continue; } CHECK(mBlockEntry != NULL); CHECK(mBlockEntry->GetBlock() != NULL); ++mBlockEntryIndex; if (mBlockEntry->GetBlock()->GetTrackNumber() == mTrackNum) { break; } }}
开发者ID:AOSP-Argon,项目名称:android_frameworks_av,代码行数:63,
示例18: sizeof// staticsp<VBRISeeker> VBRISeeker::CreateFromSource( const sp<DataSource> &source, off64_t post_id3_pos) { off64_t pos = post_id3_pos; uint8_t header[4]; ssize_t n = source->readAt(pos, header, sizeof(header)); if (n < (ssize_t)sizeof(header)) { return NULL; } uint32_t tmp = U32_AT(&header[0]); size_t frameSize; int sampleRate; if (!GetMPEGAudioFrameSize(tmp, &frameSize, &sampleRate)) { return NULL; } // VBRI header follows 32 bytes after the header _ends_. pos += sizeof(header) + 32; uint8_t vbriHeader[26]; n = source->readAt(pos, vbriHeader, sizeof(vbriHeader)); if (n < (ssize_t)sizeof(vbriHeader)) { return NULL; } if (memcmp(vbriHeader, "VBRI", 4)) { return NULL; } size_t numFrames = U32_AT(&vbriHeader[14]); int64_t durationUs = numFrames * 1000000ll * (sampleRate >= 32000 ? 1152 : 576) / sampleRate; ALOGV("duration = %.2f secs", durationUs / 1E6); size_t numEntries = U16_AT(&vbriHeader[18]); size_t entrySize = U16_AT(&vbriHeader[22]); size_t scale = U16_AT(&vbriHeader[20]); ALOGV("%zu entries, scale=%zu, size_per_entry=%zu", numEntries, scale, entrySize); size_t totalEntrySize = numEntries * entrySize; uint8_t *buffer = new uint8_t[totalEntrySize]; n = source->readAt(pos + sizeof(vbriHeader), buffer, totalEntrySize); if (n < (ssize_t)totalEntrySize) { delete[] buffer; buffer = NULL; return NULL; } sp<VBRISeeker> seeker = new VBRISeeker; seeker->mBasePos = post_id3_pos + frameSize; // only update mDurationUs if the calculated duration is valid (non zero) // otherwise, leave duration at -1 so that getDuration() and getOffsetForTime() // return false when called, to indicate that this vbri tag does not have the // requested information if (durationUs) { seeker->mDurationUs = durationUs; } off64_t offset = post_id3_pos; for (size_t i = 0; i < numEntries; ++i) { uint32_t numBytes; switch (entrySize) { case 1: numBytes = buffer[i]; break; case 2: numBytes = U16_AT(buffer + 2 * i); break; case 3: numBytes = U24_AT(buffer + 3 * i); break; default: { CHECK_EQ(entrySize, 4u); numBytes = U32_AT(buffer + 4 * i); break; } } numBytes *= scale; seeker->mSegments.push(numBytes); ALOGV("entry #%zu: %u offset %#016llx", i, numBytes, (long long)offset); offset += numBytes; } delete[] buffer; buffer = NULL; ALOGI("Found VBRI header."); return seeker;}
开发者ID:android-source,项目名称:platform_frameworks_av,代码行数:97,
示例19: ALOGVCallbackDataSource::~CallbackDataSource() { ALOGV("~CallbackDataSource"); mIDataSource->close();}
开发者ID:Hazy-legacy-zf2,项目名称:platform_frameworks_av,代码行数:4,
示例20: ALOGE//.........这里部分代码省略......... } /* set 4 buffers for display */ memset(&mRdiStreamBuf, 0, sizeof(mRdiStreamBuf)); mHalCamCtrl->mRdiMemoryLock.lock(); this->mRdiStreamBuf.num = mHalCamCtrl->mRdiMemory.buffer_count; this->myMode=myMode; /*Need to assign this in constructor after translating from mask*/ frame_len = mm_camera_get_msm_frame_len(CAMERA_RDI, myMode, dim.rdi0_width, dim.rdi0_height, OUTPUT_TYPE_R, &num_planes, planes); this->mRdiStreamBuf.frame_len = frame_len; memset(&mRdiBuf, 0, sizeof(mRdiBuf)); mRdiBuf.def.buf.mp = new mm_camera_mp_buf_t[mRdiStreamBuf.num]; if (!mRdiBuf.def.buf.mp) { ALOGE("%s Error allocating memory for mplanar struct ", __func__); } memset(mRdiBuf.def.buf.mp, 0, mRdiStreamBuf.num * sizeof(mm_camera_mp_buf_t)); /*allocate memory for the buffers*/ void *vaddr = NULL; for(int i = 0; i < mRdiStreamBuf.num; i++){ if (mHalCamCtrl->mRdiMemory.camera_memory[i] == NULL) continue; mRdiStreamBuf.frame[i].fd = mHalCamCtrl->mRdiMemory.fd[i]; mRdiStreamBuf.frame[i].cbcr_off = planes[0]; mRdiStreamBuf.frame[i].y_off = 0; mRdiStreamBuf.frame[i].path = OUTPUT_TYPE_R; mRdiStreamBuf.frame[i].buffer = (long unsigned int)mHalCamCtrl->mRdiMemory.camera_memory[i]->data; mRdiStreamBuf.frame[i].ion_alloc.len = mHalCamCtrl->mRdiMemory.alloc[i].len; ALOGE("%s: idx = %d, fd = %d, size = %d, cbcr_offset = %d, y_offset = %d, " "vaddr = 0x%x", __func__, i, mRdiStreamBuf.frame[i].fd, frame_len, mRdiStreamBuf.frame[i].cbcr_off, mRdiStreamBuf.frame[i].y_off, (uint32_t)mRdiStreamBuf.frame[i].buffer); if (NO_ERROR != mHalCamCtrl->sendMappingBuf( MSM_V4L2_EXT_CAPTURE_MODE_RDI, i, mRdiStreamBuf.frame[i].fd, mHalCamCtrl->mRdiMemory.size, mCameraId, CAM_SOCK_MSG_TYPE_FD_MAPPING)) { ALOGE("%s: sending mapping data Msg Failed", __func__); } mRdiBuf.def.buf.mp[i].frame = mRdiStreamBuf.frame[i]; mRdiBuf.def.buf.mp[i].frame_offset = mRdiStreamBuf.frame[i].y_off; mRdiBuf.def.buf.mp[i].num_planes = num_planes; /* Plane 0 needs to be set seperately. Set other planes * in a loop. */ mRdiBuf.def.buf.mp[i].planes[0].length = planes[0]; mRdiBuf.def.buf.mp[i].planes[0].m.userptr = mRdiStreamBuf.frame[i].fd; mRdiBuf.def.buf.mp[i].planes[0].data_offset = 0; mRdiBuf.def.buf.mp[i].planes[0].reserved[0] = mRdiBuf.def.buf.mp[i].frame_offset; for (int j = 1; j < num_planes; j++) { mRdiBuf.def.buf.mp[i].planes[j].length = planes[j]; mRdiBuf.def.buf.mp[i].planes[j].m.userptr = mRdiStreamBuf.frame[i].fd; mRdiBuf.def.buf.mp[i].planes[j].data_offset = 0; mRdiBuf.def.buf.mp[i].planes[j].reserved[0] = mRdiBuf.def.buf.mp[i].planes[j-1].reserved[0] + mRdiBuf.def.buf.mp[i].planes[j-1].length; } for (int j = 0; j < num_planes; j++) ALOGE("Planes: %d length: %d userptr: %lu offset: %d/n", j, mRdiBuf.def.buf.mp[i].planes[j].length, mRdiBuf.def.buf.mp[i].planes[j].m.userptr, mRdiBuf.def.buf.mp[i].planes[j].reserved[0]); }/*end of for loop*/ /* register the streaming buffers for the channel*/ mRdiBuf.ch_type = MM_CAMERA_CH_RDI; mRdiBuf.def.num = mRdiStreamBuf.num; mHalCamCtrl->mRdiMemoryLock.unlock(); ALOGE("%s:END",__func__); return NO_ERROR;end: if (MM_CAMERA_OK == ret ) { ALOGV("%s: X - NO_ERROR ", __func__); return NO_ERROR; } ALOGV("%s: out of memory clean up", __func__); /* release the allocated memory */ ALOGV("%s: X - BAD_VALUE ", __func__); return BAD_VALUE;}
开发者ID:kongan,项目名称:input--,代码行数:101,
示例21: ALOGVMetadataRetrieverClient::~MetadataRetrieverClient(){ ALOGV("MetadataRetrieverClient destructor"); disconnect();}
开发者ID:0-t,项目名称:android_frameworks_av,代码行数:5,
示例22: ALOGE//.........这里部分代码省略......... if(decoderErr != MP4AUDEC_SUCCESS) { if(mInputBuffer) { mInputBuffer->release(); mInputBuffer = NULL; } if(buffer) { buffer->release(); buffer = NULL; } goto repeat; } /* * AAC+/eAAC+ streams can be signalled in two ways: either explicitly * or implicitly, according to MPEG4 spec. AAC+/eAAC+ is a dual * rate system and the sampling rate in the final output is actually * doubled compared with the core AAC decoder sampling rate. * * Explicit signalling is done by explicitly defining SBR audio object * type in the bitstream. Implicit signalling is done by embedding * SBR content in AAC extension payload specific to SBR, and hence * requires an AAC decoder to perform pre-checks on actual audio frames. * * Thus, we could not say for sure whether a stream is * AAC+/eAAC+ until the first data frame is decoded. */ if (++mNumDecodedBuffers <= 2) { ALOGV("audio/extended audio object type: %d + %d", mConfig->audioObjectType, mConfig->extendedAudioObjectType); ALOGV("aac+ upsampling factor: %d desired channels: %d", mConfig->aacPlusUpsamplingFactor, mConfig->desiredChannels); CHECK(mNumDecodedBuffers > 0); if (mNumDecodedBuffers == 1) { mUpsamplingFactor = mConfig->aacPlusUpsamplingFactor; // Check on the sampling rate to see whether it is changed. int32_t sampleRate; CHECK(mMeta->findInt32(kKeySampleRate, &sampleRate)); ALOGV("--->aac samplerae %d",sampleRate); if (mConfig->samplingRate != sampleRate) { mMeta->setInt32(kKeySampleRate, mConfig->samplingRate); ALOGV("Sample rate was %d Hz, but now is %d Hz", sampleRate, mConfig->samplingRate); buffer->release(); // mInputBuffer->release(); // mInputBuffer = NULL; return INFO_FORMAT_CHANGED; } } else { // mNumDecodedBuffers == 2 if (mConfig->extendedAudioObjectType == MP4AUDIO_AAC_LC || mConfig->extendedAudioObjectType == MP4AUDIO_LTP) { if (mUpsamplingFactor == 2) { // The stream turns out to be not aacPlus mode anyway ALOGV("Disable AAC+/eAAC+ since extended audio object type is %d", mConfig->extendedAudioObjectType); mConfig->aacPlusEnabled = 0; } } else { if (mUpsamplingFactor == 1) { // aacPlus mode does not buy us anything, but to cause
开发者ID:Cosmos786,项目名称:ML,代码行数:67,
示例23: Dalvik_dalvik_system_DexFile_openDexFile/* * private static int openDexFile(String sourceName, String outputName, * int flags) throws IOException * * Open a DEX file, returning a pointer to our internal data structure. * * "sourceName" should point to the "source" jar or DEX file. * * If "outputName" is NULL, the DEX code will automatically find the * "optimized" version in the cache directory, creating it if necessary. * If it's non-NULL, the specified file will be used instead. * * TODO: at present we will happily open the same file more than once. * To optimize this away we could search for existing entries in the hash * table and refCount them. Requires atomic ops or adding "synchronized" * to the non-native code that calls here. * * TODO: should be using "long" for a pointer. */static void Dalvik_dalvik_system_DexFile_openDexFile(const u4* args, JValue* pResult){ StringObject* sourceNameObj = (StringObject*) args[0]; StringObject* outputNameObj = (StringObject*) args[1]; DexOrJar* pDexOrJar = NULL; JarFile* pJarFile; RawDexFile* pRawDexFile; char* sourceName; char* outputName; if (sourceNameObj == NULL) { dvmThrowNullPointerException("sourceName == null"); RETURN_VOID(); } sourceName = dvmCreateCstrFromString(sourceNameObj); if (outputNameObj != NULL) outputName = dvmCreateCstrFromString(outputNameObj); else outputName = NULL; /* * We have to deal with the possibility that somebody might try to * open one of our bootstrap class DEX files. The set of dependencies * will be different, and hence the results of optimization might be * different, which means we'd actually need to have two versions of * the optimized DEX: one that only knows about part of the boot class * path, and one that knows about everything in it. The latter might * optimize field/method accesses based on a class that appeared later * in the class path. * * We can't let the user-defined class loader open it and start using * the classes, since the optimized form of the code skips some of * the method and field resolution that we would ordinarily do, and * we'd have the wrong semantics. * * We have to reject attempts to manually open a DEX file from the boot * class path. The easiest way to do this is by filename, which works * out because variations in name (e.g. "/system/framework/./ext.jar") * result in us hitting a different dalvik-cache entry. It's also fine * if the caller specifies their own output file. */ if (dvmClassPathContains(gDvm.bootClassPath, sourceName)) { ALOGW("Refusing to reopen boot DEX '%s'", sourceName); dvmThrowIOException( "Re-opening BOOTCLASSPATH DEX files is not allowed"); free(sourceName); free(outputName); RETURN_VOID(); } /* * Try to open it directly as a DEX if the name ends with ".dex". * If that fails (or isn't tried in the first place), try it as a * Zip with a "classes.dex" inside. */ if (hasDexExtension(sourceName) && dvmRawDexFileOpen(sourceName, outputName, &pRawDexFile, false) == 0) { ALOGV("Opening DEX file '%s' (DEX)", sourceName); pDexOrJar = (DexOrJar*) malloc(sizeof(DexOrJar)); pDexOrJar->isDex = true; pDexOrJar->pRawDexFile = pRawDexFile; pDexOrJar->pDexMemory = NULL; } else if (dvmJarFileOpen(sourceName, outputName, &pJarFile, false) == 0) { ALOGV("Opening DEX file '%s' (Jar)", sourceName); pDexOrJar = (DexOrJar*) malloc(sizeof(DexOrJar)); pDexOrJar->isDex = false; pDexOrJar->pJarFile = pJarFile; pDexOrJar->pDexMemory = NULL; } else { ALOGV("Unable to open DEX file '%s'", sourceName); dvmThrowIOException("unable to open DEX file"); } if (pDexOrJar != NULL) { pDexOrJar->fileName = sourceName; addToDexFileTable(pDexOrJar); } else {//.........这里部分代码省略.........
开发者ID:1mobilesuper,项目名称:platform_dalvik,代码行数:101,
示例24: copyFileIfChanged//.........这里部分代码省略......... jstring* javaNativeLibPath = (jstring*) arg; ScopedUtfChars nativeLibPath(env, *javaNativeLibPath); size_t uncompLen; long when; long crc; time_t modTime; if (!zipFile->getEntryInfo(zipEntry, NULL, &uncompLen, NULL, NULL, &when, &crc)) { ALOGD("Couldn't read zip entry info/n"); return INSTALL_FAILED_INVALID_APK; } else { struct tm t; ZipFileRO::zipTimeToTimespec(when, &t); modTime = mktime(&t); } // Build local file path const size_t fileNameLen = strlen(fileName); char localFileName[nativeLibPath.size() + fileNameLen + 2]; if (strlcpy(localFileName, nativeLibPath.c_str(), sizeof(localFileName)) != nativeLibPath.size()) { ALOGD("Couldn't allocate local file name for library"); return INSTALL_FAILED_INTERNAL_ERROR; } *(localFileName + nativeLibPath.size()) = '/'; if (strlcpy(localFileName + nativeLibPath.size() + 1, fileName, sizeof(localFileName) - nativeLibPath.size() - 1) != fileNameLen) { ALOGD("Couldn't allocate local file name for library"); return INSTALL_FAILED_INTERNAL_ERROR; } // Only copy out the native file if it's different. struct stat st; if (!isFileDifferent(localFileName, uncompLen, modTime, crc, &st)) { return INSTALL_SUCCEEDED; } char localTmpFileName[nativeLibPath.size() + TMP_FILE_PATTERN_LEN + 2]; if (strlcpy(localTmpFileName, nativeLibPath.c_str(), sizeof(localTmpFileName)) != nativeLibPath.size()) { ALOGD("Couldn't allocate local file name for library"); return INSTALL_FAILED_INTERNAL_ERROR; } *(localFileName + nativeLibPath.size()) = '/'; if (strlcpy(localTmpFileName + nativeLibPath.size(), TMP_FILE_PATTERN, TMP_FILE_PATTERN_LEN - nativeLibPath.size()) != TMP_FILE_PATTERN_LEN) { ALOGI("Couldn't allocate temporary file name for library"); return INSTALL_FAILED_INTERNAL_ERROR; } int fd = mkstemp(localTmpFileName); if (fd < 0) { ALOGI("Couldn't open temporary file name: %s: %s/n", localTmpFileName, strerror(errno)); return INSTALL_FAILED_CONTAINER_ERROR; } if (!zipFile->uncompressEntry(zipEntry, fd)) { ALOGI("Failed uncompressing %s to %s/n", fileName, localTmpFileName); close(fd); unlink(localTmpFileName); return INSTALL_FAILED_CONTAINER_ERROR; } close(fd); // Set the modification time for this file to the ZIP's mod time. struct timeval times[2]; times[0].tv_sec = st.st_atime; times[1].tv_sec = modTime; times[0].tv_usec = times[1].tv_usec = 0; if (utimes(localTmpFileName, times) < 0) { ALOGI("Couldn't change modification time on %s: %s/n", localTmpFileName, strerror(errno)); unlink(localTmpFileName); return INSTALL_FAILED_CONTAINER_ERROR; } // Set the mode to 755 static const mode_t mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; if (chmod(localTmpFileName, mode) < 0) { ALOGI("Couldn't change permissions on %s: %s/n", localTmpFileName, strerror(errno)); unlink(localTmpFileName); return INSTALL_FAILED_CONTAINER_ERROR; } // Finally, rename it to the final name. if (rename(localTmpFileName, localFileName) < 0) { ALOGI("Couldn't rename %s to %s: %s/n", localTmpFileName, localFileName, strerror(errno)); unlink(localTmpFileName); return INSTALL_FAILED_CONTAINER_ERROR; } ALOGV("Successfully moved %s to %s/n", localTmpFileName, localFileName); return INSTALL_SUCCEEDED;}
开发者ID:nctusenselab,项目名称:android_frameworks_base,代码行数:101,
注:本文中的ALOGV函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ALSPS_LOG函数代码示例 C++ ALOGI函数代码示例 |