Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
eeb354fd
Commit
eeb354fd
authored
Apr 07, 2008
by
Filippo Carone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial release method added to the JVLC class
parent
7b2e7a1a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
1 deletion
+42
-1
bindings/java/core/src/main/java/org/videolan/jvlc/JVLC.java
bindings/java/core/src/main/java/org/videolan/jvlc/JVLC.java
+19
-1
bindings/java/core/src/test/java/org/videolan/jvlc/JVLCTest.java
...s/java/core/src/test/java/org/videolan/jvlc/JVLCTest.java
+7
-0
bindings/java/core/src/test/java/org/videolan/jvlc/internal/MediaListPlayerTest.java
.../java/org/videolan/jvlc/internal/MediaListPlayerTest.java
+16
-0
No files found.
bindings/java/core/src/main/java/org/videolan/jvlc/JVLC.java
View file @
eeb354fd
...
...
@@ -46,6 +46,8 @@ public class JVLC
private
MediaList
mediaList
;
private
volatile
boolean
released
;
public
JVLC
()
{
String
[]
args
=
new
String
[]
{};
...
...
@@ -125,6 +127,18 @@ public class JVLC
{
return
libvlc
;
}
/**
* Releases this instance and the native resources.
*/
public
void
release
()
{
if
(!
released
)
{
released
=
true
;
libvlc
.
libvlc_release
(
instance
);
}
}
/*
* (non-Javadoc)
...
...
@@ -133,7 +147,11 @@ public class JVLC
@Override
protected
void
finalize
()
throws
Throwable
{
libvlc
.
libvlc_release
(
instance
);
if
(!
released
)
{
released
=
true
;
libvlc
.
libvlc_release
(
instance
);
}
super
.
finalize
();
}
...
...
bindings/java/core/src/test/java/org/videolan/jvlc/JVLCTest.java
View file @
eeb354fd
...
...
@@ -50,6 +50,13 @@ public class JVLCTest
Assert
.
assertNotNull
(
instance
);
}
@Test
public
void
jvlcRelease
()
{
JVLC
jvlc
=
new
JVLC
();
jvlc
.
release
();
jvlc
.
release
();
}
}
bindings/java/core/src/test/java/org/videolan/jvlc/internal/MediaListPlayerTest.java
View file @
eeb354fd
...
...
@@ -69,6 +69,7 @@ public class MediaListPlayerTest
LibVlcMediaListPlayer
mediaListPlayer
=
libvlc
.
libvlc_media_list_player_new
(
libvlcInstance
,
exception
);
Assert
.
assertNotNull
(
mediaListPlayer
);
Assert
.
assertEquals
(
0
,
exception
.
raised
);
libvlc
.
libvlc_media_list_player_release
(
mediaListPlayer
);
}
@Test
...
...
@@ -79,6 +80,8 @@ public class MediaListPlayerTest
LibVlcMediaList
mediaList
=
libvlc
.
libvlc_media_list_new
(
libvlcInstance
,
exception
);
libvlc
.
libvlc_media_list_player_set_media_list
(
mediaListPlayer
,
mediaList
,
exception
);
Assert
.
assertEquals
(
0
,
exception
.
raised
);
libvlc
.
libvlc_media_list_release
(
mediaList
);
libvlc
.
libvlc_media_list_player_release
(
mediaListPlayer
);
}
@Test
...
...
@@ -91,6 +94,8 @@ public class MediaListPlayerTest
libvlc
.
libvlc_media_list_add_media
(
mediaList
,
mediaDescriptor
,
exception
);
libvlc
.
libvlc_media_list_player_set_media_list
(
mediaListPlayer
,
mediaList
,
exception
);
Assert
.
assertEquals
(
0
,
exception
.
raised
);
libvlc
.
libvlc_media_list_release
(
mediaList
);
libvlc
.
libvlc_media_list_player_release
(
mediaListPlayer
);
}
@Test
...
...
@@ -101,6 +106,7 @@ public class MediaListPlayerTest
int
result
=
libvlc
.
libvlc_media_list_player_is_playing
(
mediaListPlayer
,
exception
);
Assert
.
assertEquals
(
0
,
result
);
Assert
.
assertEquals
(
0
,
exception
.
raised
);
libvlc
.
libvlc_media_list_player_release
(
mediaListPlayer
);
}
@Test
...
...
@@ -110,6 +116,7 @@ public class MediaListPlayerTest
LibVlcMediaListPlayer
mediaListPlayer
=
libvlc
.
libvlc_media_list_player_new
(
libvlcInstance
,
exception
);
libvlc
.
libvlc_media_list_player_play
(
mediaListPlayer
,
exception
);
Assert
.
assertEquals
(
1
,
exception
.
raised
);
libvlc
.
libvlc_media_list_player_release
(
mediaListPlayer
);
}
/**
...
...
@@ -126,6 +133,8 @@ public class MediaListPlayerTest
libvlc
.
libvlc_media_list_player_set_media_list
(
mediaListPlayer
,
mediaList
,
exception
);
libvlc
.
libvlc_media_list_player_play
(
mediaListPlayer
,
exception
);
Assert
.
assertEquals
(
"Exception message: "
+
exception
.
message
+
".\n"
,
0
,
exception
.
raised
);
libvlc
.
libvlc_media_list_release
(
mediaList
);
libvlc
.
libvlc_media_list_player_release
(
mediaListPlayer
);
}
@Test
...
...
@@ -152,6 +161,8 @@ public class MediaListPlayerTest
Thread
.
sleep
(
150
);
}
libvlc
.
libvlc_media_list_player_stop
(
mediaListPlayer
,
exception
);
libvlc
.
libvlc_media_list_release
(
mediaList
);
libvlc
.
libvlc_media_list_player_release
(
mediaListPlayer
);
}
...
...
@@ -183,6 +194,7 @@ public class MediaListPlayerTest
// needs to be fixed
Thread
.
sleep
(
400
);
libvlc
.
libvlc_media_list_player_stop
(
mediaListPlayer
,
exception
);
libvlc
.
libvlc_media_list_release
(
mediaList
);
libvlc
.
libvlc_media_list_player_release
(
mediaListPlayer
);
}
...
...
@@ -193,6 +205,7 @@ public class MediaListPlayerTest
LibVlcMediaListPlayer
mediaListPlayer
=
libvlc
.
libvlc_media_list_player_new
(
libvlcInstance
,
exception
);
int
state
=
libvlc
.
libvlc_media_list_player_get_state
(
mediaListPlayer
,
exception
);
Assert
.
assertEquals
(
LibVlcState
.
libvlc_Stopped
.
ordinal
(),
state
);
libvlc
.
libvlc_media_list_player_release
(
mediaListPlayer
);
}
@Test
...
...
@@ -236,6 +249,7 @@ public class MediaListPlayerTest
int
state
=
libvlc
.
libvlc_media_list_player_get_state
(
mediaListPlayer
,
exception
);
Assert
.
assertEquals
(
"Expected state: "
+
LibVlcState
.
libvlc_Paused
+
".\n"
,
LibVlcState
.
libvlc_Paused
.
ordinal
(),
state
);
libvlc
.
libvlc_media_list_player_stop
(
mediaListPlayer
,
exception
);
libvlc
.
libvlc_media_list_release
(
mediaList
);
libvlc
.
libvlc_media_list_player_release
(
mediaListPlayer
);
}
...
...
@@ -277,6 +291,7 @@ public class MediaListPlayerTest
Thread
.
sleep
(
150
);
libvlc
.
libvlc_media_list_player_next
(
mediaListPlayer
,
exception
);
Assert
.
assertEquals
(
0
,
exception
.
raised
);
libvlc
.
libvlc_media_list_release
(
mediaList
);
}
@Test
...
...
@@ -318,6 +333,7 @@ public class MediaListPlayerTest
Assert
.
assertEquals
(
LibVlcState
.
libvlc_Stopped
.
ordinal
(),
libvlc
.
libvlc_media_list_player_get_state
(
mediaListPlayer
,
exception
));
libvlc
.
libvlc_media_list_release
(
mediaList
);
}
...
...
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