diff --git a/src/main/java/uk/co/caprica/vlcj/player/base/VideoApi.java b/src/main/java/uk/co/caprica/vlcj/player/base/VideoApi.java
index af1608fec..24c71069a 100644
--- a/src/main/java/uk/co/caprica/vlcj/player/base/VideoApi.java
+++ b/src/main/java/uk/co/caprica/vlcj/player/base/VideoApi.java
@@ -20,6 +20,7 @@
package uk.co.caprica.vlcj.player.base;
import com.sun.jna.ptr.IntByReference;
+import uk.co.caprica.vlcj.binding.internal.libvlc_video_fit_mode_t;
import uk.co.caprica.vlcj.binding.support.strings.NativeString;
import uk.co.caprica.vlcj.binding.internal.libvlc_video_adjust_option_t;
import uk.co.caprica.vlcj.binding.internal.libvlc_video_viewpoint_t;
@@ -29,6 +30,7 @@
import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_media_player_set_video_title_display;
import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_get_adjust_float;
import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_get_adjust_int;
+import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_get_display_fit;
import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_get_scale;
import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_get_size;
import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_new_viewpoint;
@@ -39,8 +41,10 @@
import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_set_crop_ratio;
import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_set_crop_window;
import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_set_deinterlace;
+import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_set_display_fit;
import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_set_scale;
import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_update_viewpoint;
+import static uk.co.caprica.vlcj.player.base.VideoFitMode.videoFitMode;
/**
* Behaviour pertaining to media player video.
@@ -203,6 +207,24 @@ public void setAspectRatio(String aspectRatio) {
libvlc_video_set_aspect_ratio(mediaPlayerInstance, aspectRatio);
}
+ /**
+ * Get the video fit mode.
+ *
+ * @return fit mode
+ */
+ public VideoFitMode displayFit() {
+ return videoFitMode(libvlc_video_get_display_fit(mediaPlayerInstance));
+ }
+
+ /**
+ * Set the video fit mode.
+ *
+ * @param fitMode fit mode
+ */
+ public void setDisplayFit(VideoFitMode fitMode) {
+ libvlc_video_set_display_fit(mediaPlayerInstance, fitMode.intValue());
+ }
+
/**
* Get the current video scale (zoom).
*
diff --git a/src/main/java/uk/co/caprica/vlcj/player/base/VideoFitMode.java b/src/main/java/uk/co/caprica/vlcj/player/base/VideoFitMode.java
new file mode 100644
index 000000000..520364af7
--- /dev/null
+++ b/src/main/java/uk/co/caprica/vlcj/player/base/VideoFitMode.java
@@ -0,0 +1,58 @@
+/*
+ * This file is part of VLCJ.
+ *
+ * VLCJ 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * VLCJ 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 VLCJ. If not, see .
+ *
+ * Copyright 2009-2024 Caprica Software Limited.
+ */
+
+package uk.co.caprica.vlcj.player.base;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Enumeration of video fit modes.
+ */
+public enum VideoFitMode {
+
+ libvlc_video_fit_none(0), /**< Explicit zoom set by \ref libvlc_video_set_scale */
+ libvlc_video_fit_smaller(1), /**< Fit inside / to smallest display dimension */
+ libvlc_video_fit_larger(2), /**< Fit outside / to largest display dimension */
+ libvlc_video_fit_width(3), /**< Fit to display width */
+ libvlc_video_fit_height(4);
+
+ private static final Map INT_MAP = new HashMap();
+
+ static {
+ for (VideoFitMode value : VideoFitMode.values()) {
+ INT_MAP.put(value.intValue, value);
+ }
+ }
+
+ public static VideoFitMode videoFitMode(int intValue) {
+ return INT_MAP.get(intValue);
+ }
+
+ private final int intValue;
+
+ VideoFitMode(int intValue) {
+ this.intValue = intValue;
+ }
+
+ public int intValue() {
+ return intValue;
+ }
+
+}