当前位置: 首页>>代码示例>>C++>>正文


C++ LOG1函数代码示例

本文整理汇总了C++中LOG1函数的典型用法代码示例。如果您正苦于以下问题:C++ LOG1函数的具体用法?C++ LOG1怎么用?C++ LOG1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LOG1函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: openSocket

int openSocket(const int port, const char * peer) {
    int fd,res,opt;
    struct sockaddr_in addr;
    socklen_t addrlen;
#ifndef DONT_USE_GETHOSTBYNAME    
    char hBuf[10000];
    struct hostent hostbuf, *he;
    //struct hostent *he;
#endif    
    if (daveDebug & daveDebugOpen) {
	LOG1(ThisModule "enter OpenSocket");
	FLUSH;
    }
    addr.sin_family = AF_INET;
    addr.sin_port =htons(port);
//	(((port) & 0xff) << 8) | (((port) & 0xff00) >> 8);
#ifndef DONT_USE_GETHOSTBYNAME
    int herr;
    gethostbyname_r(peer, &hostbuf, hBuf, sizeof(hBuf), &he, &herr);
    //he = gethostbyname(peer);
    if (!he) return 0;  // bug reported by Nick Hibma
    memcpy(&addr.sin_addr, he->h_addr_list[0], sizeof(addr.sin_addr));
#else
    inet_aton(peer, &addr.sin_addr);
#endif

    fd = socket(AF_INET, SOCK_STREAM, 0);
    if (daveDebug & daveDebugOpen) {
	LOG2(ThisModule "OpenSocket: socket is %d\n", fd);
    }	
    
    addrlen = sizeof(addr);
    if (connect(fd, (struct sockaddr *) & addr, addrlen)) {
	LOG2(ThisModule "Socket error: %s \n", strerror(errno));
	close(fd);
	fd = 0;
    } else {
	if (daveDebug & daveDebugOpen) {
	    LOG2(ThisModule "Connected to host: %s \n", peer);
	}    
/*
	Need this, so we can read a packet with a single read call and make
	read return if there are too few bytes.
*/	
	errno=0;
//	res=fcntl(fd, F_SETFL, O_NONBLOCK);
//	if (daveDebug & daveDebugOpen) 
//	    LOG3(ThisModule "Set mode to O_NONBLOCK %s %d\n", strerror(errno),res);
/*
	I thought this might solve Marc's problem with the CP closing
	a connection after 30 seconds or so, but the Standrad keepalive time
	on my box is 7200 seconds.	    
*/	
	errno=0;
	opt=1;
	res=setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &opt, 4);
	if (daveDebug & daveDebugOpen) {	
	    LOG3(ThisModule "setsockopt %s %d\n", strerror(errno),res);	
	}    
    }	
    FLUSH;
    return fd;
}
开发者ID:aleax,项目名称:openscada,代码行数:63,代码来源:openSocket.c

示例2: LOG1

void CMMADisplay::Construct(MMAFunctionServer* eventSource ,JNIEnv* aJni, jobject javadisplayref)
{
    iEventSource = eventSource;
    iJavadisplayref = javadisplayref;
    LOG1(EJavaMMAPI,EInfo,"CMMADisplay::Construct=%d",iIseSWT);
    if (iIseSWT)
    {
        iJni = aJni;
    }
    else
    {
        iJni = iEventSource->getValidJniEnv();
    }
    iJavaDisplayObject = iJni->NewGlobalRef(javadisplayref);
    iJavaDisplayClass = iJni->GetObjectClass(iJavaDisplayObject);

    setRectID = iJni->GetMethodID(iJavaDisplayClass,
                                  "setRect",
                                  "()V");
    iRectDimensionField = iJni->GetFieldID(iJavaDisplayClass, "rectDimension", "[I");

    redrawControlID = iJni->GetMethodID(
                          iJavaDisplayClass,
                          "redrawControl",
                          "()V");

    removeContentBoundID = iJni->GetMethodID(
                               iJavaDisplayClass,
                               "removeContentBound",
                               "()V");

    setContentBoundID = iJni->GetMethodID(
                            iJavaDisplayClass,
                            "setContentBound",
                            "()V");

    getCallBackMethodID = iJni->GetMethodID(
                              iJavaDisplayClass,
                              "GetCallbackInUiThread",
                              "(I)V");

    getBoundRectID = iJni->GetMethodID(
                         iJavaDisplayClass,
                         "getBoundRect",
                         "()V");

    iDisplayboundarrField = iJni->GetFieldID(iJavaDisplayClass, "displayboundarr", "[I");

    // Components must have direct content.
    /* __ASSERT_LOG(EJavaMMAPI,EInfo,"aDirectContainer, User::Invariant());

     // Not owned
     iDirectContainer = aDirectContainer;

     // Get component visibility. Later visibility changes will
     // be informed through MDirectContent observer.
     iContainerVisible = iDirectContainer->MdcContainerVisibility();
     LOG1(EJavaMMAPI,EInfo,"CMMADisplay::Construct iContainerVisible = %d", iContainerVisible);
     LOG1(EJavaMMAPI,EInfo,"CMMADisplay::Construct iVisible = %d", iVisible);

     // Add this MDirectContent to the MDirectContainer. Cannot fail.
     iDirectContainer->MdcAddContent(this);
     */
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:64,代码来源:cmmadisplay.cpp

示例3: prefetchdata3

/* Compute the set of prefetched data.
   Notes:
   1. Even if caching is off, we will
       still prefetch the small variables.
   2. All prefetches are whole variable fetches.
   3. If the data set is unconstrainable, we
      will prefetch the whole thing
*/
NCerror
prefetchdata3(NCDAPCOMMON* nccomm)
{
    int i,j;
    NCerror ncstat = NC_NOERR;
    NClist* allvars = nccomm->cdf.varnodes;
    DCEconstraint* urlconstraint = nccomm->oc.dapconstraint;
    NClist* vars = nclistnew();
    NCcachenode* cache = NULL;
    DCEconstraint* newconstraint = NULL;
    int isnc4 = FLAGSET(nccomm->controls,NCF_NC4);


    if(FLAGSET(nccomm->controls,NCF_UNCONSTRAINABLE)) {
        /* If we cannot constrain and caching is enabled,
           then pull in everything */
        if(FLAGSET(nccomm->controls,NCF_CACHE)) {
	    for(i=0;i<nclistlength(allvars);i++) {
	        nclistpush(vars,nclistget(allvars,i));
	    }
	} else { /* do no prefetching */
    	    nccomm->cdf.cache->prefetch = NULL;
	    goto done;
	}
    } else { /* can do constraints */
	/* pull in those variables of sufficiently small size */
        for(i=0;i<nclistlength(allvars);i++) {
            CDFnode* var = (CDFnode*)nclistget(allvars,i);
            size_t nelems = 1;

            if(!isnc4) {
	        /* If netcdf 3 and var is a sequence or under a sequence, then never prefetch */
	        if(var->nctype == NC_Sequence || dapinsequence(var)) continue;
	    }

            /* Compute the # of elements in the variable */
            for(j=0;j<nclistlength(var->array.dimset0);j++) {
                CDFnode* dim = (CDFnode*)nclistget(var->array.dimset0,j);
                nelems *= dim->dim.declsize;
	    }
if(SHOWFETCH) {
nclog(NCLOGDBG,"prefetch: %s=%lu",var->ncfullname,(unsigned long)nelems);
}
	    if(nelems <= nccomm->cdf.smallsizelimit) {
	        nclistpush(vars,(ncelem)var);
if(SHOWFETCH) {
nclog(NCLOGDBG,"prefetch: %s",var->ncfullname);
}
	    }
	}
    }

    /* If there are no vars, then do nothing */
    if(nclistlength(vars) == 0) {
	nccomm->cdf.cache->prefetch = NULL;
	goto done;
    }

    /* Create a single constraint consisting of the projections for the variables;
       each projection is whole variable. The selections are passed on as is.
    */

    newconstraint = (DCEconstraint*)dcecreate(CES_CONSTRAINT);
    newconstraint->projections = nclistnew();
    newconstraint->selections = dceclonelist(urlconstraint->selections);

    for(i=0;i<nclistlength(vars);i++) {
	CDFnode* var = (CDFnode*)nclistget(vars,i);
	DCEprojection* varprojection;
	/* convert var to a projection */
	ncstat = dapvar2projection(var,&varprojection);
	if(ncstat != NC_NOERR) {THROWCHK(ncstat); goto done;}
	nclistpush(newconstraint->projections,(ncelem)varprojection);
    }
if(SHOWFETCH) {
char* s = dumpprojections(newconstraint->projections);
LOG1(NCLOGNOTE,"prefetch.final: %s",s);
nullfree(s);
}
    ncstat = buildcachenode34(nccomm,newconstraint,vars,&cache,!isnc4);
    newconstraint = NULL; /* buildcachenode34 takes control of newconstraint */
    if(ncstat) goto done;
    cache->wholevariable = 1; /* All prefetches are whole variable */
    /* Make cache node be the prefetch node */
    nccomm->cdf.cache->prefetch = cache;
if(SHOWFETCH) {
LOG0(NCLOGNOTE,"prefetch.complete");
}

if(SHOWFETCH) {
char* s = NULL;
/* Log the set of prefetch variables */
//.........这里部分代码省略.........
开发者ID:qingu,项目名称:WRF-Libraries,代码行数:101,代码来源:cache.c

示例4: FUNC_ENTER


//.........这里部分代码省略.........
			iOperation = EOpRemovalDeletingStartupProcessTriggers;
			break;
			}
		case EOpRemovalDeletingStartupProcessTriggers:
		    {
		    // Here the observer is set to the get the information pertaining
            // triggers that were deleted.
            TLbtTriggerEventMask eventMask = 0;
            eventMask|= CLbtContainer::ELbtConTriggerDeleted;
            iContainer.SetChangeObserver( this,eventMask );
		    break;
		    }
			
		case EOpMMCInsertionListingTriggers:			
		case EOpMMCRemovalListingTriggers:
			{
			// Listing Triggers of startup process
			LOG("Listing Triggers Over");
			
			if( iOperation == EOpMMCInsertionListingTriggers )
				{
				iOperation = EOpMMCInsertionListingTriggerForStartupProcess;
				}
			else
				{
				iOperation = EOpMMCRemovalListingTriggerForStartupProcess;
				}
		
			ListTriggersOfStartupProcessL();
			iAppList.Close();
			LOG("Listing Triggers for startup Process");
			break;
			}
		case EOpMMCRemovalListingTriggerForStartupProcess:
		case EOpMMCInsertionListingTriggerForStartupProcess:
			{
			LOG("Listing Trigger For startup Process Done");
			LOG1("iStatus = %d", iStatus.Int());
			LOG1("Triggers Count = %d", iTriggerEntries.Count());
			if(KErrNone == iStatus.Int())
				{
				// The list operation is a success. Hence invalidate the triggers now
				RArray<TLbtTriggerId> triggerIds;
				
				for(TInt i=0;i<iTriggerEntries.Count();++i)
					{
					triggerIds.AppendL(iTriggerEntries[i]->TriggerEntry()->Id());
					}
				
				TLbtTriggerDynamicInfo::TLbtTriggerValidity validity;
				
				if(iOperation == EOpMMCRemovalListingTriggerForStartupProcess)
					{
					validity = TLbtTriggerDynamicInfo::EInvalid;
					iCleanupHandler.AddTriggersForCleanupL( triggerIds );
					}
				else
					{
					validity = TLbtTriggerDynamicInfo::EValid;
					iCleanupHandler.RemoveTriggersFromCleanupL( triggerIds );
					}
			    
				// update validity of the triggers
				iContainer.UpdateTriggersValidity( validity,
												   triggerIds,
												   iOpId,
												   iStatus );
				SetActive();				
				iOperation = EOpRequestValidityChange;
				triggerIds.Close();
				iTriggerEntries.ResetAndDestroy();
				}
			else
				{
				// Listing is not successful. Hence dont do anything
				iOperation = EOpNone;
				iTriggerEntries.ResetAndDestroy();
				iAppList.Reset();
				}
			break;
			}
		case EOpRequestValidityChange:
		    {
		    // Here the observer is set to the get the information pertaining
            // triggers that were changed to invalid
            TLbtTriggerEventMask eventMask = 0;
            eventMask|= CLbtContainer::ELbtConTriggerValidityFieldChanged;
            iContainer.SetChangeObserver( this,eventMask );
            break;
		    }
		default:
			{
			// Operation complete
			iTriggerEntries.ResetAndDestroy();
			iAppList.Close();
			iOperation = EOpNone;
			break;			
			}
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:101,代码来源:lbtappchangehandler.cpp

示例5: LOGE

int IonDmaMemManager::createIonBuffer(struct bufferinfo_s* ionbuf)
{
	int ret =0,i = 0;
	int numBufs;
	int frame_size;
	camera_ionbuf_t* tmpalloc = NULL;
	struct bufferinfo_s* tmp_buf = NULL;
	#ifdef ROCKCHIP_ION_VERSION
    ion_user_handle_t handle = 0;
	#else
	struct ion_handle* handle = NULL;
	#endif
    int map_fd;
	long temp_handle = 0;
    unsigned long vir_addr = 0;

    
	if (!ionbuf) {
		LOGE("ion_alloc malloc buffer failed");
		return -1;
	}
    
	numBufs = ionbuf->mNumBffers;
	frame_size = ionbuf->mPerBuffersize;
	ionbuf->mBufferSizes = numBufs*PAGE_ALIGN(frame_size);
	switch(ionbuf->mBufType)
	{
		case PREVIEWBUFFER:
            tmpalloc = mPreviewData ;
			if((tmp_buf  = (struct bufferinfo_s*)malloc(numBufs*sizeof(struct bufferinfo_s))) != NULL){
                mPreviewBufferInfo = tmp_buf;
            }else{
        		LOGE("ion_alloc malloc buffer failed");
        		return -1;
            }
			break;
		case RAWBUFFER:
            tmpalloc =  mRawData;
               
			if((tmp_buf = (struct bufferinfo_s*)malloc(numBufs*sizeof(struct bufferinfo_s))) != NULL){
                mRawBufferInfo = tmp_buf;
            }else{
        		LOGE("ion_alloc malloc buffer failed");
        		return -1;
            }
			break;
		case JPEGBUFFER:
            tmpalloc = mJpegData;
            
			if((tmp_buf  = (struct bufferinfo_s*)malloc(numBufs*sizeof(struct bufferinfo_s))) != NULL ){
                mJpegBufferInfo = tmp_buf;
            }else{
        		LOGE("ion_alloc malloc buffer failed");
        		return -1;
            }
			break;
		case VIDEOENCBUFFER:
            tmpalloc =  mVideoEncData ;

            if((tmp_buf = (struct bufferinfo_s*)malloc(numBufs*sizeof(struct bufferinfo_s))) != NULL){
                mVideoEncBufferInfo = tmp_buf;
            }else{
        		LOGE("ion_alloc malloc buffer failed");
        		return -1;
            }
			break;
        default:
            return -1;
    }

    for(i = 0;i < numBufs;i++){
    	memset(tmpalloc,0,sizeof(struct camera_ionbuf_s));

        if((!mIommuEnabled) || (!ionbuf->mIsForceIommuBuf))
            ret = ion_alloc(client_fd, ionbuf->mPerBuffersize, PAGE_SIZE, ION_HEAP(ION_CMA_HEAP_ID), 0, &handle);
        else
            ret = ion_alloc(client_fd, ionbuf->mPerBuffersize, PAGE_SIZE, ION_HEAP(ION_VMALLOC_HEAP_ID), 0, &handle);
        if (ret) {
            LOGE("ion alloc failed\n");
            break;
        }

        LOG1("handle %d\n", handle);

        ret = ion_share(client_fd,handle,&map_fd);
        if (ret) {
            LOGE("ion map failed\n");
            ion_free(client_fd,handle);
            break;
        }

        vir_addr = (unsigned long )mmap(NULL, ionbuf->mPerBuffersize, PROT_READ | PROT_WRITE, MAP_SHARED, map_fd, 0);
        if (vir_addr == 0) {
            LOGE("ion mmap failed\n");
            ret = -1;
            ion_free(client_fd,handle);
            break;
        }
        
        if((!mIommuEnabled) || (!ionbuf->mIsForceIommuBuf))
//.........这里部分代码省略.........
开发者ID:denisigo,项目名称:fireprime_hardware_rockchip,代码行数:101,代码来源:CameraHal_Mem.cpp

示例6: getCallingPid

sp<ICamera> CameraService::connect(
        const sp<ICameraClient>& cameraClient, int cameraId) {
    int callingPid = getCallingPid();
    sp<CameraHardwareInterface> hardware = NULL;

    LOG1("CameraService::connect E (pid %d, id %d)", callingPid, cameraId);

    if (!mModule) {
        ALOGE("Camera HAL module not loaded");
        return NULL;
    }

    sp<Client> client;
    if (cameraId < 0 || cameraId >= mNumberOfCameras) {
        ALOGE("CameraService::connect X (pid %d) rejected (invalid cameraId %d).",
            callingPid, cameraId);
        return NULL;
    }

    char value[PROPERTY_VALUE_MAX];
    property_get("sys.secpolicy.camera.disabled", value, "0");
    if (strcmp(value, "1") == 0) {
        // Camera is disabled by DevicePolicyManager.
        ALOGI("Camera is disabled. connect X (pid %d) rejected", callingPid);
        return NULL;
    }

    Mutex::Autolock lock(mServiceLock);
    if (mClient[cameraId] != 0) {
        client = mClient[cameraId].promote();
        if (client != 0) {
            if (cameraClient->asBinder() == client->getCameraClient()->asBinder()) {
                LOG1("CameraService::connect X (pid %d) (the same client)",
                    callingPid);
                return client;
            } else {
                ALOGW("CameraService::connect X (pid %d) rejected (existing client).",
                    callingPid);
                return NULL;
            }
        }
        mClient[cameraId].clear();
    }

    if (mBusy[cameraId]) {
        ALOGW("CameraService::connect X (pid %d) rejected"
             " (camera %d is still busy).", callingPid, cameraId);
        return NULL;
    }

    struct camera_info info;
    if (mModule->get_camera_info(cameraId, &info) != OK) {
        ALOGE("Invalid camera id %d", cameraId);
        return NULL;
    }

    char camera_device_name[10];
    snprintf(camera_device_name, sizeof(camera_device_name), "%d", cameraId);

    hardware = new CameraHardwareInterface(camera_device_name);
    if (hardware->initialize(&mModule->common) != OK) {
        hardware.clear();
        return NULL;
    }

    client = new Client(this, cameraClient, hardware, cameraId, info.facing, callingPid);
    mClient[cameraId] = client;
    LOG1("CameraService::connect X");
    return client;
}
开发者ID:e0234,项目名称:android_frameworks_base,代码行数:70,代码来源:CameraService.cpp

示例7: reallocQueue

void reallocQueue() {
    emul_data.req_size += DEFAULT_QUEUE_SIZE;
    LOG1("EMUL QUEUE reallocated to %d", emul_data.req_size);
    emul_data.request = midpRealloc(emul_data.request, emul_data.req_size);
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:5,代码来源:emul.c

示例8: ASSERT

//---------------------------------------------------------------------------
//
//	割り込みチェック
//
//---------------------------------------------------------------------------
void FASTCALL IOSC::IntChk()
{
	int v;

	ASSERT(this);

	// 割り込み無し
	v = -1;

	// プリンタ割り込み
	if (iosc.prt_int && iosc.prt_en) {
		v = iosc.vbase + 3;
	}

	// HDC割り込み
	if (iosc.hdc_int && iosc.hdc_en) {
		v = iosc.vbase + 2;
	}

	// FDD割り込み
	if (iosc.fdd_int && iosc.fdd_en) {
		v = iosc.vbase + 1;
	}

	// FDC割り込み
	if (iosc.fdc_int && iosc.fdc_en) {
		v = iosc.vbase;
	}

	// 要求したい割り込みがない場合
	if (v < 0) {
		// 割り込み要求中でなければ、OK
		if (iosc.vector < 0) {
			return;
		}

		// 何らかの割り込みを要求しているので、割り込みキャンセル
#if defined(IOSC_LOG)
		LOG1(Log::Normal, "割り込みキャンセル ベクタ$%02X", iosc.vector);
#endif	// IOSC_LOG
		cpu->IntCancel(1);
		iosc.vector = -1;
		return;
	}

	// 既に要求しているベクタと同じであれば、OK
	if (iosc.vector == v) {
		return;
	}

	// 違うので、要求中なら一度キャンセル
	if (iosc.vector >= 0) {
#if defined(IOSC_LOG)
		LOG1(Log::Normal, "割り込みキャンセル ベクタ$%02X", iosc.vector);
#endif	// IOSC_LOG
		cpu->IntCancel(1);
		iosc.vector = -1;
	}

	// 割り込み要求
#if defined(IOSC_LOG)
	LOG1(Log::Normal, "割り込み要求 ベクタ$%02X", v);
#endif	// IOSC_LOG
	cpu->Interrupt(1, (uint8_t)v);

	// 記憶
	iosc.vector = v;
}
开发者ID:ysei,项目名称:XM6_pid,代码行数:73,代码来源:iosc.cpp

示例9: ActiveMemoryMonitorCalibration

int
ActiveMemoryMonitorCalibration(void) {

#if MEMORY_SUPPORT
  unsigned int i, page_size, used, max_used, stop_count, base_start;
  struct bulk *start, *current;
  int connection[2];
  pid_t childPid;
 
  if(pipe(connection) != 0) {
      FAIL("ActiveMemoryMonitorCalibration: pipe() failed\n");
    }

  childPid = fork();

  if(childPid < 0) {
      FAIL("ActiveMemoryMonitorCalibration: fork() failed\n");
  }
  else if(childPid > 0) {
    /* Parent process. */
    close(connection[WRITE_END]);
    read(connection[READ_END], &BaseMem, sizeof(int));
    close(connection[READ_END]);
    wait(NULL);
    return 1;
  }

  /* Child comes here. */
  BaseMem = 0;
  close(connection[READ_END]);
  nice(19);
  LOG("ActiveMemoryMonitorCalibration: start calibration\n");
  page_size = getpagesize();
  base_start = ActiveMemoryGetRoughlyFree()*CALIBRATION_SPEEDUP_RATIO; 
  if (debug > 0) {
        DDEBUG1("Calibration speedup : start from %d KB of base memory\n", base_start);
  }

  start = (struct bulk *)malloc(sizeof(struct bulk));
  if (start == NULL) {
    write(connection[WRITE_END], &BaseMem, sizeof(int));
    close(connection[WRITE_END]);
    exit(0);
  }
  start->ptr = calloc(base_start*1024,sizeof(char));
  if (start->ptr == NULL) {
    free(start);
    write(connection[WRITE_END], &BaseMem, sizeof(int));
    close(connection[WRITE_END]);
    exit(0);
  } 
  start->length = base_start*1024*sizeof(char);
  start->next = NULL;

  used = 99;
  for (i=0; i<start->length; i+=page_size)
    start->ptr[i] = (int)used;
  start->ptr[start->length-1] = (int)used;
  
  current = start;
  max_used = 0;
  stop_count = 0;
  used = 1;
  while (stop_count <ITERATIONS_STALLED) {
    current->next = (struct bulk *)malloc(sizeof(struct bulk));
    if (current->next == NULL)
      break;
    current = current->next;
    current->ptr = malloc(CALIBRATION_BULK_SIZE*sizeof(char));
    if (current->ptr == NULL) {
      stop_count++;
      continue;
    }
    current->length = CALIBRATION_BULK_SIZE*sizeof(char);
    current->next = NULL;
    
    for (i=0; i<current->length; i+=page_size)
      current->ptr[i] = (int)used;
    current->ptr[current->length-1] = (int)used;
    
    used = ActiveMemoryGetUsed();
    if (used > max_used)
      max_used = used;
    else
      stop_count++;
  }
  
  BaseMem = max_used;
  if (debug > 0) {
	DDEBUG1("Calibration done : %d KB of base memory\n", BaseMem);
  }

  current = start;
  while (current != NULL) {
     free(current->ptr);
    current = current->next;
  }
  LOG1("ActiveMemoryMonitorCalibration: end of calibration (%d KB)\n",
       BaseMem);
  write(connection[WRITE_END], &BaseMem, sizeof(int));
//.........这里部分代码省略.........
开发者ID:LogisticalComputingAndInternetworking,项目名称:LoRS,代码行数:101,代码来源:active_memory.c

示例10: LOG1

	// set the ISurface that the preview will use
	status_t CameraService::Client::setPreviewDisplay(const sp<ISurface>& surface) {
		LOG1("setPreviewDisplay(%p) (pid %d)", surface.get(), getCallingPid());
		Mutex::Autolock lock(mLock);
		status_t result = checkPidAndHardware();
		if (result != NO_ERROR) return result;
		
		result = NO_ERROR;
		
		// return if no change in surface.
		// asBinder() is safe on NULL (returns NULL)
		if (surface->asBinder() == mSurface->asBinder()) {
			return result;
		}
		
		if (mSurface != 0) {
			LOG1("clearing old preview surface %p", mSurface.get());
			if (mUseOverlay) {
				// Force the destruction of any previous overlay
				sp<Overlay> dummy;
				mHardware->setOverlay(dummy);
				mOverlayRef = 0;
			} else {
				mSurface->unregisterBuffers();
			}
		}
		mSurface = surface;
		mOverlayRef = 0;
		// If preview has been already started, set overlay or register preview
		// buffers now.
#ifdef USE_OVERLAY_FORMAT_YCbCr_420_SP
		if (mHardware->previewEnabled() || mUseOverlay) {
#else
			if (mHardware->previewEnabled()) {
#endif
				if (mUseOverlay) {
#ifdef USE_OVERLAY_FORMAT_YCbCr_420_SP
					if (mSurface != NULL) {
#endif
						result = setOverlay();
#ifdef USE_OVERLAY_FORMAT_YCbCr_420_SP
					}
#endif
				} else if (mSurface != 0) {
					result = registerPreviewBuffers();
				}
			}
			
			return result;
		}
		
		status_t CameraService::Client::registerPreviewBuffers() {
			int w, h;
			CameraParameters params(mHardware->getParameters());
			params.getPreviewSize(&w, &h);
			
			//for 720p recording , preview can be 800X448
			if(w ==  preview_sizes[0].width && h== preview_sizes[0].height){
				LOGD("registerpreviewbufs :changing dimensions to 768X432 for 720p recording.");
				w = preview_sizes[1].width;
				h = preview_sizes[1].height;
			}
			
			// FIXME: don't use a hardcoded format here.
			ISurface::BufferHeap buffers(w, h, w, h,
										 HAL_PIXEL_FORMAT_YCrCb_420_SP,
										 mOrientation,
										 0,
										 mHardware->getPreviewHeap());
			
			status_t result = mSurface->registerBuffers(buffers);
			if (result != NO_ERROR) {
				LOGE("registerBuffers failed with status %d", result);
			}
			return result;
		}
		
		status_t CameraService::Client::setOverlay() {
			int w, h;
			CameraParameters params(mHardware->getParameters());
			params.getPreviewSize(&w, &h);
			
			//for 720p recording , preview can be 800X448
			if(w == preview_sizes[0].width && h==preview_sizes[0].height){
				LOGD("Changing overlay dimensions to 768X432 for 720p recording.");
				w = preview_sizes[1].width;
				h = preview_sizes[1].height;
			}
			
			if (w != mOverlayW || h != mOverlayH || mOrientationChanged) {
				// Force the destruction of any previous overlay
				sp<Overlay> dummy;
				mHardware->setOverlay(dummy);
				mOverlayRef = 0;
#ifdef USE_OVERLAY_FORMAT_YCbCr_420_SP
				if (mOverlay != NULL) {
					mOverlay->destroy();
				}
#endif
				mOrientationChanged = false;
//.........这里部分代码省略.........
开发者ID:HyperDroid,项目名称:android_frameworks_base_deprecated,代码行数:101,代码来源:CameraService.cpp

示例11: dap_fetch

/* Provide a wrapper for oc_fetch so we can log what it does */
NCerror
dap_fetch(NCDAPCOMMON* nccomm, OClink conn, const char* ce,
             OCdxd dxd, OCddsnode* rootp)
{
    NCerror ncstat = NC_NOERR;
    OCerror ocstat = OC_NOERR;
    char* ext = NULL;
    OCflags flags = 0;
    int httpcode = 0;

    if(dxd == OCDDS) ext = ".dds";
    else if(dxd == OCDAS) ext = ".das";
    else ext = ".dods";

    if(ce != NULL && strlen(ce) == 0)
	ce = NULL;

    if(FLAGSET(nccomm->controls,NCF_UNCONSTRAINABLE)) {
	ce = NULL;
    }

    if(FLAGSET(nccomm->controls,NCF_ONDISK)) {
	flags |= OCONDISK;
    }

    if(SHOWFETCH) {
	/* Build uri string minus the constraint and #tag */
	char* baseurl = ncuribuild(nccomm->oc.url,NULL,ext,NCURIBASE);
	if(ce == NULL)
            LOG1(NCLOGNOTE,"fetch: %s",baseurl);
	else
            LOG2(NCLOGNOTE,"fetch: %s?%s",baseurl,ce);
	nullfree(baseurl);
#ifdef HAVE_GETTIMEOFDAY
	gettimeofday(&time0,NULL);
#endif
    }
    ocstat = oc_fetch(conn,ce,dxd,flags,rootp);
    if(FLAGSET(nccomm->controls,NCF_SHOWFETCH)) {
#ifdef HAVE_GETTIMEOFDAY
        double secs;
	gettimeofday(&time1,NULL);
	secs = deltatime();
	nclog(NCLOGNOTE,"fetch complete: %0.3f secs",secs);
#else
	nclog(NCLOGNOTE,"fetch complete.");
#endif
    }
#ifdef DEBUG2
fprintf(stderr,"fetch: dds:\n");
oc_dumpnode(conn,*rootp);
#endif

    /* Look at the HTTP return code */
    httpcode = oc_httpcode(conn);
    if(httpcode < 400) {
        ncstat = ocerrtoncerr(ocstat);
    } else if(httpcode >= 500) {
        ncstat = NC_EDAPSVC;
    } else if(httpcode == 401) {
	ncstat = NC_EAUTH;
    } else if(httpcode == 404) {
	ncstat = NC_ENOTFOUND;
    } else {
	ncstat = NC_EACCESS;
    }
    return ncstat;
}
开发者ID:dschwen,项目名称:libmesh,代码行数:69,代码来源:daputil.c

示例12: dump_sps

void dump_sps(seq_parameter_set* sps, ref_pic_set* sets, int fd)
{
  //#if (_MSC_VER >= 1500)
  //#define LOG0(t) loginfo(LogHeaders, t)
  //#define LOG1(t,d) loginfo(LogHeaders, t,d)
  //#define LOG2(t,d1,d2) loginfo(LogHeaders, t,d1,d2)
  //#define LOG3(t,d1,d2,d3) loginfo(LogHeaders, t,d1,d2,d3)

  FILE* fh;
  if (fd==1) fh=stdout;
  else if (fd==2) fh=stderr;
  else { return; }

#define LOG0(t) log2fh(fh, t)
#define LOG1(t,d) log2fh(fh, t,d)
#define LOG2(t,d1,d2) log2fh(fh, t,d1,d2)
#define LOG3(t,d1,d2,d3) log2fh(fh, t,d1,d2,d3)
  

  LOG0("----------------- SPS -----------------\n");
  LOG1("video_parameter_set_id  : %d\n", sps->video_parameter_set_id);
  LOG1("sps_max_sub_layers      : %d\n", sps->sps_max_sub_layers);
  LOG1("sps_temporal_id_nesting_flag : %d\n", sps->sps_temporal_id_nesting_flag);

  dump_profile_tier_level(&sps->profile_tier_level, sps->sps_max_sub_layers, fh);

  LOG1("seq_parameter_set_id    : %d\n", sps->seq_parameter_set_id);
  LOG2("chroma_format_idc       : %d (%s)\n", sps->chroma_format_idc,
       sps->chroma_format_idc == 1 ? "4:2:0" :
       sps->chroma_format_idc == 2 ? "4:2:2" :
       sps->chroma_format_idc == 3 ? "4:4:4" : "unknown");

  if (sps->chroma_format_idc == 3) {
    LOG1("separate_colour_plane_flag : %d\n", sps->separate_colour_plane_flag);
  }

  LOG1("pic_width_in_luma_samples  : %d\n", sps->pic_width_in_luma_samples);
  LOG1("pic_height_in_luma_samples : %d\n", sps->pic_height_in_luma_samples);
  LOG1("conformance_window_flag    : %d\n", sps->conformance_window_flag);

  if (sps->conformance_window_flag) {
    LOG1("conf_win_left_offset  : %d\n", sps->conf_win_left_offset);
    LOG1("conf_win_right_offset : %d\n", sps->conf_win_right_offset);
    LOG1("conf_win_top_offset   : %d\n", sps->conf_win_top_offset);
    LOG1("conf_win_bottom_offset: %d\n", sps->conf_win_bottom_offset);
  }

  LOG1("bit_depth_luma   : %d\n", sps->bit_depth_luma);
  LOG1("bit_depth_chroma : %d\n", sps->bit_depth_chroma);

  LOG1("log2_max_pic_order_cnt_lsb : %d\n", sps->log2_max_pic_order_cnt_lsb);
  LOG1("sps_sub_layer_ordering_info_present_flag : %d\n", sps->sps_sub_layer_ordering_info_present_flag);

  int firstLayer = (sps->sps_sub_layer_ordering_info_present_flag ?
                    0 : sps->sps_max_sub_layers-1 );

  for (int i=firstLayer ; i <= sps->sps_max_sub_layers-1; i++ ) {
    LOG1("Layer %d\n",i);
    LOG1("  sps_max_dec_pic_buffering : %d\n", sps->sps_max_dec_pic_buffering[i]);
    LOG1("  sps_max_num_reorder_pics  : %d\n", sps->sps_max_num_reorder_pics[i]);
    LOG1("  sps_max_latency_increase  : %d\n", sps->sps_max_latency_increase[i]);
  }

  LOG1("log2_min_luma_coding_block_size : %d\n", sps->log2_min_luma_coding_block_size);
  LOG1("log2_diff_max_min_luma_coding_block_size : %d\n",sps->log2_diff_max_min_luma_coding_block_size);
  LOG1("log2_min_transform_block_size   : %d\n", sps->log2_min_transform_block_size);
  LOG1("log2_diff_max_min_transform_block_size : %d\n", sps->log2_diff_max_min_transform_block_size);
  LOG1("max_transform_hierarchy_depth_inter : %d\n", sps->max_transform_hierarchy_depth_inter);
  LOG1("max_transform_hierarchy_depth_intra : %d\n", sps->max_transform_hierarchy_depth_intra);
  LOG1("scaling_list_enable_flag : %d\n", sps->scaling_list_enable_flag);

  if (sps->scaling_list_enable_flag) {

    //sps->sps_scaling_list_data_present_flag = get_bits(br,1);
    if (sps->sps_scaling_list_data_present_flag) {

      LOG0("NOT IMPLEMENTED");
      //assert(0);
      //scaling_list_data()
    }
  }

  LOG1("amp_enabled_flag                    : %d\n", sps->amp_enabled_flag);
  LOG1("sample_adaptive_offset_enabled_flag : %d\n", sps->sample_adaptive_offset_enabled_flag);
  LOG1("pcm_enabled_flag                    : %d\n", sps->pcm_enabled_flag);

  if (sps->pcm_enabled_flag) {
    LOG1("pcm_sample_bit_depth_luma     : %d\n", sps->pcm_sample_bit_depth_luma);
    LOG1("pcm_sample_bit_depth_chroma   : %d\n", sps->pcm_sample_bit_depth_chroma);
    LOG1("log2_min_pcm_luma_coding_block_size : %d\n", sps->log2_min_pcm_luma_coding_block_size);
    LOG1("log2_diff_max_min_pcm_luma_coding_block_size : %d\n", sps->log2_diff_max_min_pcm_luma_coding_block_size);
    LOG1("pcm_loop_filter_disable_flag  : %d\n", sps->pcm_loop_filter_disable_flag);
  }

  LOG1("num_short_term_ref_pic_sets : %d\n", sps->num_short_term_ref_pic_sets);

  for (int i = 0; i < sps->num_short_term_ref_pic_sets; i++) {
    LOG1("ref_pic_set[ %2d ]: ",i);
    dump_compact_short_term_ref_pic_set(&sets[i], 16, fh);
  }
//.........这里部分代码省略.........
开发者ID:4j1th,项目名称:libde265,代码行数:101,代码来源:sps.c

示例13: LOG1

/*
 * encodeToJpeg: encodes the given buffer and creates the final JPEG file
 * Input:  mainBuf  - buffer containing the main picture image
 *         thumbBuf - buffer containing the thumbnail image (optional, can be NULL)
 * Output: destBuf  - buffer containing the final JPEG image including EXIF header
 *         Note that, if present, thumbBuf will be included in EXIF header
 */
status_t PictureThread::encodeToJpeg(CameraBuffer *mainBuf, CameraBuffer *thumbBuf, CameraBuffer *destBuf)
{
    LOG1("@%s", __FUNCTION__);
    status_t status = NO_ERROR;

    nsecs_t startTime = systemTime();
    nsecs_t endTime;

    // Convert and encode the thumbnail, if present and EXIF maker is initialized

    if (mConfig.exif.enableThumb) {

        LOG1("Encoding thumbnail");

        // setup the JpegCompressor input and output buffers
        mEncoderInBuf.clear();
        mEncoderInBuf.buf = (unsigned char*)thumbBuf->getData();
        mEncoderInBuf.width = mConfig.thumbnail.width;
        mEncoderInBuf.height = mConfig.thumbnail.height;
        mEncoderInBuf.format = mConfig.thumbnail.format;
        mEncoderInBuf.size = frameSize(mConfig.thumbnail.format,
                mConfig.thumbnail.width,
                mConfig.thumbnail.height);
        mEncoderOutBuf.clear();
        mEncoderOutBuf.buf = mOutData;
        mEncoderOutBuf.width = mConfig.thumbnail.width;
        mEncoderOutBuf.height = mConfig.thumbnail.height;
        mEncoderOutBuf.quality = mConfig.thumbnail.quality;
        mEncoderOutBuf.size = mMaxOutDataSize;
        endTime = systemTime();
        int size = compressor.encode(mEncoderInBuf, mEncoderOutBuf);
        LOG1("Thumbnail JPEG size: %d (time to encode: %ums)", size, (unsigned)((systemTime() - endTime) / 1000000));
        if (size > 0) {
            encoder.setThumbData(mEncoderOutBuf.buf, size);
        } else {
            // This is not critical, we can continue with main picture image
            ALOGE("Could not encode thumbnail stream!");
        }
    } else {
        LOG1("Skipping thumbnail");
    }
    int totalSize = 0;
    unsigned int exifSize = 0;
    // Copy the SOI marker
    unsigned char* currentPtr = mExifBuf;
    memcpy(currentPtr, JPEG_MARKER_SOI, sizeof(JPEG_MARKER_SOI));
    totalSize += sizeof(JPEG_MARKER_SOI);
    currentPtr += sizeof(JPEG_MARKER_SOI);
    if (encoder.makeExif(currentPtr, &mConfig.exif, &exifSize, false) != JPG_SUCCESS)
        ALOGE("Error making EXIF");
    currentPtr += exifSize;
    totalSize += exifSize;
    // Copy the EOI marker
    memcpy(currentPtr, (void*)JPEG_MARKER_EOI, sizeof(JPEG_MARKER_EOI));
    totalSize += sizeof(JPEG_MARKER_EOI);
    currentPtr += sizeof(JPEG_MARKER_EOI);
    exifSize = totalSize;

    // Convert and encode the main picture image
    // setup the JpegCompressor input and output buffers
    mEncoderInBuf.clear();
    mEncoderInBuf.buf = (unsigned char *) mainBuf->getData();

    mEncoderInBuf.width = mConfig.picture.width;
    mEncoderInBuf.height = mConfig.picture.height;
    mEncoderInBuf.format = mConfig.picture.format;
    mEncoderInBuf.size = frameSize(mConfig.picture.format,
            mConfig.picture.width,
            mConfig.picture.height);
    mEncoderOutBuf.clear();
    mEncoderOutBuf.buf = (unsigned char*)mOutData;
    mEncoderOutBuf.width = mConfig.picture.width;
    mEncoderOutBuf.height = mConfig.picture.height;
    mEncoderOutBuf.quality = mConfig.picture.quality;
    mEncoderOutBuf.size = mMaxOutDataSize;
    endTime = systemTime();
    int mainSize = compressor.encode(mEncoderInBuf, mEncoderOutBuf);
    LOG1("Picture JPEG size: %d (time to encode: %ums)", mainSize, (unsigned)((systemTime() - endTime) / 1000000));
    if (mainSize > 0) {
        // We will skip SOI marker from final file
        totalSize += (mainSize - sizeof(JPEG_MARKER_SOI));
    } else {
        ALOGE("Could not encode picture stream!");
        status = UNKNOWN_ERROR;
    }

    if (status == NO_ERROR) {
        mCallbacks->allocateMemory(destBuf, totalSize);
        if (destBuf->getData() == NULL) {
            ALOGE("No memory for final JPEG file!");
            status = NO_MEMORY;
        }
    }
//.........这里部分代码省略.........
开发者ID:quanganh2627,项目名称:platform_vendor_intel_libcamerauvc,代码行数:101,代码来源:PictureThread.cpp

示例14: LOG1

AtomCP::~AtomCP()
{
    LOG1("@%s", __FUNCTION__);
    ia_cp_hdr_uninit();
    ia_cp_uninit();
}
开发者ID:bju2000,项目名称:android_hardware_intel,代码行数:6,代码来源:AtomCP.cpp

示例15: KineticPDU_ReceiveMain

KineticStatus KineticPDU_ReceiveMain(KineticPDU* const response)
{
    assert(response != NULL);
    assert(response->connection != NULL);
    const int fd = response->connection->socket;
    assert(fd >= 0);
    LOGF1("\nReceiving PDU via fd=%d", fd);

    KineticStatus status;
    KineticMessage* msg = &response->protoData.message;

    // Receive the PDU header
    ByteBuffer rawHeader =
        ByteBuffer_Create(&response->headerNBO, sizeof(KineticPDUHeader), 0);
    status = KineticSocket_Read(fd, &rawHeader, rawHeader.array.len);
    if (status != KINETIC_STATUS_SUCCESS) {
        LOG0("Failed to receive PDU header!");
        return status;
    }
    else {
        LOG3("PDU header received successfully");
        KineticPDUHeader* headerNBO = &response->headerNBO;
        response->header = (KineticPDUHeader) {
            .versionPrefix = headerNBO->versionPrefix,
            .protobufLength = KineticNBO_ToHostU32(headerNBO->protobufLength),
            .valueLength = KineticNBO_ToHostU32(headerNBO->valueLength),
        };
        KineticLogger_LogHeader(1, &response->header);
    }

    // Receive the protobuf message
    status = KineticSocket_ReadProtobuf(fd, response);
    if (status != KINETIC_STATUS_SUCCESS) {
        LOG0("Failed to receive PDU protobuf message!");
        return status;
    }
    else {
        LOG3("Received PDU protobuf");
        KineticLogger_LogProtobuf(2, response->proto);
    }

    // Validate the HMAC for the recevied protobuf message
    if (response->proto->authType == KINETIC_PROTO_MESSAGE_AUTH_TYPE_HMACAUTH) {
        if(!KineticHMAC_Validate(
          response->proto, response->connection->session.hmacKey)) {
            LOG0("Received PDU protobuf message has invalid HMAC!");
            msg->has_command = true;
            msg->command.status = &msg->status;
            msg->status.code = KINETIC_PROTO_COMMAND_STATUS_STATUS_CODE_DATA_ERROR;
            return KINETIC_STATUS_DATA_ERROR;
        }
        else {
            LOG3("Received protobuf HMAC validation succeeded");
        }
    }
    else if (response->proto->authType == KINETIC_PROTO_MESSAGE_AUTH_TYPE_PINAUTH) {
        LOG0("PIN-based authentication not yet supported!");
        return KINETIC_STATUS_DATA_ERROR;
    }
    else if (response->proto->authType == KINETIC_PROTO_MESSAGE_AUTH_TYPE_UNSOLICITEDSTATUS) {
        LOG3("Unsolicited status message is not authenticated");
    }

    // Extract embedded command, if supplied
    KineticProto_Message* pMsg = response->proto;
    if (pMsg->has_commandBytes &&
      pMsg->commandBytes.data != NULL &&
      pMsg->commandBytes.len > 0) {
        response->command = KineticProto_command__unpack(
            NULL,
            pMsg->commandBytes.len,
            pMsg->commandBytes.data);
    }

    status = KineticPDU_GetStatus(response);
    if (status == KINETIC_STATUS_SUCCESS) {
        LOG2("PDU received successfully!");
    }
    return status;
}

KineticStatus KineticPDU_ReceiveValue(int socket_desc, ByteBuffer* value, size_t value_length)
{
    assert(socket_desc >= 0);
    assert(value != NULL);
    assert(value->array.data != NULL);

    // Receive value payload
    LOGF1("Receiving value payload (%lld bytes)...", value_length);
    ByteBuffer_Reset(value);
    KineticStatus status = KineticSocket_Read(socket_desc, value, value_length);
    if (status != KINETIC_STATUS_SUCCESS) {
        LOG0("Failed to receive PDU value payload!");
        return status;
    }
    LOG1("Received value payload successfully");
    KineticLogger_LogByteBuffer(3, "Value Buffer", *value);
    return status;
}
开发者ID:atomicobject,项目名称:kinetic-c,代码行数:99,代码来源:kinetic_pdu.c


注:本文中的LOG1函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。