[Android] LibVLC: Media: VideoTrack: add Orientation and Projection

Thomas Guillem git at videolan.org
Mon Nov 28 16:39:13 CET 2016


vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Nov 28 15:02:04 2016 +0100| [71c4ad124b634b62a18efd297b6c22a259ff461e] | committer: Thomas Guillem

LibVLC: Media: VideoTrack: add Orientation and Projection

> https://code.videolan.org/videolan/vlc-android/commit/71c4ad124b634b62a18efd297b6c22a259ff461e
---

 libvlc/jni/libvlcjni-media.c              |  4 +++-
 libvlc/jni/libvlcjni.c                    |  2 +-
 libvlc/src/org/videolan/libvlc/Media.java | 38 ++++++++++++++++++++++++++++---
 3 files changed, 39 insertions(+), 5 deletions(-)

diff --git a/libvlc/jni/libvlcjni-media.c b/libvlc/jni/libvlcjni-media.c
index 831c1a5..284124d 100644
--- a/libvlc/jni/libvlcjni-media.c
+++ b/libvlc/jni/libvlcjni-media.c
@@ -328,7 +328,9 @@ media_track_to_object(JNIEnv *env, libvlc_media_track_t *p_tracks)
                                 (jint)p_tracks->video->i_sar_num,
                                 (jint)p_tracks->video->i_sar_den,
                                 (jint)p_tracks->video->i_frame_rate_num,
-                                (jint)p_tracks->video->i_frame_rate_den);
+                                (jint)p_tracks->video->i_frame_rate_den,
+                                (jint)p_tracks->video->i_orientation,
+                                (jint)p_tracks->video->i_projection);
         case libvlc_track_text: {
             jstring jencoding = NULL;
 
diff --git a/libvlc/jni/libvlcjni.c b/libvlc/jni/libvlcjni.c
index 6b4513f..2adbdf1 100644
--- a/libvlc/jni/libvlcjni.c
+++ b/libvlc/jni/libvlcjni.c
@@ -228,7 +228,7 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved)
            fields.Media.createVideoTrackFromNativeID,
            fields.Media.clazz,
            "createVideoTrackFromNative",
-           "(Ljava/lang/String;Ljava/lang/String;IIIILjava/lang/String;Ljava/lang/String;IIIIII)"
+           "(Ljava/lang/String;Ljava/lang/String;IIIILjava/lang/String;Ljava/lang/String;IIIIIIII)"
            "Lorg/videolan/libvlc/Media$Track;");
 
     GET_ID(GetStaticMethodID,
diff --git a/libvlc/src/org/videolan/libvlc/Media.java b/libvlc/src/org/videolan/libvlc/Media.java
index 1633a00..05f2f4d 100644
--- a/libvlc/src/org/videolan/libvlc/Media.java
+++ b/libvlc/src/org/videolan/libvlc/Media.java
@@ -207,16 +207,45 @@ public class Media extends VLCObject<Media.Event> {
      * see libvlc_video_track_t
      */
     public static class VideoTrack extends Track {
+        public static final class Orientation {
+            /** Top line represents top, left column left */
+            public static final int TopLeft = 0;
+            /** Flipped horizontally */
+            public static final int TopRight = 1;
+            /** Flipped vertically */
+            public static final int BottomLeft = 2;
+            /** Rotated 180 degrees */
+            public static final int BottomRight = 3;
+            /** Transposed */
+            public static final int LeftTop = 4;
+            /** Rotated 90 degrees clockwise (or 270 anti-clockwise) */
+            public static final int LeftBottom = 5;
+            /** Rotated 90 degrees anti-clockwise */
+            public static final int RightTop= 6;
+            /** Anti-transposed */
+            public static final int RightBottom = 7;
+        }
+
+        public static final class Projection {
+            public static final int Rectangular = 0;
+            /** 360 spherical */
+            public static final int EquiRectangular = 1;
+            public static final int CubemapLayoutStandard = 0x100;
+        }
+
         public final int height;
         public final int width;
         public final int sarNum;
         public final int sarDen;
         public final int frameRateNum;
         public final int frameRateDen;
+        public final int orientation;
+        public final int projection;
 
         private VideoTrack(String codec, String originalCodec, int id, int profile,
                 int level, int bitrate, String language, String description,
-                int height, int width, int sarNum, int sarDen, int frameRateNum, int frameRateDen) {
+                int height, int width, int sarNum, int sarDen, int frameRateNum, int frameRateDen,
+                int orientation, int projection) {
             super(Type.Video, codec, originalCodec, id, profile, level, bitrate, language, description);
             this.height = height;
             this.width = width;
@@ -224,16 +253,19 @@ public class Media extends VLCObject<Media.Event> {
             this.sarDen = sarDen;
             this.frameRateNum = frameRateNum;
             this.frameRateDen = frameRateDen;
+            this.orientation = orientation;
+            this.projection = projection;
         }
     }
 
     @SuppressWarnings("unused") /* Used from JNI */
     private static Track createVideoTrackFromNative(String codec, String originalCodec, int id, int profile,
             int level, int bitrate, String language, String description,
-            int height, int width, int sarNum, int sarDen, int frameRateNum, int frameRateDen) {
+            int height, int width, int sarNum, int sarDen, int frameRateNum, int frameRateDen,
+            int orientation, int projection) {
         return new VideoTrack(codec, originalCodec, id, profile,
                 level, bitrate, language, description,
-                height, width, sarNum, sarDen, frameRateNum, frameRateDen);
+                height, width, sarNum, sarDen, frameRateNum, frameRateDen, orientation, projection);
     }
 
     /**



More information about the Android mailing list