我正在尝试从我的本机代码中读取一个简单的文本文件.
在我的活动中,我正在创建资产管理器:assetManager = getAssets();
然后我将assetManager传递给我的本机方法(如本机音频示例中所示):
AAssetManager* mgr = AAssetManager_fromJava(env, assetManager);
AAsset* asset = AAssetManager_open(mgr, "file.txt", AASSET_MODE_UNKNOWN);
AAssetManager* mgr = AAssetManager_fromJava(env, assetManager);
off_t start, length;
int fd = AAsset_openFileDescriptor(asset, &start, &length);
Run Code Online (Sandbox Code Playgroud)问题是fd
小于0 !!!
任何人都可以帮忙吗?
我有错误:uiview类型的值没有成员大小。这是我的代码:
if let nv = (AppDelegate.getAppDelegate().window?.rootViewController as? UINavigationController) {
let pushedViewControllers = nv.viewControllers
let presentedViewController:UIViewController = pushedViewControllers[pushedViewControllers.count - 1]
UIGraphicsBeginImageContext(presentedViewController.view.size()) //HERE IS THE ERROR
Run Code Online (Sandbox Code Playgroud)
检查了h文件,UIViewController具有公共var视图:UIView!谢谢!
我正在尝试编译这个例子
在Ubunto上.这是编译命令:
g++ video.cpp -o video `pkg-config --cflags opencv` `pkg-config --libs opencv` -lpthread -lavutil -lavformat -lavcodec -lz
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误:
/usr/local/include/libavutil/common.h:173:47: error: ‘UINT64_C’ was not declared in this scope
video.cpp: In member function ‘int FFread::init(char*)’:
video.cpp:24:56: error: ‘av_open_input_file’ was not declared in this scope
video.cpp:28:5: warning: ‘int av_find_stream_info(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1266) [-Wdeprecated-declarations]
video.cpp:28:35: warning: ‘int av_find_stream_info(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1266) [-Wdeprecated-declarations]
video.cpp:32:36: error: ‘dump_format’ was not declared in this scope
video.cpp:37:48: error: ‘CODEC_TYPE_VIDEO’ was not declared in this …
Run Code Online (Sandbox Code Playgroud) 我正在使用ndk 5并且样本构建正常.但是在我添加行的项目中
#include <SLES/OpenSLES.h>
它给出了编译错误,没有这样的文件或目录.除了源文件名之外,我的Android.mk与原生音频完全相同.
问题是什么?谢谢,Nahum