Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
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
videolan
vlc-1.1
Commits
45942f34
Commit
45942f34
authored
Jul 21, 2008
by
Filippo Carone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jvlc: MediaPlayerListener stopped method added
parent
581d6817
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
31 deletions
+42
-31
bindings/java/core/src/main/java/org/videolan/jvlc/MediaDescriptor.java
...core/src/main/java/org/videolan/jvlc/MediaDescriptor.java
+1
-1
bindings/java/core/src/main/java/org/videolan/jvlc/event/MediaPlayerCallback.java
...ain/java/org/videolan/jvlc/event/MediaPlayerCallback.java
+5
-1
bindings/java/core/src/main/java/org/videolan/jvlc/event/MediaPlayerListener.java
...ain/java/org/videolan/jvlc/event/MediaPlayerListener.java
+8
-6
bindings/java/core/src/main/java/org/videolan/jvlc/example/VLCExample.java
...e/src/main/java/org/videolan/jvlc/example/VLCExample.java
+28
-23
No files found.
bindings/java/core/src/main/java/org/videolan/jvlc/MediaDescriptor.java
View file @
45942f34
...
@@ -69,7 +69,7 @@ public class MediaDescriptor
...
@@ -69,7 +69,7 @@ public class MediaDescriptor
return
libvlc
.
libvlc_media_get_mrl
(
instance
);
return
libvlc
.
libvlc_media_get_mrl
(
instance
);
}
}
public
MediaPlayer
getMedia
Instance
()
public
MediaPlayer
getMedia
Player
()
{
{
return
new
MediaPlayer
(
this
);
return
new
MediaPlayer
(
this
);
}
}
...
...
bindings/java/core/src/main/java/org/videolan/jvlc/event/MediaPlayerCallback.java
View file @
45942f34
...
@@ -53,7 +53,7 @@ public class MediaPlayerCallback implements LibVlcCallback
...
@@ -53,7 +53,7 @@ public class MediaPlayerCallback implements LibVlcCallback
{
{
if
(
libvlc_event
.
type
==
LibVlcEventType
.
libvlc_MediaPlayerPlaying
.
ordinal
())
if
(
libvlc_event
.
type
==
LibVlcEventType
.
libvlc_MediaPlayerPlaying
.
ordinal
())
{
{
listener
.
play
ed
(
mediaInstance
);
listener
.
play
ing
(
mediaInstance
);
}
}
else
if
(
libvlc_event
.
type
==
LibVlcEventType
.
libvlc_MediaPlayerPaused
.
ordinal
())
else
if
(
libvlc_event
.
type
==
LibVlcEventType
.
libvlc_MediaPlayerPaused
.
ordinal
())
{
{
...
@@ -67,6 +67,10 @@ public class MediaPlayerCallback implements LibVlcCallback
...
@@ -67,6 +67,10 @@ public class MediaPlayerCallback implements LibVlcCallback
{
{
listener
.
positionChanged
(
mediaInstance
);
listener
.
positionChanged
(
mediaInstance
);
}
}
else
if
(
libvlc_event
.
type
==
LibVlcEventType
.
libvlc_MediaPlayerStopped
.
ordinal
())
{
listener
.
stopped
(
mediaInstance
);
}
else
if
(
libvlc_event
.
type
==
LibVlcEventType
.
libvlc_MediaPlayerTimeChanged
.
ordinal
())
else
if
(
libvlc_event
.
type
==
LibVlcEventType
.
libvlc_MediaPlayerTimeChanged
.
ordinal
())
{
{
libvlc_event
.
event_type_specific
.
setType
(
LibVlc
.
media_player_time_changed
.
class
);
libvlc_event
.
event_type_specific
.
setType
(
LibVlc
.
media_player_time_changed
.
class
);
...
...
bindings/java/core/src/main/java/org/videolan/jvlc/event/MediaPlayerListener.java
View file @
45942f34
/*****************************************************************************
/*****************************************************************************
*
MediaInstance
PlayListener.java: VLC Java Bindings
*
mediaPlayer
PlayListener.java: VLC Java Bindings
*****************************************************************************
*****************************************************************************
* Copyright (C) 1998-2008 the VideoLAN team
* Copyright (C) 1998-2008 the VideoLAN team
*
*
...
@@ -31,14 +31,16 @@ import org.videolan.jvlc.MediaPlayer;
...
@@ -31,14 +31,16 @@ import org.videolan.jvlc.MediaPlayer;
public
interface
MediaPlayerListener
public
interface
MediaPlayerListener
{
{
void
play
ed
(
MediaPlayer
mediaInstance
);
void
play
ing
(
MediaPlayer
mediaPlayer
);
void
paused
(
MediaPlayer
media
Instance
);
void
paused
(
MediaPlayer
media
Player
);
void
endReached
(
MediaPlayer
mediaInstance
);
void
stopped
(
MediaPlayer
mediaPlayer
);
void
timeChanged
(
MediaPlayer
mediaInstance
,
long
newTime
);
void
endReached
(
MediaPlayer
mediaPlayer
);
void
positionChanged
(
MediaPlayer
mediaInstance
);
void
timeChanged
(
MediaPlayer
mediaPlayer
,
long
newTime
);
void
positionChanged
(
MediaPlayer
mediaPlayer
);
}
}
bindings/java/core/src/main/java/org/videolan/jvlc/example/VLCExample.java
View file @
45942f34
...
@@ -30,54 +30,59 @@ public class VLCExample
...
@@ -30,54 +30,59 @@ public class VLCExample
System
.
out
.
println
(
"... done."
);
System
.
out
.
println
(
"... done."
);
MediaDescriptor
mediaDescriptor
=
new
MediaDescriptor
(
jvlc
,
"/home/carone/apps/a.avi"
);
MediaDescriptor
mediaDescriptor
=
new
MediaDescriptor
(
jvlc
,
"/home/carone/apps/a.avi"
);
MediaPlayer
media
Instance
=
mediaDescriptor
.
getMediaInstance
();
MediaPlayer
media
Player
=
mediaDescriptor
.
getMediaPlayer
();
media
Instance
.
addListener
(
new
MediaPlayerListener
()
media
Player
.
addListener
(
new
MediaPlayerListener
()
{
{
public
void
endReached
(
MediaPlayer
media
Instance
)
public
void
endReached
(
MediaPlayer
media
Player
)
{
{
System
.
out
.
println
(
"Media instance end reached. MRL: "
+
media
Instance
.
getMediaDescriptor
().
getMrl
());
System
.
out
.
println
(
"Media instance end reached. MRL: "
+
media
Player
.
getMediaDescriptor
().
getMrl
());
}
}
public
void
paused
(
MediaPlayer
media
Instance
)
public
void
paused
(
MediaPlayer
media
Player
)
{
{
System
.
out
.
println
(
"Media instance paused. MRL: "
+
media
Instance
.
getMediaDescriptor
().
getMrl
());
System
.
out
.
println
(
"Media instance paused. MRL: "
+
media
Player
.
getMediaDescriptor
().
getMrl
());
}
}
public
void
play
ed
(
MediaPlayer
mediaInstance
)
public
void
play
ing
(
MediaPlayer
mediaPlayer
)
{
{
System
.
out
.
println
(
"Media instance played. MRL: "
+
media
Instance
.
getMediaDescriptor
().
getMrl
());
System
.
out
.
println
(
"Media instance played. MRL: "
+
media
Player
.
getMediaDescriptor
().
getMrl
());
}
}
public
void
positionChanged
(
MediaPlayer
media
Instance
)
public
void
positionChanged
(
MediaPlayer
media
Player
)
{
{
// TODO Auto-generated method stub
// TODO Auto-generated method stub
}
}
public
void
timeChanged
(
MediaPlayer
media
Instance
,
long
newTime
)
public
void
timeChanged
(
MediaPlayer
media
Player
,
long
newTime
)
{
{
System
.
out
.
println
(
"new time: "
+
newTime
);
System
.
out
.
println
(
"new time: "
+
newTime
);
}
}
public
void
stopped
(
MediaPlayer
mediaPlayer
)
{
System
.
out
.
println
(
"Media player stopped. MRL: "
+
mediaPlayer
.
getMediaDescriptor
().
getMrl
());
}
});
});
media
Instance
.
play
();
media
Player
.
play
();
while
(!
media
Instance
.
hasVideoOutput
())
while
(!
media
Player
.
hasVideoOutput
())
{
{
Thread
.
sleep
(
100
);
Thread
.
sleep
(
100
);
}
}
Video
video
=
new
Video
(
jvlc
);
Video
video
=
new
Video
(
jvlc
);
System
.
out
.
print
(
video
.
getWidth
(
media
Instance
));
System
.
out
.
print
(
video
.
getWidth
(
media
Player
));
System
.
out
.
print
(
"x"
);
System
.
out
.
print
(
"x"
);
System
.
out
.
println
(
video
.
getHeight
(
media
Instance
));
System
.
out
.
println
(
video
.
getHeight
(
media
Player
));
System
.
out
.
print
(
"Fullscreen... "
);
System
.
out
.
print
(
"Fullscreen... "
);
video
.
setFullscreen
(
media
Instance
,
true
);
video
.
setFullscreen
(
media
Player
,
true
);
Thread
.
sleep
(
3000
);
Thread
.
sleep
(
3000
);
System
.
out
.
println
(
"real size."
);
System
.
out
.
println
(
"real size."
);
video
.
setFullscreen
(
media
Instance
,
false
);
video
.
setFullscreen
(
media
Player
,
false
);
System
.
out
.
print
(
"Taking snapshot... "
);
System
.
out
.
print
(
"Taking snapshot... "
);
video
.
getSnapshot
(
media
Instance
,
System
.
getProperty
(
"user.dir"
)
+
"/snap.png"
,
0
,
0
);
video
.
getSnapshot
(
media
Player
,
System
.
getProperty
(
"user.dir"
)
+
"/snap.png"
,
0
,
0
);
System
.
out
.
println
(
"taken. (see "
+
System
.
getProperty
(
"user.dir"
)
+
"/snap.png )"
);
System
.
out
.
println
(
"taken. (see "
+
System
.
getProperty
(
"user.dir"
)
+
"/snap.png )"
);
Thread
.
sleep
(
2000
);
Thread
.
sleep
(
2000
);
System
.
out
.
println
(
"Resizing to 300x300"
);
System
.
out
.
println
(
"Resizing to 300x300"
);
...
@@ -95,15 +100,15 @@ public class VLCExample
...
@@ -95,15 +100,15 @@ public class VLCExample
audio
.
setVolume
(
150
);
audio
.
setVolume
(
150
);
System
.
out
.
println
(
"done"
);
System
.
out
.
println
(
"done"
);
System
.
out
.
println
(
"== AUDIO INFO =="
);
System
.
out
.
println
(
"== AUDIO INFO =="
);
System
.
out
.
println
(
"Audio track number: "
+
audio
.
getTrack
(
media
Instance
));
System
.
out
.
println
(
"Audio track number: "
+
audio
.
getTrack
(
media
Player
));
System
.
out
.
println
(
"Audio channel info: "
+
audio
.
getChannel
());
System
.
out
.
println
(
"Audio channel info: "
+
audio
.
getChannel
());
Thread
.
sleep
(
3000
);
Thread
.
sleep
(
3000
);
System
.
out
.
println
(
"MEDIA
INSTANCE
INFORMATION"
);
System
.
out
.
println
(
"MEDIA
PLAYER
INFORMATION"
);
System
.
out
.
println
(
"--------------------------"
);
System
.
out
.
println
(
"--------------------------"
);
System
.
out
.
println
(
"Total length (ms) :\t"
+
media
Instance
.
getLength
());
System
.
out
.
println
(
"Total length (ms) :\t"
+
media
Player
.
getLength
());
System
.
out
.
println
(
"Input time (ms) :\t"
+
media
Instance
.
getTime
());
System
.
out
.
println
(
"Input time (ms) :\t"
+
media
Player
.
getTime
());
System
.
out
.
println
(
"Input position [0-1]:\t"
+
media
Instance
.
getPosition
());
System
.
out
.
println
(
"Input position [0-1]:\t"
+
media
Player
.
getPosition
());
System
.
out
.
println
(
"Input FPS :\t"
+
media
Instance
.
getFPS
());
System
.
out
.
println
(
"Input FPS :\t"
+
media
Player
.
getFPS
());
System
.
out
.
println
(
"Everything fine ;)"
);
System
.
out
.
println
(
"Everything fine ;)"
);
return
;
return
;
...
...
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