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
b774d66a
Commit
b774d66a
authored
Jul 20, 2008
by
Filippo Carone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jvlc: download a sample file to run tests, if needed
parent
7e496b25
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
210 additions
and
104 deletions
+210
-104
bindings/java/core/src/test/java/org/videolan/jvlc/MediaListTest.java
...a/core/src/test/java/org/videolan/jvlc/MediaListTest.java
+1
-1
bindings/java/core/src/test/java/org/videolan/jvlc/VLMTest.java
...gs/java/core/src/test/java/org/videolan/jvlc/VLMTest.java
+6
-4
bindings/java/core/src/test/java/org/videolan/jvlc/internal/AbstractVLCInternalTest.java
...a/org/videolan/jvlc/internal/AbstractVLCInternalTest.java
+136
-0
bindings/java/core/src/test/java/org/videolan/jvlc/internal/LibVlcMediaPlayerTest.java
...ava/org/videolan/jvlc/internal/LibVlcMediaPlayerTest.java
+1
-29
bindings/java/core/src/test/java/org/videolan/jvlc/internal/MediaDescriptorTest.java
.../java/org/videolan/jvlc/internal/MediaDescriptorTest.java
+1
-23
bindings/java/core/src/test/java/org/videolan/jvlc/internal/MediaListPlayerTest.java
.../java/org/videolan/jvlc/internal/MediaListPlayerTest.java
+1
-26
bindings/java/core/src/test/java/org/videolan/jvlc/internal/MediaListTest.java
...c/test/java/org/videolan/jvlc/internal/MediaListTest.java
+1
-21
bindings/java/core/src/test/java/org/videolan/jvlc/internal/VLMInternalTest.java
...test/java/org/videolan/jvlc/internal/VLMInternalTest.java
+45
-0
bindings/java/core/src/test/resources/log4j.xml
bindings/java/core/src/test/resources/log4j.xml
+18
-0
bindings/java/core/src/test/resources/sample
bindings/java/core/src/test/resources/sample
+0
-0
No files found.
bindings/java/core/src/test/java/org/videolan/jvlc/MediaListTest.java
View file @
b774d66a
...
...
@@ -40,7 +40,7 @@ public class MediaListTest
@Before
public
void
setup
()
{
jvlc
=
new
JVLC
(
"-vvv -I dummy --aout=dummy --vout=dummy"
);
jvlc
=
new
JVLC
(
"-vvv -
-ignore-config --no-media-library -
I dummy --aout=dummy --vout=dummy"
);
}
@Test
...
...
bindings/java/core/src/test/java/org/videolan/jvlc/VLMTest.java
View file @
b774d66a
...
...
@@ -43,8 +43,8 @@ public class VLMTest
@Before
public
void
setup
()
{
jvlc
=
new
JVLC
(
"-I dummy --aout=dummy --vout=dummy"
);
jvlc
.
setLogVerbosity
(
LoggerVerbosityLevel
.
INFO
);
jvlc
=
new
JVLC
(
"-
-ignore-config --no-media-library -
I dummy --aout=dummy --vout=dummy"
);
jvlc
.
setLogVerbosity
(
LoggerVerbosityLevel
.
DEBUG
);
}
@After
...
...
@@ -87,7 +87,7 @@ public class VLMTest
public
void
testPlayMedia
()
{
VLM
vlm
=
jvlc
.
getVLM
();
vlm
.
addBroadcast
(
mediaName
,
"file://"
+
mrl
,
""
,
null
,
true
,
false
);
vlm
.
addBroadcast
(
mediaName
,
mrl
,
""
,
null
,
true
,
false
);
vlm
.
playMedia
(
mediaName
);
}
...
...
@@ -101,12 +101,14 @@ public class VLMTest
}
@Test
public
void
testStopMedia
()
public
void
testStopMedia
()
throws
Exception
{
VLM
vlm
=
jvlc
.
getVLM
();
vlm
.
addBroadcast
(
mediaName
,
"file://"
+
mrl
,
""
,
null
,
true
,
false
);
vlm
.
playMedia
(
mediaName
);
Thread
.
sleep
(
2000
);
vlm
.
stopMedia
(
mediaName
);
jvlc
.
release
();
}
@Test
...
...
bindings/java/core/src/test/java/org/videolan/jvlc/internal/AbstractVLCInternalTest.java
0 → 100644
View file @
b774d66a
/*****************************************************************************
* VLMInternalTest.java: VLC Java Bindings
*****************************************************************************
* 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.internal
;
import
java.io.BufferedOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
junit.framework.Assert
;
import
org.apache.commons.io.IOUtils
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.videolan.jvlc.internal.LibVlc.LibVlcInstance
;
import
org.videolan.jvlc.internal.LibVlc.libvlc_exception_t
;
public
abstract
class
AbstractVLCInternalTest
{
protected
LibVlc
libvlc
=
LibVlc
.
SYNC_INSTANCE
;
protected
LibVlcInstance
libvlcInstance
;
protected
String
mrl
;
protected
libvlc_exception_t
exception
;
private
String
address
=
"http://streams.videolan.org/streams-videolan/reference/avi/Hero-Div3.avi"
;
/**
* Logger.
*/
private
Logger
log
=
LoggerFactory
.
getLogger
(
AbstractVLCInternalTest
.
class
);
@Before
public
void
testSetup
()
{
exception
=
new
libvlc_exception_t
();
libvlcInstance
=
libvlc
.
libvlc_new
(
0
,
new
String
[]{
"-vvv"
,
"--ignore-config"
,
"--no-media-library"
,
"-I"
,
"dummy"
,
"--aout=dummy"
,
"--vout=dummy"
},
exception
);
libvlc
.
libvlc_exception_clear
(
exception
);
downloadSample
();
}
@After
public
void
tearDown
()
{
libvlc
.
libvlc_release
(
libvlcInstance
);
libvlc
.
libvlc_exception_clear
(
exception
);
}
protected
void
catchException
(
libvlc_exception_t
exception
)
{
Assert
.
assertEquals
(
libvlc
.
libvlc_exception_get_message
(
exception
),
0
,
libvlc
.
libvlc_exception_raised
(
exception
));
}
private
void
downloadSample
()
{
OutputStream
out
=
null
;
URLConnection
conn
=
null
;
InputStream
in
=
null
;
URL
sampleResource
=
this
.
getClass
().
getResource
(
"/sample.avi"
);
if
(
sampleResource
!=
null
)
{
log
.
debug
(
"Sample file already downloaded"
);
mrl
=
sampleResource
.
getPath
();
return
;
}
try
{
log
.
info
(
"Downloading sample: {}"
,
address
);
String
testResoucesPath
=
this
.
getClass
().
getResource
(
"/sample"
).
getPath
();
URL
url
=
new
URL
(
address
);
out
=
new
BufferedOutputStream
(
new
FileOutputStream
(
testResoucesPath
+
".avi"
));
conn
=
url
.
openConnection
();
in
=
conn
.
getInputStream
();
byte
[]
buffer
=
new
byte
[
1024
];
int
numRead
;
long
numWritten
=
0
;
while
((
numRead
=
in
.
read
(
buffer
))
!=
-
1
)
{
out
.
write
(
buffer
,
0
,
numRead
);
numWritten
+=
numRead
;
}
log
.
info
(
"Sample downloaded."
);
mrl
=
testResoucesPath
+
".avi"
;
}
catch
(
Exception
e
)
{
log
.
error
(
"{}"
,
e
);
}
finally
{
IOUtils
.
closeQuietly
(
in
);
IOUtils
.
closeQuietly
(
out
);
}
}
}
bindings/java/core/src/test/java/org/videolan/jvlc/internal/LibVlcMediaPlayerTest.java
View file @
b774d66a
...
...
@@ -25,42 +25,14 @@
package
org.videolan.jvlc.internal
;
import
org.junit.After
;
import
org.junit.Assert
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.videolan.jvlc.internal.LibVlc.LibVlcInstance
;
import
org.videolan.jvlc.internal.LibVlc.LibVlcMediaDescriptor
;
import
org.videolan.jvlc.internal.LibVlc.LibVlcMediaInstance
;
import
org.videolan.jvlc.internal.LibVlc.libvlc_exception_t
;
public
class
LibVlcMediaPlayerTest
public
class
LibVlcMediaPlayerTest
extends
AbstractVLCInternalTest
{
private
LibVlc
libvlc
=
LibVlc
.
SYNC_INSTANCE
;
private
LibVlcInstance
libvlcInstance
;
private
String
mrl
=
this
.
getClass
().
getResource
(
"/raffa_voice.ogg"
).
getPath
();
private
libvlc_exception_t
exception
;
@Before
public
void
testSetup
()
{
exception
=
new
libvlc_exception_t
();
libvlcInstance
=
libvlc
.
libvlc_new
(
0
,
new
String
[]{
"-vvv"
,
"-I"
,
"dummy"
,
"-aout=dummy"
,
"-vout=dummy"
},
exception
);
libvlc
.
libvlc_exception_clear
(
exception
);
}
@After
public
void
tearDown
()
{
libvlc
.
libvlc_release
(
libvlcInstance
);
libvlc
.
libvlc_exception_clear
(
exception
);
}
@Test
public
void
mediaInstanceNew
()
{
...
...
bindings/java/core/src/test/java/org/videolan/jvlc/internal/MediaDescriptorTest.java
View file @
b774d66a
...
...
@@ -27,36 +27,14 @@ package org.videolan.jvlc.internal;
import
junit.framework.Assert
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.videolan.jvlc.internal.LibVlc.LibVlcInstance
;
import
org.videolan.jvlc.internal.LibVlc.LibVlcMediaDescriptor
;
import
org.videolan.jvlc.internal.LibVlc.libvlc_exception_t
;
public
class
MediaDescriptorTest
public
class
MediaDescriptorTest
extends
AbstractVLCInternalTest
{
private
LibVlc
libvlc
=
LibVlc
.
SYNC_INSTANCE
;
private
LibVlcInstance
libvlcInstance
;
private
String
mrl
=
this
.
getClass
().
getResource
(
"/raffa_voice.ogg"
).
getPath
();
@Before
public
void
testSetup
()
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
libvlcInstance
=
libvlc
.
libvlc_new
(
0
,
new
String
[]{
"-I"
,
"dummy"
,
"--aout=dummy"
,
"--vout=dummy"
},
exception
);
}
@After
public
void
tearDown
()
{
libvlc
.
libvlc_release
(
libvlcInstance
);
}
@Test
public
void
mediaDescriptorNew
()
throws
Exception
{
...
...
bindings/java/core/src/test/java/org/videolan/jvlc/internal/MediaListPlayerTest.java
View file @
b774d66a
...
...
@@ -27,10 +27,7 @@ package org.videolan.jvlc.internal;
import
junit.framework.Assert
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.videolan.jvlc.internal.LibVlc.LibVlcInstance
;
import
org.videolan.jvlc.internal.LibVlc.LibVlcMediaDescriptor
;
import
org.videolan.jvlc.internal.LibVlc.LibVlcMediaInstance
;
import
org.videolan.jvlc.internal.LibVlc.LibVlcMediaList
;
...
...
@@ -38,30 +35,8 @@ import org.videolan.jvlc.internal.LibVlc.LibVlcMediaListPlayer;
import
org.videolan.jvlc.internal.LibVlc.libvlc_exception_t
;
public
class
MediaListPlayerTest
public
class
MediaListPlayerTest
extends
AbstractVLCInternalTest
{
private
LibVlc
libvlc
=
LibVlc
.
SYNC_INSTANCE
;
private
LibVlcInstance
libvlcInstance
;
private
String
mrl
=
this
.
getClass
().
getResource
(
"/raffa_voice.ogg"
).
getPath
();
@Before
public
void
testSetup
()
throws
Exception
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
libvlcInstance
=
libvlc
.
libvlc_new
(
0
,
new
String
[]{
"-I"
,
"dummy"
,
"--aout=dummy"
,
"--vout=dummy"
},
exception
);
// use the following line to use your audio card.
// libvlcInstance = libvlc.libvlc_new(0, new String[]{}, exception);
}
@After
public
void
tearDown
()
{
libvlc
.
libvlc_release
(
libvlcInstance
);
}
@Test
public
void
mediaListPlayerNewTest
()
{
...
...
bindings/java/core/src/test/java/org/videolan/jvlc/internal/MediaListTest.java
View file @
b774d66a
...
...
@@ -27,35 +27,15 @@ package org.videolan.jvlc.internal;
import
junit.framework.Assert
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.videolan.jvlc.internal.LibVlc.LibVlcInstance
;
import
org.videolan.jvlc.internal.LibVlc.LibVlcMediaDescriptor
;
import
org.videolan.jvlc.internal.LibVlc.LibVlcMediaList
;
import
org.videolan.jvlc.internal.LibVlc.libvlc_exception_t
;
public
class
MediaListTest
public
class
MediaListTest
extends
AbstractVLCInternalTest
{
private
LibVlc
libvlc
=
LibVlc
.
SYNC_INSTANCE
;
private
LibVlcInstance
libvlcInstance
;
@Before
public
void
testSetup
()
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
libvlcInstance
=
libvlc
.
libvlc_new
(
0
,
new
String
[]{
"-I"
,
"dummy"
,
"--aout=dummy"
,
"--vout=dummy"
},
exception
);
}
@After
public
void
tearDown
()
{
libvlc
.
libvlc_release
(
libvlcInstance
);
}
@Test
public
void
mediaListNew
()
{
...
...
bindings/java/core/src/test/java/org/videolan/jvlc/internal/VLMInternalTest.java
0 → 100644
View file @
b774d66a
/*****************************************************************************
* VLMInternalTest.java: VLC Java Bindings
*****************************************************************************
* 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.internal
;
import
org.junit.Test
;
import
org.videolan.jvlc.internal.LibVlc.libvlc_exception_t
;
public
class
VLMInternalTest
extends
AbstractVLCInternalTest
{
@Test
public
void
testVLMPlay
()
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
libvlc
.
libvlc_vlm_add_broadcast
(
libvlcInstance
,
"test"
,
"file://"
+
mrl
,
""
,
0
,
null
,
1
,
0
,
exception
);
libvlc
.
libvlc_vlm_play_media
(
libvlcInstance
,
mrl
,
exception
);
catchException
(
exception
);
libvlc
.
libvlc_vlm_stop_media
(
libvlcInstance
,
mrl
,
exception
);
}
}
bindings/java/core/src/test/resources/log4j.xml
0 → 100644
View file @
b774d66a
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration>
<!-- log4j test configuration -->
<appender
name=
"test-appender"
class=
"org.apache.log4j.ConsoleAppender"
>
<layout
class=
"org.apache.log4j.PatternLayout"
>
<param
name=
"ConversionPattern"
value=
"%-5p %c.%M(%C{1}.java:%L) %m%n"
/>
<!-- <param name="ConversionPattern" value="%-5p %m%n" />-->
</layout>
</appender>
<category
name=
"org.videolan"
>
<priority
value=
"info"
/>
</category>
<root>
<priority
value=
"debug"
/>
<appender-ref
ref=
"test-appender"
/>
</root>
</log4j:configuration>
\ No newline at end of file
bindings/java/core/src/test/resources/sample
0 → 100644
View file @
b774d66a
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