NO.*_*O.7 3 android android-ndk
我的目标是进行微调以找到正确的线程优先级.
我关注的线程位于/ hardware/my_company/codec/openmax_il /下
我修改了2个文件
Android.mk
在LOCAL_C_INCLUDES列表中添加"$(TOP)/ system/core/include",如下所示
LOCAL_C_INCLUDES:= \
blur blur blur
$(TOP)/hardware/my_company/camera/v4l2_camerahal \
$(TOP)/system/core/include
Run Code Online (Sandbox Code Playgroud)在我的源文件中.
#include <cutils/properties.h>
int componentInit(blur blur blur)
{
int ret = 0;
blur blur blur
// To find proper thread priority
char value[92];
property_get("omx.video_enc.priority", value, "0");
setVideoEncoderPriority(atoi(value));
return ret;
}
Run Code Online (Sandbox Code Playgroud)但是,我遇到了链接错误
error: undefined reference to 'property_get'
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
如果有人帮忙,那对我来说会很好.:)
谢谢
mah*_*mah 10
这听起来像你想要使用__system_property_get(),其定义<sys/system_properties.h>.从那个标题:
/* Look up a system property by name, copying its value and a
** \0 terminator to the provided pointer. The total bytes
** copied will be no greater than PROP_VALUE_MAX. Returns
** the string length of the value. A property that is not
** defined is identical to a property with a length 0 value.
*/
int __system_property_get(const char *name, char *value);
Run Code Online (Sandbox Code Playgroud)
此签名并不完全是您要使用的签名,因为在未定义属性的情况下您具有默认值.由于__system_property_get()在未定义属性的情况下返回0,您可以自己轻松补充.
以下是我在自己的本机代码中解决问题的方法,它对我很有用(虽然它缺少缓冲区溢出检查,这将是一个更好的解决方案):
#include <sys/system_properties.h>
int android_property_get(const char *key, char *value, const char *default_value)
{
int iReturn = __system_property_get(key, value);
if (!iReturn) strcpy(value, default_value);
return iReturn;
}
Run Code Online (Sandbox Code Playgroud)
gra*_*uet 10
您必须添加源文件
#include <cutils/properties.h>
Run Code Online (Sandbox Code Playgroud)
并链接到android.mk中的libcutils:
LOCAL_STATIC_LIBRARIES := libcutils libc
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16135 次 |
| 最近记录: |