Skip to content

Commit f59ca1c

Browse files
Fix up buffer and pad enums
1 parent af7b486 commit f59ca1c

File tree

5 files changed

+35
-19
lines changed

5 files changed

+35
-19
lines changed

src/org/freedesktop/gstreamer/Buffer.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,13 @@ public void setOffsetEnd(long val) {
237237
*
238238
* Since GStreamer 1.10
239239
*
240-
* @return an EnumSet of {@link BufferFlag}
240+
* @return an EnumSet of {@link BufferFlags}
241241
*/
242242
@Gst.Since(minor = 10)
243-
public EnumSet<BufferFlag> getFlags() {
243+
public EnumSet<BufferFlags> getFlags() {
244244
Gst.checkVersion(1, 10);
245245
int nativeInt = GstBufferAPI.GSTBUFFER_API.gst_buffer_get_flags(this);
246-
return NativeFlags.fromInt(BufferFlag.class, nativeInt);
246+
return NativeFlags.fromInt(BufferFlags.class, nativeInt);
247247
}
248248

249249
/**
@@ -252,11 +252,11 @@ public EnumSet<BufferFlag> getFlags() {
252252
*
253253
* Since GStreamer 1.10
254254
*
255-
* @param flags an EnumSet of {@link BufferFlag} to be set on the buffer.
255+
* @param flags an EnumSet of {@link BufferFlags} to be set on the buffer.
256256
* @return true if flags were successfully set on this buffer
257257
*/
258258
@Gst.Since(minor = 10)
259-
public boolean setFlags(EnumSet<BufferFlag> flags) {
259+
public boolean setFlags(EnumSet<BufferFlags> flags) {
260260
Gst.checkVersion(1, 10);
261261
return GstBufferAPI.GSTBUFFER_API.gst_buffer_set_flags(this, NativeFlags.toInt(flags));
262262
}
@@ -267,12 +267,12 @@ public boolean setFlags(EnumSet<BufferFlag> flags) {
267267
*
268268
* Since GStreamer 1.10
269269
*
270-
* @param flags an EnumSet of {@link BufferFlag} to be cleared on the buffer.
270+
* @param flags an EnumSet of {@link BufferFlags} to be cleared on the buffer.
271271
* @return true if flags were successfully cleared on this buffer
272272
*
273273
*/
274274
@Gst.Since(minor = 10)
275-
public boolean unsetFlags(EnumSet<BufferFlag> flags) {
275+
public boolean unsetFlags(EnumSet<BufferFlags> flags) {
276276
Gst.checkVersion(1, 10);
277277
return GstBufferAPI.GSTBUFFER_API.gst_buffer_unset_flags(this, NativeFlags.toInt(flags));
278278
}

src/org/freedesktop/gstreamer/BufferFlag.java renamed to src/org/freedesktop/gstreamer/BufferFlags.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
/**
2727
* A set of buffer flags used to describe properties of a {@link Buffer}.
2828
*/
29-
public enum BufferFlag implements NativeFlags<BufferFlag> {
29+
public enum BufferFlags implements NativeFlags<BufferFlags> {
3030

3131
/**
3232
* the {@link Buffer} is live data and should be discarded in the PAUSED state.
@@ -109,7 +109,7 @@ public enum BufferFlag implements NativeFlags<BufferFlag> {
109109

110110
private final int value;
111111

112-
private BufferFlag(int value) {
112+
private BufferFlags(int value) {
113113
this.value = value;
114114
}
115115
/**

src/org/freedesktop/gstreamer/PadDirection.java

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,27 @@
1919

2020
package org.freedesktop.gstreamer;
2121

22+
import org.freedesktop.gstreamer.glib.NativeEnum;
23+
2224
/**
2325
* The direction of a {@link Pad}.
2426
*/
25-
public enum PadDirection {
27+
public enum PadDirection implements NativeEnum<PadDirection> {
2628
/** The direction is unknown. */
27-
UNKNOWN,
29+
UNKNOWN(0),
2830
/** The {@link Pad} is a source pad. */
29-
SRC,
31+
SRC(1),
3032
/** The {@link Pad} is a sink pad. */
31-
SINK;
33+
SINK(2);
34+
35+
private final int value;
36+
37+
private PadDirection(int value) {
38+
this.value = value;
39+
}
40+
41+
@Override
42+
public int intValue() {
43+
return value;
44+
}
3245
}

src/org/freedesktop/gstreamer/PadLinkReturn.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/*
2+
* Copyright (c) 2019 Neil C Smith
23
* Copyright (c) 2007 Wayne Meissner
34
*
45
* This file is part of gstreamer-java.
@@ -18,13 +19,13 @@
1819

1920
package org.freedesktop.gstreamer;
2021

22+
import org.freedesktop.gstreamer.glib.NativeEnum;
2123
import org.freedesktop.gstreamer.lowlevel.annotations.DefaultEnumValue;
22-
import org.freedesktop.gstreamer.glib.NativeFlags;
2324

2425
/**
2526
* Result values from {@link Pad#link(Pad)} and friends.
2627
*/
27-
public enum PadLinkReturn implements NativeFlags {
28+
public enum PadLinkReturn implements NativeEnum<PadLinkReturn> {
2829
/** Link succeeded. */
2930
OK(0),
3031
/** Pads have no common grandparent. */
@@ -38,20 +39,21 @@ public enum PadLinkReturn implements NativeFlags {
3839
/** Pads cannot cooperate in scheduling. */
3940
NOSCHED(-5),
4041
/** Refused for some reason. */
41-
REFUSED(-6),
42+
@DefaultEnumValue
43+
REFUSED(-6);
44+
45+
private final int value;
4246

43-
/** The default enum value used when no other value matches the native value */
44-
@DefaultEnumValue __UNKNOWN_NATIVE_VALUE(~0);
4547
PadLinkReturn(int value) {
4648
this.value = value;
4749
}
4850
/**
4951
* Gets the integer value of the enum.
5052
* @return The integer value for this enum.
5153
*/
54+
@Override
5255
public int intValue() {
5356
return value;
5457
}
5558

56-
private final int value;
5759
}

src/org/freedesktop/gstreamer/event/EventType.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/*
2+
* Copyright (c) 2019 Neil C Smith
23
* Copyright (c) 2008 Wayne Meissner
34
* Copyright (C) 1999,2000 Erik Walthinsen <[email protected]>
45
* 2000 Wim Taymans <[email protected]>

0 commit comments

Comments
 (0)