Page 1 of 1

Build VLC for android with record patch

Posted: 10 Jul 2014 11:34
by ccko
Hello guys,

I git clone the latest vlc source code and apply the record patch (download from https://patches.videolan.org/patch/606/)

and add jni interface to LibVLC.java as below. but use android to call the method to record get nothing.

please help me to resolve this issue.

{

public native boolean takeSnapShot( int num, String file, int width, int height);

public native boolean videoRecordStart(String path);

public native boolean videoRecordStop();

public native boolean videoIsRecording();

public native boolean videoIsRecordable();

public native int getState();



public boolean takeSnapShot(String file, int width, int height) {
return takeSnapShot(0, file, width, height);
}

}

Re: Build VLC for android with record patch

Posted: 10 Jul 2014 13:24
by edwardw
Read up on how to use JNI.

You need to call the corresponding C functions in vlc-android/jni/libvlcjni.c as well. You can't just declare a native function without a corresponding C JNI function.

Re: Build VLC for android with record patch

Posted: 10 Jul 2014 13:56
by ccko
Thank you.

But I already add C functions in libvlcjni.c as below . Comiple Success but nothing record.

Code: Select all

jboolean Java_org_videolan_libvlc_LibVLC_takeSnapShot(JNIEnv *env, jobject thiz,jint number, jstring path, jint width,jint height) { jboolean isCopy; libvlc_media_player_t *mp = getMediaPlayer(env, thiz); /* Get C string */ const char* psz_path = (*env)->GetStringUTFChars(env, path, &isCopy); if (mp) if(libvlc_video_take_snapshot(mp, (int)number,psz_path , (int)width,(int)height)==0) return JNI_TRUE; return JNI_FALSE; } jboolean Java_org_videolan_libvlc_LibVLC_videoRecordStart(JNIEnv *env, jobject thiz,jstring path) { jboolean isCopy; libvlc_media_player_t *mp = getMediaPlayer(env, thiz); /* Get C string */ const char* psz_path = (*env)->GetStringUTFChars(env, path, &isCopy); //const char* psz_filename=(*env)->GetStringUTFChars(env, filename, &isCopy); if (mp) if(libvlc_media_player_record_start(mp,psz_path)==0) return JNI_TRUE; return JNI_FALSE; } jboolean Java_org_videolan_libvlc_LibVLC_videoRecordStop(JNIEnv *env, jobject thiz) { jboolean isCopy; libvlc_media_player_t *mp = getMediaPlayer(env, thiz); /* Get C string */ if (mp) if(libvlc_media_player_record_stop(mp)==0) return JNI_TRUE; return JNI_FALSE; } jboolean Java_org_videolan_libvlc_LibVLC_videoIsRecording(JNIEnv *env, jobject thiz) { jboolean isCopy; libvlc_media_player_t *mp = getMediaPlayer(env, thiz); if (mp) if(libvlc_media_player_is_recording(mp)) return JNI_TRUE; return JNI_FALSE; } jboolean Java_org_videolan_libvlc_LibVLC_videoIsRecordable(JNIEnv *env, jobject thiz) { jboolean isCopy; libvlc_media_player_t *mp = getMediaPlayer(env, thiz); if (mp) if(libvlc_media_player_is_recordable(mp)) return JNI_TRUE; return JNI_FALSE; } jint Java_org_videolan_libvlc_LibVLC_getState(JNIEnv *env, jobject thiz) { libvlc_media_player_t *mp = getMediaPlayer(env, thiz); if (mp){ libvlc_state_t state=libvlc_media_player_get_state(mp); return (jint)state; } else return -1; }

Re: Build VLC for android with record patch

Posted: 10 Jul 2014 15:20
by edwardw
Then read the logs.

Re: Build VLC for android with record patch

Posted: 11 Jul 2014 05:05
by ccko
Thank u.

How can I read the logs?

Right now, I can record some streaming video.

But motion jpeg still not recorded.

Re: Build VLC for android with record patch

Posted: 11 Jul 2014 05:14
by edwardw
With logcat.

Re: Build VLC for android with record patch

Posted: 11 Jul 2014 06:31
by ccko
but logcat not display any error message.

Re: Build VLC for android with record patch

Posted: 11 Jul 2014 06:33
by edwardw

Re: Build VLC for android with record patch

Posted: 14 Jul 2014 03:55
by ccko
Thank you for your suggestion.

I use logcat (ADT Plugin) in Eclipse and double check the both log messages are the same.

only mjpeg demux:~

Please see the log file http://goo.gl/Pv9i6z

Re: Build VLC for android with record patch

Posted: 14 Jul 2014 15:03
by edwardw
They are incomplete.

Re: Build VLC for android with record patch

Posted: 15 Jul 2014 03:22
by ccko
They are incomplete.
I upload the complete log.

thank you.

http://goo.gl/QukwRs

Re: Build VLC for android with record patch

Posted: 15 Jul 2014 05:02
by edwardw
Does it even play?

Re: Build VLC for android with record patch

Posted: 15 Jul 2014 06:32
by ccko
Yes, it can play