[Android] libvlc: fix warnings and comments
Thomas Guillem
git at videolan.org
Fri Jun 26 10:24:07 CEST 2015
vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jun 26 10:23:52 2015 +0200| [854a8f6e7b3df087ddf8231a6fa5ce8c8bb4a763] | committer: Thomas Guillem
libvlc: fix warnings and comments
Only MediaPlayer class (still wip) has warnings now.
Suppress unused warning for public classes.
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=854a8f6e7b3df087ddf8231a6fa5ce8c8bb4a763
---
libvlc/src/org/videolan/libvlc/Media.java | 23 +++++++++-----------
.../src/org/videolan/libvlc/MediaDiscoverer.java | 3 ++-
libvlc/src/org/videolan/libvlc/MediaList.java | 5 +++--
libvlc/src/org/videolan/libvlc/MediaPlayer.java | 12 +++++-----
libvlc/src/org/videolan/libvlc/VLCObject.java | 13 ++++++-----
5 files changed, 27 insertions(+), 29 deletions(-)
diff --git a/libvlc/src/org/videolan/libvlc/Media.java b/libvlc/src/org/videolan/libvlc/Media.java
index 0c8ed1b..6afa87f 100644
--- a/libvlc/src/org/videolan/libvlc/Media.java
+++ b/libvlc/src/org/videolan/libvlc/Media.java
@@ -27,6 +27,7 @@ import org.videolan.libvlc.util.HWDecoderUtil;
import java.io.FileDescriptor;
+ at SuppressWarnings("unused")
public class Media extends VLCObject<Media.Event> {
private final static String TAG = "LibVLC/Media";
@@ -248,8 +249,8 @@ public class Media extends VLCObject<Media.Event> {
/**
* Create a Media from libVLC and a local path starting with '/'.
*
- * @param libVLC
- * @param path
+ * @param libVLC a valid libVLC
+ * @param path an absolute local path
*/
public Media(LibVLC libVLC, String path) {
nativeNewFromPath(libVLC, path);
@@ -260,8 +261,8 @@ public class Media extends VLCObject<Media.Event> {
/**
* Create a Media from libVLC and a Uri
*
- * @param libVLC
- * @param uri
+ * @param libVLC a valid libVLC
+ * @param uri a valid RFC 2396 Uri
*/
public Media(LibVLC libVLC, Uri uri) {
nativeNewFromLocation(libVLC, locationFromUri(uri));
@@ -272,8 +273,8 @@ public class Media extends VLCObject<Media.Event> {
/**
* Create a Media from libVLC and a FileDescriptor
*
- * @param libVLC
- * @param fd
+ * @param libVLC a valid LibVLC
+ * @param fd file descriptor object
*/
public Media(LibVLC libVLC, FileDescriptor fd) {
nativeNewFromFD(libVLC, fd);
@@ -284,7 +285,7 @@ public class Media extends VLCObject<Media.Event> {
/**
*
* @param ml Should not be released and locked
- * @param index
+ * @param index index of the Media from the MediaList
*/
protected Media(MediaList ml, int index) {
if (ml == null || ml.isReleased())
@@ -302,8 +303,6 @@ public class Media extends VLCObject<Media.Event> {
/**
* VLC authorize only "-._~" in Mrl format, android Uri authorize "_-!.~'()*".
* Therefore, decode the characters authorized by Android Uri when creating an Uri from VLC.
- * @param mrl
- * @return
*/
private static Uri UriFromMrl(String mrl) {
final char array[] = mrl.toCharArray();
@@ -331,8 +330,6 @@ public class Media extends VLCObject<Media.Event> {
/**
* VLC authorize only "-._~" in Mrl format, android Uri authorize "_-!.~'()*".
* Therefore, encode the characters authorized by Android Uri when creating a mrl from an Uri.
- * @param uri
- * @return
*/
private static String locationFromUri(Uri uri) {
final char array[] = uri.toString().toCharArray();
@@ -512,7 +509,7 @@ public class Media extends VLCObject<Media.Event> {
* Get a Track
* The Track can be casted to {@link AudioTrack}, {@link VideoTrack} or {@link SubtitleTrack} in function of the {@link Track.Type}.
*
- * @param idx
+ * @param idx index of the track
* @return Track or null if not idx is not valid
* @see #getTrackCount()
*/
@@ -543,7 +540,7 @@ public class Media extends VLCObject<Media.Event> {
/**
* Add or remove hw acceleration media options
*
- * @param enabled
+ * @param enabled if true, hw decoder will be used
* @param force force hw acceleration even for unknown devices
*/
public void setHWDecoderEnabled(boolean enabled, boolean force) {
diff --git a/libvlc/src/org/videolan/libvlc/MediaDiscoverer.java b/libvlc/src/org/videolan/libvlc/MediaDiscoverer.java
index 0711ac1..65ba669 100644
--- a/libvlc/src/org/videolan/libvlc/MediaDiscoverer.java
+++ b/libvlc/src/org/videolan/libvlc/MediaDiscoverer.java
@@ -20,6 +20,7 @@
package org.videolan.libvlc;
+ at SuppressWarnings("unused")
public class MediaDiscoverer extends VLCObject<MediaDiscoverer.Event> {
private final static String TAG = "LibVLC/MediaDiscoverer";
@@ -40,7 +41,7 @@ public class MediaDiscoverer extends VLCObject<MediaDiscoverer.Event> {
/**
* Create a MediaDiscover.
*
- * @param libVLC
+ * @param libVLC a valid LibVLC
* @param name Name of the vlc service discovery ("dsm", "upnp", "bonjour"...).
*/
public MediaDiscoverer(LibVLC libVLC, String name) {
diff --git a/libvlc/src/org/videolan/libvlc/MediaList.java b/libvlc/src/org/videolan/libvlc/MediaList.java
index e61ff18..d790b3d 100644
--- a/libvlc/src/org/videolan/libvlc/MediaList.java
+++ b/libvlc/src/org/videolan/libvlc/MediaList.java
@@ -22,6 +22,7 @@ package org.videolan.libvlc;
import android.util.SparseArray;
+ at SuppressWarnings("unused")
public class MediaList extends VLCObject<MediaList.Event> {
private final static String TAG = "LibVLC/MediaList";
@@ -65,7 +66,7 @@ public class MediaList extends VLCObject<MediaList.Event> {
/**
* Create a MediaList from libVLC
- * @param libVLC
+ * @param libVLC a valid libVLC
*/
public MediaList(LibVLC libVLC) {
nativeNewFromLibVlc(libVLC);
@@ -160,7 +161,7 @@ public class MediaList extends VLCObject<MediaList.Event> {
/**
* Get a Media at specified index.
*
- * @param index
+ * @param index index of the media
* @return Media hold by MediaList. This Media should be released with {@link #release()}.
*/
public synchronized Media getMediaAt(int index) {
diff --git a/libvlc/src/org/videolan/libvlc/MediaPlayer.java b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
index dd3e754..eddfe55 100644
--- a/libvlc/src/org/videolan/libvlc/MediaPlayer.java
+++ b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
@@ -24,6 +24,7 @@ package org.videolan.libvlc;
import java.util.Map;
+ at SuppressWarnings("unused")
public class MediaPlayer extends VLCObject<MediaPlayer.Event> implements AWindow.SurfaceCallback {
public static class Event extends VLCEvent {
@@ -83,7 +84,7 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> implements AWindow
/**
* Create an empty MediaPlayer
*
- * @param libVLC
+ * @param libVLC a valid libVLC
*/
public MediaPlayer(LibVLC libVLC) {
nativeNewFromLibVlc(libVLC, mWindow);
@@ -92,7 +93,7 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> implements AWindow
/**
* Create a MediaPlayer from a Media
*
- * @param media
+ * @param media a valid Media
*/
public MediaPlayer(Media media) {
if (media == null || media.isReleased())
@@ -103,8 +104,7 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> implements AWindow
}
/**
- *
- * @return
+ * Get the IVLCVout helper.
*/
public IVLCVout getVLCVout() {
return mWindow;
@@ -113,7 +113,7 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> implements AWindow
/**
* Set a Media
*
- * @param media
+ * @param media a valid libVLC
*/
public synchronized void setMedia(Media media) {
if (mMedia != null)
@@ -130,8 +130,6 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> implements AWindow
/**
* Get the Media used by this MediaPlayer. This Media should be released with {@link #release()}.
- *
- * @return
*/
public synchronized Media getMedia() {
if (mMedia != null)
diff --git a/libvlc/src/org/videolan/libvlc/VLCObject.java b/libvlc/src/org/videolan/libvlc/VLCObject.java
index e8bbe24..5ff8f28 100644
--- a/libvlc/src/org/videolan/libvlc/VLCObject.java
+++ b/libvlc/src/org/videolan/libvlc/VLCObject.java
@@ -26,8 +26,6 @@ import android.os.Looper;
import java.lang.ref.WeakReference;
abstract class VLCObject<T extends VLCEvent> {
- private final static String TAG = "LibVLC/VlcObject";
-
private VLCEvent.Listener<T> mEventListener = null;
private Handler mHandler = null;
private int mNativeRefCount = 1;
@@ -96,9 +94,9 @@ abstract class VLCObject<T extends VLCEvent> {
/**
* Called when libvlc send events.
*
- * @param eventType
- * @param arg1
- * @param arg2
+ * @param eventType event type
+ * @param arg1 first argument
+ * @param arg2 second argument
* @return Event that will be dispatched to listeners
*/
protected abstract T onEventNative(int eventType, long arg1, long arg2);
@@ -111,7 +109,8 @@ abstract class VLCObject<T extends VLCEvent> {
protected abstract void onReleaseNative();
/* JNI */
- private long mInstance = 0; // Read-only, reserved for JNI
+ @SuppressWarnings("unused") /* Used from JNI */
+ private long mInstance = 0;
private synchronized void dispatchEventFromNative(int eventType, long arg1, long arg2) {
if (isReleased())
return;
@@ -137,9 +136,11 @@ abstract class VLCObject<T extends VLCEvent> {
private native void nativeDetachEvents();
/* used only before API 7: substitute for NewWeakGlobalRef */
+ @SuppressWarnings("unused") /* Used from JNI */
private Object getWeakReference() {
return new WeakReference<VLCObject>(this);
}
+ @SuppressWarnings("unchecked,unused") /* Used from JNI */
private static void dispatchEventFromWeakNative(Object weak, int eventType, long arg1, long arg2) {
VLCObject obj = ((WeakReference<VLCObject>)weak).get();
if (obj != null)
More information about the Android
mailing list