Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
LibVLC Android samples
Commits
e5b92522
Commit
e5b92522
authored
Dec 21, 2016
by
Thomas Guillem
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update with last LibVLC API
parent
725ec7aa
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
22 deletions
+10
-22
build.gradle
build.gradle
+1
-1
java_sample/src/main/java/org/videolan/javasample/JavaActivity.java
...e/src/main/java/org/videolan/javasample/JavaActivity.java
+3
-13
native_sample/jni/main.c
native_sample/jni/main.c
+0
-2
native_sample/src/main/java/org/videolan/nativesample/NativeActivity.java
...c/main/java/org/videolan/nativesample/NativeActivity.java
+6
-6
No files found.
build.gradle
View file @
e5b92522
...
...
@@ -5,7 +5,7 @@ buildscript {
jcenter
()
}
dependencies
{
classpath
'com.android.tools.build:gradle:2.
1
.3'
classpath
'com.android.tools.build:gradle:2.
2
.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
...
...
java_sample/src/main/java/org/videolan/javasample/JavaActivity.java
View file @
e5b92522
...
...
@@ -32,7 +32,7 @@ import org.videolan.libvlc.MediaPlayer;
import
java.util.ArrayList
;
public
class
JavaActivity
extends
AppCompatActivity
implements
IVLCVout
.
Callback
{
public
class
JavaActivity
extends
AppCompatActivity
implements
IVLCVout
.
OnNewVideoLayoutListener
{
private
static
final
boolean
ENABLE_SUBTITLES
=
true
;
private
static
final
String
TAG
=
"JavaActivity"
;
private
static
final
String
SAMPLE_URL
=
"http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_640x360.m4v"
;
...
...
@@ -97,8 +97,7 @@ public class JavaActivity extends AppCompatActivity implements IVLCVout.Callback
vlcVout
.
setVideoView
(
mVideoSurface
);
if
(
mSubtitlesSurface
!=
null
)
vlcVout
.
setSubtitlesView
(
mSubtitlesSurface
);
vlcVout
.
attachViews
();
mMediaPlayer
.
getVLCVout
().
addCallback
(
this
);
vlcVout
.
attachViews
(
this
);
Media
media
=
new
Media
(
mLibVLC
,
Uri
.
parse
(
SAMPLE_URL
));
mMediaPlayer
.
setMedia
(
media
);
...
...
@@ -138,7 +137,6 @@ public class JavaActivity extends AppCompatActivity implements IVLCVout.Callback
mMediaPlayer
.
stop
();
mMediaPlayer
.
getVLCVout
().
detachViews
();
mMediaPlayer
.
getVLCVout
().
removeCallback
(
this
);
}
private
void
updateVideoSurfaces
()
{
if
(
mVideoWidth
*
mVideoHeight
==
0
)
...
...
@@ -232,7 +230,7 @@ public class JavaActivity extends AppCompatActivity implements IVLCVout.Callback
@TargetApi
(
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
@Override
public
void
onNewLayout
(
IVLCVout
vlcVout
,
int
width
,
int
height
,
int
visibleWidth
,
int
visibleHeight
,
int
sarNum
,
int
sarDen
)
{
public
void
onNew
Video
Layout
(
IVLCVout
vlcVout
,
int
width
,
int
height
,
int
visibleWidth
,
int
visibleHeight
,
int
sarNum
,
int
sarDen
)
{
mVideoWidth
=
width
;
mVideoHeight
=
height
;
mVideoVisibleWidth
=
visibleWidth
;
...
...
@@ -241,12 +239,4 @@ public class JavaActivity extends AppCompatActivity implements IVLCVout.Callback
mVideoSarDen
=
sarDen
;
updateVideoSurfaces
();
}
@Override
public
void
onSurfacesCreated
(
IVLCVout
vlcVout
)
{
}
@Override
public
void
onSurfacesDestroyed
(
IVLCVout
vlcVout
)
{
}
}
native_sample/jni/main.c
View file @
e5b92522
...
...
@@ -55,8 +55,6 @@ Java_org_videolan_nativesample_NativeActivity_nativeCreate(
static
const
char
*
pp_argv
[]
=
{
"-vvv"
,
"--aout"
,
"android_audiotrack"
,
"--androidwindow-chroma"
,
"RV32"
,
"--audio-resampler"
,
"soxr"
,
};
p_ctx
->
p_libvlc
=
libvlc_new
(
sizeof
(
pp_argv
)
/
sizeof
(
*
pp_argv
),
pp_argv
);
...
...
native_sample/src/main/java/org/videolan/nativesample/NativeActivity.java
View file @
e5b92522
...
...
@@ -27,11 +27,11 @@ import android.widget.FrameLayout;
import
android.widget.Toast
;
import
org.videolan.libvlc.AWindow
;
import
org.videolan.libvlc.AWindowNativeHandler
;
import
org.videolan.libvlc.IVLCVout
;
@SuppressWarnings
(
"JniMissingFunction"
)
public
class
NativeActivity
extends
AppCompatActivity
implements
IVLCVout
.
Callback
{
public
class
NativeActivity
extends
AppCompatActivity
implements
IVLCVout
.
Callback
,
IVLCVout
.
OnNewVideoLayoutListener
{
private
static
final
boolean
ENABLE_SUBTITLES
=
true
;
private
static
final
String
TAG
=
"NativeActivity"
;
private
static
final
int
SURFACE_BEST_FIT
=
0
;
...
...
@@ -140,7 +140,7 @@ public class NativeActivity extends AppCompatActivity implements IVLCVout.Callba
mAWindow
.
setVideoView
(
mVideoSurface
);
if
(
mSubtitlesSurface
!=
null
)
mAWindow
.
setSubtitlesView
(
mSubtitlesSurface
);
mAWindow
.
attachViews
();
mAWindow
.
attachViews
(
this
);
if
(
mOnLayoutChangeListener
==
null
)
{
mOnLayoutChangeListener
=
new
View
.
OnLayoutChangeListener
()
{
...
...
@@ -269,7 +269,7 @@ public class NativeActivity extends AppCompatActivity implements IVLCVout.Callba
@TargetApi
(
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
@Override
public
void
onNewLayout
(
IVLCVout
vlcVout
,
int
width
,
int
height
,
int
visibleWidth
,
int
visibleHeight
,
int
sarNum
,
int
sarDen
)
{
public
void
onNew
Video
Layout
(
IVLCVout
vlcVout
,
int
width
,
int
height
,
int
visibleWidth
,
int
visibleHeight
,
int
sarNum
,
int
sarDen
)
{
mVideoWidth
=
width
;
mVideoHeight
=
height
;
mVideoVisibleWidth
=
visibleWidth
;
...
...
@@ -282,7 +282,7 @@ public class NativeActivity extends AppCompatActivity implements IVLCVout.Callba
@Override
public
void
onSurfacesCreated
(
IVLCVout
vlcVout
)
{
if
(!
mNativeStarted
)
{
if
(!
nativeStart
(
mAWindow
.
getNativeHandler
()
))
{
if
(!
nativeStart
(
mAWindow
))
{
Toast
.
makeText
(
this
,
"Couldn't start LibVLC"
,
Toast
.
LENGTH_LONG
).
show
();
finish
();
return
;
...
...
@@ -301,6 +301,6 @@ public class NativeActivity extends AppCompatActivity implements IVLCVout.Callba
private
long
mInstance
;
private
native
boolean
nativeCreate
();
private
native
void
nativeDestroy
();
private
native
boolean
nativeStart
(
AWindow
NativeHandler
aWindowNative
);
private
native
boolean
nativeStart
(
AWindow
aWindowNative
);
private
native
void
nativeStop
();
}
Thomas Guillem
@tguillem
Mentioned in issue
vlc-android#171 (closed)
·
Dec 21, 2016
Mentioned in issue
vlc-android#171 (closed)
Mentioned in issue videolan/vlc-android#171
Toggle commit list
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