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
bc91ae25
Commit
bc91ae25
authored
Jul 20, 2008
by
Filippo Carone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MediaInstance renamed to MediaPlayer
parent
0b0379db
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
231 additions
and
35 deletions
+231
-35
bindings/java/core/src/main/java/org/videolan/jvlc/Audio.java
...ings/java/core/src/main/java/org/videolan/jvlc/Audio.java
+2
-2
bindings/java/core/src/main/java/org/videolan/jvlc/JVLC.java
bindings/java/core/src/main/java/org/videolan/jvlc/JVLC.java
+2
-2
bindings/java/core/src/main/java/org/videolan/jvlc/MediaDescriptor.java
...core/src/main/java/org/videolan/jvlc/MediaDescriptor.java
+2
-2
bindings/java/core/src/main/java/org/videolan/jvlc/MediaListPlayer.java
...core/src/main/java/org/videolan/jvlc/MediaListPlayer.java
+1
-1
bindings/java/core/src/main/java/org/videolan/jvlc/MediaPlayer.java
...ava/core/src/main/java/org/videolan/jvlc/MediaPlayer.java
+196
-0
bindings/java/core/src/main/java/org/videolan/jvlc/Playlist.java
...s/java/core/src/main/java/org/videolan/jvlc/Playlist.java
+2
-2
bindings/java/core/src/main/java/org/videolan/jvlc/Video.java
...ings/java/core/src/main/java/org/videolan/jvlc/Video.java
+9
-9
bindings/java/core/src/main/java/org/videolan/jvlc/event/MediaInstanceCallback.java
...n/java/org/videolan/jvlc/event/MediaInstanceCallback.java
+3
-3
bindings/java/core/src/main/java/org/videolan/jvlc/event/MediaInstanceListener.java
...n/java/org/videolan/jvlc/event/MediaInstanceListener.java
+6
-6
bindings/java/core/src/main/java/org/videolan/jvlc/example/VLCExample.java
...e/src/main/java/org/videolan/jvlc/example/VLCExample.java
+7
-7
bindings/java/core/src/test/java/org/videolan/jvlc/JVLCTest.java
...s/java/core/src/test/java/org/videolan/jvlc/JVLCTest.java
+1
-1
No files found.
bindings/java/core/src/main/java/org/videolan/jvlc/Audio.java
View file @
bc91ae25
...
...
@@ -66,13 +66,13 @@ public class Audio
this
.
jvlc
=
jvlc
;
}
public
int
getTrack
(
Media
Instance
mediaInstance
)
public
int
getTrack
(
Media
Player
mediaInstance
)
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
return
jvlc
.
getLibvlc
().
libvlc_audio_get_track
(
mediaInstance
.
getInstance
(),
exception
);
}
public
void
setTrack
(
Media
Instance
mediaInstance
,
int
track
)
public
void
setTrack
(
Media
Player
mediaInstance
,
int
track
)
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
jvlc
.
getLibvlc
().
libvlc_audio_set_track
(
mediaInstance
.
getInstance
(),
track
,
exception
);
...
...
bindings/java/core/src/main/java/org/videolan/jvlc/JVLC.java
View file @
bc91ae25
...
...
@@ -76,10 +76,10 @@ public class JVLC
return
libvlc
.
libvlc_new
(
args
.
length
,
args
,
exception
);
}
public
Media
Instance
play
(
String
media
)
public
Media
Player
play
(
String
media
)
{
MediaDescriptor
mediaDescriptor
=
new
MediaDescriptor
(
this
,
media
);
Media
Instance
mediaInstance
=
new
MediaInstance
(
mediaDescriptor
);
Media
Player
mediaInstance
=
new
MediaPlayer
(
mediaDescriptor
);
mediaInstance
.
play
();
mediaDescriptor
.
release
();
return
mediaInstance
;
...
...
bindings/java/core/src/main/java/org/videolan/jvlc/MediaDescriptor.java
View file @
bc91ae25
...
...
@@ -69,9 +69,9 @@ public class MediaDescriptor
return
libvlc
.
libvlc_media_get_mrl
(
instance
);
}
public
Media
Instance
getMediaInstance
()
public
Media
Player
getMediaInstance
()
{
return
new
Media
Instance
(
this
);
return
new
Media
Player
(
this
);
}
/**
...
...
bindings/java/core/src/main/java/org/videolan/jvlc/MediaListPlayer.java
View file @
bc91ae25
...
...
@@ -160,7 +160,7 @@ public class MediaListPlayer
}
}
public
void
setMediaInstance
(
Media
Instance
mediaInstance
)
public
void
setMediaInstance
(
Media
Player
mediaInstance
)
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
jvlc
.
getLibvlc
().
libvlc_media_list_player_set_media_player
(
instance
,
mediaInstance
.
getInstance
(),
exception
);
...
...
bindings/java/core/src/main/java/org/videolan/jvlc/MediaPlayer.java
0 → 100644
View file @
bc91ae25
/*****************************************************************************
* MediaInstance.java: VLC Java Bindings Media Instance
*****************************************************************************
* Copyright (C) 1998-2008 the VideoLAN team
*
* Authors: Filippo Carone <filippo@carone.org>
*
*
* $Id $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
package
org.videolan.jvlc
;
import
java.util.ArrayList
;
import
java.util.EnumSet
;
import
java.util.List
;
import
org.videolan.jvlc.event.MediaInstanceCallback
;
import
org.videolan.jvlc.event.MediaInstanceListener
;
import
org.videolan.jvlc.internal.LibVlc
;
import
org.videolan.jvlc.internal.LibVlcEventType
;
import
org.videolan.jvlc.internal.LibVlc.LibVlcEventManager
;
import
org.videolan.jvlc.internal.LibVlc.LibVlcMediaInstance
;
import
org.videolan.jvlc.internal.LibVlc.libvlc_exception_t
;
public
class
MediaPlayer
{
private
final
LibVlcMediaInstance
instance
;
private
final
LibVlc
libvlc
;
private
final
LibVlcEventManager
eventManager
;
private
List
<
MediaInstanceCallback
>
callbacks
=
new
ArrayList
<
MediaInstanceCallback
>();
private
MediaDescriptor
mediaDescriptor
;
MediaPlayer
(
JVLC
jvlc
,
LibVlcMediaInstance
instance
)
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
this
.
instance
=
instance
;
libvlc
=
jvlc
.
getLibvlc
();
eventManager
=
libvlc
.
libvlc_media_player_event_manager
(
instance
,
exception
);
}
public
MediaPlayer
(
MediaDescriptor
mediaDescriptor
)
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
libvlc
=
mediaDescriptor
.
getLibvlc
();
instance
=
libvlc
.
libvlc_media_player_new_from_media
(
mediaDescriptor
.
getInstance
(),
exception
);
eventManager
=
libvlc
.
libvlc_media_player_event_manager
(
instance
,
exception
);
this
.
mediaDescriptor
=
mediaDescriptor
;
}
public
MediaDescriptor
getMediaDescriptor
()
{
return
mediaDescriptor
;
}
public
void
play
()
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
libvlc
.
libvlc_media_player_play
(
instance
,
exception
);
}
public
void
stop
()
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
libvlc
.
libvlc_media_player_stop
(
instance
,
exception
);
}
public
void
pause
()
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
libvlc
.
libvlc_media_player_pause
(
instance
,
exception
);
}
public
long
getLength
()
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
return
libvlc
.
libvlc_media_player_get_length
(
instance
,
exception
);
}
public
long
getTime
()
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
return
libvlc
.
libvlc_media_player_get_time
(
instance
,
exception
);
}
public
void
setTime
(
long
time
)
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
libvlc
.
libvlc_media_player_set_time
(
instance
,
time
,
exception
);
}
public
float
getPosition
()
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
return
libvlc
.
libvlc_media_player_get_position
(
instance
,
exception
);
}
public
void
setPosition
(
float
position
)
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
libvlc
.
libvlc_media_player_set_position
(
instance
,
position
,
exception
);
}
public
boolean
willPlay
()
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
return
(
libvlc
.
libvlc_media_player_will_play
(
instance
,
exception
)
==
1
);
}
public
float
getRate
()
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
return
libvlc
.
libvlc_media_player_get_rate
(
instance
,
exception
);
}
public
void
setRate
(
float
rate
)
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
libvlc
.
libvlc_media_player_set_rate
(
instance
,
rate
,
exception
);
}
public
boolean
hasVideoOutput
()
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
return
(
libvlc
.
libvlc_media_player_has_vout
(
instance
,
exception
)
==
1
);
}
public
float
getFPS
()
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
return
libvlc
.
libvlc_media_player_get_fps
(
instance
,
exception
);
}
public
void
addListener
(
final
MediaInstanceListener
listener
)
{
MediaInstanceCallback
callback
=
new
MediaInstanceCallback
(
this
,
listener
);
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
for
(
LibVlcEventType
event
:
EnumSet
.
range
(
LibVlcEventType
.
libvlc_MediaPlayerPlayed
,
LibVlcEventType
.
libvlc_MediaPlayerTimeChanged
))
{
libvlc
.
libvlc_event_attach
(
eventManager
,
event
.
ordinal
(),
callback
,
null
,
exception
);
}
callbacks
.
add
(
callback
);
}
/**
* {@inheritDoc}
*/
@Override
protected
void
finalize
()
throws
Throwable
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
for
(
MediaInstanceCallback
callback
:
callbacks
)
{
for
(
LibVlcEventType
event
:
EnumSet
.
range
(
LibVlcEventType
.
libvlc_MediaPlayerPlayed
,
LibVlcEventType
.
libvlc_MediaPlayerPositionChanged
))
{
libvlc
.
libvlc_event_detach
(
eventManager
,
event
.
ordinal
(),
callback
,
null
,
exception
);
}
}
libvlc
.
libvlc_media_player_release
(
instance
);
super
.
finalize
();
}
/**
* Returns the instance.
* @return the instance
*/
LibVlcMediaInstance
getInstance
()
{
return
instance
;
}
}
bindings/java/core/src/main/java/org/videolan/jvlc/Playlist.java
View file @
bc91ae25
...
...
@@ -116,11 +116,11 @@ public class Playlist {
libvlc
.
libvlc_playlist_loop
(
libvlcInstance
,
loop
?
1
:
0
,
exception
);
}
public
Media
Instance
getMediaInstance
()
public
Media
Player
getMediaInstance
()
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
LibVlcMediaInstance
mi
=
libvlc
.
libvlc_playlist_get_media_player
(
libvlcInstance
,
exception
);
return
new
Media
Instance
(
jvlc
,
mi
);
return
new
Media
Player
(
jvlc
,
mi
);
}
}
bindings/java/core/src/main/java/org/videolan/jvlc/Video.java
View file @
bc91ae25
...
...
@@ -49,7 +49,7 @@ public class Video
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#destroyVideo()
*/
public
void
destroyVideo
(
Media
Instance
media
)
public
void
destroyVideo
(
Media
Player
media
)
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
libvlc
.
libvlc_video_destroy
(
media
.
getInstance
(),
exception
);
...
...
@@ -59,7 +59,7 @@ public class Video
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#getFullscreen()
*/
public
boolean
getFullscreen
(
Media
Instance
media
)
{
public
boolean
getFullscreen
(
Media
Player
media
)
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
return
libvlc
.
libvlc_get_fullscreen
(
media
.
getInstance
(),
exception
)
==
1
?
true
:
false
;
}
...
...
@@ -67,7 +67,7 @@ public class Video
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#getSnapshot(java.lang.String)
*/
public
void
getSnapshot
(
Media
Instance
media
,
String
filepath
,
int
width
,
int
height
)
{
public
void
getSnapshot
(
Media
Player
media
,
String
filepath
,
int
width
,
int
height
)
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
libvlc
.
libvlc_video_take_snapshot
(
media
.
getInstance
(),
filepath
,
width
,
height
,
exception
);
}
...
...
@@ -75,7 +75,7 @@ public class Video
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#getVideoHeight()
*/
public
int
getHeight
(
Media
Instance
media
)
{
public
int
getHeight
(
Media
Player
media
)
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
return
libvlc
.
libvlc_video_get_height
(
media
.
getInstance
(),
exception
);
}
...
...
@@ -83,7 +83,7 @@ public class Video
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#getVideoWidth()
*/
public
int
getWidth
(
Media
Instance
media
)
{
public
int
getWidth
(
Media
Player
media
)
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
return
libvlc
.
libvlc_video_get_height
(
media
.
getInstance
(),
exception
);
}
...
...
@@ -91,7 +91,7 @@ public class Video
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#reparentVideo(java.awt.Component)
*/
public
void
reparent
(
Media
Instance
media
,
java
.
awt
.
Canvas
canvas
)
{
public
void
reparent
(
Media
Player
media
,
java
.
awt
.
Canvas
canvas
)
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
long
drawable
=
com
.
sun
.
jna
.
Native
.
getComponentID
(
canvas
);
libvlc
.
libvlc_video_reparent
(
media
.
getInstance
(),
drawable
,
exception
);
...
...
@@ -108,7 +108,7 @@ public class Video
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#setFullscreen(boolean)
*/
public
void
setFullscreen
(
Media
Instance
media
,
boolean
fullscreen
)
{
public
void
setFullscreen
(
Media
Player
media
,
boolean
fullscreen
)
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
libvlc
.
libvlc_set_fullscreen
(
media
.
getInstance
(),
fullscreen
?
1
:
0
,
exception
);
}
...
...
@@ -116,7 +116,7 @@ public class Video
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#toggleFullscreen()
*/
public
void
toggleFullscreen
(
Media
Instance
media
)
{
public
void
toggleFullscreen
(
Media
Player
media
)
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
libvlc
.
libvlc_toggle_fullscreen
(
media
.
getInstance
(),
exception
);
}
...
...
@@ -124,7 +124,7 @@ public class Video
/* (non-Javadoc)
* @see org.videolan.jvlc.VideoIntf#getSize()
*/
public
Dimension
getSize
(
Media
Instance
media
)
{
public
Dimension
getSize
(
Media
Player
media
)
{
return
new
Dimension
(
getWidth
(
media
),
getHeight
(
media
));
}
...
...
bindings/java/core/src/main/java/org/videolan/jvlc/event/MediaInstanceCallback.java
View file @
bc91ae25
...
...
@@ -25,7 +25,7 @@
package
org.videolan.jvlc.event
;
import
org.videolan.jvlc.Media
Instance
;
import
org.videolan.jvlc.Media
Player
;
import
org.videolan.jvlc.internal.LibVlc
;
import
org.videolan.jvlc.internal.LibVlcEventType
;
import
org.videolan.jvlc.internal.LibVlc.LibVlcCallback
;
...
...
@@ -39,9 +39,9 @@ public class MediaInstanceCallback implements LibVlcCallback
{
private
MediaInstanceListener
listener
;
private
Media
Instance
mediaInstance
;
private
Media
Player
mediaInstance
;
public
MediaInstanceCallback
(
Media
Instance
mediaInstance
,
MediaInstanceListener
listener
)
public
MediaInstanceCallback
(
Media
Player
mediaInstance
,
MediaInstanceListener
listener
)
{
this
.
mediaInstance
=
mediaInstance
;
this
.
listener
=
listener
;
...
...
bindings/java/core/src/main/java/org/videolan/jvlc/event/MediaInstanceListener.java
View file @
bc91ae25
...
...
@@ -25,20 +25,20 @@
package
org.videolan.jvlc.event
;
import
org.videolan.jvlc.Media
Instance
;
import
org.videolan.jvlc.Media
Player
;
public
interface
MediaInstanceListener
{
void
played
(
Media
Instance
mediaInstance
);
void
played
(
Media
Player
mediaInstance
);
void
paused
(
Media
Instance
mediaInstance
);
void
paused
(
Media
Player
mediaInstance
);
void
endReached
(
Media
Instance
mediaInstance
);
void
endReached
(
Media
Player
mediaInstance
);
void
timeChanged
(
Media
Instance
mediaInstance
,
long
newTime
);
void
timeChanged
(
Media
Player
mediaInstance
,
long
newTime
);
void
positionChanged
(
Media
Instance
mediaInstance
);
void
positionChanged
(
Media
Player
mediaInstance
);
}
bindings/java/core/src/main/java/org/videolan/jvlc/example/VLCExample.java
View file @
bc91ae25
...
...
@@ -3,7 +3,7 @@ package org.videolan.jvlc.example;
import
org.videolan.jvlc.Audio
;
import
org.videolan.jvlc.JVLC
;
import
org.videolan.jvlc.MediaDescriptor
;
import
org.videolan.jvlc.Media
Instance
;
import
org.videolan.jvlc.Media
Player
;
import
org.videolan.jvlc.VLCException
;
import
org.videolan.jvlc.Video
;
import
org.videolan.jvlc.event.MediaInstanceListener
;
...
...
@@ -31,32 +31,32 @@ public class VLCExample
System
.
out
.
println
(
"... done."
);
MediaDescriptor
mediaDescriptor
=
new
MediaDescriptor
(
jvlc
,
"/home/carone/apps/a.avi"
);
Media
Instance
mediaInstance
=
mediaDescriptor
.
getMediaInstance
();
Media
Player
mediaInstance
=
mediaDescriptor
.
getMediaInstance
();
mediaInstance
.
addListener
(
new
MediaInstanceListener
()
{
public
void
endReached
(
Media
Instance
mediaInstance
)
public
void
endReached
(
Media
Player
mediaInstance
)
{
System
.
out
.
println
(
"Media instance end reached. MRL: "
+
mediaInstance
.
getMediaDescriptor
().
getMrl
());
}
public
void
paused
(
Media
Instance
mediaInstance
)
public
void
paused
(
Media
Player
mediaInstance
)
{
System
.
out
.
println
(
"Media instance paused. MRL: "
+
mediaInstance
.
getMediaDescriptor
().
getMrl
());
}
public
void
played
(
Media
Instance
mediaInstance
)
public
void
played
(
Media
Player
mediaInstance
)
{
System
.
out
.
println
(
"Media instance played. MRL: "
+
mediaInstance
.
getMediaDescriptor
().
getMrl
());
}
public
void
positionChanged
(
Media
Instance
mediaInstance
)
public
void
positionChanged
(
Media
Player
mediaInstance
)
{
// TODO Auto-generated method stub
}
public
void
timeChanged
(
Media
Instance
mediaInstance
,
long
newTime
)
public
void
timeChanged
(
Media
Player
mediaInstance
,
long
newTime
)
{
System
.
out
.
println
(
"new time: "
+
newTime
);
}
...
...
bindings/java/core/src/test/java/org/videolan/jvlc/JVLCTest.java
View file @
bc91ae25
...
...
@@ -46,7 +46,7 @@ public class JVLCTest
public
void
jvlcPlay
()
{
JVLC
jvlc
=
new
JVLC
();
Media
Instance
instance
=
jvlc
.
play
(
mrl
);
Media
Player
instance
=
jvlc
.
play
(
mrl
);
Assert
.
assertNotNull
(
instance
);
}
...
...
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