Skip to content

Commit de98f61

Browse files
Merge pull request #223 from codelerity/message-type-fix
Fix check for Message type in Bus so extended types don't cause errors.
2 parents da9c309 + 7abe4dc commit de98f61

File tree

3 files changed

+113
-47
lines changed

3 files changed

+113
-47
lines changed

src/org/freedesktop/gstreamer/Bus.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019 Neil C Smith
2+
* Copyright (c) 2020 Neil C Smith
33
* Copyright (C) 2014 Tom Greenwood <[email protected]>
44
* Copyright (C) 2007 Wayne Meissner
55
* Copyright (C) 2004 Wim Taymans <[email protected]>
@@ -855,7 +855,7 @@ public MessageProxy(MessageType type, BusCallback callback) {
855855
}
856856

857857
public void busMessage(final Bus bus, final Message msg) {
858-
if ((type.intValue() & msg.getType().intValue()) != 0) {
858+
if (type == MessageType.ANY || type == msg.getType()) {
859859
callback.callback(bus, msg, null);
860860
}
861861
}

src/org/freedesktop/gstreamer/message/MessageType.java

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019 Neil C Smith
2+
* Copyright (C) 2020 Neil C Smith
33
* Copyright (C) 2009 Levente Farkas
44
* Copyright (C) 2008 Wayne Meissner
55
* Copyright (C) 2004 Wim Taymans <[email protected]>
@@ -20,9 +20,11 @@
2020
*/
2121
package org.freedesktop.gstreamer.message;
2222

23+
import org.freedesktop.gstreamer.Gst;
24+
import org.freedesktop.gstreamer.device.Device;
25+
import org.freedesktop.gstreamer.device.DeviceProvider;
2326
import org.freedesktop.gstreamer.glib.NativeEnum;
2427

25-
2628
/**
2729
* The different message types that are available.
2830
* <p>
@@ -31,7 +33,6 @@
3133
* >https://gstreamer.freedesktop.org/data/doc/gstreamer/stable/gstreamer/html/GstMessage.html#GstMessageType</a>
3234
* <p>
3335
*/
34-
3536
// use NativeEnum not NativeFlags - from upstream definition
3637
// FIXME: 2.0: Make it NOT flags, just a regular 1,2,3,4.. enumeration
3738
public enum MessageType implements NativeEnum<MessageType> {
@@ -47,17 +48,17 @@ public enum MessageType implements NativeEnum<MessageType> {
4748
*/
4849
EOS(1 << 0),
4950
/**
50-
* An error occured. Whe the application receives an error message it should
51-
* stop playback of the pipeline and not assume that more data will be
52-
* played.
51+
* An error occurred. When the application receives an error message it
52+
* should stop playback of the pipeline and not assume that more data will
53+
* be played.
5354
*/
5455
ERROR(1 << 1),
5556
/**
56-
* A warning occured.
57+
* A warning occurred.
5758
*/
5859
WARNING(1 << 2),
5960
/**
60-
* An info message occured.
61+
* An info message occurred.
6162
*/
6263
INFO(1 << 3),
6364
/**
@@ -215,30 +216,47 @@ public enum MessageType implements NativeEnum<MessageType> {
215216
/**
216217
* Message indicating a {@link GObject} property has changed (Since 1.10)
217218
*/
219+
@Gst.Since(minor = 10)
218220
PROPERTY_NOTIFY(EXTENDED.intValue() + 3),
219221
/**
220222
* Message indicating a new {@link GstStreamCollection} is available (Since
221223
* 1.10)
222224
*/
225+
@Gst.Since(minor = 10)
223226
STREAM_COLLECTION(EXTENDED.intValue() + 4),
224227
/**
225228
* Message indicating the active selection of {@link GstStreams} has changed
226229
* (Since 1.10)
227230
*/
231+
@Gst.Since(minor = 10)
228232
STREAMS_SELECTED(EXTENDED.intValue() + 5),
229233
/**
230234
* Message indicating to request the application to try to play the given
231235
* URL(s). Useful if for example a HTTP 302/303 response is received with a
232236
* non-HTTP URL inside. (Since 1.10)
233237
*/
238+
@Gst.Since(minor = 10)
234239
REDIRECT(EXTENDED.intValue() + 6),
240+
/**
241+
* Message indicating a {@link Device} was changed by a
242+
* {@link DeviceProvider} (Since 1.16)
243+
*/
244+
@Gst.Since(minor = 16)
245+
DEVICE_CHANGED(EXTENDED.intValue() + 7),
246+
/**
247+
* Message sent by elements to request the running time from the pipeline
248+
* when an instant rate change should be applied (which may be in the past
249+
* when the answer arrives). (Since 1.18)
250+
*/
251+
@Gst.Since(minor = 18)
252+
INSTANT_RATE_REQUEST(EXTENDED.intValue() + 8),
235253
/**
236254
* mask for all of the above messages.
237255
*/
238256
ANY(~0);
239257

240258
private final int type;
241-
259+
242260
private MessageType(int type) {
243261
this.type = type;
244262
}

0 commit comments

Comments
 (0)