jobject surface) {
GLEnv* gl_env = ConvertFromJava<GLEnv>(env, thiz);
if (!surface) {
- LOGE("GLEnvironment: Null Surface passed!");
+ ALOGE("GLEnvironment: Null Surface passed!");
return -1;
} else if (gl_env) {
// Get the ANativeWindow
ANativeWindow* window = ANativeWindow_fromSurface(env, surface);
if (!window) {
- LOGE("GLEnvironment: Error creating window!");
+ ALOGE("GLEnvironment: Error creating window!");
return -1;
}
eglChooseConfig(gl_env->display(), configAttribs, &config, 1, &numConfigs);
if (numConfigs < 1) {
- LOGE("GLEnvironment: No suitable EGL configuration found for surface!");
+ ALOGE("GLEnvironment: No suitable EGL configuration found for surface!");
return -1;
}
NULL);
if (GLEnv::CheckEGLError("eglCreateWindowSurface")) {
- LOGE("GLEnvironment: Error creating window surface!");
+ ALOGE("GLEnvironment: Error creating window surface!");
return -1;
}
jint height) {
GLEnv* gl_env = ConvertFromJava<GLEnv>(env, thiz);
if (!surface) {
- LOGE("GLEnvironment: Null SurfaceTexture passed!");
+ ALOGE("GLEnvironment: Null SurfaceTexture passed!");
return -1;
} else if (gl_env) {
// Get the ANativeWindow
ANativeWindow* window = ANativeWindow_fromSurface(env, surface);
if (!window) {
- LOGE("GLEnvironment: Error creating window!");
+ ALOGE("GLEnvironment: Error creating window!");
return -1;
}
eglChooseConfig(gl_env->display(), configAttribs, &config, 1, &numConfigs);
if (numConfigs < 1) {
- LOGE("GLEnvironment: No suitable EGL configuration found for surface texture!");
+ ALOGE("GLEnvironment: No suitable EGL configuration found for surface texture!");
return -1;
}
NULL);
if (GLEnv::CheckEGLError("eglCreateWindowSurface")) {
- LOGE("GLEnvironment: Error creating window surface!");
+ ALOGE("GLEnvironment: Error creating window surface!");
return -1;
}
// get a native mediarecorder object from the java object
sp<MediaRecorder> mr = getMediaRecorder(env, jmediarecorder);
if (mr == NULL) {
- LOGE("GLEnvironment: Error- MediaRecorder could not be initialized!");
+ ALOGE("GLEnvironment: Error- MediaRecorder could not be initialized!");
return -1;
}
// over binder calls
sp<ISurfaceTexture> surfaceMS = mr->querySurfaceMediaSourceFromMediaServer();
if (surfaceMS == NULL) {
- LOGE("GLEnvironment: Error- MediaRecorder returned a null \
+ ALOGE("GLEnvironment: Error- MediaRecorder returned a null \
<ISurfaceTexture> handle.");
return -1;
}
if (window == NULL) {
- LOGE("GLEnvironment: Error creating window!");
+ ALOGE("GLEnvironment: Error creating window!");
return -1;
}
window->incStrong((void*)ANativeWindow_acquire);
eglChooseConfig(gl_env->display(), configAttribs, &config, 1, &numConfigs);
if (numConfigs < 1) {
- LOGE("GLEnvironment: No suitable EGL configuration found for surface texture!");
+ ALOGE("GLEnvironment: No suitable EGL configuration found for surface texture!");
delete winHandle;
return -1;
}
NULL);
if (GLEnv::CheckEGLError("eglCreateWindowSurface")) {
- LOGE("GLEnvironment: Error creating window surface!");
+ ALOGE("GLEnvironment: Error creating window surface!");
delete winHandle;
return -1;
}
if (frame && bitmap) {
// Make sure frame size matches bitmap size
if ((size / 4) != (frame->Size() / bytes_per_sample)) {
- LOGE("Size mismatch in native setBitmap()!");
+ ALOGE("Size mismatch in native setBitmap()!");
return JNI_FALSE;
}
break;
}
default:
- LOGE("Unsupported bytes-per-pixel %d in setBitmap!", bytes_per_sample);
+ ALOGE("Unsupported bytes-per-pixel %d in setBitmap!", bytes_per_sample);
break;
}
return (AndroidBitmap_unlockPixels(env, bitmap) == ANDROID_BITMAP_RESUT_SUCCESS);
if (result == ANDROID_BITMAP_RESUT_SUCCESS) {
// Make sure frame size matches bitmap size
if ((size / 4) != (frame->Size() / bytes_per_sample)) {
- LOGE("Size mismatch in native getBitmap()!");
+ ALOGE("Size mismatch in native getBitmap()!");
return JNI_FALSE;
}
break;
}
default:
- LOGE("Unsupported bytes-per-pixel %d in getBitmap!", bytes_per_sample);
+ ALOGE("Unsupported bytes-per-pixel %d in getBitmap!", bytes_per_sample);
break;
}
return (AndroidBitmap_unlockPixels(env, bitmap) == ANDROID_BITMAP_RESUT_SUCCESS);
jstring key,
jstring value) {
if (!value) {
- LOGE("Native Program: Attempting to set null value for key %s!",
+ ALOGE("Native Program: Attempting to set null value for key %s!",
ToCppString(env, key).c_str());
}
NativeProgram* program = ConvertFromJava<NativeProgram>(env, thiz);
if (input) {
NativeFrame* native_frame = ConvertFromJava<NativeFrame>(env, input);
if (!native_frame) {
- LOGE("NativeProgram: Could not grab NativeFrame input %d!", i);
+ ALOGE("NativeProgram: Could not grab NativeFrame input %d!", i);
return JNI_FALSE;
}
input_data = reinterpret_cast<const char*>(native_frame->Data());
if (output) {
NativeFrame* output_frame = ConvertFromJava<NativeFrame>(env, output);
if (!output_frame) {
- LOGE("NativeProgram: Could not grab NativeFrame output!");
+ ALOGE("NativeProgram: Could not grab NativeFrame output!");
return JNI_FALSE;
}
output_data = reinterpret_cast<char*>(output_frame->MutableData());
if (c_value.value) {
return ToJBool(program && program->SetUniformValue(c_key, c_value));
} else {
- LOGE("ShaderProgram: Could not convert java object value passed for key '%s'!", c_key.c_str());
+ ALOGE("ShaderProgram: Could not convert java object value passed for key '%s'!", c_key.c_str());
return JNI_FALSE;
}
}
jobject input = env->GetObjectArrayElement(inputs, i);
const GLFrame* input_frame = ConvertFromJava<GLFrame>(env, input);
if (!input || !input_frame) {
- LOGE("ShaderProgram: invalid input frame %d!", i);
+ ALOGE("ShaderProgram: invalid input frame %d!", i);
return JNI_FALSE;
}
input_frames.push_back(input_frame);
// Get the output frame
GLFrame* output_frame = ConvertFromJava<GLFrame>(env, output);
if (!output_frame) {
- LOGE("ShaderProgram: no output frame found!");
+ ALOGE("ShaderProgram: no output frame found!");
return JNI_FALSE;
}
// Process the frames!
if (!program->Process(input_frames, output_frame)) {
- LOGE("ShaderProgram: error processing shader!");
+ ALOGE("ShaderProgram: error processing shader!");
return JNI_FALSE;
}
if (ref_count_)
++(*ref_count_);
else
- LOGE("JavaObject: Reference count is NULL! JavaObject may be corrupted.");
+ ALOGE("JavaObject: Reference count is NULL! JavaObject may be corrupted.");
}
void JavaObject::Release() {
if (*ref_count_ == 0) {
JNIEnv* env = GetCurrentJNIEnv();
if (!env)
- LOGE("JavaObject: Releasing outside of Java thread. Will just leak!");
+ ALOGE("JavaObject: Releasing outside of Java thread. Will just leak!");
else if (object_)
env->DeleteGlobalRef(object_);
delete ref_count_;
ref_count_ = NULL;
}
} else {
- LOGE("JavaObject: Reference count is NULL! JavaObject may be corrupted.");
+ ALOGE("JavaObject: Reference count is NULL! JavaObject may be corrupted.");
}
}
// Log error if this did not work
if (CheckEGLError("TearDown!"))
- LOGE("GLEnv: Error tearing down GL Environment!");
+ ALOGE("GLEnv: Error tearing down GL Environment!");
}
bool GLEnv::IsInitialized() const {
bool GLEnv::InitWithNewContext() {
if (IsInitialized()) {
- LOGE("GLEnv: Attempting to reinitialize environment!");
+ ALOGE("GLEnv: Attempting to reinitialize environment!");
return false;
}
eglChooseConfig(display(), configAttribs, &config, 1, &numConfigs);
if (numConfigs < 1) {
- LOGE("GLEnv::Init: No suitable EGL configuration found!");
+ ALOGE("GLEnv::Init: No suitable EGL configuration found!");
return false;
}
bool GLEnv::CheckGLError(const std::string& op) {
bool err = false;
for (GLint error = glGetError(); error; error = glGetError()) {
- LOGE("GL Error: Operation '%s' caused GL error (0x%x)\n",
+ ALOGE("GL Error: Operation '%s' caused GL error (0x%x)\n",
op.c_str(),
error);
err = true;
for (EGLint error = eglGetError();
error != EGL_SUCCESS;
error = eglGetError()) {
- LOGE("EGL Error: Operation '%s' caused EGL error (0x%x)\n",
+ ALOGE("EGL Error: Operation '%s' caused EGL error (0x%x)\n",
op.c_str(),
error);
err = true;
error = eglGetError()) {
switch (error) {
case EGL_BAD_DISPLAY:
- LOGE("EGL Error: Attempting to activate context with bad display!");
+ ALOGE("EGL Error: Attempting to activate context with bad display!");
break;
case EGL_BAD_SURFACE:
- LOGE("EGL Error: Attempting to activate context with bad surface!");
+ ALOGE("EGL Error: Attempting to activate context with bad surface!");
break;
case EGL_BAD_ACCESS:
- LOGE("EGL Error: Attempting to activate context, which is "
+ ALOGE("EGL Error: Attempting to activate context, which is "
"already active in another thread!");
break;
default:
- LOGE("EGL Error: Making EGL rendering context current caused "
+ ALOGE("EGL Error: Making EGL rendering context current caused "
"error: 0x%x\n", error);
}
err = true;
if (texture_state_ == kStateUninitialized) {
// Make sure texture not in use already
if (glIsTexture(texture_id_)) {
- LOGE("GLFrame: Cannot generate texture id %d, as it is in use already!", texture_id_);
+ ALOGE("GLFrame: Cannot generate texture id %d, as it is in use already!", texture_id_);
return false;
}
if (fbo_state_ == kStateUninitialized) {
// Make sure FBO not in use already
if (glIsFramebuffer(fbo_id_)) {
- LOGE("GLFrame: Cannot generate FBO id %d, as it is in use already!", fbo_id_);
+ ALOGE("GLFrame: Cannot generate FBO id %d, as it is in use already!", fbo_id_);
return false;
}
if (fbo_state_ == kStateComplete || texture_state_ == kStateUnmanaged) {
return true;
} else if (fbo_state_ != kStateGenerated) {
- LOGE("Attempting to attach texture to FBO with no FBO in place!");
+ ALOGE("Attempting to attach texture to FBO with no FBO in place!");
return false;
}
if (!lib_handle_) {
lib_handle_ = dlopen(lib_name.c_str(), RTLD_NOW);
if (!lib_handle_) {
- LOGE("NativeProgram: Error opening library: '%s': %s", lib_name.c_str(), dlerror());
+ ALOGE("NativeProgram: Error opening library: '%s': %s", lib_name.c_str(), dlerror());
return false;
}
return true;
return false;
process_function_ = reinterpret_cast<ProcessFunctionPtr>(dlsym(lib_handle_, func_name.c_str()));
if (!process_function_) {
- LOGE("NativeProgram: Could not find process function symbol: '%s'!", func_name.c_str());
+ ALOGE("NativeProgram: Could not find process function symbol: '%s'!", func_name.c_str());
return false;
}
return true;
// Abort if program did not successfully compile and link
if (!IsExecutable()) {
- LOGE("ShaderProgram: unexecutable program!");
+ ALOGE("ShaderProgram: unexecutable program!");
return false;
}
// Focus the FBO of the output
if (!output->FocusFrameBuffer()) {
- LOGE("Unable to focus frame buffer");
+ ALOGE("Unable to focus frame buffer");
return false;
}
const GLuint tex_id = input[i]->GetTextureId();
const GLenum target = input[i]->GetTextureTarget();
if (tex_id == 0) {
- LOGE("ShaderProgram: invalid texture id at input: %d!", i);
+ ALOGE("ShaderProgram: invalid texture id at input: %d!", i);
return false;
}
textures.push_back(tex_id);
// And render!
if (!RenderFrame(textures, targets)) {
- LOGE("Unable to render frame");
+ ALOGE("Unable to render frame");
return false;
}
return true;
bool ShaderProgram::CompileAndLink() {
// Make sure we haven't compiled and linked already
if (vertex_shader_ != 0 || fragment_shader_ != 0 || program_ != 0) {
- LOGE("Attempting to re-compile shaders!");
+ ALOGE("Attempting to re-compile shaders!");
return false;
}
vertex_shader_ = CompileShader(GL_VERTEX_SHADER,
vertex_shader_source_.c_str());
if (!vertex_shader_) {
- LOGE("Shader compilation failed!");
+ ALOGE("Shader compilation failed!");
return false;
}
ProgramVar pos_coord_attr = glGetAttribLocation(program_, PositionAttributeName().c_str());
manage_coordinates_ = (tex_coord_attr >= 0 && pos_coord_attr >= 0);
} else {
- LOGE("Could not link shader program!");
+ ALOGE("Could not link shader program!");
return false;
}
glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
if (!compiled) {
// Log the compilation error messages
- LOGE("Problem compiling shader! Source:");
- LOGE("%s", source);
+ ALOGE("Problem compiling shader! Source:");
+ ALOGE("%s", source);
std::string src(source);
unsigned int cur_pos = 0;
unsigned int next_pos = 0;
int line_number = 1;
while ( (next_pos = src.find_first_of('\n', cur_pos)) != std::string::npos) {
- LOGE("%03d : %s", line_number, src.substr(cur_pos, next_pos-cur_pos).c_str());
+ ALOGE("%03d : %s", line_number, src.substr(cur_pos, next_pos-cur_pos).c_str());
cur_pos = next_pos + 1;
line_number++;
}
- LOGE("%03d : %s", line_number, src.substr(cur_pos, next_pos-cur_pos).c_str());
+ ALOGE("%03d : %s", line_number, src.substr(cur_pos, next_pos-cur_pos).c_str());
GLint log_length = 0;
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &log_length);
char* error_log = new char[log_length];
if (error_log) {
glGetShaderInfoLog(shader, log_length, NULL, error_log);
- LOGE("Shader compilation error %d:\n%s\n", shader_type, error_log);
+ ALOGE("Shader compilation error %d:\n%s\n", shader_type, error_log);
delete[] error_log;
}
}
char* error_log = new char[log_length];
if (error_log) {
glGetProgramInfoLog(program, log_length, NULL, error_log);
- LOGE("Program Linker Error:\n%s\n", error_log);
+ ALOGE("Program Linker Error:\n%s\n", error_log);
delete[] error_log;
}
}
if (tex_var >= 0) {
glUniform1i(tex_var, i);
} else {
- LOGE("ShaderProgram: Shader does not seem to support %d number of "
+ ALOGE("ShaderProgram: Shader does not seem to support %d number of "
"inputs! Missing uniform 'tex_sampler_%d'!", textures.size(), i);
return false;
}
const std::vector<GLenum>& targets) {
// Make sure we have enough texture units to accomodate the textures
if (textures.size() > static_cast<unsigned>(MaxTextureUnits())) {
- LOGE("ShaderProgram: Number of input textures is unsupported on this "
+ ALOGE("ShaderProgram: Number of input textures is unsupported on this "
"platform!");
return false;
}
// Prepare to render
if (!BeginDraw()) {
- LOGE("ShaderProgram: couldn't initialize gl for drawing!");
+ ALOGE("ShaderProgram: couldn't initialize gl for drawing!");
return false;
}
// Bind input textures
if (!BindInputTextures(textures, targets)) {
- LOGE("BindInputTextures failed");
+ ALOGE("BindInputTextures failed");
return false;
}
int components,
int value_size) {
if (expected_count != (value_size / components)) {
- LOGE("Shader Program: %s Value Error (%s): Expected value length %d "
+ ALOGE("Shader Program: %s Value Error (%s): Expected value length %d "
"(%d components), but received length of %d (%d components)!",
var_type.c_str(), var_name.c_str(),
expected_count, components * expected_count,
int components,
int value_size) {
if (value_size % components != 0) {
- LOGE("Shader Program: %s Value Error (%s): Value must be multiple of %d, "
+ ALOGE("Shader Program: %s Value Error (%s): Value must be multiple of %d, "
"but %d elements were passed!", var_type.c_str(), var_name.c_str(),
components, value_size);
return false;
bool ShaderProgram::CheckVarValid(ProgramVar var) {
if (!IsVarValid(var)) {
- LOGE("Shader Program: Attempting to access invalid variable!");
+ ALOGE("Shader Program: Attempting to access invalid variable!");
return false;
}
return true;
// Uniforms ////////////////////////////////////////////////////////////////////
bool ShaderProgram::CheckUniformValid(ProgramVar var) {
if (!IsVarValid(var) || uniform_indices_.find(var) == uniform_indices_.end()) {
- LOGE("Shader Program: Attempting to access unknown uniform %d!", var);
+ ALOGE("Shader Program: Attempting to access unknown uniform %d!", var);
return false;
}
return true;
ProgramVar ShaderProgram::GetUniform(const std::string& name) const {
if (!IsExecutable()) {
- LOGE("ShaderProgram: Error: Must link program before querying uniforms!");
+ ALOGE("ShaderProgram: Error: Must link program before querying uniforms!");
return -1;
}
return glGetUniformLocation(program_, name.c_str());
ProgramVar ShaderProgram::GetAttribute(const std::string& name) const {
if (!IsExecutable()) {
- LOGE("ShaderProgram: Error: Must link program before querying attributes!");
+ ALOGE("ShaderProgram: Error: Must link program before querying attributes!");
return -1;
} else if (name == PositionAttributeName() || name == TexCoordAttributeName()) {
ALOGW("ShaderProgram: Attempting to overwrite internal vertex attribute '%s'!", name.c_str());
// Make sure the passed data vector has a valid size
if (total % components != 0) {
- LOGE("ShaderProgram: Invalid attribute vector given! Specified a component "
+ ALOGE("ShaderProgram: Invalid attribute vector given! Specified a component "
"count of %d, but passed a non-multiple vector of size %d!",
components, total);
return false;
mTotalUSec += stopUSec - mStartUSec;
if (mNumCalls % mLoggingPeriodInFrames == 0) {
const float mSec = TotalUSec() * 1.0E-3f / NumCalls();
- LOGE("%s: %f ms", Name().c_str(), mSec);
+ ALOGE("%s: %f ms", Name().c_str(), mSec);
}
}
mStartUSec = 0;
// Create buffer if not created already
const bool first_upload = !HasVBO();
if (first_upload && !CreateBuffer()) {
- LOGE("VertexFrame: Could not create vertex buffer!");
+ ALOGE("VertexFrame: Could not create vertex buffer!");
return false;
}
else if (!first_upload && size <= size_)
glBufferSubData(GL_ARRAY_BUFFER, 0, size, data);
else {
- LOGE("VertexFrame: Attempting to upload more data (%d bytes) than fits "
+ ALOGE("VertexFrame: Attempting to upload more data (%d bytes) than fits "
"inside the vertex frame (%d bytes)!", size, size_);
return false;
}
const Point& lengths) {
Point dy = vert_axis;
if (!dy.ScaleTo(lengths.y() / 2.0f)) {
- LOGE("Illegal axis: %f %f", vert_axis.x(), vert_axis.y());
+ ALOGE("Illegal axis: %f %f", vert_axis.x(), vert_axis.y());
return false;
}
mTotalUSec += stopUSec - mStartUSec;
if (mNumCalls % mLoggingPeriodInFrames == 0) {
const float mSec = TotalUSec() * 1.0E-3f / NumCalls();
- LOGE("%s: %f ms", Name().c_str(), mSec);
+ ALOGE("%s: %f ms", Name().c_str(), mSec);
}
}
mStartUSec = 0;
sp<IOMX> omx(service->getOMX());
if (omx.get() == NULL) {
- LOGE("android_videoCodec_expose() couldn't access OMX interface");
+ ALOGE("android_videoCodec_expose() couldn't access OMX interface");
return false;
}
// Receives notifications about death of media.player service
const sp<MediaPlayerDeathNotifier> mPlayerDeathNotifier;
- // Return a reference to the media player service, or LOGE and return NULL after retries fail
+ // Return a reference to the media player service, or ALOGE and return NULL after retries fail
static const sp<IMediaPlayerService> getMediaPlayerService() {
return IMediaDeathNotifier::getMediaPlayerService();
}
nbRead = fread(dataCache, BUFFER_SIZE, NB_BUFFERS, file);
if (nbRead <= 0) {
// could be premature EOF or I/O error
- LOGE("Error filling cache, exiting\n");
+ ALOGE("Error filling cache, exiting\n");
return JNI_FALSE;
}
assert(1 <= nbRead && nbRead <= NB_BUFFERS);
// open the file to play
file = fopen(utf8, "rb");
if (file == NULL) {
- LOGE("Failed to open %s", utf8);
+ ALOGE("Failed to open %s", utf8);
return JNI_FALSE;
}