double
, or Double.NaN
if the denominator is 0
61 | */
62 | public double toDouble() {
63 | return denominator != 0 ? ((double) numerator / denominator) : Double.NaN;
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/src/org/freedesktop/gstreamer/GstException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 Neil C Smith
3 | * Copyright (C) 2008 Wayne Meissner
4 | * Copyright (C) 2004 Wim Taymans GstException
without detail message.
35 | */
36 | public GstException() {
37 | }
38 |
39 |
40 | /**
41 | * Constructs an instance of GstException
with the specified detail message.
42 | *
43 | * @param msg the detail message.
44 | */
45 | public GstException(String msg) {
46 | super(msg);
47 | }
48 |
49 | public GstException(GError error) {
50 | super(error);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/org/freedesktop/gstreamer/GstIterator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Neil C Smith
3 | *
4 | * This file is part of gstreamer-java.
5 | *
6 | * This code is free software: you can redistribute it and/or modify it under
7 | * the terms of the GNU Lesser General Public License version 3 only, as
8 | * published by the Free Software Foundation.
9 | *
10 | * This code is distributed in the hope that it will be useful, but WITHOUT
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13 | * version 3 for more details.
14 | *
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * version 3 along with this work. If not, see
26 | * See upstream documentation at
27 | * https://gstreamer.freedesktop.org/data/doc/gstreamer/stable/gst-plugins-base-libs/html/gst-plugins-base-libs-GstSDPMessage.html#GstSDPResult
29 | *
30 | * @see SDPMessage
31 | */
32 | public enum SDPResult implements NativeEnum
27 | * Only {@link StateChangeReturn#FAILURE} is a real failure.
28 | *
29 | * See upstream documentation at
30 | * https://gstreamer.freedesktop.org/data/doc/gstreamer/stable/gstreamer/html/GstElement.html#GstStateChangeReturn
32 | *
33 | */
34 | public enum StateChangeReturn implements NativeEnum
29 | * See upstream documentation at
30 | * https://gstreamer.freedesktop.org/data/doc/gstreamer/stable/gstreamer/html/GstTagList.html#GstTagFlag
32 | *
33 | */
34 | public enum TagFlag implements NativeEnum
26 | * See upstream documentation at
27 | * https://gstreamer.freedesktop.org/data/doc/gstreamer/stable/gstreamer-libs/html/GstBaseTransform.html
29 | *
30 | */
31 | public class BaseTransform extends Element {
32 |
33 | public static final String GTYPE_NAME = "GstBaseTransform";
34 |
35 | protected BaseTransform(Initializer init) {
36 | super(init);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/org/freedesktop/gstreamer/elements/Elements.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019 Neil C Smith
3 | *
4 | * This file is part of gstreamer-java.
5 | *
6 | * This code is free software: you can redistribute it and/or modify it under
7 | * the terms of the GNU Lesser General Public License version 3 only, as
8 | * published by the Free Software Foundation.
9 | *
10 | * This code is distributed in the hope that it will be useful, but WITHOUT
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13 | * version 3 for more details.
14 | *
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * version 3 along with this work. If not, see
30 | * See upstream documentation at
31 | * https://gstreamer.freedesktop.org/data/doc/gstreamer/stable/gstreamer/html/GstEvent.html#gst-event-new-caps
33 | *
34 | */
35 | public class CapsEvent extends Event {
36 |
37 | /**
38 | * This constructor is for internal use only.
39 | *
40 | * @param init initialization data.
41 | */
42 | CapsEvent(Initializer init) {
43 | super(init);
44 | }
45 |
46 | /**
47 | * Creates a new caps event.
48 | */
49 | public CapsEvent(final Caps caps) {
50 | super(Natives.initializer(GSTEVENT_API.ptr_gst_event_new_caps(caps)));
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/org/freedesktop/gstreamer/event/QOSType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019 Neil C Smith
3 | * Copyright (c) 2007 Wayne Meissner
4 | *
5 | * This file is part of gstreamer-java.
6 | *
7 | * This code is free software: you can redistribute it and/or modify it under
8 | * the terms of the GNU Lesser General Public License version 3 only, as
9 | * published by the Free Software Foundation.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
14 | * version 3 for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * version 3 along with this work. If not, see
30 | * See upstream documentation at
31 | * https://gstreamer.freedesktop.org/data/doc/gstreamer/stable/gstreamer/html/GstEvent.html#gst-event-new-reconfigure
33 | *
34 | */
35 | public class ReconfigureEvent extends Event {
36 |
37 | /**
38 | * This constructor is for internal use only.
39 | *
40 | * @param init initialization data.
41 | */
42 | ReconfigureEvent(Initializer init) {
43 | super(init);
44 | }
45 |
46 | /**
47 | * Creates a new reconfigure event.
48 | */
49 | public ReconfigureEvent() {
50 | super(Natives.initializer(GSTEVENT_API.ptr_gst_event_new_reconfigure()));
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/org/freedesktop/gstreamer/event/SeekType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019 Neil C Smith
3 | * Copyright (c) 2007 Wayne Meissner
4 | *
5 | * This file is part of gstreamer-java.
6 | *
7 | * This code is free software: you can redistribute it and/or modify it under
8 | * the terms of the GNU Lesser General Public License version 3 only, as
9 | * published by the Free Software Foundation.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
14 | * version 3 for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * version 3 along with this work. If not, see
27 | * When constructing a seek event with
28 | * gst_event_new_seek(), a format, a seek method and optional flags are to
29 | * be provided. The seek event is then inserted into the graph with
30 | * gst_pad_send_event() or gst_element_send_event().
31 | */
32 | public enum SeekType implements NativeEnum
29 | * See upstream documentation at
30 | * https://gstreamer.freedesktop.org/data/doc/gstreamer/stable/gstreamer/html/GstEvent.html#gst-event-new-stream-start
32 | *
33 | */
34 | public class StreamStartEvent extends Event {
35 |
36 | /**
37 | * This constructor is for internal use only.
38 | * @param init initialization data.
39 | */
40 | StreamStartEvent(Initializer init) {
41 | super(init);
42 | }
43 |
44 | /**
45 | * Creates a new EOS event.
46 | * @param stream_id identifier for this stream
47 | */
48 | public StreamStartEvent(final String stream_id) {
49 | super(Natives.initializer(GSTEVENT_API.ptr_gst_event_new_stream_start(stream_id)));
50 | }
51 | }
--------------------------------------------------------------------------------
/src/org/freedesktop/gstreamer/glib/GCancellable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Neil C Smith
3 | * Copyright (c) 2016 Isaac Raño Jares
4 | *
5 | * This file is part of gstreamer-java.
6 | *
7 | * This code is free software: you can redistribute it and/or modify it under
8 | * the terms of the GNU Lesser General Public License version 3 only, as
9 | * published by the Free Software Foundation.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
14 | * version 3 for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * version 3 along with this work. If not, see
29 | * See upstream documentation at
30 | * https://gstreamer.freedesktop.org/data/doc/gstreamer/stable/gstreamer/html/GstMessage.html#gst-message-new-duration-changed
32 | *
33 | * This message is posted by elements that know the duration of a stream when
34 | * the duration changes. This message is received by bins and is used to
35 | * calculate the total duration of a pipeline.
36 | */
37 | public class DurationChangedMessage extends Message {
38 |
39 | /**
40 | * Creates a new DurationChanged message.
41 | *
42 | * @param init internal initialization data.
43 | */
44 | DurationChangedMessage(Initializer init) {
45 | super(init);
46 | }
47 |
48 | /**
49 | * Creates a new DurationChanged Message
50 | *
51 | * @param src The object originating the message.
52 | */
53 | public DurationChangedMessage(GstObject src) {
54 | this(Natives.initializer(GSTMESSAGE_API.ptr_gst_message_new_duration_changed(src)));
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/org/freedesktop/gstreamer/message/EOSMessage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 Neil C Smith
3 | * Copyright (C) 2008 Wayne Meissner
4 | * Copyright (C) 2004 Wim Taymans
30 | * See upstream documentation at
31 | * https://gstreamer.freedesktop.org/data/doc/gstreamer/stable/gstreamer/html/GstMessage.html#gst-message-new-eos
33 | *
34 | * This message is generated and posted in the sink elements of a {@link Bin}.
35 | * The bin will only forward the EOS message to the application if all sinks
36 | * have posted an EOS message.
37 | */
38 | public class EOSMessage extends Message {
39 |
40 | /**
41 | * Creates a new eos message.
42 | *
43 | * @param init internal initialization data.
44 | */
45 | EOSMessage(Initializer init) {
46 | super(init);
47 | }
48 |
49 | /**
50 | * Creates a new eos message.
51 | *
52 | * @param src The object originating the message.
53 | */
54 | public EOSMessage(GstObject src) {
55 | this(Natives.initializer(GSTMESSAGE_API.ptr_gst_message_new_eos(src)));
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/org/freedesktop/gstreamer/message/ErrorMessage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 Neil C Smith
3 | * Copyright (C) 2008 Wayne Meissner
4 | * Copyright (C) 2004 Wim Taymans
29 | * See upstream documentation at
30 | * https://gstreamer.freedesktop.org/data/doc/gstreamer/stable/gstreamer/html/GstMessage.html#gst-message-new-error
32 | *
33 | * The pipeline will probably (partially) stop. The application
34 | * receiving this message should stop the pipeline.
35 | */
36 | public class ErrorMessage extends GErrorMessage {
37 |
38 | /**
39 | * Creates a new error message.
40 | *
41 | * @param init internal initialization data.
42 | */
43 | ErrorMessage(Initializer init) {
44 | super(init);
45 | }
46 |
47 | /**
48 | * Retrieves the GError structure contained in this message.
49 | *
50 | * @return the GError contained in this message.
51 | */
52 | @Override
53 | GErrorStruct parseMessage() {
54 | GErrorStruct[] err = { null };
55 | GSTMESSAGE_API.gst_message_parse_error(this, err, null);
56 | return err[0];
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/org/freedesktop/gstreamer/message/InfoMessage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 Neil C Smith
3 | * Copyright (C) 2008 Wayne Meissner
4 | * Copyright (C) 2004 Wim Taymans
28 | * See upstream documentation at
29 | * https://gstreamer.freedesktop.org/data/doc/gstreamer/stable/gstreamer/html/GstMessage.html#gst-message-new-info
31 | *
32 | */
33 | public class InfoMessage extends GErrorMessage {
34 |
35 | /**
36 | * Creates a new info message.
37 | *
38 | * @param init internal initialization data.
39 | */
40 | InfoMessage(Initializer init) {
41 | super(init);
42 | }
43 |
44 | /**
45 | * Retrieves the GError structure contained in this message.
46 | *
47 | * @return the GError contained in this message.
48 | */
49 | @Override
50 | GErrorStruct parseMessage() {
51 | GErrorStruct[] err = {null};
52 | GSTMESSAGE_API.gst_message_parse_info(this, err, null);
53 | return err[0];
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/org/freedesktop/gstreamer/message/LatencyMessage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 Neil C Smith
3 | * Copyright (C) 2008 Wayne Meissner
4 | * Copyright (C) 2004 Wim Taymans
29 | * See upstream documentation at
30 | * https://gstreamer.freedesktop.org/data/doc/gstreamer/stable/gstreamer/html/GstMessage.html#gst-message-new-latency
32 | *
33 | */
34 | public class LatencyMessage extends Message {
35 |
36 | /**
37 | * Creates a new Latency message.
38 | *
39 | * @param init internal initialization data.
40 | */
41 | LatencyMessage(Initializer init) {
42 | super(init);
43 | }
44 |
45 | /**
46 | * Creates a new Latency message.
47 | *
48 | * @param source the object originating the message.
49 | */
50 | public LatencyMessage(GstObject source) {
51 | this(Natives.initializer(GSTMESSAGE_API.ptr_gst_message_new_latency(source)));
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/org/freedesktop/gstreamer/message/NeedContextMessage.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright (c) 2019 Christophe Lafolet
4 | *
5 | * This file is part of gstreamer-java.
6 | *
7 | * This code is free software: you can redistribute it and/or modify it under
8 | * the terms of the GNU Lesser General Public License version 3 only, as
9 | * published by the Free Software Foundation.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
14 | * version 3 for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * version 3 along with this work. If not, see
28 | * See upstream documentation at
29 | * https://gstreamer.freedesktop.org/data/doc/gstreamer/stable/gstreamer/html/GstMessage.html#gst-message-new-warning
31 | *
32 | */
33 | public class WarningMessage extends GErrorMessage {
34 |
35 | /**
36 | * Creates a new warning message.
37 | *
38 | * @param init internal initialization data.
39 | */
40 | WarningMessage(Initializer init) {
41 | super(init);
42 | }
43 |
44 | /**
45 | * Retrieves the GError structure contained in this message.
46 | *
47 | * @return the GError contained in this message.
48 | */
49 | @Override
50 | GErrorStruct parseMessage() {
51 | GErrorStruct[] err = {null};
52 | GSTMESSAGE_API.gst_message_parse_warning(this, err, null);
53 | return err[0];
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/org/freedesktop/gstreamer/video/Video.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020 Neil C Smith
3 | *
4 | * This file is part of gstreamer-java.
5 | *
6 | * This code is free software: you can redistribute it and/or modify it under
7 | * the terms of the GNU Lesser General Public License version 3 only, as
8 | * published by the Free Software Foundation.
9 | *
10 | * This code is distributed in the hope that it will be useful, but WITHOUT
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13 | * version 3 for more details.
14 | *
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * version 3 along with this work. If not, see
27 | * See upstream documentation at
28 | * https://gstreamer.freedesktop.org/documentation/video/gstvideotimecode.html#GstVideoTimeCodeFlags
30 | */
31 | public enum VideoTimeCodeFlags implements NativeFlags
26 | * @see https://w3c.github.io/webrtc-pc/#rtcsdptype
27 | * Available since GStreamer 1.12
28 | */
29 | @Gst.Since(minor = 12)
30 | public enum WebRTCSDPType implements NativeEnum
8 | * Copyright (C) 2018 Robert Forsman, Ericsson SATV $Author thoth $ $Date 3/8/18
9 | * $
10 | */
11 | public class BufferFieldsTest {
12 |
13 | @BeforeClass
14 | public static void setUpClass() throws Exception {
15 | Gst.init("BufferFieldsTest");
16 | }
17 |
18 | @AfterClass
19 | public static void tearDownClass() throws Exception {
20 | Gst.deinit();
21 | }
22 |
23 | private Buffer buf;
24 |
25 | @Before
26 | public void setUp() {
27 | buf = new Buffer(12);
28 | }
29 |
30 | @Test
31 | public void setPTS() {
32 | buf.setPresentationTimestamp(ClockTime.fromMicros(5004003));
33 | long val = buf.getPresentationTimestamp();
34 | assertEquals(5004003, ClockTime.toMicros(val));
35 | }
36 |
37 | @Test
38 | public void setDTS() {
39 | buf.setDecodeTimestamp(ClockTime.fromMicros(9001004));
40 | long val = buf.getDecodeTimestamp();
41 | assertEquals(9001004, ClockTime.toMicros(val));
42 | }
43 |
44 | @Test
45 | public void setDuration() {
46 | buf.setDuration(ClockTime.fromMicros(4006008));
47 | long val = buf.getDuration();
48 | assertEquals(4006008, ClockTime.toMicros(val));
49 | }
50 |
51 | @Test
52 | public void setOffset() {
53 | buf.setOffset(2009006);
54 | long val = buf.getOffset();
55 | assertEquals(2009006, val);
56 | }
57 |
58 | @Test
59 | public void setOffsetEnd() {
60 | buf.setOffsetEnd(7005003);
61 | long val = buf.getOffsetEnd();
62 | assertEquals(7005003, val);
63 | }
64 |
65 | @Test
66 | // cannot test on GStreamer 1.8
67 | public void setFlags() {
68 | // assertTrue(buf.setFlags(7));
69 | // int val = buf.getFlags();
70 | // assertEquals(7, val);
71 | //
72 | // assertTrue(buf.setFlags(10));
73 | // val = buf.getFlags();
74 | // assertEquals(15, val);
75 | //
76 | // assertTrue(buf.unsetFlags(20));
77 | // val = buf.getFlags();
78 | // assertEquals(11, val);
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/test/org/freedesktop/gstreamer/ClockTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020 Neil C Smith
3 | *
4 | * This file is part of gstreamer-java.
5 | *
6 | * This code is free software: you can redistribute it and/or modify it under
7 | * the terms of the GNU Lesser General Public License version 3 only, as
8 | * published by the Free Software Foundation.
9 | *
10 | * This code is distributed in the hope that it will be useful, but WITHOUT
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13 | * version 3 for more details.
14 | *
15 | * You should have received a copy of the GNU Lesser General Public License
16 | * version 3 along with this work. If not, see GLibException
without detail message.
28 | */
29 | public GLibException() {
30 | }
31 |
32 | /**
33 | * Constructs an instance of GLibException
with the specified detail message.
34 | *
35 | * @param msg the detail message.
36 | */
37 | public GLibException(String msg) {
38 | super(msg);
39 | }
40 | public GLibException(GError error) {
41 | super(error.getMessage());
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/org/freedesktop/gstreamer/glib/GMainContext.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009 Levente Farkas
3 | * Copyright (c) 2007 Wayne Meissner
4 | *
5 | * This file is part of gstreamer-java.
6 | *
7 | * This code is free software: you can redistribute it and/or modify it under
8 | * the terms of the GNU Lesser General Public License version 3 only, as
9 | * published by the Free Software Foundation.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
14 | * version 3 for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public License
17 | * version 3 along with this work. If not, see