• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ LOGD函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

int main(int argc, char **argv)
{
    const char * rilLibPath = NULL;
    char **rilArgv;
    void *dlHandle;
    const RIL_RadioFunctions *(*rilInit)(const struct RIL_Env *, int, char **);
    const RIL_RadioFunctions *funcs;
    char libPath[PROPERTY_VALUE_MAX];
    unsigned char hasLibArgs = 0;

    int i;

    umask(S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH);
    for (i = 1; i < argc ;) {
        if (0 == strcmp(argv[i], "-l") && (argc - i > 1)) {
            rilLibPath = argv[i + 1];
            i += 2;
        } else if (0 == strcmp(argv[i], "--")) {
            i++;
            hasLibArgs = 1;
            break;
        } else {
            usage(argv[0]);
        }
    }

    if (rilLibPath == NULL) {
        if ( 0 == property_get(LIB_PATH_PROPERTY, libPath, NULL)) {
            // No lib sepcified on the command line, and nothing set in props.
            // Assume "no-ril" case.
            goto done;
        } else {
            rilLibPath = libPath;
        }
    }

    /* special override when in the emulator */
#if 1
    {
        static char*  arg_overrides[3];
        static char   arg_device[32];
        int           done = 0;

#define  REFERENCE_RIL_PATH  "/system/lib/libreference-ril.so"

        /* first, read /proc/cmdline into memory */
        char          buffer[1024], *p, *q;
        int           len;
        int           fd = open("/proc/cmdline",O_RDONLY);

        if (fd < 0) {
            LOGD("could not open /proc/cmdline:%s", strerror(errno));
            goto OpenLib;
        }

        do {
            len = read(fd,buffer,sizeof(buffer)); }
        while (len == -1 && errno == EINTR);

        if (len < 0) {
            LOGD("could not read /proc/cmdline:%s", strerror(errno));
            close(fd);
            goto OpenLib;
        }
        close(fd);

        if (strstr(buffer, "android.qemud=") != NULL)
        {
            /* the qemud daemon is launched after rild, so
            * give it some time to create its GSM socket
            */
            int  tries = 5;
#define  QEMUD_SOCKET_NAME    "qemud"

            while (1) {
                int  fd;

                sleep(1);

                fd = socket_local_client(
                            QEMUD_SOCKET_NAME,
                            ANDROID_SOCKET_NAMESPACE_RESERVED,
                            SOCK_STREAM );

                if (fd >= 0) {
                    close(fd);
                    snprintf( arg_device, sizeof(arg_device), "%s/%s",
                                ANDROID_SOCKET_DIR, QEMUD_SOCKET_NAME );

                    arg_overrides[1] = "-s";
                    arg_overrides[2] = arg_device;
                    done = 1;
                    break;
                }
                LOGD("could not connect to %s socket: %s",
                    QEMUD_SOCKET_NAME, strerror(errno));
                if (--tries == 0)
                    break;
            }
            if (!done) {
//.........这里部分代码省略.........
开发者ID:ioz9,项目名称:hardware_ril,代码行数:101,代码来源:rild.c


示例2: switch


//.........这里部分代码省略.........
				{
					for (int z = 0; z < 2; ++z)
					{
						CanSpawn = a_Chunk->UnboundedRelGetBlockType(a_RelX + x, a_RelY, a_RelZ + z, TargetBlock);
						CanSpawn = CanSpawn && (TargetBlock == E_BLOCK_AIR);
						if (!CanSpawn)
						{
							return false;
						}
						HasFloor = (
							HasFloor ||
							(
								a_Chunk->UnboundedRelGetBlockType(a_RelX + x, a_RelY - 1, a_RelZ + z, TargetBlock) &&
								!cBlockInfo::IsTransparent(TargetBlock)
							)
						);
					}
				}
				return CanSpawn && HasFloor && (SkyLight <= 7) && (BlockLight <= 7);
			}
			
			case mtCreeper:
			case mtSkeleton:
			case mtZombie:
			{
				return (
					(TargetBlock == E_BLOCK_AIR) &&
					(BlockAbove == E_BLOCK_AIR) &&
					(!cBlockInfo::IsTransparent(BlockBelow)) &&
					(SkyLight <= 7) &&
					(BlockLight <= 7) &&
					(Random.NextInt(2, a_Biome) == 0)
				);
			}

			case mtMagmaCube:
			case mtSlime:
			{
				return (
					(TargetBlock == E_BLOCK_AIR) &&
					(BlockAbove == E_BLOCK_AIR) &&
					(!cBlockInfo::IsTransparent(BlockBelow)) &&
					(
						(a_RelY <= 40) || (a_Biome == biSwampland)
					)
				);
			}
			
			case mtGhast:
			case mtZombiePigman:
			{
				return (
					(TargetBlock == E_BLOCK_AIR) &&
					(BlockAbove == E_BLOCK_AIR) &&
					(!cBlockInfo::IsTransparent(BlockBelow)) &&
					(Random.NextInt(20, a_Biome) == 0)
				);
			}
			
			case mtWolf:
			{
				return (
					(TargetBlock == E_BLOCK_GRASS) &&
					(BlockAbove == E_BLOCK_AIR) &&
					(
						(a_Biome == biTaiga) ||
						(a_Biome == biTaigaHills) ||
						(a_Biome == biForest) ||
						(a_Biome == biForestHills) ||
						(a_Biome == biColdTaiga) ||
						(a_Biome == biColdTaigaHills) ||
						(a_Biome == biTaigaM) ||
						(a_Biome == biMegaTaiga) ||
						(a_Biome == biMegaTaigaHills)
					)
				);
			}

			case mtMooshroom:
			{
				return (
					(TargetBlock == E_BLOCK_AIR) &&
					(BlockAbove == E_BLOCK_AIR) &&
					(BlockBelow == E_BLOCK_MYCELIUM) &&
					(
						(a_Biome == biMushroomShore) ||
						(a_Biome == biMushroomIsland)
					)
				);
			}
			
			default:
			{
				LOGD("MG TODO: Write spawning rule for mob type %d", a_MobType);
				return false;
			}
		}
	}
	return false;
}
开发者ID:dougvj,项目名称:MCServer,代码行数:101,代码来源:MobSpawner.cpp


示例3: zipalign

int zipalign(const char *apk_path, uid_t uid, int is_public)
{
    char za_path[PKG_PATH_MAX];
    struct utimbuf ut;
    struct stat za_stat, apk_stat;
    int res;
    pid_t pid;
    pid = fork();
    if (pid == 0) {
        run_check_zipalign(apk_path);
        exit(67);
    } else {
        res = wait_check_zipalign(pid, apk_path);
        if (res == 0) {
            goto notneeded;
        }
    }    
    
    memset(&apk_stat, 0, sizeof(apk_stat));
    stat(apk_path, &apk_stat);

    strcpy(za_path, apk_path);
    strcat(za_path, ".tmp");
    LOGD("ZipAlign: --- BEGIN '%s' ---\n", apk_path);
    
    pid = fork();
    if (pid == 0) {
        run_zipalign(apk_path, za_path);
        exit(67);
    } else {
        res = wait_zipalign(pid, za_path);
        if (res != 0) {
            LOGE("zipalign failed on '%s' res = %d\n", za_path, res);
            goto fail;
        }
   }
    
    if (chown(za_path, apk_stat.st_uid, apk_stat.st_gid) < 0) {
        LOGE("zipalign cannot chown '%s'", apk_path);
        goto fail;
    }
    if (chmod(za_path, S_IRUSR|S_IWUSR|S_IRGRP |
        (is_public ? S_IROTH : 0)) < 0) {
LOGE("zipalign cannot chmod '%s'\n", apk_path);
goto fail;
    }

    ut.actime = apk_stat.st_atime;
    ut.modtime = apk_stat.st_mtime;
    utime(za_path, &ut);

    unlink(apk_path);
    rename(za_path, apk_path);

    return 0;
    
notneeded:
    return 0;
    
fail:
    unlink(za_path);
    return -1;

}
开发者ID:mnlk2-custom,项目名称:android_frameworks_base,代码行数:64,代码来源:commands.c


示例4: LOGD

bool
HwcComposer2D::TryHwComposition()
{
    FramebufferSurface* fbsurface = (FramebufferSurface*)(GetGonkDisplay()->GetFBSurface());

    if (!(fbsurface && fbsurface->lastHandle)) {
        LOGD("H/W Composition failed. FBSurface not initialized.");
        return false;
    }

    // Add FB layer
    int idx = mList->numHwLayers++;
    if (idx >= mMaxLayerCount) {
        if (!ReallocLayerList() || idx >= mMaxLayerCount) {
            LOGE("TryHwComposition failed! Could not add FB layer");
            return false;
        }
    }

    Prepare(fbsurface->lastHandle, -1);

    /* Possible composition paths, after hwc prepare:
    1. GPU Composition
    2. BLIT Composition
    3. Full OVERLAY Composition
    4. Partial OVERLAY Composition (GPU + OVERLAY) */

    bool gpuComposite = false;
    bool blitComposite = false;
    bool overlayComposite = true;

    for (int j=0; j < idx; j++) {
        if (mList->hwLayers[j].compositionType == HWC_FRAMEBUFFER ||
            mList->hwLayers[j].compositionType == HWC_BLIT) {
            // Full OVERLAY composition is not possible on this frame
            // It is either GPU / BLIT / partial OVERLAY composition.
            overlayComposite = false;
            break;
        }
    }

    if (!overlayComposite) {
        for (int k=0; k < idx; k++) {
            switch (mList->hwLayers[k].compositionType) {
                case HWC_FRAMEBUFFER:
                    gpuComposite = true;
                    break;
                case HWC_BLIT:
                    blitComposite = true;
                    break;
                case HWC_OVERLAY:
                    // HWC will compose HWC_OVERLAY layers in partial
                    // Overlay Composition, set layer composition flag
                    // on mapped LayerComposite to skip GPU composition
                    mHwcLayerMap[k]->SetLayerComposited(true);
                    if ((mList->hwLayers[k].hints & HWC_HINT_CLEAR_FB) &&
                        (mList->hwLayers[k].blending == HWC_BLENDING_NONE)) {
                        // Clear visible rect on FB with transparent pixels.
                        hwc_rect_t r = mList->hwLayers[k].displayFrame;
                        mHwcLayerMap[k]->SetClearRect(nsIntRect(r.left, r.top,
                                                                r.right - r.left,
                                                                r.bottom - r.top));
                    }
                    break;
                default:
                    break;
            }
        }

        if (gpuComposite) {
            // GPU or partial OVERLAY Composition
            return false;
        } else if (blitComposite) {
            // Some EGLSurface implementations require glClear() on blit composition.
            // See bug 1029856.
            if (mGLContext) {
                mGLContext->MakeCurrent();
                mGLContext->fClearColor(0.0, 0.0, 0.0, 0.0);
                mGLContext->fClear(LOCAL_GL_COLOR_BUFFER_BIT);
            }
            // BLIT Composition, flip FB target
            GetGonkDisplay()->UpdateFBSurface(mDpy, mSur);
            FramebufferSurface* fbsurface = (FramebufferSurface*)(GetGonkDisplay()->GetFBSurface());
            if (!fbsurface) {
                LOGE("H/W Composition failed. NULL FBSurface.");
                return false;
            }
            mList->hwLayers[idx].handle = fbsurface->lastHandle;
            mList->hwLayers[idx].acquireFenceFd = fbsurface->GetPrevFBAcquireFd();
        }
    }

    // BLIT or full OVERLAY Composition
    Commit();

    GetGonkDisplay()->SetFBReleaseFd(mList->hwLayers[idx].releaseFenceFd);
    mList->hwLayers[idx].releaseFenceFd = -1;
    return true;
}
开发者ID:Acidburn0zzz,项目名称:tor-browser,代码行数:99,代码来源:HwcComposer2D.cpp


示例5: client_connection

static bool client_connection(int fd)
{
    bool ret = true;
    auto fail = util::finally([&] {
        if (!ret) {
            LOGE("Killing connection");
        }
    });

    LOGD("Accepted connection from %d", fd);

    struct ucred cred;
    socklen_t cred_len = sizeof(struct ucred);

    if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len) < 0) {
        LOGE("Failed to get socket credentials: %s", strerror(errno));
        return ret = false;
    }

    LOGD("Client PID: %u", cred.pid);
    LOGD("Client UID: %u", cred.uid);
    LOGD("Client GID: %u", cred.gid);

    if (verify_credentials(cred.uid)) {
        if (!util::socket_write_string(fd, RESPONSE_ALLOW)) {
            LOGE("Failed to send credentials allowed message");
            return ret = false;
        }
    } else {
        if (!util::socket_write_string(fd, RESPONSE_DENY)) {
            LOGE("Failed to send credentials denied message");
        }
        return ret = false;
    }

    int32_t version;
    if (!util::socket_read_int32(fd, &version)) {
        LOGE("Failed to get interface version");
        return ret = false;
    }

    if (version == 2) {
        LOGE("Protocol version 2 is no longer supported");
        util::socket_write_string(fd, RESPONSE_UNSUPPORTED);
        return ret = false;
    } else if (version == 3) {
        if (!util::socket_write_string(fd, RESPONSE_OK)) {
            return false;
        }

        if (!connection_version_3(fd)) {
            LOGE("[Version 3] Communication error");
        }
        return true;
    } else {
        LOGE("Unsupported interface version: %d", version);
        util::socket_write_string(fd, RESPONSE_UNSUPPORTED);
        return ret = false;
    }

    return true;
}
开发者ID:TeamButter,项目名称:DualBootPatcher,代码行数:62,代码来源:daemon.cpp


示例6: replace_method

static void replace_method (Package *pkg) {
    xmono::ReplaceMethodReq req;
    xmono::ReplaceMethodRsp rsp;
    std::string str((char*)pkg->body, pkg->all_len - sizeof (Package));
    if (!req.ParseFromString (str)) {
        LOGD ("xmono::ReplaceMethodReq ParseFromString err!");
        return;
    }
    std::string err;
    void *p, *old_p;
    uint8_t *code;
    int code_size;
    MonoMethodHeader *mh;
    MonoThread *thread;
    MonoMethod *new_method;
    MonoDomain *domain;
    MonoMethod * method = get_method_with_token (req.image_name ().c_str (), req.method_token ());
    if (!method) {
        rsp.set_err (false);
        rsp.set_msg (helper_last_err ());
        goto replace_method_end;
    }
    domain = mono_domain_get_by_id (req.domain_id ());
    if (!domain) {
        rsp.set_err (false);
        rsp.set_msg ("can not get the domain from id");
        goto replace_method_end;
    }
    mh = mono_method_get_header (method);
    if (req.ex_size () != mono_method_header_get_num_clauses (mh)) {
        rsp.set_err (false);
        rsp.set_msg ("ex size != mono_method_header_clauses size!");
        goto replace_method_end;
    }
    for (int i = 0; i < req.ex_size (); i++) {
        xmono::ReplaceMethodReq_ExceptionClause const &e = req.ex (i);
        void *iter = 0;
        MonoExceptionClause *clauses = &mh->clauses[i];
        MonoExceptionClause *old_e = (MonoExceptionClause*)iter;
        old_e->try_offset = e.try_offset ();
        old_e->try_len = e.try_len ();
        old_e->handler_offset = e.handler_offset ();
        old_e->handler_len = e.handler_len ();
    }
    code = new uint8_t[req.new_code ().size ()];
    memcpy (code, req.new_code ().c_str (), req.new_code ().size ());
    mh->code = code;
    mh->code_size = req.new_code ().size ();
    thread = mono_thread_attach (domain);
    /*128 是一个估计值, 在未来可能不稳定, 但当前只能如此*/
    new_method = (MonoMethod*)calloc (128, 1); /*这个地方用malloc优于用new*/
    memcpy (new_method, method, 128);

    pthread_mutex_lock (&replace_mutex);
    replace_method_dict[new_method] = true;
    pthread_mutex_unlock (&replace_mutex);

    p = mono_compile_method (new_method);
    memcpy (hooked_method_dict[method]->specific_hook + 4, &p, 4);

    pthread_mutex_lock (&hooked_mutex);
    old_p = mono_jit_info_get_code_start (hooked_method_dict[method]->jinfo);
    pthread_mutex_unlock (&hooked_mutex);

    mono_thread_detach (thread);
    LOGD ("compile method, new ptr : %p, old ptr : %p", p, old_p);
    rsp.set_err (true);
    rsp.set_msg ("replace_method successful.");
replace_method_end:
    std::string out;
    rsp.SerializeToString (&out);
    ecmd_send (XMONO_ID_REPLACE_METHOD_RSP, (uint8_t const*)out.c_str (), out.size ());
    return;
}
开发者ID:0bj3ct,项目名称:xmono,代码行数:74,代码来源:xmono.cpp


示例7: so_main

extern "C" int so_main() {
    LOGD ("hello, xmono");
    install_jit_profile ();
    init_network ();
    return 0;
}
开发者ID:0bj3ct,项目名称:xmono,代码行数:6,代码来源:xmono.cpp


示例8: LOGD

Application::~Application()
{
	LOGD("Application::Destructor()");

     destroy();
}
开发者ID:XClouded,项目名称:xielei,代码行数:6,代码来源:Application.cpp


示例9: jsScope


//.........这里部分代码省略.........
                break;
        }

    } else if (jsValue.isArray()) {
        auto len = jsValue.getLength();

        switch (_key) {
            case StyleParamKey::extrude: {
                if (len != 2) {
                    LOGW("Wrong array size for extrusion: '%d'.", len);
                    break;
                }

                double v1 = jsValue.getValueAtIndex(0).toDouble();
                double v2 = jsValue.getValueAtIndex(1).toDouble();

                _val = glm::vec2(v1, v2);
                break;
            }
            case StyleParamKey::color:
            case StyleParamKey::outline_color:
            case StyleParamKey::text_font_fill:
            case StyleParamKey::text_font_stroke_color: {
                if (len < 3 || len > 4) {
                    LOGW("Wrong array size for color: '%d'.", len);
                    break;
                }
                double r = jsValue.getValueAtIndex(0).toDouble();
                double g = jsValue.getValueAtIndex(1).toDouble();
                double b = jsValue.getValueAtIndex(2).toDouble();
                double a = 1.0;
                if (len == 4) {
                    a = jsValue.getValueAtIndex(3).toDouble();
                }
                _val = ColorF(r, g, b, a).toColor().abgr;
                break;
            }
            default:
                break;
        }
    } else if (jsValue.isNumber()) {
        double number = jsValue.toDouble();
        if (std::isnan(number)) {
            LOGD("duk evaluates JS method to NAN.\n");
        }
        switch (_key) {
            case StyleParamKey::text_source:
            case StyleParamKey::text_source_left:
            case StyleParamKey::text_source_right:
                _val = doubleToString(number);
                break;
            case StyleParamKey::extrude:
                _val = glm::vec2(0.f, number);
                break;
            case StyleParamKey::placement_spacing: {
                _val = StyleParam::Width{static_cast<float>(number), Unit::pixel};
                break;
            }
            case StyleParamKey::width:
            case StyleParamKey::outline_width: {
                // TODO more efficient way to return pixels.
                // atm this only works by return value as string
                _val = StyleParam::Width{static_cast<float>(number)};
                break;
            }
            case StyleParamKey::angle:
            case StyleParamKey::priority:
            case StyleParamKey::text_priority:
            case StyleParamKey::text_font_stroke_width:
            case StyleParamKey::placement_min_length_ratio: {
                _val = static_cast<float>(number);
                break;
            }
            case StyleParamKey::size: {
                StyleParam::SizeValue vec;
                vec.x.value = static_cast<float>(number);
                _val = vec;
                break;
            }
            case StyleParamKey::order:
            case StyleParamKey::outline_order:
            case StyleParamKey::color:
            case StyleParamKey::outline_color:
            case StyleParamKey::text_font_fill:
            case StyleParamKey::text_font_stroke_color: {
                _val = static_cast<uint32_t>(number);
                break;
            }
            default:
                break;
        }
    } else if (jsValue.isUndefined()) {
        // Explicitly set value as 'undefined'. This is important for some styling rules.
        _val = Undefined();
    } else {
        LOGW("Unhandled return type from Javascript style function for %d.", _key);
    }

    return !_val.is<none_type>();
}
开发者ID:karimnaaji,项目名称:tangram-es,代码行数:101,代码来源:styleContext.cpp


示例10: dvmAbstractMethodStub

/*
 * Magic "internal native" code stub, inserted into abstract method
 * definitions when a class is first loaded.  This throws the expected
 * exception so we don't have to explicitly check for it in the interpreter.
 */
void dvmAbstractMethodStub(const u4* args, JValue* pResult)
{
    LOGD("--- called into dvmAbstractMethodStub\n");
    dvmThrowException("Ljava/lang/AbstractMethodError;",
        "abstract method not implemented");
}
开发者ID:sdklite,项目名称:Dalvik_CAR,代码行数:11,代码来源:InternalNative.c


示例11: AT_DUMP

void  AT_DUMP(const char*  prefix, const char*  buff, int  len)
{
    if (len < 0)
        len = strlen(buff);
    LOGD("%.*s", len, buff);
}
开发者ID:CoolRunnerII,项目名称:device_kovsky,代码行数:6,代码来源:atchannel.c


示例12: while

static const char *readline()
{
    ssize_t count;

    char *p_read = NULL;
    char *p_eol = NULL;
    char *ret;

    /* this is a little odd. I use *s_ATBufferCur == 0 to
     * mean "buffer consumed completely". If it points to a character, than
     * the buffer continues until a \0
     */
    if (*s_ATBufferCur == '\0') {
        /* empty buffer */
        s_ATBufferCur = s_ATBuffer;
        *s_ATBufferCur = '\0';
        p_read = s_ATBuffer;
    } else {   /* *s_ATBufferCur != '\0' */
        /* there's data in the buffer from the last read */

        // skip over leading newlines
        while (*s_ATBufferCur == '\r' || *s_ATBufferCur == '\n')
            s_ATBufferCur++;

        p_eol = findNextEOL(s_ATBufferCur);

        if (p_eol == NULL) {
            /* a partial line. move it up and prepare to read more */
            size_t len;

            len = strlen(s_ATBufferCur);

            memmove(s_ATBuffer, s_ATBufferCur, len + 1);
            p_read = s_ATBuffer + len;
            s_ATBufferCur = s_ATBuffer;
        }
        /* Otherwise, (p_eol !- NULL) there is a complete line  */
        /* that will be returned the while () loop below        */
    }

    while (p_eol == NULL) {
        if (0 == MAX_AT_RESPONSE - (p_read - s_ATBuffer)) {
            LOGE("ERROR: Input line exceeded buffer\n");
            /* ditch buffer and start over again */
            s_ATBufferCur = s_ATBuffer;
            *s_ATBufferCur = '\0';
            p_read = s_ATBuffer;
        }

        do {
            count = read(s_fd, p_read,
                            MAX_AT_RESPONSE - (p_read - s_ATBuffer));
        } while (count < 0 && errno == EINTR);

        if (count > 0) {
            AT_DUMP( "<< ", p_read, count );
            s_readCount += count;

            p_read[count] = '\0';

            // skip over leading newlines
            while (*s_ATBufferCur == '\r' || *s_ATBufferCur == '\n')
                s_ATBufferCur++;

            p_eol = findNextEOL(s_ATBufferCur);
            p_read += count;
        } else if (count <= 0) {
            /* read error encountered or EOF reached */
            if(count == 0) {
                LOGD("atchannel: EOF reached");
            } else {
                LOGD("atchannel: read error %s", strerror(errno));
            }
            return NULL;
        }
    }

    /* a full line in the buffer. Place a \0 over the \r and return */

    ret = s_ATBufferCur;
    *p_eol = '\0';
    s_ATBufferCur = p_eol + 1; /* this will always be <= p_read,    */
                              /* and there will be a \0 at *p_read */

    LOGD("AT< %s\n", ret);
    return ret;
}
开发者ID:CoolRunnerII,项目名称:device_kovsky,代码行数:87,代码来源:atchannel.c


示例13: predict

int predict(float **values, int **indices, int rowNum, int colNum, int isProb,
        const char *modelFile, int *labels, double* prob_estimates) {
    LOGD("Coming into classification\n");
    return svmpredict(values, indices, rowNum, colNum, isProb, modelFile, labels, prob_estimates);
}
开发者ID:4nt0ny,项目名称:HandGestureApp,代码行数:5,代码来源:predict.cpp


示例14: defaultEGLChooser

bool defaultEGLChooser(EGLDisplay disp, EGLConfig& bestConfig)
{

	EGLint count = 0;
	if (!eglGetConfigs(disp, NULL, 0, &count))
	{
		LOGE("defaultEGLChooser cannot query count of all configs");
		return false;
	}

	LOGD("Config count = %d", count);

	EGLConfig* configs = new EGLConfig[count];
	if (!eglGetConfigs(disp, configs, count, &count))
	{
		LOGE("defaultEGLChooser cannot query all configs");
		return false;
	}

	int bestMatch = 1<<30;
	int bestIndex = -1;

	int i;
	for (i = 0; i < count; i++)
	{
		int match = 0;
		EGLint surfaceType = 0;
		EGLint blueBits = 0;
		EGLint greenBits = 0;
		EGLint redBits = 0;
		EGLint alphaBits = 0;
		EGLint depthBits = 0;
		EGLint stencilBits = 0;
		EGLint renderableFlags = 0;

		eglGetConfigAttrib(disp, configs[i], EGL_SURFACE_TYPE, &surfaceType);
		eglGetConfigAttrib(disp, configs[i], EGL_BLUE_SIZE, &blueBits);
		eglGetConfigAttrib(disp, configs[i], EGL_GREEN_SIZE, &greenBits);
		eglGetConfigAttrib(disp, configs[i], EGL_RED_SIZE, &redBits);
		eglGetConfigAttrib(disp, configs[i], EGL_ALPHA_SIZE, &alphaBits);
		eglGetConfigAttrib(disp, configs[i], EGL_DEPTH_SIZE, &depthBits);
		eglGetConfigAttrib(disp, configs[i], EGL_STENCIL_SIZE, &stencilBits);
		eglGetConfigAttrib(disp, configs[i], EGL_RENDERABLE_TYPE, &renderableFlags);
		LOGD("Config[%d]: R%dG%dB%dA%d D%dS%d Type=%04x Render=%04x",
			i, redBits, greenBits, blueBits, alphaBits, depthBits, stencilBits, surfaceType, renderableFlags);

		if ((surfaceType & EGL_WINDOW_BIT) == 0)
			continue;
		if ((renderableFlags & EGL_OPENGL_ES2_BIT) == 0)
			continue;
		if (depthBits < 16)
			continue;
		if ((redBits < 5) || (greenBits < 6) || (blueBits < 5))
			continue;

		int penalty = depthBits - 16;
		match += penalty * penalty;
		penalty = redBits - 5;
		match += penalty * penalty;
		penalty = greenBits - 6;
		match += penalty * penalty;
		penalty = blueBits - 5;
		match += penalty * penalty;
		penalty = alphaBits;
		match += penalty * penalty;
		penalty = stencilBits;
		match += penalty * penalty;

		if ((match < bestMatch) || (bestIndex == -1))
		{
			bestMatch = match;
			bestIndex = i;
			LOGD("Config[%d] is the new best config", i, configs[i]);
		}
	}

	if (bestIndex < 0)
	{
		delete[] configs;
		return false;
	}

	bestConfig = configs[bestIndex];
	delete[] configs;

	return true;
}
开发者ID:ikryukov,项目名称:ShadowsAndroid,代码行数:87,代码来源:Shadows.cpp


示例15: mono_shutdown

/*mono正常退出时 该函数被调用*/
static void mono_shutdown (MonoProfiler *prof) {
    LOGD ("mono over.");
}
开发者ID:0bj3ct,项目名称:xmono,代码行数:4,代码来源:xmono.cpp


示例16: fb_open

static int fb_open(struct FB *fb)
{
	if (NULL == fb)
	{
		return -1;
	}

	fb->fd = open("/dev/graphics/fb0", O_RDONLY | O_RDWR);
	if (fb->fd < 0)
	{
		printf("open(\"/dev/graphics/fb0\") failed!\n");
		LOGI("---open(\"/dev/graphics/fb0\") failed!---");
		return -1;
	}

	struct fb_var_screeninfo vi;
	vi.xres = 1088;
	vi.yres = 1800;
	vi.xres_virtual = 1088;
	vi.yres_virtual = 4000;

	ioctl(fb->fd, FBIOPUT_VSCREENINFO, vi);


	if (ioctl(fb->fd, FBIOGET_FSCREENINFO, &fb->fi) < 0)
	{
		printf("FBIOGET_FSCREENINFO failed!\n");
		LOGI("---FBIOGET_FSCREENINFO failed!---");
		goto fail;
	}

	LOGD("====== smem_start : %lu",  fb->fi.smem_start);
	// Framebuffer设备的大小
	LOGD("====== smem_len : %d",  fb->fi.smem_len);
	// 一行的byte数目 除以 (bits_per_pixel/8) 就是一行的像素点的数目
	LOGD("====== line_length : %d",  fb->fi.line_length);

	//FB_TYPE_PACKED_PIXELS                0       /* Packed Pixels        */
	//FB_TYPE_PLANES                            1       /* Non interleaved planes */
	//FB_TYPE_INTERLEAVED_PLANES      2       /* Interleaved planes   */
	//FB_TYPE_TEXT                                3       /* Text/attributes      */
	//FB_TYPE_VGA_PLANES                    4       /* EGA/VGA planes       */
	//FB_TYPE_FOURCC                          5       /* Type identified by a V4L2 FOURCC */
	LOGD("====== type : %d",  fb->fi.type);

	if (ioctl(fb->fd, FBIOGET_VSCREENINFO, &fb->vi) < 0)
	{
		printf("FBIOGET_VSCREENINFO failed!\n");
		LOGI("---FBIOGET_VSCREENINFO failed!---");
		goto fail;
	}



	/*打印信息*/
	{
		// 这两个是显示在显示屏上时候的分辨率
		LOGD("====== xres : %d",  fb->vi.xres);
		LOGD("====== yres : %d",  fb->vi.yres);
		// 这两个是显存缓存的分辨率 如果显存缓存了两个屏幕的时候
		// yres_virtula 应该等于 yres * 2
		// 而 xres_virtual 就应该 == xres
		LOGD("====== xres_virtual : %d",  fb->vi.xres_virtual);
		LOGD("====== yres_virtual : %d",  fb->vi.yres_virtual);

		/* offset from virtual to visible */
		// 显存可能缓存了多个屏幕,哪到底哪个屏幕才是显示屏应该显示的内容呢
		// 这就是由下面这两个offset来决定了
		LOGD("====== xoffset : %d",  fb->vi.xoffset);
		LOGD("====== yoffset : %d",  fb->vi.yoffset);

		LOGD("====== bits_per_pixel : %d",  fb->vi.bits_per_pixel);

		// 下面这一段是每个像素点的格式
		LOGD("====== fb_bitfield red.offset : %d",  fb->vi.red.offset);
		LOGD("====== fb_bitfield red.length : %d",  fb->vi.red.length);
		// 如果 == 0,指的是数据的最高有效位在最左边 也就是Big endian
		LOGD("====== fb_bitfield red.msb_right : %d",  fb->vi.red.msb_right);
		LOGD("====== fb_bitfield green.offset : %d",  fb->vi.green.offset);
		LOGD("====== fb_bitfield green.length : %d",  fb->vi.green.length);
		LOGD("====== fb_bitfield green.msb_right : %d",  fb->vi.green.msb_right);
		LOGD("====== fb_bitfield blue.offset : %d",  fb->vi.blue.offset);
		LOGD("====== fb_bitfield blue.length : %d",  fb->vi.blue.length);
		LOGD("====== fb_bitfield blue.msb_right : %d",  fb->vi.blue.msb_right);
		LOGD("====== fb_bitfield transp.offset : %d",  fb->vi.transp.offset);
		LOGD("====== fb_bitfield transp.length : %d",  fb->vi.transp.length);
		LOGD("====== fb_bitfield transp.msb_right : %d",  fb->vi.transp.msb_right);

		LOGD("====== height : %d",  fb->vi.height);
		// width of picture in mm 毫米
		LOGD("====== width : %d",  fb->vi.width);


		LOGD("====== left_margin : %d",  fb->vi.left_margin);
		LOGD("====== right_margin : %d",  fb->vi.right_margin);
		LOGD("====== upper_margin : %d",  fb->vi.upper_margin);
		LOGD("====== lower_margin : %d",  fb->vi.lower_margin);
		LOGD("====== hsync_len : %d",  fb->vi.hsync_len);
		LOGD("====== vsync_len : %d",  fb->vi.vsync_len);
		LOGD("====== sync : %d",  fb->vi.sync);
//.........这里部分代码省略.........
开发者ID:WangMJ,项目名称:JieC_GetFramebuffer,代码行数:101,代码来源:ReadFrameBuffer.c


示例17: ecmd_err_callback

static void ecmd_err_callback () {
    LOGD ("ecmd err!");
    exit (1);
}
开发者ID:0bj3ct,项目名称:xmono,代码行数:4,代码来源:xmono.cpp


示例18: LOGI

/*
 * Class:     my_streamplayer_Rtsplayer
 * Method:    CreateRec
 * Signature: (Landroid/graphics/Bitmap;Ljava/lang/String;Ljava/lang/String;IIII)V
 */
void Java_my_streamplayer_Rtsplayer_CreateRec
(JNIEnv *env, jobject, jstring URL, jstring recfile, jint ID, jint x, jint y, jint frame_rate, jobject bitmap)
{
	jboolean isCopy;
	char* rtspURL = (char*) env->GetStringUTFChars(URL, &isCopy);
	char* RecFile = (char*) env->GetStringUTFChars(recfile, &isCopy);
	LOGI("CAM ID %d \tURL: %s \t FILE: %s\n ", ID, rtspURL, RecFile);

	int ret;

	switch(ID)
	{
	case 1:
		if ((ret = AndroidBitmap_getInfo(env, bitmap, &info)) < 0) {
			LOGI("AndroidBitmap_getInfo() failed ! error=%d", ret);
			return;
		}
		LOGI("Checked on the bitmap 1 ");

		if ((ret = AndroidBitmap_lockPixels(env, bitmap, &pixel1)) < 0) {
			LOGE("AndroidBitmap_lockPixels() failed ! error=%d", ret);
		}

		MyIPCAM1 = new ipcam_camera(rtspURL, ID, frame_rate);
		MyIPCAM1->init();      // initialize ring buffers
		MyIPCAM1->set_recFile(RecFile);

		//create FFMPEG Decoder - must be getting created here
		videoDecode1 = ipcam_vdec::getInstance(1);
		videoDecode1->setparam(x, y);
		MyIPCAM1->pVDec = videoDecode1;

		usleep (1000);
		//	videoDecode1->InitMPEG4Dec();  //doing this in play now, in playcontinueAfterDESCRIBE

		errorCam1 = MyIPCAM1->play_connect();
		//	MyIPCAM1->rec_connect();

		LOGD("IPCAM %d errorCam1 %d  widthframe : %d, heightframe =%d \n", ID, errorCam1 , x, y);
		break;

	case 2:
		if ((ret = AndroidBitmap_getInfo(env, bitmap, &info)) < 0) {
			LOGI("AndroidBitmap_getInfo() failed ! error=%d", ret);
			return;
		}
		LOGI("Checked on the bitmap 2");

		if ((ret = AndroidBitmap_lockPixels(env, bitmap, &pixel2)) < 0) {
			LOGE("AndroidBitmap_lockPixels() failed ! error=%d", ret);
		}

		MyIPCAM2 = new ipcam_camera(rtspURL, ID, frame_rate);
		MyIPCAM2->init();      // initialize ring buffers
		MyIPCAM2->set_recFile(RecFile);

		//create FFMPEG Decoder - must be getting created here
		videoDecode2 = ipcam_vdec::getInstance(2);
		videoDecode2->setparam(x, y);
		MyIPCAM2->pVDec = videoDecode2;
		//now initialize init
		usleep (1000);
		//videoDecode2->InitMPEG4Dec();
		errorCam2 = MyIPCAM2->play_connect();

		LOGD("IPCAM %d errorCam2 %d  widthframe : %d, heightframe =%d \n", ID, errorCam2 , x, y);
		break;

	case 3:
		if ((ret = AndroidBitmap_getInfo(env, bitmap, &info)) < 0) {
			LOGI("AndroidBitmap_getInfo() failed ! error=%d", ret);
			return;
		}
		LOGI("Checked on the bitmap");

		if ((ret = AndroidBitmap_lockPixels(env, bitmap, &pixel3)) < 0) {
			LOGE("AndroidBitmap_lockPixels() failed ! error=%d", ret);
		}
		LOGI("Grabbed the pixels");

		MyIPCAM3 = new ipcam_camera(rtspURL, ID, frame_rate);
		MyIPCAM3->init();      // initialize ring buffers
		MyIPCAM3->set_recFile(RecFile);

		//create FFMPEG Decoder - must be getting created here
		videoDecode3 = ipcam_vdec::getInstance(3);
		videoDecode3->setparam(x, y);
		MyIPCAM3->pVDec = videoDecode3;

		usleep (1000);
		//videoDecode3->InitMPEG4Dec();

		errorCam3 = MyIPCAM3->play_connect();
		//	MyIPCAM1->rec_connect();

//.........这里部分代码省略.........
开发者ID:JavanWang,项目名称:playstream,代码行数:101,代码来源:my_streamplayer_Rtsplayer.cpp


示例19: Java_com_example_hellohalide_CameraPreview_processFrame

JNIEXPORT void JNICALL Java_com_example_hellohalide_CameraPreview_processFrame(JNIEnv * env, jobject obj, jbyteArray jSrc, jobject surf) {

    halide_set_error_handler(handler);

    unsigned char *src = (unsigned char *)env->GetByteArrayElements(jSrc, NULL);

    ANativeWindow *win = ANativeWindow_fromSurface(env, surf);
    ANativeWindow_acquire(win);

    static bool first_call = true;
    static unsigned counter = 0;
    static unsigned times[16];
    if (first_call) {
      LOGD("Resetting buffer format");
      ANativeWindow_setBuffersGeometry(win, 640, 360, 0);
      first_call = false;
      for (int t = 0; t < 16; t++) times[t] = 0;
    }

    ANativeWindow_Buffer buf;
    ARect rect = {0, 0, 640, 360};
    ANativeWindow_lock(win, &buf, &rect);

    uint8_t *dst = (uint8_t *)buf.bits;
    buffer_t srcBuf = {0}, dstBuf = {0};
    srcBuf.host = (uint8_t *)src;
    srcBuf.extent[0] = 642;
    srcBuf.extent[1] = 362;
    srcBuf.extent[2] = 1;
    srcBuf.extent[3] = 1;
    srcBuf.stride[0] = 1;
    srcBuf.stride[1] = 640;
    srcBuf.min[0] = -1;
    srcBuf.min[1] = -1;
    srcBuf.elem_size = 1;

    dstBuf.host = dst;
    dstBuf.extent[0] = 640;
    dstBuf.extent[1] = 360;
    dstBuf.extent[2] = 1;
    dstBuf.extent[3] = 1;
    dstBuf.stride[0] = 1;
    dstBuf.stride[1] = 640;
    dstBuf.min[0] = 0;
    dstBuf.min[1] = 0;
    dstBuf.elem_size = 1;

    timeval t1, t2;
    gettimeofday(&t1, NULL);
    halide(&srcBuf, &dstBuf);
    gettimeofday(&t2, NULL);
    unsigned elapsed = (t2.tv_sec - t1.tv_sec)*1000000 + (t2.tv_usec - t1.tv_usec);

    times[counter & 15] = elapsed;
    counter++;
    unsigned min = times[0];
    for (int i = 1; i < 16; i++) {
        if (times[i] < min) min = times[i];
    }
    LOGD("Time taken: %d (%d)", elapsed, min);

    // Just copy over chrominance untouched
    memcpy(dst + 640*360, src + 640*480, 320*180);
    memcpy(dst + 640*360 + 320*180, src + 640*480 + 320*240, 320*180);

    ANativeWindow_unlockAndPost(win);
    ANativeWindow_release(win);

    env->ReleaseByteArrayElements(jSrc, (jbyte *)src, 0);
}
开发者ID:202198,项目名称:Halide,代码行数:70,代码来源:native.cpp


示例20: run_daemon

static bool run_daemon(void)
{
    int fd;
    struct sockaddr_un addr;

    fd = socket(AF_LOCAL, SOCK_STREAM, 0);
    if (fd < 0) {
        LOGE("Failed to create socket: %s", strerror(errno));
        return false;
    }

    auto close_fd = util::finally([&] {
        close(fd);
    });

    char abs_name[] = "\0mbtool.daemon";
    size_t abs_name_len = sizeof(abs_name) - 1;

    memset(&addr, 0, sizeof(addr));
    addr.sun_family = AF_LOCAL;
    memcpy(addr.sun_path, abs_name, abs_name_len);

    // Calculate correct length so the trailing junk is not included in the
    // abstract socket name
    socklen_t addr_len = offsetof(struct sockaddr_un, sun_path) + abs_name_len;

    if (bind(fd, (struct sockaddr *) &addr, addr_len) < 0) {
        LOGE("Failed to bind socket: %s", strerror(errno));
    

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LOGE函数代码示例发布时间:2022-05-30
下一篇:
C++ LOG4CXX_WARN函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap