Skip to content

Commit 3d03d12

Browse files
author
Isaac Raño Jares
committed
Allow to create GSockets from a constructor.
Now it GSockets can be created in the same way as any other GObject in the library.
1 parent ebfbb6f commit 3d03d12

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/org/freedesktop/gstreamer/GSocket.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,21 @@ public class GSocket extends GObject{
1313

1414
public static final String GTYPE_NAME = "GSocket";
1515

16-
public static GSocket create(GSocketFamily family, GSocketType type, GSocketProtocol protocol) throws GstException {
16+
public static Initializer makeRawSocket(GSocketFamily family, GSocketType type, GSocketProtocol protocol) throws GstException {
1717
GErrorStruct reference = new GErrorStruct();
1818
GErrorStruct[] errorArray = (GErrorStruct[]) reference.toArray(1);
1919
Pointer socketPointer = GioAPI.g_socket_new(family.toGioValue(), type.toGioValue(), protocol.toGioValue(), reference.getPointer());
2020
if (socketPointer == null) {
2121
errorArray[0].read();
2222
throw new GstException(new GError(errorArray[0]));
2323
}
24-
return new GSocket(initializer(socketPointer));
24+
return initializer(socketPointer);
2525
}
2626

27-
public static GSocket createDefaultUdpSocket() {
28-
return create(GSocketFamily.IPV4, GSocketType.DATAGRAM, GSocketProtocol.UDP);
27+
public GSocket(GSocketFamily family, GSocketType type, GSocketProtocol protocol) throws GstException {
28+
this(makeRawSocket(family, type, protocol));
2929
}
30-
31-
public static GSocket createDefaultUdpSocket(String bindAddress, int bindPort) {
32-
return create(GSocketFamily.IPV4, GSocketType.DATAGRAM, GSocketProtocol.UDP).bind(bindAddress, bindPort);
33-
}
34-
30+
3531
public GSocket(Initializer init) {
3632
super(init);
3733
}

0 commit comments

Comments
 (0)