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
c71376ba
Commit
c71376ba
authored
Apr 06, 2008
by
Filippo Carone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jvlc logging classes added
parent
81a45bed
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
415 additions
and
0 deletions
+415
-0
bindings/java/core/src/main/java/org/videolan/jvlc/JVLC.java
bindings/java/core/src/main/java/org/videolan/jvlc/JVLC.java
+19
-0
bindings/java/core/src/main/java/org/videolan/jvlc/Logger.java
...ngs/java/core/src/main/java/org/videolan/jvlc/Logger.java
+79
-0
bindings/java/core/src/main/java/org/videolan/jvlc/LoggerIterator.java
.../core/src/main/java/org/videolan/jvlc/LoggerIterator.java
+97
-0
bindings/java/core/src/main/java/org/videolan/jvlc/LoggerMessage.java
...a/core/src/main/java/org/videolan/jvlc/LoggerMessage.java
+103
-0
bindings/java/core/src/main/java/org/videolan/jvlc/LoggerVerbosityLevel.java
...src/main/java/org/videolan/jvlc/LoggerVerbosityLevel.java
+37
-0
bindings/java/core/src/test/java/org/videolan/jvlc/LoggerTest.java
...java/core/src/test/java/org/videolan/jvlc/LoggerTest.java
+80
-0
No files found.
bindings/java/core/src/main/java/org/videolan/jvlc/JVLC.java
View file @
c71376ba
...
...
@@ -89,6 +89,25 @@ public class JVLC
return
libvlc
.
libvlc_new
(
args
.
length
,
args
,
exception
);
}
public
Logger
getLogger
()
{
return
new
Logger
(
this
);
}
public
LoggerVerbosityLevel
getLogVerbosity
()
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
int
level
=
libvlc
.
libvlc_get_log_verbosity
(
instance
,
exception
);
return
LoggerVerbosityLevel
.
getSeverity
(
level
);
}
public
void
setLogVerbosity
(
LoggerVerbosityLevel
level
)
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
libvlc
.
libvlc_set_log_verbosity
(
instance
,
level
.
ordinal
(),
exception
);
}
/**
* Returns the _instance.
* @return the _instance
...
...
bindings/java/core/src/main/java/org/videolan/jvlc/Logger.java
0 → 100644
View file @
c71376ba
/*****************************************************************************
* Logger.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
;
import
java.util.Iterator
;
import
org.videolan.jvlc.internal.LibVlc
;
import
org.videolan.jvlc.internal.LibVlc.LibVlcLog
;
import
org.videolan.jvlc.internal.LibVlc.libvlc_exception_t
;
public
class
Logger
{
LibVlcLog
logInstance
;
LibVlc
libvlc
;
/**
* @param jvlc The current jvlc instance
*/
public
Logger
(
JVLC
jvlc
)
{
this
.
libvlc
=
jvlc
.
getLibvlc
();
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
this
.
logInstance
=
jvlc
.
getLibvlc
().
libvlc_log_open
(
jvlc
.
getInstance
(),
exception
);
if
(
exception
.
raised
==
1
)
{
throw
new
RuntimeException
(
"Native exception thrown: "
+
exception
.
message
);
}
}
public
void
clear
()
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
libvlc
.
libvlc_log_clear
(
logInstance
,
exception
);
}
public
void
close
()
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
libvlc
.
libvlc_log_close
(
logInstance
,
exception
);
}
public
int
count
()
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
return
libvlc
.
libvlc_log_count
(
logInstance
,
exception
);
}
public
Iterator
<
LoggerMessage
>
iterator
()
{
return
new
LoggerIterator
(
this
);
}
}
bindings/java/core/src/main/java/org/videolan/jvlc/LoggerIterator.java
0 → 100644
View file @
c71376ba
/*****************************************************************************
* LoggerIterator.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
;
import
java.util.Iterator
;
import
org.videolan.jvlc.internal.LibVlc.LibVlcLogIterator
;
import
org.videolan.jvlc.internal.LibVlc.libvlc_exception_t
;
import
org.videolan.jvlc.internal.LibVlc.libvlc_log_message_t
;
public
class
LoggerIterator
implements
Iterator
<
LoggerMessage
>
{
private
Logger
logger
;
private
LibVlcLogIterator
logIterator
;
/**
* @param logInstance
*/
LoggerIterator
(
Logger
logger
)
{
this
.
logger
=
logger
;
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
this
.
logIterator
=
logger
.
libvlc
.
libvlc_log_get_iterator
(
logger
.
logInstance
,
exception
);
}
/**
* {@inheritDoc}
*/
@Override
public
boolean
hasNext
()
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
return
logger
.
libvlc
.
libvlc_log_iterator_has_next
(
logIterator
,
exception
)
!=
0
;
}
/**
* {@inheritDoc}
*/
@Override
public
LoggerMessage
next
()
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
libvlc_log_message_t
message
=
new
libvlc_log_message_t
();
logger
.
libvlc
.
libvlc_log_iterator_next
(
logIterator
,
message
,
exception
);
LoggerMessage
result
=
new
LoggerMessage
(
message
);
return
result
;
}
/**
* {@inheritDoc}
* Does not remove the element.
*/
@Override
public
void
remove
()
{
//
}
/**
* {@inheritDoc}
*/
@Override
protected
void
finalize
()
throws
Throwable
{
libvlc_exception_t
exception
=
new
libvlc_exception_t
();
logger
.
libvlc
.
libvlc_log_iterator_free
(
logIterator
,
exception
);
super
.
finalize
();
}
}
bindings/java/core/src/main/java/org/videolan/jvlc/LoggerMessage.java
0 → 100644
View file @
c71376ba
/*****************************************************************************
* LoggerMessage.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
;
import
org.videolan.jvlc.internal.LibVlc.libvlc_log_message_t
;
public
class
LoggerMessage
{
private
LoggerVerbosityLevel
severity
;
private
String
header
;
private
String
message
;
private
String
name
;
private
String
type
;
/**
* @param message
*/
LoggerMessage
(
libvlc_log_message_t
message
)
{
this
.
severity
=
LoggerVerbosityLevel
.
getSeverity
(
message
.
i_severity
);
this
.
header
=
message
.
psz_header
;
this
.
message
=
message
.
psz_message
;
this
.
name
=
message
.
psz_name
;
this
.
type
=
message
.
psz_type
;
}
/**
* Returns the header.
* @return the header
*/
public
String
getHeader
()
{
return
header
;
}
/**
* Returns the message.
* @return the message
*/
public
String
getMessage
()
{
return
message
;
}
/**
* Returns the name.
* @return the name
*/
public
String
getName
()
{
return
name
;
}
/**
* Returns the type.
* @return the type
*/
public
String
getType
()
{
return
type
;
}
/**
* Returns the severity.
* @return the severity
*/
public
LoggerVerbosityLevel
getSeverity
()
{
return
severity
;
}
}
bindings/java/core/src/main/java/org/videolan/jvlc/LoggerVerbosityLevel.java
0 → 100644
View file @
c71376ba
/*****************************************************************************
* LoggerSeverityEnum.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
;
public
enum
LoggerVerbosityLevel
{
INFO
,
ERROR
,
WARNING
,
DEBUG
;
public
static
LoggerVerbosityLevel
getSeverity
(
int
ordinal
)
{
return
new
LoggerVerbosityLevel
[]{
INFO
,
ERROR
,
WARNING
,
DEBUG
}[
ordinal
];
}
}
bindings/java/core/src/test/java/org/videolan/jvlc/LoggerTest.java
0 → 100644
View file @
c71376ba
/*****************************************************************************
* LoggerTest.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
;
import
java.util.Iterator
;
import
junit.framework.Assert
;
import
org.junit.Before
;
import
org.junit.Test
;
public
class
LoggerTest
{
private
JVLC
jvlc
;
private
String
mrl
=
getClass
().
getResource
(
"/raffa_voice.ogg"
).
getFile
();
@Before
public
void
setup
()
{
jvlc
=
new
JVLC
(
"-I dummy --aout=dummy --vout=dummy"
);
}
@Test
public
void
testLogDebug
()
{
jvlc
.
setLogVerbosity
(
LoggerVerbosityLevel
.
DEBUG
);
Logger
logger
=
jvlc
.
getLogger
();
jvlc
.
play
(
mrl
);
Assert
.
assertTrue
(
logger
.
count
()
>
0
);
}
/**
*
*/
@Test
public
void
testLogError
()
{
jvlc
.
setLogVerbosity
(
LoggerVerbosityLevel
.
DEBUG
);
Logger
logger
=
jvlc
.
getLogger
();
logger
.
clear
();
Assert
.
assertEquals
(
0
,
logger
.
count
());
jvlc
.
play
(
mrl
);
Iterator
<
LoggerMessage
>
loggerIterator
=
logger
.
iterator
();
while
(
loggerIterator
.
hasNext
())
{
LoggerMessage
message
=
loggerIterator
.
next
();
Assert
.
assertNotNull
(
message
.
getMessage
());
}
}
}
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