Build VLC for android with record patch

VLC for Android and Chrome OS specific usage questions
ccko
New Cone
New Cone
Posts: 9
Joined: 10 Jul 2014 11:28

Build VLC for android with record patch

Postby ccko » 10 Jul 2014 11:34

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);
}

}

edwardw
Big Cone-huna
Big Cone-huna
Posts: 2346
Joined: 24 Jun 2012 23:36
VLC version: 3.0.0-git

Re: Build VLC for android with record patch

Postby edwardw » 10 Jul 2014 13:24

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.

ccko
New Cone
New Cone
Posts: 9
Joined: 10 Jul 2014 11:28

Re: Build VLC for android with record patch

Postby ccko » 10 Jul 2014 13:56

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; }

edwardw
Big Cone-huna
Big Cone-huna
Posts: 2346
Joined: 24 Jun 2012 23:36
VLC version: 3.0.0-git

Re: Build VLC for android with record patch

Postby edwardw » 10 Jul 2014 15:20

Then read the logs.

ccko
New Cone
New Cone
Posts: 9
Joined: 10 Jul 2014 11:28

Re: Build VLC for android with record patch

Postby ccko » 11 Jul 2014 05:05

Thank u.

How can I read the logs?

Right now, I can record some streaming video.

But motion jpeg still not recorded.

edwardw
Big Cone-huna
Big Cone-huna
Posts: 2346
Joined: 24 Jun 2012 23:36
VLC version: 3.0.0-git

Re: Build VLC for android with record patch

Postby edwardw » 11 Jul 2014 05:14

With logcat.

ccko
New Cone
New Cone
Posts: 9
Joined: 10 Jul 2014 11:28

Re: Build VLC for android with record patch

Postby ccko » 11 Jul 2014 06:31

but logcat not display any error message.

edwardw
Big Cone-huna
Big Cone-huna
Posts: 2346
Joined: 24 Jun 2012 23:36
VLC version: 3.0.0-git

Re: Build VLC for android with record patch

Postby edwardw » 11 Jul 2014 06:33


ccko
New Cone
New Cone
Posts: 9
Joined: 10 Jul 2014 11:28

Re: Build VLC for android with record patch

Postby ccko » 14 Jul 2014 03:55

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

edwardw
Big Cone-huna
Big Cone-huna
Posts: 2346
Joined: 24 Jun 2012 23:36
VLC version: 3.0.0-git

Re: Build VLC for android with record patch

Postby edwardw » 14 Jul 2014 15:03

They are incomplete.

ccko
New Cone
New Cone
Posts: 9
Joined: 10 Jul 2014 11:28

Re: Build VLC for android with record patch

Postby ccko » 15 Jul 2014 03:22

They are incomplete.
I upload the complete log.

thank you.

http://goo.gl/QukwRs

edwardw
Big Cone-huna
Big Cone-huna
Posts: 2346
Joined: 24 Jun 2012 23:36
VLC version: 3.0.0-git

Re: Build VLC for android with record patch

Postby edwardw » 15 Jul 2014 05:02

Does it even play?

ccko
New Cone
New Cone
Posts: 9
Joined: 10 Jul 2014 11:28

Re: Build VLC for android with record patch

Postby ccko » 15 Jul 2014 06:32

Yes, it can play


Return to “VLC for Android and Chrome OS”

Who is online

Users browsing this forum: No registered users and 11 guests