mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Fix upload progress callback in transcoder
This commit is contained in:
parent
ec5bcfc48e
commit
8fae40f1e4
2 changed files with 16 additions and 3 deletions
|
|
@ -5,7 +5,7 @@ include $(CLEAR_VARS)
|
|||
LOCAL_MODULE := libtranscode
|
||||
LOCAL_SRC_FILES := transcode.c
|
||||
LOCAL_SHARED_LIBRARIES := gstreamer_android
|
||||
LOCAL_LDLIBS := -landroid
|
||||
LOCAL_LDLIBS := -landroid -llog
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
#include <jni.h>
|
||||
#include <android/log.h>
|
||||
|
||||
static int init(void)
|
||||
{
|
||||
|
|
@ -56,11 +57,23 @@ static int transcode(const char *infile, const char *outfile,
|
|||
|
||||
gst_structure_get_int(s, "percent", &percent);
|
||||
|
||||
break;
|
||||
cb_class = (*env)->FindClass(env, "org/wikimedia/commons/Transcoder$TranscoderProgressCallback");
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "GStreamer", "Class not found");
|
||||
break;
|
||||
}
|
||||
|
||||
cb_class = (*env)->FindClass(env, "org/wikimedia/commons/TranscoderProgressCallback");
|
||||
cb_id = (*env)->GetMethodID(env, cb_class, "transcodeProgressCb", "(I)V");
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "GStreamer", "Method not found");
|
||||
break;
|
||||
}
|
||||
|
||||
(*env)->CallVoidMethod(env, cb_obj, cb_id, percent);
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "GStreamer", "Method call failed");
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue