Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLC-Android
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ewout ter Hoeven
VLC-Android
Commits
4f6f5e01
Commit
4f6f5e01
authored
Jul 12, 2016
by
Thomas Guillem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LibVLC: setup HOME env variable from an Android Context
parent
21603a2a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
17 deletions
+25
-17
libvlc/jni/libvlcjni.c
libvlc/jni/libvlcjni.c
+13
-1
libvlc/src/org/videolan/libvlc/LibVLC.java
libvlc/src/org/videolan/libvlc/LibVLC.java
+7
-6
libvlc/src/org/videolan/libvlc/media/MediaPlayer.java
libvlc/src/org/videolan/libvlc/media/MediaPlayer.java
+1
-1
libvlc/src/org/videolan/libvlc/media/VideoView.java
libvlc/src/org/videolan/libvlc/media/VideoView.java
+1
-6
libvlc/src/org/videolan/libvlc/util/Dumper.java
libvlc/src/org/videolan/libvlc/util/Dumper.java
+1
-1
vlc-android/src/org/videolan/vlc/util/VLCInstance.java
vlc-android/src/org/videolan/vlc/util/VLCInstance.java
+2
-2
No files found.
libvlc/jni/libvlcjni.c
View file @
4f6f5e01
...
...
@@ -356,7 +356,9 @@ void JNI_OnUnload(JavaVM* vm, void* reserved)
#endif
}
void
Java_org_videolan_libvlc_LibVLC_nativeNew
(
JNIEnv
*
env
,
jobject
thiz
,
jobjectArray
jstringArray
)
void
Java_org_videolan_libvlc_LibVLC_nativeNew
(
JNIEnv
*
env
,
jobject
thiz
,
jobjectArray
jstringArray
,
jstring
jhomePath
)
{
vlcjni_object
*
p_obj
=
NULL
;
libvlc_instance_t
*
p_libvlc
=
NULL
;
...
...
@@ -364,6 +366,16 @@ void Java_org_videolan_libvlc_LibVLC_nativeNew(JNIEnv *env, jobject thiz, jobjec
const
char
**
argv
=
NULL
;
int
argc
=
0
;
if
(
jhomePath
)
{
const
char
*
psz_home
=
(
*
env
)
->
GetStringUTFChars
(
env
,
jhomePath
,
0
);
if
(
psz_home
)
{
setenv
(
"HOME"
,
psz_home
,
1
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jhomePath
,
psz_home
);
}
}
if
(
jstringArray
)
{
argc
=
(
*
env
)
->
GetArrayLength
(
env
,
jstringArray
);
...
...
libvlc/src/org/videolan/libvlc/LibVLC.java
View file @
4f6f5e01
...
...
@@ -20,6 +20,7 @@
package
org.videolan.libvlc
;
import
android.content.Context
;
import
android.os.Build
;
import
android.util.Log
;
...
...
@@ -45,7 +46,7 @@ public class LibVLC extends VLCObject<LibVLC.Event> {
*
* @param options
*/
public
LibVLC
(
ArrayList
<
String
>
options
)
{
public
LibVLC
(
Context
context
,
ArrayList
<
String
>
options
)
{
loadLibraries
();
boolean
setAout
=
true
,
setChroma
=
true
;
...
...
@@ -78,14 +79,14 @@ public class LibVLC extends VLCObject<LibVLC.Event> {
}
}
nativeNew
(
options
.
toArray
(
new
String
[
options
.
size
()]));
nativeNew
(
options
.
toArray
(
new
String
[
options
.
size
()])
,
context
.
getDir
(
"vlc"
,
Context
.
MODE_PRIVATE
).
getAbsolutePath
()
);
}
/**
* Create a LibVLC
*/
public
LibVLC
()
{
this
(
null
);
public
LibVLC
(
Context
context
)
{
this
(
context
,
null
);
}
/**
...
...
@@ -141,10 +142,10 @@ public class LibVLC extends VLCObject<LibVLC.Event> {
}
/* JNI */
private
native
void
nativeNew
(
String
[]
options
);
private
native
void
nativeNew
(
String
[]
options
,
String
homePath
);
private
native
void
nativeRelease
();
private
native
void
nativeSetUserAgent
(
String
name
,
String
http
);
private
static
boolean
sLoaded
=
false
;
static
synchronized
void
loadLibraries
()
{
...
...
libvlc/src/org/videolan/libvlc/media/MediaPlayer.java
View file @
4f6f5e01
...
...
@@ -72,7 +72,7 @@ public class MediaPlayer
private
org
.
videolan
.
libvlc
.
MediaPlayer
mMediaPlayer
;
public
MediaPlayer
()
{
mLibVLC
=
new
LibVLC
();
//FIXME, this is wrong
mLibVLC
=
new
LibVLC
(
null
);
//FIXME, this is wrong
mMediaPlayer
=
new
org
.
videolan
.
libvlc
.
MediaPlayer
(
mLibVLC
);
}
...
...
libvlc/src/org/videolan/libvlc/media/VideoView.java
View file @
4f6f5e01
...
...
@@ -55,6 +55,7 @@ public class VideoView extends SurfaceView
public
VideoView
(
Context
context
)
{
super
(
context
);
sLibVLC
=
new
LibVLC
(
context
,
null
);
}
public
VideoView
(
Context
context
,
AttributeSet
attrs
)
{
...
...
@@ -70,10 +71,6 @@ public class VideoView extends SurfaceView
super
(
context
,
attrs
,
defStyleAttr
,
defStyleRes
);
}
private
void
initLibVLC
()
{
sLibVLC
=
new
LibVLC
();
}
@Override
@TargetApi
(
Build
.
VERSION_CODES
.
ICE_CREAM_SANDWICH
)
public
void
onInitializeAccessibilityEvent
(
AccessibilityEvent
event
)
{
...
...
@@ -91,12 +88,10 @@ public class VideoView extends SurfaceView
}
public
void
setVideoPath
(
String
path
)
{
initLibVLC
();
final
Media
media
=
new
Media
(
sLibVLC
,
path
);
}
public
void
setVideoURI
(
Uri
uri
)
{
initLibVLC
();
final
Media
media
=
new
Media
(
sLibVLC
,
uri
);
}
...
...
libvlc/src/org/videolan/libvlc/util/Dumper.java
View file @
4f6f5e01
...
...
@@ -60,7 +60,7 @@ public class Dumper {
options
.
add
(
"--no-audio"
);
options
.
add
(
"--no-spu"
);
options
.
add
(
"-vvv"
);
mLibVLC
=
new
LibVLC
(
options
);
mLibVLC
=
new
LibVLC
(
null
,
options
);
final
Media
media
=
new
Media
(
mLibVLC
,
uri
);
mMediaPlayer
=
new
MediaPlayer
(
media
);
...
...
vlc-android/src/org/videolan/vlc/util/VLCInstance.java
View file @
4f6f5e01
...
...
@@ -111,7 +111,7 @@ public class VLCInstance {
linkCompatLib
(
context
);
}
sLibVLC
=
new
LibVLC
(
VLCOptions
.
getLibOptions
());
sLibVLC
=
new
LibVLC
(
context
,
VLCOptions
.
getLibOptions
());
LibVLC
.
setOnNativeCrashListener
(
new
LibVLC
.
OnNativeCrashListener
()
{
@Override
public
void
onNativeCrash
()
{
...
...
@@ -130,7 +130,7 @@ public class VLCInstance {
public
static
synchronized
void
restart
()
throws
IllegalStateException
{
if
(
sLibVLC
!=
null
)
{
sLibVLC
.
release
();
sLibVLC
=
new
LibVLC
(
VLCOptions
.
getLibOptions
());
sLibVLC
=
new
LibVLC
(
VLC
Application
.
getAppContext
(),
VLC
Options
.
getLibOptions
());
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment