Skip to content

Commit c6da07b

Browse files
committed
Support new native API to get deinterlace status
1 parent b42effe commit c6da07b

3 files changed

Lines changed: 129 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* This file is part of VLCJ.
3+
*
4+
* VLCJ is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* VLCJ is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with VLCJ. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
* Copyright 2009-2025 Caprica Software Limited.
18+
*/
19+
20+
package uk.co.caprica.vlcj.player.base;
21+
22+
public final class DeinterlaceResult {
23+
24+
public final DeinterlaceStatus status;
25+
public final DeinterlaceMode mode;
26+
27+
public DeinterlaceResult(DeinterlaceStatus status, DeinterlaceMode mode) {
28+
this.status = status;
29+
this.mode = mode;
30+
}
31+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
* This file is part of VLCJ.
3+
*
4+
* VLCJ is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* VLCJ is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with VLCJ. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
* Copyright 2009-2025 Caprica Software Limited.
18+
*/
19+
20+
package uk.co.caprica.vlcj.player.base;
21+
22+
import java.util.HashMap;
23+
import java.util.Map;
24+
25+
/**
26+
* Enumeration of deinterlace statuses.
27+
*/
28+
public enum DeinterlaceStatus {
29+
30+
/**
31+
* Automatically selected.
32+
*/
33+
AUTOMATIC(-1),
34+
35+
/**
36+
* Forced disabled.
37+
*/
38+
DISABLED(0),
39+
40+
/**
41+
* Forced enabled.
42+
*/
43+
ENABLED(1);
44+
45+
private static final Map<Integer, DeinterlaceStatus> INT_MAP = new HashMap<Integer, DeinterlaceStatus>();
46+
47+
static {
48+
for (DeinterlaceStatus value : DeinterlaceStatus.values()) {
49+
INT_MAP.put(value.status, value);
50+
}
51+
}
52+
53+
public static DeinterlaceStatus deinterlaceStatus(int intValue) {
54+
return INT_MAP.get(intValue);
55+
}
56+
57+
/**
58+
* Native mode value.
59+
*/
60+
private final int status;
61+
62+
/**
63+
* Create an enumerated value.
64+
*
65+
* @param status native status value
66+
*/
67+
DeinterlaceStatus(int status) {
68+
this.status = status;
69+
}
70+
71+
/**
72+
* Get the native mode value.
73+
*
74+
* @return mode value
75+
*/
76+
public final int intValue() {
77+
return status;
78+
}
79+
80+
}

src/main/java/uk/co/caprica/vlcj/player/base/VideoApi.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
package uk.co.caprica.vlcj.player.base;
2121

2222
import com.sun.jna.ptr.IntByReference;
23+
import com.sun.jna.ptr.PointerByReference;
2324
import uk.co.caprica.vlcj.binding.internal.libvlc_video_adjust_option_t;
2425
import uk.co.caprica.vlcj.binding.internal.libvlc_video_viewpoint_t;
2526
import uk.co.caprica.vlcj.binding.support.strings.NativeString;
@@ -33,6 +34,7 @@
3334
import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_get_adjust_int;
3435
import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_get_aspect_ratio;
3536
import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_get_cursor;
37+
import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_get_deinterlace;
3638
import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_get_display_fit;
3739
import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_get_scale;
3840
import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_get_size;
@@ -51,6 +53,8 @@
5153
import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_set_video_stereo_mode;
5254
import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_unset_projection_mode;
5355
import static uk.co.caprica.vlcj.binding.lib.LibVlc.libvlc_video_update_viewpoint;
56+
import static uk.co.caprica.vlcj.player.base.DeinterlaceMode.deinterlaceMode;
57+
import static uk.co.caprica.vlcj.player.base.DeinterlaceStatus.deinterlaceStatus;
5458
import static uk.co.caprica.vlcj.player.base.VideoFitMode.videoFitMode;
5559
import static uk.co.caprica.vlcj.player.base.VideoStereoMode.videoStereoMode;
5660

@@ -63,6 +67,20 @@ public final class VideoApi extends BaseApi {
6367
super(mediaPlayer);
6468
}
6569

70+
/**
71+
* Get the de-interlace mode status.
72+
*
73+
* @return de-interlace status and mode
74+
*/
75+
public DeinterlaceResult getDeinterlace() {
76+
PointerByReference modePointer = new PointerByReference();
77+
int statusValue = libvlc_video_get_deinterlace(mediaPlayerInstance, modePointer);
78+
String modeValue = NativeString.copyAndFreeNativeString(modePointer.getValue());
79+
DeinterlaceStatus status = deinterlaceStatus(statusValue);
80+
DeinterlaceMode mode = deinterlaceMode(modeValue);
81+
return new DeinterlaceResult(status, mode);
82+
}
83+
6684
/**
6785
* Set the de-interlace filter to use.
6886
*

0 commit comments

Comments
 (0)