├── .github ├── FUNDING.yml └── workflows │ └── maven.yml ├── .gitignore ├── LICENSE.md ├── README.md ├── nbactions.xml ├── pom.xml ├── src └── org │ └── freedesktop │ └── gstreamer │ ├── Bin.java │ ├── Buffer.java │ ├── BufferFlags.java │ ├── BufferPool.java │ ├── Bus.java │ ├── BusSyncHandler.java │ ├── BusSyncReply.java │ ├── Caps.java │ ├── Clock.java │ ├── ClockID.java │ ├── ClockReturn.java │ ├── ClockTime.java │ ├── Context.java │ ├── ControlBinding.java │ ├── ControlSource.java │ ├── DateTime.java │ ├── Element.java │ ├── ElementFactory.java │ ├── FlowReturn.java │ ├── Format.java │ ├── Fraction.java │ ├── GhostPad.java │ ├── Gst.java │ ├── GstException.java │ ├── GstIterator.java │ ├── GstObject.java │ ├── Meta.java │ ├── MetaFlags.java │ ├── MiniObject.java │ ├── MiniObjectFlags.java │ ├── Pad.java │ ├── PadDirection.java │ ├── PadLinkException.java │ ├── PadLinkReturn.java │ ├── PadMode.java │ ├── PadPresence.java │ ├── PadProbeInfo.java │ ├── PadProbeReturn.java │ ├── PadProbeType.java │ ├── PadTemplate.java │ ├── Pipeline.java │ ├── Plugin.java │ ├── PluginFeature.java │ ├── Promise.java │ ├── PromiseResult.java │ ├── Range.java │ ├── Registry.java │ ├── SDPMessage.java │ ├── SDPResult.java │ ├── Sample.java │ ├── Segment.java │ ├── SegmentFlags.java │ ├── State.java │ ├── StateChangeReturn.java │ ├── StaticPadTemplate.java │ ├── Structure.java │ ├── Tag.java │ ├── TagFlag.java │ ├── TagList.java │ ├── TagMergeMode.java │ ├── Version.java │ ├── controller │ ├── ARGBControlBinding.java │ ├── Controllers.java │ ├── DirectControlBinding.java │ ├── InterpolationControlSource.java │ ├── InterpolationMode.java │ ├── LFOControlSource.java │ ├── LFOWaveform.java │ ├── ProxyControlBinding.java │ ├── TimedValueControlSource.java │ └── TriggerControlSource.java │ ├── device │ ├── Device.java │ ├── DeviceMonitor.java │ ├── DeviceProvider.java │ └── DeviceProviderFactory.java │ ├── elements │ ├── AppSink.java │ ├── AppSrc.java │ ├── BaseSink.java │ ├── BaseSrc.java │ ├── BaseTransform.java │ ├── DecodeBin.java │ ├── Elements.java │ ├── PlayBin.java │ ├── PlayFlags.java │ └── URIDecodeBin.java │ ├── event │ ├── BufferSizeEvent.java │ ├── CapsEvent.java │ ├── EOSEvent.java │ ├── Event.java │ ├── EventType.java │ ├── FlushStartEvent.java │ ├── FlushStopEvent.java │ ├── LatencyEvent.java │ ├── NavigationEvent.java │ ├── QOSEvent.java │ ├── QOSType.java │ ├── ReconfigureEvent.java │ ├── SeekEvent.java │ ├── SeekFlags.java │ ├── SeekType.java │ ├── SegmentEvent.java │ ├── StepEvent.java │ ├── StreamStartEvent.java │ └── TagEvent.java │ ├── glib │ ├── GCancellable.java │ ├── GDate.java │ ├── GError.java │ ├── GInetAddress.java │ ├── GInetSocketAddress.java │ ├── GLib.java │ ├── GLibException.java │ ├── GMainContext.java │ ├── GObject.java │ ├── GQuark.java │ ├── GSocket.java │ ├── GSocketAddress.java │ ├── GSocketFamily.java │ ├── GSocketProtocol.java │ ├── GSocketType.java │ ├── GSource.java │ ├── MainContextExecutorService.java │ ├── NativeEnum.java │ ├── NativeFlags.java │ ├── NativeObject.java │ ├── Natives.java │ └── RefCountedObject.java │ ├── interfaces │ ├── ColorBalance.java │ ├── ColorBalanceChannel.java │ ├── GstInterface.java │ ├── Navigation.java │ ├── VideoOrientation.java │ └── VideoOverlay.java │ ├── lowlevel │ ├── AppAPI.java │ ├── BaseSinkAPI.java │ ├── BaseSrcAPI.java │ ├── BaseTransformAPI.java │ ├── EnumMapper.java │ ├── GBoolean.java │ ├── GFunctionMapper.java │ ├── GNative.java │ ├── GObjectAPI.java │ ├── GObjectPtr.java │ ├── GPointer.java │ ├── GSignalAPI.java │ ├── GType.java │ ├── GTypeMapper.java │ ├── GTypedPtr.java │ ├── GValueAPI.java │ ├── GValueStruct.java │ ├── GioAPI.java │ ├── GlibAPI.java │ ├── GstAPI.java │ ├── GstARGBControlBindingPtr.java │ ├── GstBinAPI.java │ ├── GstBufferAPI.java │ ├── GstBufferPoolAPI.java │ ├── GstBusAPI.java │ ├── GstBusPtr.java │ ├── GstCapsAPI.java │ ├── GstClockAPI.java │ ├── GstColorBalanceAPI.java │ ├── GstContextAPI.java │ ├── GstContextPtr.java │ ├── GstControlBindingAPI.java │ ├── GstControlBindingPtr.java │ ├── GstControlSourceAPI.java │ ├── GstControlSourcePtr.java │ ├── GstControllerAPI.java │ ├── GstDateTimeAPI.java │ ├── GstDeviceAPI.java │ ├── GstDeviceMonitorAPI.java │ ├── GstDeviceProviderAPI.java │ ├── GstDeviceProviderFactoryAPI.java │ ├── GstDirectControlBindingPtr.java │ ├── GstElementAPI.java │ ├── GstElementFactoryAPI.java │ ├── GstEventAPI.java │ ├── GstGhostPadAPI.java │ ├── GstInterpolationControlSourceAPI.java │ ├── GstInterpolationControlSourcePtr.java │ ├── GstIteratorAPI.java │ ├── GstIteratorPtr.java │ ├── GstLFOControlSourcePtr.java │ ├── GstMessageAPI.java │ ├── GstMessagePtr.java │ ├── GstMetaAPI.java │ ├── GstMetaPtr.java │ ├── GstMiniObjectAPI.java │ ├── GstMiniObjectPtr.java │ ├── GstNative.java │ ├── GstNavigationAPI.java │ ├── GstObjectAPI.java │ ├── GstObjectPtr.java │ ├── GstPadAPI.java │ ├── GstPadProbeInfo.java │ ├── GstPadPtr.java │ ├── GstPadTemplateAPI.java │ ├── GstParseAPI.java │ ├── GstPipelineAPI.java │ ├── GstPluginAPI.java │ ├── GstPluginFeatureAPI.java │ ├── GstPromiseAPI.java │ ├── GstProxyControlBindingPtr.java │ ├── GstQueryAPI.java │ ├── GstRegistryAPI.java │ ├── GstSDPMessageAPI.java │ ├── GstSampleAPI.java │ ├── GstStructureAPI.java │ ├── GstStructurePtr.java │ ├── GstTagAPI.java │ ├── GstTagListAPI.java │ ├── GstTimedValueControlSourcePtr.java │ ├── GstTriggerControlSourcePtr.java │ ├── GstTypes.java │ ├── GstValueAPI.java │ ├── GstVideoAPI.java │ ├── GstVideoOrientationAPI.java │ ├── GstVideoOverlayAPI.java │ ├── GstWebRTCSessionDescriptionAPI.java │ ├── IntPtr.java │ ├── MainLoop.java │ ├── README │ ├── ReferenceManager.java │ └── annotations │ │ ├── CallerOwnsReturn.java │ │ ├── Const.java │ │ ├── ConstField.java │ │ ├── ConstReturn.java │ │ ├── DefaultEnumValue.java │ │ ├── FreeReturnValue.java │ │ ├── HasSubtype.java │ │ ├── IncRef.java │ │ └── Invalidate.java │ ├── message │ ├── BufferingMessage.java │ ├── DurationChangedMessage.java │ ├── EOSMessage.java │ ├── ErrorMessage.java │ ├── GErrorMessage.java │ ├── InfoMessage.java │ ├── LatencyMessage.java │ ├── Message.java │ ├── MessageType.java │ ├── NeedContextMessage.java │ ├── SegmentDoneMessage.java │ ├── StateChangedMessage.java │ ├── TagMessage.java │ └── WarningMessage.java │ ├── query │ ├── AllocationQuery.java │ ├── ConvertQuery.java │ ├── DurationQuery.java │ ├── FormatsQuery.java │ ├── LatencyQuery.java │ ├── PositionQuery.java │ ├── Query.java │ ├── QueryType.java │ ├── SeekingQuery.java │ └── SegmentQuery.java │ ├── video │ ├── Video.java │ ├── VideoTimeCode.java │ ├── VideoTimeCodeConfig.java │ ├── VideoTimeCodeFlags.java │ └── VideoTimeCodeMeta.java │ └── webrtc │ ├── WebRTC.java │ ├── WebRTCBin.java │ ├── WebRTCICEGatheringState.java │ ├── WebRTCPeerConnectionState.java │ ├── WebRTCSDPType.java │ └── WebRTCSessionDescription.java └── test └── org └── freedesktop └── gstreamer ├── BinTest.java ├── BufferFieldsTest.java ├── BufferProbeTester.java ├── BusTest.java ├── CapsTest.java ├── ClockTest.java ├── ClockTimeTest.java ├── ContextTest.java ├── ElementFactoryTest.java ├── ElementTest.java ├── EnumTest.java ├── ExecutorServiceTest.java ├── GCTracker.java ├── GLibTest.java ├── GarbageCollectionEDTTest.java ├── GarbageCollectionTest.java ├── GhostPadTest.java ├── GobjectSubclassTest.java ├── GstTypesTest.java ├── InitTest.java ├── MessageTest.java ├── PadProbeTypeTest.java ├── PadTemplateTest.java ├── PadTest.java ├── PipelineTest.java ├── PluginFeatureTest.java ├── PluginTest.java ├── ProbeTester.java ├── PromiseTest.java ├── PropertyTypeTest.java ├── QueryTest.java ├── RegistryTest.java ├── SampleTest.java ├── SampleTester.java ├── StreamInfoTest.java ├── StructureTest.java ├── TestPipe.java ├── WebRTCBinTest.java ├── controller ├── InterpolationControlSourceTest.java └── TriggerControlSourceTest.java ├── elements └── PlayBinTest.java ├── event └── EventTest.java ├── lowlevel ├── GValueTest.java ├── LowLevelStructureTest.java └── ReferenceManagerTest.java ├── util └── TestAssumptions.java └── video ├── VideoCropMetaTest.java ├── VideoTimeCodeConfigTest.java ├── VideoTimeCodeFlagsTest.java ├── VideoTimeCodeMetaTest.java └── VideoTimeCodeTest.java /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: neilcsmith-net 2 | 3 | -------------------------------------------------------------------------------- /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | name: Test on Maven 2 | 3 | on: 4 | [push, pull_request] 5 | 6 | jobs: 7 | test-1-16: 8 | 9 | runs-on: ubuntu-20.04 10 | 11 | steps: 12 | - name: Checkout 13 | uses: actions/checkout@v3 14 | 15 | - name: Set up JDK 1.8 16 | uses: actions/setup-java@v3 17 | with: 18 | java-version: '8' 19 | distribution: 'temurin' 20 | 21 | - name: Install GStreamer 22 | run: sudo apt-get update && sudo apt-get install gstreamer1.0-plugins-good gstreamer1.0-plugins-bad 23 | 24 | - name: Build with Maven 25 | run: mvn -B verify --file pom.xml 26 | 27 | test-1-20: 28 | 29 | runs-on: ubuntu-22.04 30 | 31 | steps: 32 | - name: Checkout 33 | uses: actions/checkout@v3 34 | 35 | - name: Set up JDK 1.8 36 | uses: actions/setup-java@v3 37 | with: 38 | java-version: '8' 39 | distribution: 'temurin' 40 | 41 | - name: Install GStreamer 42 | run: sudo apt-get update && sudo apt-get install gstreamer1.0-plugins-good gstreamer1.0-plugins-bad 43 | 44 | - name: Build with Maven 45 | run: mvn -B verify --file pom.xml 46 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Package Files # 4 | *.jar 5 | *.war 6 | *.ear 7 | /target/ 8 | 9 | # Eclipse Files # 10 | .classpath 11 | .project 12 | .settings 13 | 14 | # NetBeans Files # 15 | /nbproject/ 16 | nb-configuration.xml 17 | 18 | .idea 19 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/BusSyncHandler.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 . 18 | */ 19 | package org.freedesktop.gstreamer; 20 | 21 | import org.freedesktop.gstreamer.message.Message; 22 | 23 | /** 24 | * A BusSyncHandler will be invoked synchronously, when a new message has been 25 | * injected into a {@link Bus}. This function is mostly used internally. Only 26 | * one sync handler can be attached to a given bus. 27 | * 28 | * @see Bus#setSyncHandler(org.freedesktop.gstreamer.BusSyncHandler) 29 | */ 30 | public interface BusSyncHandler { 31 | 32 | public BusSyncReply syncMessage(Message message); 33 | } 34 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/BusSyncReply.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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer; 21 | 22 | import org.freedesktop.gstreamer.glib.NativeEnum; 23 | 24 | /** 25 | * The result values for a GstBusSyncHandler. 26 | */ 27 | public enum BusSyncReply implements NativeEnum { 28 | 29 | /** Drop the {@link Message} */ 30 | DROP(0), 31 | /** Pass the {@link Message} to the async queue */ 32 | PASS(1), 33 | /** Pass {@link Message} to async queue, continue if message is handled */ 34 | ASYNC(2); 35 | 36 | private final int value; 37 | 38 | BusSyncReply(int value) { 39 | this.value = value; 40 | } 41 | 42 | /** 43 | * Gets the integer value of the enum. 44 | * @return The integer value for this enum. 45 | */ 46 | @Override 47 | public int intValue() { 48 | return value; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/ClockReturn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Neil C Smith 3 | * Copyright (C) 2008 Wayne Meissner 4 | * Copyright (C) 1999,2000 Erik Walthinsen 5 | * 2000 Wim Taymans 6 | * 2005 Wim Taymans 7 | * 8 | * This file is part of gstreamer-java. 9 | * 10 | * This code is free software: you can redistribute it and/or modify it under 11 | * the terms of the GNU Lesser General Public License version 3 only, as 12 | * published by the Free Software Foundation. 13 | * 14 | * This code is distributed in the hope that it will be useful, but WITHOUT 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 17 | * version 3 for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * version 3 along with this work. If not, see . 21 | */ 22 | 23 | package org.freedesktop.gstreamer; 24 | 25 | import org.freedesktop.gstreamer.lowlevel.annotations.DefaultEnumValue; 26 | 27 | /** 28 | * The return value of a clock operation. 29 | */ 30 | public enum ClockReturn { 31 | /** The operation succeeded. */ 32 | OK, 33 | /** The operation was scheduled too late. */ 34 | EARLY, 35 | /** The clockID was unscheduled */ 36 | UNSCHEDULED, 37 | /** The ClockID is busy */ 38 | BUSY, 39 | /** A bad time was provided to a function. */ 40 | BADTIME, 41 | /** An error occured */ 42 | ERROR, 43 | /** Operation is not supported */ 44 | @DefaultEnumValue 45 | UNSUPPORTED, 46 | /** The ClockID is done waiting */ 47 | DONE 48 | } 49 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/Fraction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Neil C Smith 3 | * Copyright (c) 2007,2008 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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer; 21 | 22 | /** 23 | * Represents a fraction value. 24 | */ 25 | public class Fraction { 26 | public final int numerator; 27 | public final int denominator; 28 | 29 | /** 30 | * Creates a new {@code Fraction}. 31 | * 32 | * @param numerator the numerator value. 33 | * @param denominator the denominator value. 34 | */ 35 | public Fraction(int numerator, int denominator) { 36 | this.numerator = numerator; 37 | this.denominator = denominator; 38 | } 39 | 40 | /** 41 | * Gets the numerator of the {@code Fraction} 42 | * 43 | * @return the numerator as an integer. 44 | */ 45 | public int getNumerator() { 46 | return numerator; 47 | } 48 | 49 | /** 50 | * Gets the denominator of the {@code Fraction} 51 | * 52 | * @return the denominator as an integer. 53 | */ 54 | public int getDenominator() { 55 | return denominator; 56 | } 57 | 58 | /** 59 | * Returns the fraction as a floating point value (numerator divided by the denominator). 60 | * @return fraction as a 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 5 | * 6 | * This file is part of gstreamer-java. 7 | * 8 | * This code is free software: you can redistribute it and/or modify it under 9 | * the terms of the GNU Lesser General Public License version 3 only, as 10 | * published by the Free Software Foundation. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 15 | * version 3 for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * version 3 along with this work. If not, see . 19 | */ 20 | 21 | package org.freedesktop.gstreamer; 22 | 23 | import org.freedesktop.gstreamer.glib.GError; 24 | import org.freedesktop.gstreamer.glib.GLibException; 25 | 26 | /** 27 | * Thrown when a GStreamer error occurs. 28 | */ 29 | public class GstException extends GLibException { 30 | 31 | private static final long serialVersionUID = -7413580400835548033L; 32 | 33 | /** 34 | * Creates a new instance of 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 . 17 | */ 18 | package org.freedesktop.gstreamer; 19 | 20 | import java.util.ArrayList; 21 | import java.util.List; 22 | 23 | import org.freedesktop.gstreamer.glib.NativeObject; 24 | import org.freedesktop.gstreamer.lowlevel.GstIteratorPtr; 25 | import org.freedesktop.gstreamer.lowlevel.GstTypes; 26 | import org.freedesktop.gstreamer.lowlevel.GType; 27 | import org.freedesktop.gstreamer.lowlevel.GValueAPI; 28 | 29 | import static org.freedesktop.gstreamer.lowlevel.GstIteratorAPI.GSTITERATOR_API; 30 | 31 | /** 32 | * Utility class for working with gstiterator. 33 | */ 34 | class GstIterator { 35 | 36 | static List asList(GstIteratorPtr iter, Class type) { 37 | final GType gtype = GstTypes.typeFor(type); 38 | final GValueAPI.GValue gValue = new GValueAPI.GValue(gtype); 39 | List list = new ArrayList<>(); 40 | while (GSTITERATOR_API.gst_iterator_next(iter, gValue) == 1) { 41 | list.add((T) gValue.getValue()); 42 | } 43 | gValue.reset(); 44 | GSTITERATOR_API.gst_iterator_free(iter); 45 | return list; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/MetaFlags.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Neil C Smith 3 | * Copyright (c) 2020 Petr Lastovka 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 . 18 | */ 19 | package org.freedesktop.gstreamer; 20 | 21 | import org.freedesktop.gstreamer.glib.NativeFlags; 22 | 23 | /** 24 | * See upstream documentation at 25 | * https://gstreamer.freedesktop.org/documentation/gstreamer/gstmeta.html#GstMetaFlags 27 | */ 28 | /*public*/ enum MetaFlags implements NativeFlags { 29 | 30 | // /** 31 | // * no flags 32 | // */ 33 | // GST_META_FLAG_NONE(0), 34 | /** 35 | * metadata should not be modified 36 | */ 37 | GST_META_FLAG_READONLY(1 << 0), 38 | /** 39 | * metadata is managed by a bufferpool 40 | */ 41 | GST_META_FLAG_POOLED(1 << 1), 42 | /** 43 | * metadata should not be removed 44 | */ 45 | GST_META_FLAG_LOCKED(1 << 2), 46 | // /** 47 | // * additional flags can be added starting from this flag. 48 | // */ 49 | // GST_META_FLAG_LAST(1 << 16) 50 | // 51 | ; 52 | 53 | private final int value; 54 | 55 | MetaFlags(int value) { 56 | this.value = value; 57 | } 58 | 59 | /** 60 | * Gets the integer value of the enum. 61 | * 62 | * @return The integer value for this enum. 63 | */ 64 | @Override 65 | public int intValue() { 66 | return value; 67 | } 68 | 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/MiniObjectFlags.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 . 18 | */ 19 | package org.freedesktop.gstreamer; 20 | 21 | import org.freedesktop.gstreamer.glib.NativeFlags; 22 | 23 | /** 24 | * Flags for {@link MiniObject } 25 | */ 26 | public enum MiniObjectFlags implements NativeFlags { 27 | /** 28 | * the object can be locked and unlocked with gst_mini_object_lock() and 29 | * gst_mini_object_unlock() 30 | * 31 | */ 32 | LOCKABLE(1 << 0), 33 | /** 34 | * the object is permanently locked in READONLY mode. Only read locks can be 35 | * performed on the object. 36 | */ 37 | LOCK_READONLY(1 << 1), 38 | /** 39 | * the object is expected to stay alive even after gst_deinit() has been 40 | * called and so should be ignored by leak detection tools. (Since 1.10) 41 | */ 42 | MAY_BE_LEAKED(1 << 2), 43 | /** 44 | * The last valid MiniObject flag 45 | */ 46 | LAST(1 << 4); 47 | 48 | private final int value; 49 | 50 | private MiniObjectFlags(int value) { 51 | this.value = value; 52 | } 53 | 54 | public int intValue() { 55 | return value; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/PadDirection.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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer; 21 | 22 | import org.freedesktop.gstreamer.glib.NativeEnum; 23 | 24 | /** 25 | * The direction of a {@link Pad}. 26 | */ 27 | public enum PadDirection implements NativeEnum { 28 | /** The direction is unknown. */ 29 | UNKNOWN(0), 30 | /** The {@link Pad} is a source pad. */ 31 | SRC(1), 32 | /** The {@link Pad} is a sink pad. */ 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 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/PadLinkException.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 . 17 | */ 18 | 19 | package org.freedesktop.gstreamer; 20 | 21 | /** 22 | * The exception thrown when a pad link operation returns a non-OK result 23 | */ 24 | public class PadLinkException extends GstException { 25 | 26 | private final PadLinkReturn linkResult; 27 | 28 | PadLinkException(PadLinkReturn result) { 29 | this("failed to link pads (" + result + ")", result); 30 | } 31 | 32 | PadLinkException(String message, PadLinkReturn result) { 33 | super(message); 34 | linkResult = result; 35 | } 36 | 37 | /** 38 | * Get the PadLinkReturn result that caused this exception. 39 | * @return PadLinkReturn 40 | */ 41 | public PadLinkReturn getLinkResult() { 42 | return linkResult; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/PadLinkReturn.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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer; 21 | 22 | import org.freedesktop.gstreamer.glib.NativeEnum; 23 | import org.freedesktop.gstreamer.lowlevel.annotations.DefaultEnumValue; 24 | 25 | /** 26 | * Result values from {@link Pad#link(Pad)} and friends. 27 | */ 28 | public enum PadLinkReturn implements NativeEnum { 29 | /** Link succeeded. */ 30 | OK(0), 31 | /** Pads have no common grandparent. */ 32 | WRONG_HIERARCHY(-1), 33 | /** Pad was already linked. */ 34 | WAS_LINKED(-2), 35 | /** Pads have wrong direction. */ 36 | WRONG_DIRECTION(-3), 37 | /** Pads do not have common format. */ 38 | NOFORMAT(-4), 39 | /** Pads cannot cooperate in scheduling. */ 40 | NOSCHED(-5), 41 | /** Refused for some reason. */ 42 | @DefaultEnumValue 43 | REFUSED(-6); 44 | 45 | private final int value; 46 | 47 | PadLinkReturn(int value) { 48 | this.value = value; 49 | } 50 | /** 51 | * Gets the integer value of the enum. 52 | * @return The integer value for this enum. 53 | */ 54 | @Override 55 | public int intValue() { 56 | return value; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/PadMode.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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer; 21 | 22 | import org.freedesktop.gstreamer.lowlevel.annotations.DefaultEnumValue; 23 | 24 | /** 25 | * The status of a {@link Pad}. After activating a pad, which usually happens when 26 | * the parent element goes from {@link State#READY} to {@link State#PAUSED}, the 27 | * PadMode defines if the {@link Pad} operates in push or pull mode. 28 | */ 29 | public enum PadMode { 30 | /** 31 | * Pad will not handle dataflow 32 | */ 33 | @DefaultEnumValue 34 | NONE, 35 | /** 36 | * Pad handles dataflow in downstream push mode 37 | */ 38 | PUSH, 39 | /** 40 | * Pad handles dataflow in upstream pull mode 41 | */ 42 | PULL; 43 | } 44 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/PadPresence.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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer; 21 | 22 | /** 23 | * Indicates when a {@link Pad} will become available, for use in {@link PadTemplate} 24 | */ 25 | public enum PadPresence { 26 | /** 27 | * The Pad is always available. 28 | */ 29 | ALWAYS, 30 | /** 31 | * The pad will become available depending on the media stream. 32 | */ 33 | SOMETIMES, 34 | /** 35 | * The pad is only available on request with {@link Element#getRequestPad(java.lang.String) } 36 | */ 37 | REQUEST; 38 | } 39 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/PromiseResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Neil C Smith 3 | * Copyright (c) 2018 Antonio Morales 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 the terms of the GNU 8 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 9 | * 10 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 11 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License version 3 for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 15 | * this work. If not, see . 16 | */ 17 | 18 | package org.freedesktop.gstreamer; 19 | 20 | import org.freedesktop.gstreamer.lowlevel.annotations.DefaultEnumValue; 21 | 22 | /** 23 | * The result of a {@link Promise} 24 | * Available since GStreamer 1.14 25 | */ 26 | @Gst.Since(minor = 14) 27 | public enum PromiseResult { 28 | /** Initial state. Waiting for transition to any other state. */ 29 | @DefaultEnumValue 30 | PENDING, 31 | /** Interrupted by the consumer as it doesn't want the value anymore. */ 32 | INTERRUPTED, 33 | /** A producer marked a reply. */ 34 | REPLIED, 35 | /** The promise expired (the carrying object lost all refs) and the promise 36 | * will never be fulfilled. */ 37 | EXPIRED 38 | } 39 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/SDPResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Neil C Smith 3 | * Copyright (c) 2018 Antonio Morales 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 the terms of the GNU 8 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 9 | * 10 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 11 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License version 3 for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 15 | * this work. If not, see . 16 | */ 17 | 18 | package org.freedesktop.gstreamer; 19 | 20 | import org.freedesktop.gstreamer.glib.NativeEnum; 21 | import org.freedesktop.gstreamer.lowlevel.annotations.DefaultEnumValue; 22 | 23 | /** 24 | * Return values for SDP functions 25 | *

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 { 33 | /** A successful return value*/ 34 | OK(0), 35 | /** A function to SDPMessage was given invalid parameters */ 36 | @DefaultEnumValue 37 | EINVAL(-1); 38 | 39 | private final int value; 40 | 41 | SDPResult(int value) { 42 | this.value = value; 43 | } 44 | 45 | /** 46 | * Gets the integer value of the enum 47 | * @return the integer value for this enum. 48 | */ 49 | @Override 50 | public int intValue() { 51 | return value; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/SegmentFlags.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 . 18 | */ 19 | package org.freedesktop.gstreamer; 20 | 21 | import org.freedesktop.gstreamer.event.SeekFlags; 22 | import org.freedesktop.gstreamer.glib.NativeFlags; 23 | 24 | /** 25 | * GstSegmentFlags 26 | */ 27 | enum SegmentFlags implements NativeFlags { 28 | 29 | // /** 30 | // * no flags 31 | // */ 32 | // public static final int NONE = SeekFlags.NONE; 33 | /** 34 | * reset the pipeline running_time to the segment running_time 35 | */ 36 | RESET(SeekFlags.FLUSH), 37 | 38 | /** 39 | * perform skip playback 40 | */ 41 | TRICKMODE(SeekFlags.TRICKMODE), 42 | /** 43 | * send SEGMENT_DONE instead of EOS 44 | */ 45 | SEGMENT(SeekFlags.SEGMENT), 46 | /** 47 | * Decode only keyframes, where possible 48 | */ 49 | TRICKMODE_KEY_UNITS(SeekFlags.TRICKMODE_KEY_UNITS), 50 | /** 51 | * Do not decode any audio, where possible (Since 1.6) 52 | */ 53 | TRICKMODE_NO_AUDIO(SeekFlags.TRICKMODE_NO_AUDIO); 54 | 55 | private final SeekFlags seekFlags; 56 | 57 | private SegmentFlags(SeekFlags seekFlags) { 58 | this.seekFlags = seekFlags; 59 | } 60 | 61 | @Override 62 | public int intValue() { 63 | return seekFlags.intValue(); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/StateChangeReturn.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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer; 21 | 22 | import org.freedesktop.gstreamer.glib.NativeEnum; 23 | 24 | /** 25 | * The possible return values from a state change function. 26 | *

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 { 35 | /** The state change failed. */ 36 | FAILURE(0), 37 | /** The state change succeeded. */ 38 | SUCCESS(1), 39 | /** The state change will happen asynchronously. */ 40 | ASYNC(2), 41 | /** 42 | * The state change succeeded but the {@link Element} cannot produce data in 43 | * {@link State#PAUSED}. This typically happens with live sources. 44 | */ 45 | NO_PREROLL(3); 46 | 47 | private final int value; 48 | 49 | private StateChangeReturn(int value) { 50 | this.value = value; 51 | } 52 | 53 | @Override 54 | public int intValue() { 55 | return value; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/StaticPadTemplate.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 . 18 | */ 19 | package org.freedesktop.gstreamer; 20 | 21 | public class StaticPadTemplate { 22 | 23 | private final String templateName; 24 | private final PadDirection direction; 25 | private final PadPresence presence; 26 | private final Caps caps; 27 | 28 | StaticPadTemplate(String templateName, PadDirection direction, PadPresence presence, 29 | Caps caps) { 30 | this.templateName = templateName; 31 | this.direction = direction; 32 | this.presence = presence; 33 | this.caps = caps; 34 | } 35 | 36 | /** 37 | * Get the name of the template. 38 | * 39 | * @return The name of the template. 40 | */ 41 | public String getName() { 42 | return templateName; 43 | } 44 | 45 | /** 46 | * Get the direction (SINK, SRC) of the template. 47 | * 48 | * @return The {@link PadDirection} of the template. 49 | */ 50 | public PadDirection getDirection() { 51 | return direction; 52 | } 53 | 54 | /** 55 | * Get the presence (ALWAYS, SOMETIMES, REQUEST) of the template. 56 | * 57 | * @return The {@link PadPresence} of this template. 58 | */ 59 | public PadPresence getPresence() { 60 | return presence; 61 | } 62 | 63 | /** 64 | * Get the {@link Caps} of the template. 65 | * 66 | * @return The {@link Caps} for this template. 67 | */ 68 | public Caps getCaps() { 69 | return caps; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/TagFlag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Neil C Smith 3 | * Copyright (C) 2007 Wayne Meissner 4 | * Copyright (C) 2003 Benjamin Otte 5 | * 6 | * This file is part of gstreamer-java. 7 | * 8 | * This code is free software: you can redistribute it and/or modify it under 9 | * the terms of the GNU Lesser General Public License version 3 only, as 10 | * published by the Free Software Foundation. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 15 | * version 3 for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * version 3 along with this work. If not, see . 19 | */ 20 | 21 | package org.freedesktop.gstreamer; 22 | 23 | import org.freedesktop.gstreamer.glib.NativeEnum; 24 | import org.freedesktop.gstreamer.lowlevel.annotations.DefaultEnumValue; 25 | 26 | /** 27 | * Extra tag flags used when registering tags. 28 | *

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 { 35 | /** Undefined flag. */ 36 | @DefaultEnumValue 37 | UNDEFINED(0), 38 | /** Tag is meta data. */ 39 | META(1), 40 | /** Tag is encoded. */ 41 | ENCODED(2), 42 | /** Tag is decoded. */ 43 | DECODED(3), 44 | /** Number of tag flags. */ 45 | COUNT(4); 46 | 47 | private final int value; 48 | 49 | private TagFlag(int value) { 50 | this.value = value; 51 | } 52 | 53 | @Override 54 | public int intValue() { 55 | return value; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/controller/InterpolationMode.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 . 17 | */ 18 | package org.freedesktop.gstreamer.controller; 19 | 20 | import org.freedesktop.gstreamer.glib.NativeEnum; 21 | 22 | /** 23 | * The various interpolation modes available for use with 24 | * {@link InterpolationControlSource}. 25 | */ 26 | // https://gitlab.freedesktop.org/gstreamer/gstreamer/blob/master/libs/gst/controller/gstinterpolationcontrolsource.h#L64 27 | public enum InterpolationMode implements NativeEnum { 28 | 29 | /** 30 | * Steps-like interpolation, default. 31 | */ 32 | NONE(0), 33 | /** 34 | * Linear interpolation. 35 | */ 36 | LINEAR(1), 37 | /** 38 | * Cubic interpolation (natural), may overshoot the min or max values set by 39 | * the control point, but is more 'curvy'. 40 | */ 41 | CUBIC(2), 42 | /** 43 | * Monotonic cubic interpolation, will not produce any values outside of the 44 | * min-max range set by the control points. 45 | */ 46 | CUBIC_MONOTONIC(3); 47 | 48 | private final int value; 49 | 50 | private InterpolationMode(int value) { 51 | this.value = value; 52 | } 53 | 54 | @Override 55 | public int intValue() { 56 | return value; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/controller/LFOWaveform.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 . 17 | */ 18 | package org.freedesktop.gstreamer.controller; 19 | 20 | import org.freedesktop.gstreamer.glib.NativeEnum; 21 | 22 | /** 23 | * The various waveform modes available for use with {@link LFOControlSource} 24 | */ 25 | // https://gitlab.freedesktop.org/gstreamer/gstreamer/blob/master/libs/gst/controller/gstlfocontrolsource.h#L60 26 | public enum LFOWaveform implements NativeEnum { 27 | 28 | /** 29 | * Sine waveform. 30 | */ 31 | SINE(0), 32 | 33 | /** 34 | * Square waveform. 35 | */ 36 | SQUARE(1), 37 | 38 | /** 39 | * Saw waveform. 40 | */ 41 | SAW(2), 42 | 43 | /** 44 | * Reverse saw waveform. 45 | */ 46 | REVERSE_SAW(3), 47 | 48 | /** 49 | * Triangle waveform. 50 | */ 51 | TRIANGLE(4) 52 | ; 53 | 54 | 55 | private final int value; 56 | 57 | private LFOWaveform(int value) { 58 | this.value = value; 59 | } 60 | 61 | @Override 62 | public int intValue() { 63 | return value; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/elements/BaseTransform.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Neil C Smith 3 | * Copyright (c) 2009 Levente Farkas 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 . 18 | */ 19 | package org.freedesktop.gstreamer.elements; 20 | 21 | import org.freedesktop.gstreamer.Element; 22 | 23 | /** 24 | * A base class for simple transform filters. 25 | *

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 . 17 | */ 18 | package org.freedesktop.gstreamer.elements; 19 | 20 | import java.util.stream.Stream; 21 | import org.freedesktop.gstreamer.glib.NativeObject; 22 | import static org.freedesktop.gstreamer.glib.Natives.registration; 23 | 24 | /** 25 | * 26 | * @author Neil C Smith - https://www.neilcsmith.net 27 | */ 28 | public class Elements implements NativeObject.TypeProvider { 29 | 30 | @Override 31 | public Stream> types() { 32 | return Stream.of( 33 | registration(AppSink.class, AppSink.GTYPE_NAME, AppSink::new), 34 | registration(AppSrc.class, AppSrc.GTYPE_NAME, AppSrc::new), 35 | registration(BaseSrc.class, BaseSrc.GTYPE_NAME, BaseSrc::new), 36 | registration(BaseSink.class, BaseSink.GTYPE_NAME, BaseSink::new), 37 | registration(BaseTransform.class, BaseTransform.GTYPE_NAME, BaseTransform::new), 38 | registration(DecodeBin.class, DecodeBin.GTYPE_NAME, DecodeBin::new), 39 | registration(PlayBin.class, PlayBin.GTYPE_NAME, PlayBin::new), 40 | registration(URIDecodeBin.class, URIDecodeBin.GTYPE_NAME, URIDecodeBin::new)); 41 | 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/event/CapsEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Neil C Smith 3 | * Copyright (c) 2016 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 . 18 | */ 19 | package org.freedesktop.gstreamer.event; 20 | 21 | import org.freedesktop.gstreamer.Caps; 22 | import org.freedesktop.gstreamer.glib.Natives; 23 | import static org.freedesktop.gstreamer.lowlevel.GstEventAPI.GSTEVENT_API; 24 | 25 | /** 26 | * A CAPS event for {@link Caps}. The caps event can only travel downstream 27 | * synchronized with the buffer flow and contains the format of the buffers that 28 | * will follow after the event. 29 | *

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 . 18 | */ 19 | package org.freedesktop.gstreamer.event; 20 | 21 | import org.freedesktop.gstreamer.glib.NativeEnum; 22 | 23 | /** 24 | * The different types of QoS events that can be given to the 25 | * gst_event_new_qos() method. 26 | */ 27 | public enum QOSType implements NativeEnum { 28 | /** 29 | * The QoS event type that is produced when downstream elements are 30 | * producing data too quickly and the element can't keep up processing the 31 | * data. Upstream should reduce their processing rate. This type is also 32 | * used when buffers arrive early or in time. 33 | */ 34 | OVERFLOW(0), 35 | /** 36 | * The QoS event type that is produced when downstream elements are 37 | * producing data too slowly and need to speed up their processing rate. 38 | */ 39 | UNDERFLOW(1), 40 | /** 41 | * The QoS event type that is produced when the application enabled 42 | * throttling to limit the datarate. 43 | */ 44 | THROTTLE(2); 45 | 46 | private final int value; 47 | 48 | private QOSType(int value) { 49 | this.value = value; 50 | } 51 | 52 | @Override 53 | public int intValue() { 54 | return value; 55 | } 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/event/ReconfigureEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Neil C Smith 3 | * Copyright (c) 2016 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 . 18 | */ 19 | package org.freedesktop.gstreamer.event; 20 | 21 | import org.freedesktop.gstreamer.glib.Natives; 22 | import static org.freedesktop.gstreamer.lowlevel.GstEventAPI.GSTEVENT_API; 23 | 24 | /** 25 | * A reconfigure event. The purpose of the reconfigure event is to travel 26 | * upstream and make elements renegotiate their caps or reconfigure their buffer 27 | * pools. This is useful when changing properties on elements or changing the 28 | * topology of the pipeline. 29 | *

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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer.event; 21 | 22 | import org.freedesktop.gstreamer.glib.NativeEnum; 23 | 24 | /** 25 | * The different types of seek events. 26 | *

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{ 33 | /** No change in position is required. */ 34 | NONE(0), 35 | /** Absolute position is requested. */ 36 | SET(1), 37 | /** Relative position to duration is requested. */ 38 | END(2); 39 | 40 | private final int value; 41 | 42 | private SeekType(int value) { 43 | this.value = value; 44 | } 45 | 46 | @Override 47 | public int intValue() { 48 | return value; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/event/StreamStartEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Neil C Smith 3 | * Copyright (c) 2016 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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer.event; 21 | 22 | 23 | import org.freedesktop.gstreamer.glib.Natives; 24 | import static org.freedesktop.gstreamer.lowlevel.GstEventAPI.GSTEVENT_API; 25 | 26 | /** 27 | * Stream Start event. 28 | *

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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer.glib; 21 | 22 | import static org.freedesktop.gstreamer.lowlevel.GioAPI.GIO_API; 23 | 24 | public class GCancellable extends GObject{ 25 | 26 | public static final String GTYPE_NAME = "GCancellable"; 27 | 28 | public GCancellable() { 29 | this(Natives.initializer(GIO_API.g_cancellable_new())); 30 | } 31 | 32 | private GCancellable(Initializer init) { 33 | super(init); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/glib/GError.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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer.glib; 21 | 22 | import java.util.Objects; 23 | 24 | /** 25 | * Base GLib error type. 26 | */ 27 | public class GError { 28 | 29 | private final int code; 30 | private final String message; 31 | 32 | /** 33 | * Creates a new instance of GError 34 | * 35 | * @param code native int error code 36 | * @param message error message text 37 | */ 38 | public GError(int code, String message) { 39 | this.code = code; 40 | this.message = Objects.requireNonNull(message); 41 | } 42 | 43 | /** 44 | * Gets a numeric code representing this error. 45 | * 46 | * @return an integer code. 47 | */ 48 | public final int getCode() { 49 | return code; 50 | } 51 | /** 52 | * Gets a string representation of this error. 53 | * 54 | * @return a string representing the error. 55 | */ 56 | public String getMessage() { 57 | return message; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/glib/GInetAddress.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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer.glib; 21 | 22 | import static org.freedesktop.gstreamer.lowlevel.GioAPI.GIO_API; 23 | 24 | public class GInetAddress extends GObject{ 25 | 26 | public static final String GTYPE_NAME = "GInetAddress"; 27 | 28 | GInetAddress(Initializer init) { 29 | super(init); 30 | } 31 | 32 | public String getAddress() { 33 | return GIO_API.g_inet_address_to_string(getRawPointer()); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/glib/GInetSocketAddress.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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer.glib; 21 | 22 | import static org.freedesktop.gstreamer.lowlevel.GioAPI.GIO_API; 23 | 24 | import com.sun.jna.Pointer; 25 | 26 | public class GInetSocketAddress extends GSocketAddress { 27 | 28 | public static final String GTYPE_NAME = "GInetSocketAddress"; 29 | 30 | public GInetSocketAddress(String address, int port) { 31 | this(createRawAddress(address, port)); 32 | } 33 | 34 | GInetSocketAddress(Initializer init) { 35 | super(init); 36 | } 37 | 38 | public GInetAddress getAddress() { 39 | return (GInetAddress) get("address"); 40 | } 41 | 42 | public int getPort() { 43 | return (Integer) get("port"); 44 | } 45 | 46 | private static Initializer createRawAddress(String address, int port) { 47 | Pointer nativePointer = GIO_API.g_inet_socket_address_new_from_string(address, port); 48 | if (nativePointer == null) { 49 | throw new GLibException("Can not create "+GInetSocketAddress.class.getSimpleName()+" for "+address+":"+port+", please check that the IP address is valid, with format x.x.x.x"); 50 | } 51 | return Natives.initializer(nativePointer); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/glib/GLibException.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 . 17 | */ 18 | 19 | package org.freedesktop.gstreamer.glib; 20 | 21 | /** 22 | * Thrown when a gstreamer error occurs. 23 | */ 24 | public class GLibException extends RuntimeException { 25 | 26 | /** 27 | * Creates a new instance of 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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer.glib; 21 | 22 | import org.freedesktop.gstreamer.lowlevel.*; 23 | import com.sun.jna.Pointer; 24 | import static org.freedesktop.gstreamer.lowlevel.GlibAPI.GLIB_API; 25 | 26 | /** 27 | * 28 | */ 29 | public class GMainContext extends RefCountedObject { 30 | 31 | public GMainContext() { 32 | this(Natives.initializer(GLIB_API.g_main_context_new())); 33 | } 34 | private GMainContext(Initializer init) { 35 | super(new Handle(init.ptr, init.ownsHandle), init.needRef); 36 | } 37 | 38 | public int attach(GSource source) { 39 | return GLIB_API.g_source_attach(source, this); 40 | } 41 | public static GMainContext getDefaultContext() { 42 | return new GMainContext(Natives.initializer(GLIB_API.g_main_context_default(), false, false)); 43 | } 44 | 45 | private static final class Handle extends RefCountedObject.Handle { 46 | 47 | public Handle(GPointer ptr, boolean ownsHandle) { 48 | super(ptr, ownsHandle); 49 | } 50 | 51 | @Override 52 | protected void disposeNativeHandle(GPointer ptr) { 53 | GLIB_API.g_main_context_unref(ptr); 54 | } 55 | 56 | @Override 57 | protected void ref() { 58 | GLIB_API.g_main_context_ref(getPointer()); 59 | } 60 | 61 | @Override 62 | protected void unref() { 63 | GLIB_API.g_main_context_unref(getPointer()); 64 | } 65 | 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/glib/GQuark.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Neil C Smith 3 | * Copyright (c) 2016 Christophe Lafolet 4 | * Copyright (c) 2007 Wayne Meissner 5 | * 6 | * This file is part of gstreamer-java. 7 | * 8 | * This code is free software: you can redistribute it and/or modify it under 9 | * the terms of the GNU Lesser General Public License version 3 only, as 10 | * published by the Free Software Foundation. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 15 | * version 3 for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * version 3 along with this work. If not, see . 19 | */ 20 | 21 | package org.freedesktop.gstreamer.glib; 22 | 23 | import org.freedesktop.gstreamer.lowlevel.GObjectAPI; 24 | 25 | /** 26 | * Quarks — a 2-way association between a string and a unique integer identifier. 27 | * 28 | * See upstream documentation at https://developer.gnome.org/glib/stable/glib-Quarks.html 30 | * 31 | */ 32 | public class GQuark { 33 | 34 | private final int value; 35 | 36 | public GQuark(int value) { 37 | this.value = value; 38 | } 39 | 40 | public int intValue() { 41 | return value; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return GObjectAPI.GOBJECT_API.g_quark_to_string(this); 47 | } 48 | 49 | public static GQuark valueOf(String quark) { 50 | return GObjectAPI.GOBJECT_API.g_quark_from_string(quark); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/glib/GSocketAddress.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer.glib; 21 | 22 | public class GSocketAddress extends GObject{ 23 | 24 | public static final String GTYPE_NAME = "GSocketAddress"; 25 | 26 | public GSocketAddress(Initializer init) { 27 | super(init); 28 | } 29 | 30 | public GSocketFamily getFamily() { 31 | return GSocketFamily.fromGioValue((Integer) get("family")); 32 | } 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/glib/GSocketFamily.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 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 . 18 | */ 19 | 20 | 21 | package org.freedesktop.gstreamer.glib; 22 | 23 | import java.util.HashMap; 24 | import java.util.Map; 25 | 26 | import org.freedesktop.gstreamer.lowlevel.GlibAPI; 27 | 28 | public enum GSocketFamily { 29 | 30 | INVALID (0x00), 31 | UNIX (GlibAPI.GLIB_SYSDEF_AF_UNIX), 32 | IPV4 (GlibAPI.GLIB_SYSDEF_AF_INET), 33 | IPV6 (GlibAPI.GLIB_SYSDEF_AF_INET6); 34 | 35 | private static final Map fastResolveMap = new HashMap(); 36 | static { 37 | for(GSocketFamily dataUnitType : values()) { 38 | fastResolveMap.put(dataUnitType.toGioValue(), dataUnitType); 39 | } 40 | } 41 | 42 | private int gioValue; 43 | 44 | private GSocketFamily(int gioValue) { 45 | this.gioValue = gioValue; 46 | } 47 | 48 | public int toGioValue() { 49 | return gioValue; 50 | } 51 | 52 | public static GSocketFamily fromGioValue(int gioValue) { 53 | return fastResolveMap.get(gioValue); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/glib/GSocketProtocol.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 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 . 18 | */ 19 | 20 | 21 | package org.freedesktop.gstreamer.glib; 22 | 23 | import java.util.HashMap; 24 | import java.util.Map; 25 | 26 | public enum GSocketProtocol { 27 | UNKNOWN (-1), 28 | DEFAULT (0), 29 | TCP (6), 30 | UDP (17), 31 | SCTP (132); 32 | 33 | private static final Map fastResolveMap = new HashMap(); 34 | static { 35 | for(GSocketProtocol dataUnitType : values()) { 36 | fastResolveMap.put(dataUnitType.toGioValue(), dataUnitType); 37 | } 38 | } 39 | 40 | private int gioValue; 41 | 42 | private GSocketProtocol(int gioValue) { 43 | this.gioValue = gioValue; 44 | } 45 | 46 | public int toGioValue() { 47 | return gioValue; 48 | } 49 | 50 | public static GSocketProtocol fromGioValue(int gioValue) { 51 | return fastResolveMap.get(gioValue); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/glib/GSocketType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 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 . 18 | */ 19 | 20 | 21 | package org.freedesktop.gstreamer.glib; 22 | 23 | import java.util.HashMap; 24 | import java.util.Map; 25 | 26 | public enum GSocketType { 27 | INVALID (0), 28 | STREAM (1), 29 | DATAGRAM (2), 30 | SEQPACKET (3); 31 | 32 | private static final Map fastResolveMap = new HashMap(); 33 | static { 34 | for(GSocketType dataUnitType : values()) { 35 | fastResolveMap.put(dataUnitType.toGioValue(), dataUnitType); 36 | } 37 | } 38 | 39 | private int gioValue; 40 | 41 | private GSocketType(int gioValue) { 42 | this.gioValue = gioValue; 43 | } 44 | 45 | public int toGioValue() { 46 | return gioValue; 47 | } 48 | 49 | public static GSocketType fromGioValue(int gioValue) { 50 | return fastResolveMap.get(gioValue); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/glib/NativeFlags.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 . 17 | */ 18 | package org.freedesktop.gstreamer.glib; 19 | 20 | import java.util.EnumSet; 21 | import java.util.Set; 22 | 23 | /** 24 | * Interface for enums that represent native bit flags. 25 | * @param type of flag enum 26 | */ 27 | public interface NativeFlags> extends NativeEnum { 28 | 29 | public static & NativeFlags> int toInt(Set flags) { 30 | int ret = 0; 31 | for (FLAG flag : flags) { 32 | ret |= flag.intValue(); 33 | } 34 | return ret; 35 | } 36 | 37 | public static & NativeFlags> int toInt(EnumSet flags) { 38 | int ret = 0; 39 | for (FLAG flag : flags) { 40 | ret |= flag.intValue(); 41 | } 42 | return ret; 43 | } 44 | 45 | public static & NativeFlags> EnumSet 46 | fromInt(Class type, int val) { 47 | EnumSet set = EnumSet.allOf(type); 48 | set.removeIf(f -> ((val & f.intValue()) == 0)); 49 | return set; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/glib/RefCountedObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Neil C Smith 3 | * Copyright (c) 2007, 2008 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 . 18 | */ 19 | package org.freedesktop.gstreamer.glib; 20 | 21 | import org.freedesktop.gstreamer.lowlevel.GPointer; 22 | 23 | /** 24 | * A {@link NativeObject} that has an associated reference count 25 | */ 26 | public abstract class RefCountedObject extends NativeObject { 27 | 28 | // /** 29 | // * Creates a new instance of RefCountedObject 30 | // */ 31 | // protected RefCountedObject(Initializer init) { 32 | // this(new Handle()) 33 | // if (init.ownsHandle && init.needRef) { 34 | // ref(); 35 | // } 36 | // } 37 | 38 | protected RefCountedObject(Handle handle) { 39 | super(handle); 40 | 41 | } 42 | 43 | protected RefCountedObject(Handle handle, boolean needRef) { 44 | super(handle); 45 | if (needRef) { 46 | handle.ref(); 47 | } 48 | } 49 | 50 | 51 | 52 | // overridden in subclasses 53 | // protected abstract void ref(); 54 | // 55 | // protected abstract void unref(); 56 | 57 | protected static abstract class Handle extends NativeObject.Handle { 58 | 59 | public Handle(GPointer ptr, boolean ownsHandle) { 60 | super(ptr, ownsHandle); 61 | } 62 | 63 | protected abstract void ref(); 64 | 65 | protected abstract void unref(); 66 | 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/interfaces/GstInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Neil C Smith 3 | * Copyright (c) 2009 Levente Farkas 4 | * Copyright (c) 2008 Wayne Meissner 5 | * 6 | * This file is part of gstreamer-java. 7 | * 8 | * This code is free software: you can redistribute it and/or modify it under 9 | * the terms of the GNU Lesser General Public License version 3 only, as 10 | * published by the Free Software Foundation. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 15 | * version 3 for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * version 3 along with this work. If not, see . 19 | */ 20 | 21 | package org.freedesktop.gstreamer.interfaces; 22 | 23 | import org.freedesktop.gstreamer.lowlevel.GType; 24 | 25 | import org.freedesktop.gstreamer.Element; 26 | 27 | import org.freedesktop.gstreamer.glib.GObject; 28 | 29 | /** 30 | * Base type for all gstreamer interface proxies 31 | */ 32 | class GstInterface implements GObject.GInterface { 33 | protected final Element element; 34 | protected GstInterface(Element element, GType type) { 35 | this.element = element; 36 | } 37 | 38 | @Override 39 | public Element getGObject() { 40 | return element; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/interfaces/Navigation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Neil C Smith 3 | * Copyright (c) 2009 Levente Farkas 4 | * Copyright (c) 2009 Tamas Korodi 5 | * 6 | * This file is part of gstreamer-java. 7 | * 8 | * This code is free software: you can redistribute it and/or modify it under 9 | * the terms of the GNU Lesser General Public License version 3 only, as 10 | * published by the Free Software Foundation. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 15 | * version 3 for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * version 3 along with this work. If not, see . 19 | */ 20 | 21 | package org.freedesktop.gstreamer.interfaces; 22 | 23 | import org.freedesktop.gstreamer.Element; 24 | import org.freedesktop.gstreamer.Structure; 25 | 26 | import static org.freedesktop.gstreamer.lowlevel.GstNavigationAPI.GSTNAVIGATION_API; 27 | 28 | public class Navigation extends GstInterface { 29 | /** 30 | * Wraps the {@link Element} in a Navigation interface 31 | * 32 | * @param element 33 | * the element to use as a Navigation 34 | * @return a Navigation for the element 35 | */ 36 | public static final Navigation wrap(Element element) { 37 | return new Navigation(element); 38 | } 39 | 40 | /** 41 | * Creates a new Navigation instance 42 | * 43 | * @param element 44 | * the element that implements the Navigation interface 45 | */ 46 | private Navigation(Element element) { 47 | super(element, GSTNAVIGATION_API.gst_navigation_get_type()); 48 | } 49 | 50 | public void sendEvent(Structure structure) { 51 | GSTNAVIGATION_API.gst_navigation_send_event(this, structure); 52 | } 53 | 54 | public void sendKeyEvent(String event, String key) { 55 | GSTNAVIGATION_API.gst_navigation_send_key_event(this, event, key); 56 | } 57 | 58 | public void sendMouseEvent(String event, int button, double x, double y) { 59 | GSTNAVIGATION_API.gst_navigation_send_mouse_event(this, event, button, x, y); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GBoolean.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Wayne Meissner 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 . 17 | */ 18 | 19 | package org.freedesktop.gstreamer.lowlevel; 20 | 21 | /** 22 | * 23 | */ 24 | public class GBoolean { 25 | public static final int TRUE = 1; 26 | public static final int FALSE = 0; 27 | public static int valueOf(boolean value) { 28 | return value ? 1 : 0; 29 | } 30 | public static int valueOf(Boolean value) { 31 | return Boolean.TRUE.equals(value) ? 1 : 0; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GFunctionMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008 Wayne Meissner 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 . 17 | */ 18 | 19 | package org.freedesktop.gstreamer.lowlevel; 20 | 21 | import java.lang.reflect.Method; 22 | import java.util.Arrays; 23 | import java.util.List; 24 | 25 | import com.sun.jna.NativeLibrary; 26 | 27 | /** 28 | * 29 | * @author wayne 30 | */ 31 | public class GFunctionMapper implements com.sun.jna.FunctionMapper { 32 | private final static List stripPrefixes = Arrays.asList("ptr_"); 33 | 34 | public String getFunctionName(NativeLibrary library, Method method) { 35 | 36 | String name = method.getName(); 37 | for (String prefix : stripPrefixes) { 38 | if (name.startsWith(prefix)) { 39 | return name.substring(prefix.length()); 40 | } 41 | } 42 | // Default to just returning the name 43 | return name; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GObjectPtr.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 the terms of the GNU 7 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * Lesser General Public License version 3 for more details. 12 | * 13 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 14 | * this work. If not, see . 15 | */ 16 | package org.freedesktop.gstreamer.lowlevel; 17 | 18 | import com.sun.jna.Native; 19 | import com.sun.jna.Pointer; 20 | 21 | /** 22 | * Base GObject pointer 23 | */ 24 | public class GObjectPtr extends GTypedPtr { 25 | 26 | public GObjectPtr() { 27 | } 28 | 29 | public GObjectPtr(Pointer ptr) { 30 | super(ptr); 31 | } 32 | 33 | @Override 34 | public GType getGType() { 35 | // Quick getter for GType without allocation 36 | // same as : new GObjectStruct(ptr).g_type_instance.g_class.g_type 37 | Pointer g_class = getPointer().getPointer(0); 38 | if (Native.SIZE_T_SIZE == 8) { 39 | return GType.valueOf(g_class.getLong(0)); 40 | } else if (Native.SIZE_T_SIZE == 4) { 41 | return GType.valueOf(((long) g_class.getInt(0)) & 0xffffffffL); 42 | } else { 43 | throw new IllegalStateException("SIZE_T size not supported: " + Native.SIZE_T_SIZE); 44 | } 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GPointer.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 the terms of the GNU 7 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * Lesser General Public License version 3 for more details. 12 | * 13 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 14 | * this work. If not, see . 15 | */ 16 | package org.freedesktop.gstreamer.lowlevel; 17 | 18 | import com.sun.jna.Pointer; 19 | import com.sun.jna.PointerType; 20 | import java.util.function.Function; 21 | 22 | /** 23 | * Base GLib pointer 24 | */ 25 | public class GPointer extends PointerType { 26 | 27 | public GPointer() { 28 | } 29 | 30 | public GPointer(Pointer ptr) { 31 | super(ptr); 32 | } 33 | 34 | public T as(Class cls, Function converter) { 35 | if (cls.isInstance(this)) { 36 | return cls.cast(this); 37 | } else { 38 | return converter.apply(this.getPointer()); 39 | } 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GTypedPtr.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 the terms of the GNU 7 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * Lesser General Public License version 3 for more details. 12 | * 13 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 14 | * this work. If not, see . 15 | */ 16 | package org.freedesktop.gstreamer.lowlevel; 17 | 18 | import com.sun.jna.Pointer; 19 | 20 | /** 21 | * Base GLib pointer with GType 22 | */ 23 | public abstract class GTypedPtr extends GPointer { 24 | 25 | public GTypedPtr() { 26 | } 27 | 28 | public GTypedPtr(Pointer ptr) { 29 | super(ptr); 30 | } 31 | 32 | public abstract GType getGType(); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GValueStruct.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Wayne Meissner 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 . 17 | */ 18 | 19 | package org.freedesktop.gstreamer.lowlevel; 20 | 21 | import com.sun.jna.Structure; 22 | import java.util.Collections; 23 | import java.util.List; 24 | 25 | /** 26 | * 27 | */ 28 | public class GValueStruct extends Structure { 29 | public volatile int g_type; 30 | /** Creates a new instance of GValueStruct */ 31 | public GValueStruct() { 32 | } 33 | 34 | @Override 35 | protected List getFieldOrder() { 36 | return Collections.singletonList("g_type"); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GioAPI.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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer.lowlevel; 21 | 22 | import com.sun.jna.Library; 23 | import com.sun.jna.Pointer; 24 | import java.util.Collections; 25 | 26 | public interface GioAPI extends Library { 27 | 28 | public static final GioAPI GIO_API = 29 | GNative.loadLibrary("gio-2.0", GioAPI.class, Collections.emptyMap()); 30 | 31 | // GInetAddress 32 | public String g_inet_address_to_string(Pointer gInetAddress); 33 | 34 | // GstSocketAddress 35 | public Pointer g_inet_socket_address_new_from_string(String address, int port); 36 | 37 | // GstSocket 38 | public Pointer g_socket_new(int gSocketFamilyEnumValue, int gSocketTypeEnumValue, int gSocketProtcolEnumValue, Pointer gErrorStructArrayPointer); 39 | public boolean g_socket_bind(Pointer gSocketPointer, Pointer gSocketAddressPointer, boolean allowReuse, Pointer gErrorStructArrayPointer); 40 | public boolean g_socket_connect(Pointer gSocketPointer, Pointer gSocketAddressPointer, Pointer gCancellablePointer, Pointer gErrorStructArrayPointer); 41 | 42 | // GCancellable 43 | public Pointer g_cancellable_new(); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstARGBControlBindingPtr.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 the terms of the GNU 7 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * Lesser General Public License version 3 for more details. 12 | * 13 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 14 | * this work. If not, see . 15 | */ 16 | package org.freedesktop.gstreamer.lowlevel; 17 | 18 | import com.sun.jna.Pointer; 19 | 20 | /** 21 | * 22 | */ 23 | public class GstARGBControlBindingPtr extends GstControlBindingPtr { 24 | 25 | public GstARGBControlBindingPtr() { 26 | } 27 | 28 | public GstARGBControlBindingPtr(Pointer ptr) { 29 | super(ptr); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstBufferPoolAPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Christophe Lafolet 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 . 17 | */ 18 | package org.freedesktop.gstreamer.lowlevel; 19 | 20 | import org.freedesktop.gstreamer.BufferPool; 21 | import org.freedesktop.gstreamer.Caps; 22 | import org.freedesktop.gstreamer.Structure; 23 | import org.freedesktop.gstreamer.lowlevel.annotations.CallerOwnsReturn; 24 | 25 | import com.sun.jna.Pointer; 26 | 27 | /** 28 | * GstBufferPool methods and structures 29 | * @see https://cgit.freedesktop.org/gstreamer/gstreamer/tree/gst/gstbufferpool.h?h=1.8 30 | */ 31 | public interface GstBufferPoolAPI extends com.sun.jna.Library { 32 | GstBufferPoolAPI GSTBUFFERPOOL_API = GstNative.load(GstBufferPoolAPI.class); 33 | 34 | GType gst_buffer_pool_get_type(); 35 | 36 | /* allocation */ 37 | @CallerOwnsReturn BufferPool gst_buffer_pool_new(); 38 | Pointer ptr_gst_buffer_pool_new(); 39 | 40 | /* state management */ 41 | Structure gst_buffer_pool_get_config(BufferPool pool); 42 | 43 | /* helpers for configuring the config structure */ 44 | boolean gst_buffer_pool_config_get_params(Structure config, /* Caps ** */ Pointer[] caps, /* guint * */ int[] size, /* guint * */ int[] min_buffers, /* guint * */ int[] max_buffers); 45 | void gst_buffer_pool_config_set_params(Structure config, Caps caps, int size, int min_buffers, int max_buffers); 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstBusPtr.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 the terms of the GNU 7 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * Lesser General Public License version 3 for more details. 12 | * 13 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 14 | * this work. If not, see . 15 | */ 16 | package org.freedesktop.gstreamer.lowlevel; 17 | 18 | import com.sun.jna.Pointer; 19 | 20 | /** 21 | * GstBus pointer. 22 | */ 23 | public class GstBusPtr extends GstObjectPtr { 24 | 25 | public GstBusPtr() { 26 | } 27 | 28 | public GstBusPtr(Pointer ptr) { 29 | super(ptr); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstContextAPI.java: -------------------------------------------------------------------------------- 1 | package org.freedesktop.gstreamer.lowlevel; 2 | 3 | import org.freedesktop.gstreamer.Structure; 4 | 5 | /** 6 | * GstContext API 7 | * 8 | * https://gstreamer.freedesktop.org/documentation/gstreamer/gstcontext.html 9 | * 10 | * https://gitlab.freedesktop.org/gstreamer/gstreamer/blob/master/gst/gstcontext.h 11 | * https://gitlab.freedesktop.org/gstreamer/gstreamer/blob/master/gst/gstcontext.c 12 | */ 13 | public interface GstContextAPI extends com.sun.jna.Library { 14 | 15 | GstContextAPI GSTCONTEXT_API = GstNative.load(GstContextAPI.class); 16 | 17 | /*@CallerOwnsReturn*/ GstContextPtr gst_context_new(String context_type, boolean persistent); 18 | 19 | String gst_context_get_context_type(GstContextPtr context); 20 | 21 | boolean gst_context_has_context_type(GstContextPtr context, String context_type); 22 | 23 | Structure gst_context_get_structure(GstContextPtr context); 24 | 25 | Structure gst_context_writable_structure(GstContextPtr context); 26 | 27 | boolean gst_context_is_persistent(GstContextPtr context); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstContextPtr.java: -------------------------------------------------------------------------------- 1 | package org.freedesktop.gstreamer.lowlevel; 2 | 3 | import com.sun.jna.Pointer; 4 | 5 | public class GstContextPtr extends GstMiniObjectPtr { 6 | 7 | public GstContextPtr() { 8 | } 9 | 10 | public GstContextPtr(Pointer ptr) { 11 | super(ptr); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstControlBindingAPI.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 . 17 | */ 18 | 19 | package org.freedesktop.gstreamer.lowlevel; 20 | 21 | import com.sun.jna.Library; 22 | 23 | /** 24 | * GstControlBinding API 25 | * 26 | * https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstControlBinding.html 27 | * https://gitlab.freedesktop.org/gstreamer/gstreamer/tree/master/libs/gst/controller 28 | */ 29 | 30 | public interface GstControlBindingAPI extends Library { 31 | 32 | GstControlBindingAPI GSTCONTROLBINDING_API = GstNative.load(GstControlBindingAPI.class); 33 | 34 | 35 | boolean gst_control_binding_sync_values(GstControlBindingPtr binding, 36 | GstObjectPtr object, 37 | long timestamp, 38 | long lastSync); 39 | 40 | GValueAPI.GValue gst_control_binding_get_value(GstControlBindingPtr binding, 41 | long timestamp); 42 | 43 | boolean gst_control_binding_get_g_value_array(GstControlBindingPtr binding, 44 | long timestamp, 45 | long internal, 46 | int n_values, 47 | GValueAPI.GValue[] values); 48 | 49 | void gst_control_binding_set_disabled(GstControlBindingPtr binding, 50 | boolean disabled); 51 | 52 | boolean gst_control_binding_is_disabled(GstControlBindingPtr binding); 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstControlBindingPtr.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 the terms of the GNU 7 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * Lesser General Public License version 3 for more details. 12 | * 13 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 14 | * this work. If not, see . 15 | */ 16 | package org.freedesktop.gstreamer.lowlevel; 17 | 18 | import com.sun.jna.Pointer; 19 | 20 | /** 21 | * 22 | */ 23 | public class GstControlBindingPtr extends GstObjectPtr { 24 | 25 | public GstControlBindingPtr() { 26 | } 27 | 28 | public GstControlBindingPtr(Pointer ptr) { 29 | super(ptr); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstControlSourcePtr.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 the terms of the GNU 7 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * Lesser General Public License version 3 for more details. 12 | * 13 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 14 | * this work. If not, see . 15 | */ 16 | package org.freedesktop.gstreamer.lowlevel; 17 | 18 | import com.sun.jna.Pointer; 19 | 20 | /** 21 | * 22 | */ 23 | public class GstControlSourcePtr extends GstObjectPtr { 24 | 25 | public GstControlSourcePtr() { 26 | } 27 | 28 | public GstControlSourcePtr(Pointer ptr) { 29 | super(ptr); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstDeviceAPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Neil C Smith 3 | * Copyright (c) 2015 Andres Colubri 4 | * Copyright (C) 2013 Olivier Crete 5 | * 6 | * This file is part of gstreamer-java. 7 | * 8 | * This code is free software: you can redistribute it and/or modify it under 9 | * the terms of the GNU Lesser General Public License version 3 only, as 10 | * published by the Free Software Foundation. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 15 | * version 3 for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * version 3 along with this work. If not, see . 19 | */ 20 | package org.freedesktop.gstreamer.lowlevel; 21 | 22 | import com.sun.jna.Pointer; 23 | import org.freedesktop.gstreamer.Caps; 24 | import org.freedesktop.gstreamer.Element; 25 | import org.freedesktop.gstreamer.Structure; 26 | import org.freedesktop.gstreamer.device.Device; 27 | import org.freedesktop.gstreamer.lowlevel.annotations.CallerOwnsReturn; 28 | 29 | /** 30 | * 31 | * http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstDevice.html 32 | */ 33 | public interface GstDeviceAPI extends com.sun.jna.Library { 34 | GstDeviceAPI GSTDEVICE_API = GstNative.load(GstDeviceAPI.class); 35 | 36 | @CallerOwnsReturn Element gst_device_create_element(Device device, String name); 37 | @CallerOwnsReturn Caps gst_device_get_caps(Device device); 38 | Pointer gst_device_get_device_class(Device device); 39 | Pointer gst_device_get_display_name(Device device); 40 | boolean gst_device_has_classes(Device device, String classes); 41 | boolean gst_device_has_classesv(Device device, String[] classes); 42 | boolean gst_device_reconfigure_element(Device device, Element element); 43 | Structure gst_device_get_properties(Device device); 44 | } 45 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstDeviceMonitorAPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Andres Colubri 3 | * Copyright (C) 2013 Olivier Crete 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 . 18 | */ 19 | package org.freedesktop.gstreamer.lowlevel; 20 | 21 | import com.sun.jna.Pointer; 22 | import org.freedesktop.gstreamer.Bus; 23 | import org.freedesktop.gstreamer.device.DeviceMonitor; 24 | import org.freedesktop.gstreamer.lowlevel.annotations.CallerOwnsReturn; 25 | import org.freedesktop.gstreamer.lowlevel.GlibAPI.GList; 26 | import org.freedesktop.gstreamer.Caps; 27 | 28 | /** 29 | * 30 | * http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstDeviceMonitor.html 31 | */ 32 | public interface GstDeviceMonitorAPI extends com.sun.jna.Library { 33 | GstDeviceMonitorAPI GSTDEVICEMONITOR_API = GstNative.load(GstDeviceMonitorAPI.class); 34 | 35 | @CallerOwnsReturn DeviceMonitor gst_device_monitor_new(); 36 | @CallerOwnsReturn Pointer ptr_gst_device_monitor_new(); 37 | @CallerOwnsReturn Bus gst_device_monitor_get_bus(DeviceMonitor monitor); 38 | int gst_device_monitor_add_filter(DeviceMonitor monitor, String classes, Caps caps); 39 | boolean gst_device_monitor_remove_filter(DeviceMonitor monitor, int filterId); 40 | boolean gst_device_monitor_start(DeviceMonitor monitor); 41 | void gst_device_monitor_stop(DeviceMonitor monitor); 42 | GList gst_device_monitor_get_devices(DeviceMonitor monitor); 43 | } 44 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstDeviceProviderFactoryAPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Andres Colubri 3 | * Copyright (C) 2013 Olivier Crete 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 . 18 | */ 19 | package org.freedesktop.gstreamer.lowlevel; 20 | 21 | import org.freedesktop.gstreamer.PluginFeature.Rank; 22 | import org.freedesktop.gstreamer.device.DeviceProvider; 23 | import org.freedesktop.gstreamer.device.DeviceProviderFactory; 24 | import org.freedesktop.gstreamer.lowlevel.GlibAPI.GList; 25 | 26 | /** 27 | * 28 | * http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstDeviceProviderFactory.html 29 | */ 30 | public interface GstDeviceProviderFactoryAPI extends com.sun.jna.Library { 31 | GstDeviceProviderFactoryAPI GSTDEVICEPROVIDERFACTORY_API = GstNative.load(GstDeviceProviderFactoryAPI.class); 32 | 33 | DeviceProviderFactory gst_device_provider_factory_find(String name); 34 | DeviceProvider gst_device_provider_factory_get(DeviceProviderFactory factory); 35 | DeviceProvider gst_device_provider_factory_get_by_name(String factoryName); 36 | GType gst_device_provider_factory_get_device_provider_type(DeviceProviderFactory factory); 37 | String gst_device_provider_factory_get_metadata(DeviceProviderFactory factory, String key); 38 | String[] gst_device_provider_factory_get_metadata_keys(DeviceProviderFactory factory); 39 | boolean gst_device_provider_factory_has_classes(DeviceProviderFactory factory, String classes); 40 | boolean gst_device_provider_factory_has_classesv(DeviceProviderFactory factory, String[] classes); 41 | GList gst_device_provider_factory_list_get_device_providers(Rank minRank); 42 | } 43 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstDirectControlBindingPtr.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 the terms of the GNU 7 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * Lesser General Public License version 3 for more details. 12 | * 13 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 14 | * this work. If not, see . 15 | */ 16 | package org.freedesktop.gstreamer.lowlevel; 17 | 18 | import com.sun.jna.Pointer; 19 | 20 | /** 21 | * 22 | */ 23 | public class GstDirectControlBindingPtr extends GstControlBindingPtr { 24 | 25 | public GstDirectControlBindingPtr() { 26 | } 27 | 28 | public GstDirectControlBindingPtr(Pointer ptr) { 29 | super(ptr); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstGhostPadAPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Levente Farkas 3 | * Copyright (c) 2007, 2008 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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer.lowlevel; 21 | 22 | import org.freedesktop.gstreamer.GhostPad; 23 | import org.freedesktop.gstreamer.Pad; 24 | import org.freedesktop.gstreamer.PadTemplate; 25 | import org.freedesktop.gstreamer.lowlevel.annotations.CallerOwnsReturn; 26 | 27 | import com.sun.jna.Pointer; 28 | 29 | /** 30 | * GstGhostPad functions 31 | */ 32 | public interface GstGhostPadAPI extends com.sun.jna.Library { 33 | GstGhostPadAPI GSTGHOSTPAD_API = GstNative.load(GstGhostPadAPI.class); 34 | 35 | GType gst_ghost_pad_get_type(); 36 | 37 | @CallerOwnsReturn Pointer ptr_gst_ghost_pad_new(String name, Pad target); 38 | @CallerOwnsReturn Pointer ptr_gst_ghost_pad_new_no_target(String name, int direction); 39 | 40 | @CallerOwnsReturn Pointer ptr_gst_ghost_pad_new_from_template(String name, Pad target, PadTemplate templ); 41 | @CallerOwnsReturn Pointer ptr_gst_ghost_pad_new_no_target_from_template(String name, PadTemplate templ); 42 | @CallerOwnsReturn GhostPad gst_ghost_pad_new(String name, Pad target); 43 | @CallerOwnsReturn GhostPad gst_ghost_pad_new_no_target(String name, int direction); 44 | 45 | @CallerOwnsReturn GhostPad gst_ghost_pad_new_from_template(String name, Pad target, PadTemplate templ); 46 | @CallerOwnsReturn GhostPad gst_ghost_pad_new_no_target_from_template(String name, PadTemplate templ); 47 | @CallerOwnsReturn Pad gst_ghost_pad_get_target(GhostPad gpad); 48 | boolean gst_ghost_pad_set_target(GhostPad gpad, Pad newtarget); 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstInterpolationControlSourcePtr.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 the terms of the GNU 7 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * Lesser General Public License version 3 for more details. 12 | * 13 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 14 | * this work. If not, see . 15 | */ 16 | package org.freedesktop.gstreamer.lowlevel; 17 | 18 | import com.sun.jna.Pointer; 19 | 20 | /** 21 | * 22 | */ 23 | public class GstInterpolationControlSourcePtr extends GstTimedValueControlSourcePtr { 24 | 25 | public GstInterpolationControlSourcePtr() { 26 | } 27 | 28 | public GstInterpolationControlSourcePtr(Pointer ptr) { 29 | super(ptr); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstIteratorAPI.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 . 17 | */ 18 | 19 | package org.freedesktop.gstreamer.lowlevel; 20 | 21 | /** 22 | * GstIterator functions 23 | */ 24 | public interface GstIteratorAPI extends com.sun.jna.Library { 25 | 26 | GstIteratorAPI GSTITERATOR_API = GstNative.load(GstIteratorAPI.class); 27 | 28 | void gst_iterator_free(GstIteratorPtr iter); 29 | int gst_iterator_next(GstIteratorPtr iter, GValueAPI.GValue next); 30 | void gst_iterator_resync(GstIteratorPtr iter); 31 | } 32 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstIteratorPtr.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 the terms of the GNU 7 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * Lesser General Public License version 3 for more details. 12 | * 13 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 14 | * this work. If not, see . 15 | */ 16 | package org.freedesktop.gstreamer.lowlevel; 17 | 18 | import com.sun.jna.Pointer; 19 | 20 | /** 21 | * GstIterator pointer. 22 | */ 23 | public class GstIteratorPtr extends GPointer { 24 | 25 | public GstIteratorPtr() { 26 | } 27 | 28 | public GstIteratorPtr(Pointer ptr) { 29 | super(ptr); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstLFOControlSourcePtr.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 the terms of the GNU 7 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * Lesser General Public License version 3 for more details. 12 | * 13 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 14 | * this work. If not, see . 15 | */ 16 | package org.freedesktop.gstreamer.lowlevel; 17 | 18 | import com.sun.jna.Pointer; 19 | 20 | /** 21 | * 22 | */ 23 | public class GstLFOControlSourcePtr extends GstControlSourcePtr { 24 | 25 | public GstLFOControlSourcePtr() { 26 | } 27 | 28 | public GstLFOControlSourcePtr(Pointer ptr) { 29 | super(ptr); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstMessagePtr.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 the terms of the GNU 7 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * Lesser General Public License version 3 for more details. 12 | * 13 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 14 | * this work. If not, see . 15 | */ 16 | package org.freedesktop.gstreamer.lowlevel; 17 | 18 | import com.sun.jna.Pointer; 19 | 20 | /** 21 | * GstMessage pointer. 22 | */ 23 | public class GstMessagePtr extends GstMiniObjectPtr { 24 | 25 | private static final int TYPE_OFFSET; 26 | private static final int SRC_OFFSET; 27 | 28 | static { 29 | GstMessageAPI.MessageStruct struct = new GstMessageAPI.MessageStruct(); 30 | TYPE_OFFSET = struct.typeOffset(); 31 | SRC_OFFSET = struct.srcOffset(); 32 | } 33 | 34 | 35 | public GstMessagePtr() { 36 | } 37 | 38 | public GstMessagePtr(Pointer ptr) { 39 | super(ptr); 40 | } 41 | 42 | public int getMessageType() { 43 | return getPointer().getInt(TYPE_OFFSET); 44 | } 45 | 46 | public GstObjectPtr getSource() { 47 | Pointer raw = getPointer().getPointer(SRC_OFFSET); 48 | return raw == null ? null : new GstObjectPtr(raw); 49 | } 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstMetaAPI.java: -------------------------------------------------------------------------------- 1 | package org.freedesktop.gstreamer.lowlevel; 2 | 3 | import com.sun.jna.Library; 4 | import com.sun.jna.Pointer; 5 | import com.sun.jna.Structure; 6 | 7 | /** 8 | */ 9 | public interface GstMetaAPI extends Library { 10 | GstMetaAPI GST_META_API = GstNative.load(GstMetaAPI.class); 11 | 12 | 13 | 14 | @Structure.FieldOrder({"flags", "info"}) 15 | class GstMetaStruct extends Structure { 16 | public static final class ByValue extends GstMetaStruct implements Structure.ByValue { 17 | } 18 | 19 | public int flags; 20 | public GstMetaInfoStruct.ByReference info; 21 | 22 | int infoOffset() { 23 | return fieldOffset("info"); 24 | } 25 | 26 | } 27 | 28 | @Structure.FieldOrder({"api", "type", "size"}) 29 | class GstMetaInfoStruct extends Structure { 30 | public static class ByReference extends GstMetaInfoStruct implements Structure.ByReference { 31 | } 32 | 33 | public GstMetaInfoStruct() { 34 | } 35 | 36 | public GstMetaInfoStruct(Pointer p) { 37 | super(p); 38 | read(); 39 | } 40 | 41 | public GType api; 42 | public GType type; 43 | public long size; 44 | 45 | int typeOffset() { 46 | return fieldOffset("type"); 47 | } 48 | 49 | } 50 | 51 | 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstMiniObjectPtr.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 the terms of the GNU 7 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * Lesser General Public License version 3 for more details. 12 | * 13 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 14 | * this work. If not, see . 15 | */ 16 | package org.freedesktop.gstreamer.lowlevel; 17 | 18 | import com.sun.jna.Native; 19 | import com.sun.jna.Pointer; 20 | 21 | /** 22 | * Base MiniObject pointer 23 | */ 24 | public class GstMiniObjectPtr extends GTypedPtr { 25 | 26 | public GstMiniObjectPtr() { 27 | } 28 | 29 | public GstMiniObjectPtr(Pointer ptr) { 30 | super(ptr); 31 | } 32 | 33 | @Override 34 | public GType getGType() { 35 | // Quick getter for GType without allocation 36 | // same as : new MiniObjectStruct(ptr).type 37 | if (Native.SIZE_T_SIZE == 8) { 38 | return GType.valueOf(getPointer().getLong(0)); 39 | } else if (Native.SIZE_T_SIZE == 4) { 40 | return GType.valueOf( ((long) getPointer().getInt(0)) & 0xffffffffL ); 41 | } else { 42 | throw new IllegalStateException("SIZE_T size not supported: " + Native.SIZE_T_SIZE); 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstNative.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Neil C Smith 3 | * Copyright (c) 2009 Levente Farkas 4 | * Copyright (c) 2007, 2008 Wayne Meissner 5 | * 6 | * This file is part of gstreamer-java. 7 | * 8 | * This code is free software: you can redistribute it and/or modify it under 9 | * the terms of the GNU Lesser General Public License version 3 only, as 10 | * published by the Free Software Foundation. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 15 | * version 3 for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * version 3 along with this work. If not, see . 19 | */ 20 | 21 | package org.freedesktop.gstreamer.lowlevel; 22 | 23 | import java.util.HashMap; 24 | import java.util.Map; 25 | 26 | import com.sun.jna.Library; 27 | 28 | /** 29 | * A convenience wrapper to aid in loading an API interface. 30 | */ 31 | @SuppressWarnings("serial") 32 | public final class GstNative { 33 | // gstreamer library names the files one of libfoo-0.10 and libfoo-1.0 34 | // private static String[] nameFormats = { /*"%s-0.10",*/ "%s-1.0" }; 35 | private final static String[] nameFormats = 36 | System.getProperty("gstreamer.GstNative.nameFormats", "%s-1.0").split("\\|"); 37 | 38 | private GstNative() {} 39 | 40 | private static final Map options = new HashMap() {{ 41 | put(Library.OPTION_TYPE_MAPPER, new GTypeMapper()); 42 | put(Library.OPTION_FUNCTION_MAPPER, new GFunctionMapper()); 43 | }}; 44 | 45 | public static T load(Class interfaceClass) { 46 | return load("gstreamer", interfaceClass); 47 | } 48 | 49 | public static T load(String libraryName, Class interfaceClass) { 50 | for (String format : nameFormats) 51 | try { 52 | return GNative.loadLibrary(String.format(format, libraryName), interfaceClass, options); 53 | } catch (UnsatisfiedLinkError ex) { 54 | continue; 55 | } 56 | throw new UnsatisfiedLinkError("Could not load library: " + libraryName); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstNavigationAPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Neil C Smith 3 | * Copyright (c) 2009 Levente Farkas 4 | * Copyright (c) 2009 Tamas Korodi 5 | * 6 | * This file is part of gstreamer-java. 7 | * 8 | * This code is free software: you can redistribute it and/or modify it under 9 | * the terms of the GNU Lesser General Public License version 3 only, as 10 | * published by the Free Software Foundation. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 15 | * version 3 for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * version 3 along with this work. If not, see . 19 | */ 20 | 21 | package org.freedesktop.gstreamer.lowlevel; 22 | 23 | import org.freedesktop.gstreamer.Structure; 24 | import org.freedesktop.gstreamer.interfaces.Navigation; 25 | 26 | import com.sun.jna.Library; 27 | 28 | public interface GstNavigationAPI extends Library { 29 | GstNavigationAPI GSTNAVIGATION_API = GstNative.load("gstvideo", GstNavigationAPI.class); 30 | 31 | GType gst_navigation_get_type(); 32 | 33 | /* vitrual class functions */ 34 | void gst_navigation_send_event(Navigation navigation, Structure structure); 35 | 36 | void gst_navigation_send_key_event(Navigation navigation, String event, String key); 37 | 38 | void gst_navigation_send_mouse_event(Navigation navigation, String event, 39 | int button, double x, double y); 40 | } 41 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstObjectPtr.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 the terms of the GNU 7 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * Lesser General Public License version 3 for more details. 12 | * 13 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 14 | * this work. If not, see . 15 | */ 16 | package org.freedesktop.gstreamer.lowlevel; 17 | 18 | import com.sun.jna.Pointer; 19 | 20 | /** 21 | * Base GObject pointer 22 | */ 23 | public class GstObjectPtr extends GObjectPtr { 24 | 25 | public GstObjectPtr() { 26 | } 27 | 28 | public GstObjectPtr(Pointer ptr) { 29 | super(ptr); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstPadProbeInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Tom Greenwood 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 . 17 | */ 18 | package org.freedesktop.gstreamer.lowlevel; 19 | 20 | import java.util.Arrays; 21 | import java.util.List; 22 | 23 | import com.sun.jna.NativeLong; 24 | import com.sun.jna.Pointer; 25 | import com.sun.jna.Structure; 26 | import static org.freedesktop.gstreamer.lowlevel.GstAPI.GST_PADDING; 27 | 28 | /** 29 | * GstPadProbeInfo structure 30 | * @see https://cgit.freedesktop.org/gstreamer/gstreamer/tree/gst/gstpad.h?h=1.8 31 | */ 32 | public class GstPadProbeInfo extends Structure { 33 | 34 | public volatile int padProbeType; // GstPadProbeInfo enum constants 35 | public volatile NativeLong id; // id of the probe 36 | public volatile Pointer data; // (allow-none): type specific data, check the @type field to know the datatype. This field can be %NULL. 37 | public volatile long offset; // offset of pull probe, this field is valid when type contains GST_PAD_PROBE_TYPE_PULL 38 | public volatile int size; // size of pull probe, this field is valid when type contains GST_PAD_PROBE_TYPE_PULL 39 | 40 | /*< private >*/ 41 | public volatile Pointer[] _gst_reserved = new Pointer[GST_PADDING]; 42 | 43 | @Override 44 | protected List getFieldOrder() { 45 | return Arrays.asList(new String[] { 46 | "padProbeType", "id", "data", "offset", "size", 47 | "_gst_reserved" 48 | }); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstPadPtr.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 the terms of the GNU 7 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * Lesser General Public License version 3 for more details. 12 | * 13 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 14 | * this work. If not, see . 15 | */ 16 | package org.freedesktop.gstreamer.lowlevel; 17 | 18 | import com.sun.jna.Pointer; 19 | 20 | /** 21 | * Base GObject pointer 22 | */ 23 | public class GstPadPtr extends GstObjectPtr { 24 | 25 | public GstPadPtr() { 26 | } 27 | 28 | public GstPadPtr(Pointer ptr) { 29 | super(ptr); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstParseAPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Levente Farkas 3 | * Copyright (c) 2007, 2008 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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer.lowlevel; 21 | 22 | import org.freedesktop.gstreamer.Bin; 23 | import org.freedesktop.gstreamer.Pipeline; 24 | import org.freedesktop.gstreamer.lowlevel.annotations.CallerOwnsReturn; 25 | 26 | import com.sun.jna.Pointer; 27 | import org.freedesktop.gstreamer.Element; 28 | 29 | /** 30 | * gstparse functions 31 | */ 32 | public interface GstParseAPI extends com.sun.jna.Library { 33 | GstParseAPI GSTPARSE_API = GstNative.load(GstParseAPI.class); 34 | 35 | @CallerOwnsReturn Element gst_parse_launch(String pipeline_description, Pointer[] error); 36 | @CallerOwnsReturn Element gst_parse_launchv(String[] pipeline_description, Pointer[] error); 37 | @CallerOwnsReturn Element gst_parse_launch(String pipeline_description, GstAPI.GErrorStruct[] error); 38 | @CallerOwnsReturn Element gst_parse_launchv(String[] pipeline_description, GstAPI.GErrorStruct[] error); 39 | @CallerOwnsReturn Bin gst_parse_bin_from_description(String bin_description, boolean ghost_unlinked_pads,Pointer[] error); 40 | } 41 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstPipelineAPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Levente Farkas 3 | * Copyright (c) 2007, 2008 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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer.lowlevel; 21 | 22 | import org.freedesktop.gstreamer.Bus; 23 | import org.freedesktop.gstreamer.Clock; 24 | import org.freedesktop.gstreamer.Pipeline; 25 | import org.freedesktop.gstreamer.lowlevel.annotations.CallerOwnsReturn; 26 | 27 | import com.sun.jna.Pointer; 28 | 29 | /** 30 | * GstPipeline 31 | */ 32 | public interface GstPipelineAPI extends com.sun.jna.Library { 33 | GstPipelineAPI GSTPIPELINE_API = GstNative.load(GstPipelineAPI.class); 34 | 35 | @CallerOwnsReturn Pipeline gst_pipeline_new(String name); 36 | @CallerOwnsReturn Pointer ptr_gst_pipeline_new(String name); 37 | GType gst_pipeline_get_type(); 38 | @CallerOwnsReturn Bus gst_pipeline_get_bus(Pipeline pipeline); 39 | void gst_pipeline_set_auto_flush_bus(Pipeline pipeline, boolean flush); 40 | boolean gst_pipeline_get_auto_flush_bus(Pipeline pipeline); 41 | void gst_pipeline_set_new_stream_time(Pipeline pipeline, long time); 42 | long gst_pipeline_get_last_stream_time(Pipeline pipeline); 43 | void gst_pipeline_use_clock(Pipeline pipeline, Clock clock); 44 | boolean gst_pipeline_set_clock(Pipeline pipeline, Clock clock); 45 | @CallerOwnsReturn Clock gst_pipeline_get_clock(Pipeline pipeline); 46 | void gst_pipeline_auto_clock(Pipeline pipeline); 47 | void gst_pipeline_set_delay(Pipeline pipeline, long delay); 48 | long gst_pipeline_get_delay(Pipeline pipeline); 49 | } 50 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstPluginAPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Levente Farkas 3 | * Copyright (c) 2007, 2008 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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer.lowlevel; 21 | 22 | import org.freedesktop.gstreamer.Plugin; 23 | import org.freedesktop.gstreamer.lowlevel.GlibAPI.GList; 24 | import org.freedesktop.gstreamer.lowlevel.annotations.CallerOwnsReturn; 25 | 26 | /** 27 | * GstPlugin functions 28 | */ 29 | public interface GstPluginAPI extends com.sun.jna.Library { 30 | GstPluginAPI GSTPLUGIN_API = GstNative.load(GstPluginAPI.class); 31 | 32 | GType gst_plugin_get_type(); 33 | 34 | String gst_plugin_get_name(Plugin plugin); 35 | String gst_plugin_get_description(Plugin plugin); 36 | String gst_plugin_get_filename(Plugin plugin); 37 | String gst_plugin_get_version(Plugin plugin); 38 | String gst_plugin_get_license(Plugin plugin); 39 | String gst_plugin_get_source(Plugin plugin); 40 | String gst_plugin_get_package(Plugin plugin); 41 | String gst_plugin_get_origin(Plugin plugin); 42 | String gst_plugin_get_release_date_string(Plugin plugin); 43 | boolean gst_plugin_is_loaded(Plugin plugin); 44 | boolean gst_plugin_name_filter(Plugin plugin, String name); 45 | 46 | //Plugin gst_plugin_load_file (String filename, GError** error); 47 | 48 | @CallerOwnsReturn Plugin gst_plugin_load(Plugin plugin); 49 | @CallerOwnsReturn Plugin gst_plugin_load_by_name(String name); 50 | 51 | void gst_plugin_list_free(GList list); 52 | } 53 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstPluginFeatureAPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Levente Farkas 3 | * Copyright (c) 2007, 2008 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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer.lowlevel; 21 | 22 | import org.freedesktop.gstreamer.Plugin; 23 | import org.freedesktop.gstreamer.PluginFeature; 24 | import org.freedesktop.gstreamer.lowlevel.GlibAPI.GList; 25 | import org.freedesktop.gstreamer.lowlevel.annotations.CallerOwnsReturn; 26 | 27 | /** 28 | * GstPluginFeature functions 29 | */ 30 | public interface GstPluginFeatureAPI extends com.sun.jna.Library { 31 | GstPluginFeatureAPI GSTPLUGINFEATURE_API = GstNative.load(GstPluginFeatureAPI.class); 32 | 33 | /* normal GObject stuff */ 34 | GType gst_plugin_feature_get_type(); 35 | 36 | @CallerOwnsReturn PluginFeature gst_plugin_feature_load(PluginFeature feature); 37 | 38 | void gst_plugin_feature_set_rank(PluginFeature feature, int rank); 39 | int gst_plugin_feature_get_rank(PluginFeature feature); 40 | String gst_plugin_feature_get_plugin_name(PluginFeature feature); 41 | @CallerOwnsReturn Plugin gst_plugin_feature_get_plugin(PluginFeature feature); 42 | 43 | boolean gst_plugin_feature_check_version(PluginFeature feature, 44 | int min_major, int min_minor, int min_micro); 45 | 46 | void gst_plugin_feature_list_free (GList list); 47 | } 48 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstProxyControlBindingPtr.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 the terms of the GNU 7 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * Lesser General Public License version 3 for more details. 12 | * 13 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 14 | * this work. If not, see . 15 | */ 16 | package org.freedesktop.gstreamer.lowlevel; 17 | 18 | import com.sun.jna.Pointer; 19 | 20 | /** 21 | * 22 | */ 23 | public class GstProxyControlBindingPtr extends GstControlBindingPtr { 24 | 25 | public GstProxyControlBindingPtr() { 26 | } 27 | 28 | public GstProxyControlBindingPtr(Pointer ptr) { 29 | super(ptr); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstStructurePtr.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 the terms of the GNU 7 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * Lesser General Public License version 3 for more details. 12 | * 13 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 14 | * this work. If not, see . 15 | */ 16 | package org.freedesktop.gstreamer.lowlevel; 17 | 18 | import com.sun.jna.Native; 19 | import com.sun.jna.Pointer; 20 | 21 | /** 22 | * GstStructure pointer 23 | */ 24 | public class GstStructurePtr extends GTypedPtr { 25 | 26 | public GstStructurePtr() { 27 | } 28 | 29 | public GstStructurePtr(Pointer ptr) { 30 | super(ptr); 31 | } 32 | 33 | @Override 34 | public GType getGType() { 35 | // Quick getter for GType without allocation 36 | if (Native.SIZE_T_SIZE == 8) { 37 | return GType.valueOf(getPointer().getLong(0)); 38 | } else if (Native.SIZE_T_SIZE == 4) { 39 | return GType.valueOf( ((long) getPointer().getInt(0)) & 0xffffffffL ); 40 | } else { 41 | throw new IllegalStateException("SIZE_T size not supported: " + Native.SIZE_T_SIZE); 42 | } 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstTagAPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Levente Farkas 3 | * Copyright (c) 2007, 2008 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 . 18 | */ 19 | 20 | package org.freedesktop.gstreamer.lowlevel; 21 | 22 | import org.freedesktop.gstreamer.TagFlag; 23 | 24 | public interface GstTagAPI extends com.sun.jna.Library { 25 | GstTagAPI GSTTAG_API = GstNative.load(GstTagAPI.class); 26 | 27 | boolean gst_tag_exists(String tag); 28 | GType gst_tag_get_type(String tag); 29 | String gst_tag_get_nick(String tag); 30 | String gst_tag_get_description(String tag); 31 | TagFlag gst_tag_get_flag(String tag); 32 | boolean gst_tag_is_fixed(String tag); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstTimedValueControlSourcePtr.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 the terms of the GNU 7 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * Lesser General Public License version 3 for more details. 12 | * 13 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 14 | * this work. If not, see . 15 | */ 16 | package org.freedesktop.gstreamer.lowlevel; 17 | 18 | import com.sun.jna.Pointer; 19 | 20 | /** 21 | * 22 | */ 23 | public class GstTimedValueControlSourcePtr extends GstControlSourcePtr { 24 | 25 | public GstTimedValueControlSourcePtr() { 26 | } 27 | 28 | public GstTimedValueControlSourcePtr(Pointer ptr) { 29 | super(ptr); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstTriggerControlSourcePtr.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 the terms of the GNU 7 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 10 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | * Lesser General Public License version 3 for more details. 12 | * 13 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 14 | * this work. If not, see . 15 | */ 16 | package org.freedesktop.gstreamer.lowlevel; 17 | 18 | import com.sun.jna.Pointer; 19 | 20 | /** 21 | * 22 | */ 23 | public class GstTriggerControlSourcePtr extends GstTimedValueControlSourcePtr { 24 | 25 | public GstTriggerControlSourcePtr() { 26 | } 27 | 28 | public GstTriggerControlSourcePtr(Pointer ptr) { 29 | super(ptr); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstValueAPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Neil C Smith 3 | * Copyright (c) 2009 Levente Farkas 4 | * Copyright (c) 2007, 2008 Wayne Meissner 5 | * 6 | * This file is part of gstreamer-java. 7 | * 8 | * This code is free software: you can redistribute it and/or modify it under 9 | * the terms of the GNU Lesser General Public License version 3 only, as 10 | * published by the Free Software Foundation. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 15 | * version 3 for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * version 3 along with this work. If not, see . 19 | */ 20 | 21 | package org.freedesktop.gstreamer.lowlevel; 22 | 23 | import com.sun.jna.Pointer; 24 | import org.freedesktop.gstreamer.lowlevel.GValueAPI.GValue; 25 | 26 | /** 27 | * GstValue functions 28 | */ 29 | public interface GstValueAPI extends com.sun.jna.Library { 30 | GstValueAPI GSTVALUE_API = GstNative.load(GstValueAPI.class); 31 | 32 | GType gst_fourcc_get_type(); 33 | GType gst_int_range_get_type(); 34 | GType gst_double_range_get_type(); 35 | GType gst_fraction_range_get_type(); 36 | GType gst_value_list_get_type(); 37 | GType gst_fraction_get_type(); 38 | 39 | int gst_value_get_fraction_numerator(GValue value); 40 | int gst_value_get_fraction_denominator(GValue value); 41 | GValue gst_value_get_fraction_range_min(GValue value); 42 | GValue gst_value_get_fraction_range_max(GValue value); 43 | double gst_value_get_double_range_min(GValue value); 44 | double gst_value_get_double_range_max(GValue value); 45 | int gst_value_get_int_range_min(GValue value); 46 | int gst_value_get_int_range_max(GValue value); 47 | int gst_value_list_get_size(GValue value); 48 | GValue gst_value_list_get_value(GValue value, int index); 49 | 50 | boolean gst_value_deserialize(GValue value, String src); 51 | Pointer gst_value_serialize(GValue value); 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstVideoOrientationAPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Neil C Smith 3 | * Copyright (c) 2009 Levente Farkas 4 | * Copyright (c) 2009 Tamas Korodi 5 | * 6 | * This file is part of gstreamer-java. 7 | * 8 | * This code is free software: you can redistribute it and/or modify it under 9 | * the terms of the GNU Lesser General Public License version 3 only, as 10 | * published by the Free Software Foundation. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 15 | * version 3 for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * version 3 along with this work. If not, see . 19 | */ 20 | 21 | package org.freedesktop.gstreamer.lowlevel; 22 | 23 | import org.freedesktop.gstreamer.interfaces.VideoOrientation; 24 | 25 | import com.sun.jna.Library; 26 | 27 | public interface GstVideoOrientationAPI extends Library { 28 | GstVideoOrientationAPI GSTVIDEOORIENTATION_API = GstNative.load("gstvideo", GstVideoOrientationAPI.class); 29 | 30 | GType gst_video_orientation_get_type(); 31 | 32 | // @TODO need implementing to use pointers 33 | // boolean gst_video_orientation_get_hflip(VideoOrientation video_orientation, boolean flip); 34 | // 35 | // boolean gst_video_orientation_get_vflip(VideoOrientation video_orientation, boolean flip); 36 | // 37 | // boolean gst_video_orientation_get_hcenter(VideoOrientation video_orientation, int center); 38 | // 39 | // boolean gst_video_orientation_get_vcenter(VideoOrientation video_orientation, int center); 40 | 41 | boolean gst_video_orientation_set_hflip(VideoOrientation video_orientation, boolean flip); 42 | 43 | boolean gst_video_orientation_set_vflip(VideoOrientation video_orientation, boolean flip); 44 | 45 | boolean gst_video_orientation_set_hcenter(VideoOrientation video_orientation, int center); 46 | 47 | boolean gst_video_orientation_set_vcenter(VideoOrientation video_orientation, int center); 48 | } 49 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/GstVideoOverlayAPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Neil C Smith 3 | * Copyright (c) 2009 Levente Farkas 4 | * Copyright (c) 2009 Tamas Korodi 5 | * 6 | * This file is part of gstreamer-java. 7 | * 8 | * This code is free software: you can redistribute it and/or modify it under 9 | * the terms of the GNU Lesser General Public License version 3 only, as 10 | * published by the Free Software Foundation. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 15 | * version 3 for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * version 3 along with this work. If not, see . 19 | */ 20 | 21 | package org.freedesktop.gstreamer.lowlevel; 22 | 23 | import org.freedesktop.gstreamer.message.Message; 24 | import org.freedesktop.gstreamer.interfaces.VideoOverlay; 25 | 26 | import com.sun.jna.Library; 27 | import com.sun.jna.NativeLong; 28 | import com.sun.jna.Pointer; 29 | 30 | public interface GstVideoOverlayAPI extends Library { 31 | GstVideoOverlayAPI GSTVIDEOOVERLAY_API = GstNative.load("gstvideo", GstVideoOverlayAPI.class); 32 | 33 | GType gst_video_overlay_get_type(); 34 | 35 | void gst_video_overlay_set_window_handle(VideoOverlay overlay, Pointer xwindow_id); 36 | 37 | void gst_video_overlay_got_window_handle(VideoOverlay overlay, NativeLong xwindow_id); 38 | 39 | void gst_video_overlay_prepare_xwindow_id(VideoOverlay overlay); 40 | 41 | void gst_video_overlay_expose(VideoOverlay overlay); 42 | 43 | void gst_video_overlay_handle_events(VideoOverlay overlay, boolean handle_events); 44 | 45 | boolean gst_video_overlay_set_render_rectangle(VideoOverlay overlay, int x, int y, int width, int height); 46 | 47 | boolean gst_is_video_overlay_prepare_window_handle_message(Message message); 48 | } 49 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/IntPtr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Wayne Meissner 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 . 17 | */ 18 | package org.freedesktop.gstreamer.lowlevel; 19 | 20 | import com.sun.jna.Native; 21 | 22 | @SuppressWarnings("serial") 23 | public class IntPtr extends Number { 24 | public final Number value; 25 | public IntPtr(int value) { 26 | this.value = Native.POINTER_SIZE == 8 ? new Long(value) : new Integer(value); 27 | } 28 | 29 | public String toString() { 30 | return Integer.toHexString(intValue()); 31 | } 32 | 33 | public int intValue() { 34 | return value.intValue(); 35 | } 36 | 37 | public long longValue() { 38 | return value.longValue(); 39 | } 40 | 41 | public float floatValue() { 42 | return value.floatValue(); 43 | } 44 | 45 | public double doubleValue() { 46 | return value.doubleValue(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/README: -------------------------------------------------------------------------------- 1 | lowlevel cleanup log 2 | 3 | 4 | structures in the following classes were aligned to 1.8: 5 | (https://cgit.freedesktop.org/gstreamer/gstreamer/tree/?h=1.8) 6 | 7 | - BaseSinkAPI 8 | - BaseSrcAPI 9 | - BaseTransformAPI 10 | - GstAPI 11 | - GstBufferAPI 12 | - GstBufferPoolAPI 13 | - GstControlSourceAPI 14 | - GstControllerAPI - removed 15 | - GstElementAPI 16 | - GstEvent 17 | - GstObject 18 | - GstPadProbeInfo 19 | - GstQueryAPI 20 | - GstSampleAPI -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/annotations/CallerOwnsReturn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Wayne Meissner 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 . 17 | */ 18 | 19 | package org.freedesktop.gstreamer.lowlevel.annotations; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | /** 27 | * Indicates that the returned value is owned by the method caller, so appropriate 28 | * action should be taken when the object is garbage collected. 29 | */ 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target(ElementType.METHOD) 32 | public @interface CallerOwnsReturn { 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/annotations/Const.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, 2008 Wayne Meissner 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 . 17 | */ 18 | 19 | package org.freedesktop.gstreamer.lowlevel.annotations; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | /** 27 | * 28 | * @author wayne 29 | */ 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target({ElementType.PARAMETER, ElementType.METHOD}) 32 | public @interface Const { 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/annotations/ConstField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 Wayne Meissner 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 . 17 | */ 18 | 19 | package org.freedesktop.gstreamer.lowlevel.annotations; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | /** 27 | * 28 | * @author wayne 29 | */ 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target(ElementType.FIELD) 32 | public @interface ConstField { 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/annotations/ConstReturn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, 2008 Wayne Meissner 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 . 17 | */ 18 | 19 | package org.freedesktop.gstreamer.lowlevel.annotations; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | /** 27 | * 28 | * @author wayne 29 | */ 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target(ElementType.METHOD) 32 | public @interface ConstReturn { 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/annotations/DefaultEnumValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 Wayne Meissner 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 . 17 | */ 18 | 19 | package org.freedesktop.gstreamer.lowlevel.annotations; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | /** 27 | * Used to flag the Enum value to use for converting from a native value, 28 | * when no exact match is found. 29 | */ 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target(ElementType.FIELD) 32 | public @interface DefaultEnumValue { 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/annotations/FreeReturnValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Wayne Meissner 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 . 17 | */ 18 | 19 | package org.freedesktop.gstreamer.lowlevel.annotations; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | /** 27 | * 28 | * @author wayne 29 | */ 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target(ElementType.METHOD) 32 | public @interface FreeReturnValue { 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/annotations/HasSubtype.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008 Wayne Meissner 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 . 17 | */ 18 | 19 | package org.freedesktop.gstreamer.lowlevel.annotations; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | @Retention(RetentionPolicy.RUNTIME) 27 | @Target(ElementType.TYPE) 28 | public @interface HasSubtype { 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/annotations/IncRef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Wayne Meissner 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 . 17 | */ 18 | 19 | package org.freedesktop.gstreamer.lowlevel.annotations; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | /** 27 | * Signal that the Handle parameter's refcount should be incremented 28 | */ 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Target(ElementType.PARAMETER) 31 | 32 | public @interface IncRef { 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/lowlevel/annotations/Invalidate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Wayne Meissner 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 . 17 | */ 18 | 19 | package org.freedesktop.gstreamer.lowlevel.annotations; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | /** 27 | * Signal that the Handle parameter should be invalidated (not used after this call) 28 | */ 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Target(ElementType.PARAMETER) 31 | public @interface Invalidate { 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/message/DurationChangedMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Neil C Smith 3 | * Copyright (C) 2008 Wayne Meissner 4 | * Copyright (C) 2004 Wim Taymans 5 | * 6 | * This file is part of gstreamer-java. 7 | * 8 | * This code is free software: you can redistribute it and/or modify it under 9 | * the terms of the GNU Lesser General Public License version 3 only, as 10 | * published by the Free Software Foundation. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 15 | * version 3 for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * version 3 along with this work. If not, see . 19 | */ 20 | package org.freedesktop.gstreamer.message; 21 | 22 | import org.freedesktop.gstreamer.GstObject; 23 | import org.freedesktop.gstreamer.glib.Natives; 24 | import static org.freedesktop.gstreamer.lowlevel.GstMessageAPI.GSTMESSAGE_API; 25 | 26 | /** 27 | * A duration changed message. 28 | *

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 5 | * 6 | * This file is part of gstreamer-java. 7 | * 8 | * This code is free software: you can redistribute it and/or modify it under 9 | * the terms of the GNU Lesser General Public License version 3 only, as 10 | * published by the Free Software Foundation. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 15 | * version 3 for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * version 3 along with this work. If not, see . 19 | */ 20 | package org.freedesktop.gstreamer.message; 21 | 22 | import org.freedesktop.gstreamer.Bin; 23 | import org.freedesktop.gstreamer.GstObject; 24 | import org.freedesktop.gstreamer.glib.Natives; 25 | import static org.freedesktop.gstreamer.lowlevel.GstMessageAPI.GSTMESSAGE_API; 26 | 27 | /** 28 | * An End-of-Stream Message. 29 | *

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 5 | * 6 | * This file is part of gstreamer-java. 7 | * 8 | * This code is free software: you can redistribute it and/or modify it under 9 | * the terms of the GNU Lesser General Public License version 3 only, as 10 | * published by the Free Software Foundation. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 15 | * version 3 for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * version 3 along with this work. If not, see . 19 | */ 20 | 21 | package org.freedesktop.gstreamer.message; 22 | 23 | import org.freedesktop.gstreamer.lowlevel.GstAPI.GErrorStruct; 24 | import static org.freedesktop.gstreamer.lowlevel.GstMessageAPI.GSTMESSAGE_API; 25 | 26 | /** 27 | * This message is posted by element when a fatal event occurs. 28 | *

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 5 | * 6 | * This file is part of gstreamer-java. 7 | * 8 | * This code is free software: you can redistribute it and/or modify it under 9 | * the terms of the GNU Lesser General Public License version 3 only, as 10 | * published by the Free Software Foundation. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 15 | * version 3 for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * version 3 along with this work. If not, see . 19 | */ 20 | package org.freedesktop.gstreamer.message; 21 | 22 | import org.freedesktop.gstreamer.lowlevel.GstAPI.GErrorStruct; 23 | import static org.freedesktop.gstreamer.lowlevel.GstMessageAPI.GSTMESSAGE_API; 24 | 25 | /** 26 | * This message is posted by element to provide information to the application. 27 | *

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 5 | * 6 | * This file is part of gstreamer-java. 7 | * 8 | * This code is free software: you can redistribute it and/or modify it under 9 | * the terms of the GNU Lesser General Public License version 3 only, as 10 | * published by the Free Software Foundation. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 15 | * version 3 for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * version 3 along with this work. If not, see . 19 | */ 20 | package org.freedesktop.gstreamer.message; 21 | 22 | import org.freedesktop.gstreamer.GstObject; 23 | import org.freedesktop.gstreamer.glib.Natives; 24 | import static org.freedesktop.gstreamer.lowlevel.GstMessageAPI.GSTMESSAGE_API; 25 | 26 | /** 27 | * Message posted by elements when their latency requirements have changed. 28 | *

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 . 18 | */ 19 | package org.freedesktop.gstreamer.message; 20 | 21 | import static org.freedesktop.gstreamer.lowlevel.GstMessageAPI.GSTMESSAGE_API; 22 | 23 | import org.freedesktop.gstreamer.GstObject; 24 | import org.freedesktop.gstreamer.glib.Natives; 25 | 26 | /** 27 | * Message indicating that an element wants a specific context. 28 | */ 29 | public class NeedContextMessage extends Message { 30 | 31 | /** 32 | * Creates a new Need-Context message. 33 | * 34 | * @param init internal initialization data. 35 | */ 36 | NeedContextMessage(Initializer init) { 37 | super(init); 38 | } 39 | 40 | /** 41 | * Creates a new Need-Context message. 42 | * 43 | * @param src the object originating the message. 44 | */ 45 | public NeedContextMessage(GstObject src, String context_type) { 46 | this(Natives.initializer(GSTMESSAGE_API.ptr_gst_message_new_need_context(src, context_type))); 47 | } 48 | 49 | /** 50 | * Gets the context type contained in this message. 51 | * 52 | * @return the context type. 53 | */ 54 | public String getContextType() { 55 | String context_type[] = new String[1]; 56 | boolean isOk = GSTMESSAGE_API.gst_message_parse_context_type(this, context_type); 57 | return isOk ? context_type[0] : null; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/message/WarningMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Neil C Smith 3 | * Copyright (C) 2008 Wayne Meissner 4 | * Copyright (C) 2004 Wim Taymans 5 | * 6 | * This file is part of gstreamer-java. 7 | * 8 | * This code is free software: you can redistribute it and/or modify it under 9 | * the terms of the GNU Lesser General Public License version 3 only, as 10 | * published by the Free Software Foundation. 11 | * 12 | * This code is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 15 | * version 3 for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public License 18 | * version 3 along with this work. If not, see . 19 | */ 20 | package org.freedesktop.gstreamer.message; 21 | 22 | import org.freedesktop.gstreamer.lowlevel.GstAPI.GErrorStruct; 23 | import static org.freedesktop.gstreamer.lowlevel.GstMessageAPI.GSTMESSAGE_API; 24 | 25 | /** 26 | * This message is posted by element when a warning notice is required. 27 | *

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 . 17 | */ 18 | package org.freedesktop.gstreamer.video; 19 | 20 | import java.util.stream.Stream; 21 | import org.freedesktop.gstreamer.glib.NativeObject; 22 | 23 | import static org.freedesktop.gstreamer.glib.Natives.registration; 24 | 25 | /** 26 | * Utility class for GStreamer Video library. 27 | */ 28 | public final class Video { 29 | 30 | private Video() { 31 | } 32 | 33 | /** 34 | * TypeProvider implementation for GStreamer Video library. 35 | */ 36 | public static class Types implements NativeObject.TypeProvider { 37 | 38 | @Override 39 | public Stream> types() { 40 | return Stream.of( 41 | registration(VideoTimeCodeMeta.class, VideoTimeCodeMeta.GTYPE_NAME, 42 | VideoTimeCodeMeta::new) 43 | ); 44 | } 45 | 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/video/VideoTimeCodeFlags.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Neil C Smith 3 | * Copyright (c) 2020 Petr Lastovka 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 . 18 | */ 19 | package org.freedesktop.gstreamer.video; 20 | 21 | import org.freedesktop.gstreamer.glib.NativeFlags; 22 | 23 | /** 24 | * Flags related to the time code information. For drop frame, only 30000/1001 25 | * and 60000/1001 frame rates are supported. 26 | *

27 | * See upstream documentation at 28 | * https://gstreamer.freedesktop.org/documentation/video/gstvideotimecode.html#GstVideoTimeCodeFlags 30 | */ 31 | public enum VideoTimeCodeFlags implements NativeFlags { 32 | // /** 33 | // * No flags 34 | // */ 35 | // GST_VIDEO_TIME_CODE_FLAGS_NONE(0), // No flags 36 | /** 37 | * Whether we have drop frame rate 38 | */ 39 | GST_VIDEO_TIME_CODE_FLAGS_DROP_FRAME(1), 40 | /** 41 | * Whether we have interlaced video 42 | */ 43 | GST_VIDEO_TIME_CODE_FLAGS_INTERLACED(2); 44 | 45 | 46 | private final int value; 47 | 48 | VideoTimeCodeFlags(int value) { 49 | this.value = value; 50 | } 51 | 52 | @Override 53 | public int intValue() { 54 | return value; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/webrtc/WebRTC.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 . 17 | */ 18 | package org.freedesktop.gstreamer.webrtc; 19 | 20 | import java.util.stream.Stream; 21 | import org.freedesktop.gstreamer.glib.NativeObject; 22 | import static org.freedesktop.gstreamer.glib.Natives.registration; 23 | 24 | /** 25 | * 26 | * @author Neil C Smith - https://www.neilcsmith.net 27 | */ 28 | public class WebRTC { 29 | 30 | private WebRTC() { 31 | } 32 | 33 | public static class Types implements NativeObject.TypeProvider { 34 | 35 | @Override 36 | public Stream> types() { 37 | return Stream.of( 38 | registration(WebRTCSessionDescription.class, 39 | WebRTCSessionDescription.GTYPE_NAME, 40 | WebRTCSessionDescription::new), 41 | registration(WebRTCBin.class, 42 | WebRTCBin.GTYPE_NAME, 43 | WebRTCBin::new)); 44 | 45 | } 46 | 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/webrtc/WebRTCICEGatheringState.java: -------------------------------------------------------------------------------- 1 | package org.freedesktop.gstreamer.webrtc; 2 | 3 | import org.freedesktop.gstreamer.Gst; 4 | import org.freedesktop.gstreamer.glib.NativeEnum; 5 | 6 | /** 7 | * The ICE gathering state of WebRTC peer 8 | * Available since GStreamer 1.14 9 | */ 10 | @Gst.Since(minor = 14) 11 | public enum WebRTCICEGatheringState implements NativeEnum { 12 | /** New gathering */ 13 | NEW(0), 14 | /** Gathering in progress */ 15 | GATHERING(1), 16 | /** Gathering completed */ 17 | COMPLETE(2); 18 | 19 | private final int value; 20 | 21 | private WebRTCICEGatheringState(int value) { 22 | this.value = value; 23 | } 24 | 25 | @Override 26 | public int intValue() { 27 | return this.value; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/webrtc/WebRTCPeerConnectionState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Neil C Smith 3 | * Copyright (c) 2018 Antonio Morales 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 the terms of the GNU 8 | * Lesser General Public License version 3 only, as published by the Free Software Foundation. 9 | * 10 | * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 11 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License version 3 for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License version 3 along with 15 | * this work. If not, see . 16 | */ 17 | 18 | package org.freedesktop.gstreamer.webrtc; 19 | 20 | import org.freedesktop.gstreamer.Gst; 21 | import org.freedesktop.gstreamer.glib.NativeEnum; 22 | 23 | /** 24 | * The state of a WebRTC peer connection 25 | * Available since GStreamer 1.14 26 | */ 27 | @Gst.Since(minor = 14) 28 | public enum WebRTCPeerConnectionState implements NativeEnum { 29 | /** New WebRTC connection */ 30 | NEW(0), 31 | /** A WebRTC connection is being made */ 32 | CONNECTING(1), 33 | /** A WebRTC connection has been made */ 34 | CONNECTED(2), 35 | /** A WebRTC connection has been disconnected */ 36 | DISCONNECTED(3), 37 | /** Attempt to make a WebRTC connection failed */ 38 | FAILED(4), 39 | /** A WebRTC connection has been closed */ 40 | CLOSED(5); 41 | 42 | private final int value; 43 | 44 | private WebRTCPeerConnectionState(int value) { 45 | this.value = value; 46 | } 47 | 48 | @Override 49 | public int intValue() { 50 | return value; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/org/freedesktop/gstreamer/webrtc/WebRTCSDPType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Antonio Morales 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 . 17 | */ 18 | package org.freedesktop.gstreamer.webrtc; 19 | 20 | import org.freedesktop.gstreamer.Gst; 21 | import org.freedesktop.gstreamer.glib.NativeEnum; 22 | 23 | /** 24 | * The type of a {@link WebRTCSessionDescription} 25 | *

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 { 31 | OFFER(1), 32 | PRANSWER(2), 33 | ANSWER(3), 34 | ROLLBACK(4); 35 | 36 | private final int value; 37 | 38 | private WebRTCSDPType(int value) { 39 | this.value = value; 40 | } 41 | 42 | /** 43 | * Gets the integer value of the enum 44 | * @return the integer value for this enum. 45 | */ 46 | @Override 47 | public int intValue() { 48 | return value; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /test/org/freedesktop/gstreamer/BufferFieldsTest.java: -------------------------------------------------------------------------------- 1 | package org.freedesktop.gstreamer; 2 | 3 | import org.junit.*; 4 | import static org.junit.Assert.*; 5 | 6 | /** 7 | *

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 . 17 | * 18 | */ 19 | package org.freedesktop.gstreamer; 20 | 21 | import org.junit.AfterClass; 22 | import org.junit.BeforeClass; 23 | import org.junit.Test; 24 | 25 | import static org.junit.Assert.*; 26 | 27 | /** 28 | * 29 | */ 30 | public class ClockTest { 31 | 32 | @BeforeClass 33 | public static void beforeClass() { 34 | Gst.init(Gst.getVersion()); 35 | } 36 | 37 | @AfterClass 38 | public static void afterClass() { 39 | Gst.deinit(); 40 | } 41 | 42 | @Test 43 | public void calibrationTest() { 44 | Pipeline pipe = (Pipeline) Gst.parseLaunch("autovideosrc ! autovideosink"); 45 | Clock clock = pipe.getClock(); 46 | Clock.Calibration cal1 = clock.getCalibration(); 47 | System.out.println(cal1); 48 | assertEquals(0, cal1.internal()); 49 | assertEquals(0, cal1.external()); 50 | assertEquals(1, cal1.rateNum()); 51 | assertEquals(1, cal1.rateDenom()); 52 | clock.setCalibration(-100, 1000, 8, 5); 53 | 54 | Clock.Calibration cal2 = clock.getCalibration(); 55 | System.out.println(cal2); 56 | assertEquals(-100, cal2.internal()); 57 | assertEquals(1000, cal2.external()); 58 | assertEquals(8, cal2.rateNum()); 59 | assertEquals(5, cal2.rateDenom()); 60 | 61 | Clock.Calibration cal3 = clock.getCalibration(); 62 | assertEquals(cal2, cal3); 63 | assertEquals(cal2.hashCode(), cal3.hashCode()); 64 | assertNotEquals(cal1, cal3); 65 | 66 | } 67 | 68 | 69 | } 70 | -------------------------------------------------------------------------------- /test/org/freedesktop/gstreamer/ContextTest.java: -------------------------------------------------------------------------------- 1 | package org.freedesktop.gstreamer; 2 | 3 | import org.freedesktop.gstreamer.glib.Natives; 4 | import org.freedesktop.gstreamer.lowlevel.GstContextAPI; 5 | import org.freedesktop.gstreamer.lowlevel.GstContextPtr; 6 | import org.junit.AfterClass; 7 | import org.junit.Assert; 8 | import org.junit.BeforeClass; 9 | import org.junit.Test; 10 | 11 | public class ContextTest { 12 | 13 | @BeforeClass 14 | public static void setUpClass() throws Exception { 15 | Gst.init("test"); 16 | } 17 | 18 | @AfterClass 19 | public static void tearDownClass() throws Exception { 20 | Gst.deinit(); 21 | } 22 | 23 | @Test 24 | public void testConstruction() { 25 | GstContextAPI contextApi = GstContextAPI.GSTCONTEXT_API; 26 | String contextType = "whatever"; 27 | try (Context context = new Context(contextType)) { 28 | GstContextPtr gstContextPtr = Natives.getPointer(context).as(GstContextPtr.class, GstContextPtr::new); 29 | 30 | // Context type. 31 | Assert.assertEquals(contextType, context.getContextType()); 32 | Assert.assertTrue(contextApi.gst_context_has_context_type(gstContextPtr, contextType)); 33 | Assert.assertFalse(contextApi.gst_context_has_context_type(gstContextPtr, contextType + ".something-else")); 34 | 35 | // Default is persistent. 36 | Assert.assertTrue(contextApi.gst_context_is_persistent(gstContextPtr)); 37 | 38 | Assert.assertNotNull(context.getWritableStructure()); 39 | } 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /test/org/freedesktop/gstreamer/EnumTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008 Wayne Meissner 3 | * 4 | * This file is part of gstreamer-java. 5 | * 6 | * gstreamer-java is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * gstreamer-java is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with gstreamer-java. If not, see . 18 | */ 19 | 20 | package org.freedesktop.gstreamer; 21 | 22 | import static org.junit.Assert.assertEquals; 23 | 24 | import org.freedesktop.gstreamer.lowlevel.EnumMapper; 25 | import org.freedesktop.gstreamer.lowlevel.annotations.DefaultEnumValue; 26 | import org.junit.After; 27 | import org.junit.AfterClass; 28 | import org.junit.Before; 29 | import org.junit.BeforeClass; 30 | import org.junit.Test; 31 | 32 | /** 33 | * 34 | * @author wayne 35 | */ 36 | public class EnumTest { 37 | 38 | public EnumTest() { 39 | } 40 | 41 | @BeforeClass 42 | public static void setUpClass() throws Exception { 43 | Gst.init("EnumTest", new String[] {}); 44 | } 45 | 46 | @AfterClass 47 | public static void tearDownClass() throws Exception { 48 | Gst.deinit(); 49 | } 50 | 51 | @Before 52 | public void setUp() { 53 | } 54 | 55 | @After 56 | public void tearDown() { 57 | } 58 | private static enum TestEnum { 59 | FOO, 60 | @DefaultEnumValue 61 | BAR; 62 | } 63 | // TODO add test methods here. 64 | // The methods must be annotated with annotation @Test. For example: 65 | // 66 | // @Test 67 | // public void hello() {} 68 | @Test public void valueOfInt() { 69 | TestEnum e = EnumMapper.getInstance().valueOf(0xdeadbeef, TestEnum.class); 70 | assertEquals("Wrong value returned for the default", TestEnum.BAR, e); 71 | } 72 | } -------------------------------------------------------------------------------- /test/org/freedesktop/gstreamer/GLibTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of gstreamer-java. 3 | * 4 | * gstreamer-java is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser 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 | * gstreamer-java 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 Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with gstreamer-java. If not, see . 16 | */ 17 | package org.freedesktop.gstreamer; 18 | 19 | import org.freedesktop.gstreamer.glib.GLib; 20 | import static org.junit.Assert.assertEquals; 21 | import org.junit.Test; 22 | 23 | public class GLibTest { 24 | 25 | @Test 26 | public void getEnv() { 27 | String user = GLib.getEnv("USER"); 28 | String pwd = GLib.getEnv("PWD"); 29 | System.out.println("user: " + user); 30 | System.out.println("path: " + pwd); 31 | } 32 | 33 | @Test 34 | public void setUnsetEnv() { 35 | 36 | // set environment 37 | GLib.setEnv("TESTVAR", "foo", true); 38 | 39 | // get environment 40 | assertEquals("could not set TESTVAR!", GLib.getEnv("TESTVAR"), "foo"); 41 | 42 | // unset 43 | GLib.unsetEnv("TESTVAR"); 44 | assertEquals("could not unset TESTVAR!", GLib.getEnv("TESTVAR"), null); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /test/org/freedesktop/gstreamer/GhostPadTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007 Wayne Meissner 3 | * 4 | * This file is part of gstreamer-java. 5 | * 6 | * gstreamer-java is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * gstreamer-java is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with gstreamer-java. If not, see . 18 | */ 19 | 20 | package org.freedesktop.gstreamer; 21 | 22 | import org.junit.After; 23 | import org.junit.AfterClass; 24 | import org.junit.Before; 25 | import org.junit.BeforeClass; 26 | import org.junit.Test; 27 | 28 | /** 29 | * 30 | * @author wayne 31 | */ 32 | public class GhostPadTest { 33 | 34 | public GhostPadTest() { 35 | } 36 | 37 | @BeforeClass 38 | public static void setUpClass() throws Exception { 39 | Gst.init("GhostPadTest", new String[] {}); 40 | } 41 | 42 | @AfterClass 43 | public static void tearDownClass() throws Exception { 44 | Gst.deinit(); 45 | } 46 | 47 | @Before 48 | public void setUp() { 49 | } 50 | 51 | @After 52 | public void tearDown() { 53 | } 54 | 55 | // TODO add test methods here. 56 | // The methods must be annotated with annotation @Test. For example: 57 | // 58 | // @Test 59 | // public void hello() {} 60 | @Test 61 | public void newGhostPad() { 62 | Element fakesink = ElementFactory.make("fakesink", "fs"); 63 | @SuppressWarnings("unused") 64 | GhostPad gpad = new GhostPad("ghostsink", fakesink.getStaticPad("sink")); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /test/org/freedesktop/gstreamer/PadProbeTypeTest.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 . 17 | */ 18 | package org.freedesktop.gstreamer; 19 | 20 | import java.lang.reflect.Field; 21 | import java.util.Set; 22 | import org.freedesktop.gstreamer.glib.NativeFlags; 23 | import org.freedesktop.gstreamer.lowlevel.GstPadAPI; 24 | import org.junit.Test; 25 | 26 | import static org.junit.Assert.*; 27 | 28 | public class PadProbeTypeTest { 29 | 30 | 31 | @Test 32 | public void testCombinations() throws Exception { 33 | for (Field field : PadProbeType.class.getFields()) { 34 | if (Set.class.isAssignableFrom(field.getType())) { 35 | Set flags = (Set) field.get(null); 36 | // System.out.println(field.getName() + " : " + flags); 37 | Field nativeField = GstPadAPI.class.getField("GST_PAD_PROBE_TYPE_" + field.getName()); 38 | assertEquals(NativeFlags.toInt(flags), nativeField.get(null)); 39 | } 40 | } 41 | } 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /test/org/freedesktop/gstreamer/PluginFeatureTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of gstreamer-java. 3 | * 4 | * gstreamer-java is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU Lesser 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 | * gstreamer-java 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 Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public License 15 | * along with gstreamer-java. If not, see . 16 | */ 17 | package org.freedesktop.gstreamer; 18 | 19 | import org.junit.AfterClass; 20 | import org.junit.Test; 21 | import static org.junit.Assert.*; 22 | import org.junit.BeforeClass; 23 | 24 | public class PluginFeatureTest { 25 | private static PluginFeature decodebinFeature; 26 | 27 | @BeforeClass 28 | public static void setUpClass() throws Exception { 29 | Gst.init("PluginTest", new String[] {}); 30 | decodebinFeature = Registry.get().lookupFeature("decodebin"); 31 | } 32 | 33 | @AfterClass 34 | public static void tearDownClass() throws Exception { 35 | Gst.deinit(); 36 | } 37 | 38 | @Test 39 | public void testToString() { 40 | assertEquals("decodebin", decodebinFeature.toString()); 41 | } 42 | 43 | @Test 44 | public void testGetName() { 45 | assertEquals("decodebin", decodebinFeature.getName()); 46 | } 47 | 48 | @Test 49 | public void testGetRank() { 50 | assertEquals(0, decodebinFeature.getRank()); 51 | } 52 | 53 | @Test 54 | public void testCheckVersion() { 55 | assertTrue(decodebinFeature.checkVersion(0, 0, 1)); 56 | } 57 | 58 | @Test 59 | public void testGetPluginName() { 60 | assertEquals("playback", decodebinFeature.getPluginName()); 61 | } 62 | 63 | public void testGetPlugin() { 64 | Plugin plugin = decodebinFeature.getPlugin(); 65 | assertNotNull(plugin); 66 | assertEquals("playback", plugin.getName()); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /test/org/freedesktop/gstreamer/StreamInfoTest.java: -------------------------------------------------------------------------------- 1 | package org.freedesktop.gstreamer; 2 | 3 | -------------------------------------------------------------------------------- /test/org/freedesktop/gstreamer/TestPipe.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007, 2008 Wayne Meissner 3 | * 4 | * This file is part of gstreamer-java. 5 | * 6 | * gstreamer-java is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * gstreamer-java is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with gstreamer-java. If not, see . 18 | */ 19 | 20 | package org.freedesktop.gstreamer; 21 | 22 | import java.util.concurrent.CountDownLatch; 23 | import java.util.concurrent.TimeUnit; 24 | 25 | class TestPipe { 26 | 27 | public final Pipeline pipe = new Pipeline("pipe"); 28 | public final Element src = ElementFactory.make("fakesrc", "src"); 29 | public final Element sink = ElementFactory.make("fakesink", "sink"); 30 | public final String name; 31 | private final CountDownLatch latch = new CountDownLatch(1); 32 | 33 | public TestPipe() { 34 | this(getInvokingMethod()); 35 | } 36 | private static String getInvokingMethod() { 37 | try { 38 | throw new Exception(); 39 | } catch (Exception ex) { 40 | return ex.getStackTrace()[2].getMethodName(); 41 | } 42 | } 43 | public TestPipe(String name) { 44 | this.name = name; 45 | pipe.addMany(src, sink); 46 | Element.linkMany(src, sink); 47 | } 48 | 49 | public TestPipe run() { 50 | try { 51 | latch.await(250, TimeUnit.MILLISECONDS); 52 | } catch (Exception ex) { 53 | } 54 | return this; 55 | } 56 | 57 | public TestPipe play() { 58 | pipe.play(); 59 | return this; 60 | } 61 | 62 | public Bus getBus() { 63 | return pipe.getBus(); 64 | } 65 | 66 | public void quit() { 67 | latch.countDown(); 68 | } 69 | 70 | public void dispose() { 71 | pipe.stop(); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /test/org/freedesktop/gstreamer/WebRTCBinTest.java: -------------------------------------------------------------------------------- 1 | package org.freedesktop.gstreamer; 2 | 3 | import org.freedesktop.gstreamer.glib.NativeEnum; 4 | import org.freedesktop.gstreamer.webrtc.WebRTCICEGatheringState; 5 | import org.freedesktop.gstreamer.webrtc.WebRTCPeerConnectionState; 6 | import org.junit.Test; 7 | 8 | import static org.junit.Assert.assertEquals; 9 | 10 | public class WebRTCBinTest { 11 | @Test 12 | public void connectionStateTest() { 13 | assertEquals(NativeEnum.fromInt(WebRTCPeerConnectionState.class, 0), WebRTCPeerConnectionState.NEW); 14 | assertEquals(NativeEnum.fromInt(WebRTCPeerConnectionState.class, 1), WebRTCPeerConnectionState.CONNECTING); 15 | assertEquals(NativeEnum.fromInt(WebRTCPeerConnectionState.class, 2), WebRTCPeerConnectionState.CONNECTED); 16 | assertEquals(NativeEnum.fromInt(WebRTCPeerConnectionState.class, 3), WebRTCPeerConnectionState.DISCONNECTED); 17 | assertEquals(NativeEnum.fromInt(WebRTCPeerConnectionState.class, 4), WebRTCPeerConnectionState.FAILED); 18 | assertEquals(NativeEnum.fromInt(WebRTCPeerConnectionState.class, 5), WebRTCPeerConnectionState.CLOSED); 19 | } 20 | 21 | @Test 22 | public void iceGatheringStateTest() { 23 | assertEquals(NativeEnum.fromInt(WebRTCICEGatheringState.class, 0), WebRTCICEGatheringState.NEW); 24 | assertEquals(NativeEnum.fromInt(WebRTCICEGatheringState.class, 1), WebRTCICEGatheringState.GATHERING); 25 | assertEquals(NativeEnum.fromInt(WebRTCICEGatheringState.class, 2), WebRTCICEGatheringState.COMPLETE); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /test/org/freedesktop/gstreamer/util/TestAssumptions.java: -------------------------------------------------------------------------------- 1 | package org.freedesktop.gstreamer.util; 2 | 3 | import org.freedesktop.gstreamer.ElementFactory; 4 | import org.freedesktop.gstreamer.Gst; 5 | import org.junit.Assume; 6 | 7 | /** 8 | * These Assumptions skip Tests if the environmental Properties do not meet the Assumption. 9 | */ 10 | public class TestAssumptions { 11 | /** 12 | * Assume a GStreamer-Installation of at least the specified Version, ignore the Test if not met. 13 | * 14 | * @param major Required Major Version 15 | * @param minor Required Minor Version 16 | */ 17 | public static void requireGstVersion(int major, int minor) { 18 | Assume.assumeTrue(Gst.testVersion(major, minor)); 19 | } 20 | 21 | /** 22 | * Assume a GStreamer installation has the required element. 23 | * 24 | * @param elementType element type 25 | */ 26 | public static void requireElement(String elementType) { 27 | ElementFactory factory = null; 28 | try { 29 | factory = ElementFactory.find(elementType); 30 | } catch (Exception ex) {} 31 | Assume.assumeNotNull(factory); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/org/freedesktop/gstreamer/video/VideoCropMetaTest.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 . 17 | * 18 | */ 19 | package org.freedesktop.gstreamer.video; 20 | 21 | import org.freedesktop.gstreamer.BufferProbeTester; 22 | import org.freedesktop.gstreamer.Gst; 23 | import org.freedesktop.gstreamer.glib.Natives; 24 | import org.freedesktop.gstreamer.lowlevel.GstMetaPtr; 25 | import org.freedesktop.gstreamer.util.TestAssumptions; 26 | import org.junit.AfterClass; 27 | import org.junit.BeforeClass; 28 | import org.junit.Test; 29 | 30 | 31 | 32 | public class VideoCropMetaTest { 33 | 34 | @BeforeClass 35 | public static void beforeClass() { 36 | Gst.init(Gst.getVersion()); 37 | } 38 | 39 | @AfterClass 40 | public static void afterClass() { 41 | Gst.deinit(); 42 | } 43 | 44 | @Test 45 | public void testIterateWithCrop() { 46 | TestAssumptions.requireGstVersion(1, 14); 47 | TestAssumptions.requireElement("fakevideosink"); 48 | BufferProbeTester.test(buffer -> { 49 | buffer.iterateMeta().forEachRemaining(meta -> { 50 | GstMetaPtr ptr = Natives.getPointer(meta).as(GstMetaPtr.class, GstMetaPtr::new); 51 | System.out.println(ptr.getGType().getTypeName()); 52 | System.out.println(ptr.getAPIGType().getTypeName()); 53 | }); 54 | 55 | }, "videotestsrc ! videocrop top=10 left=10 bottom=50 right=50 ! fakevideosink name=sink"); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /test/org/freedesktop/gstreamer/video/VideoTimeCodeConfigTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Petr Lastovka 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 . 17 | * 18 | */ 19 | package org.freedesktop.gstreamer.video; 20 | 21 | import org.freedesktop.gstreamer.glib.NativeFlags; 22 | import org.junit.Before; 23 | import org.junit.Test; 24 | 25 | import static org.junit.Assert.assertEquals; 26 | 27 | import org.freedesktop.gstreamer.lowlevel.GstVideoAPI; 28 | 29 | public class VideoTimeCodeConfigTest { 30 | private GstVideoAPI.GstVideoTimeCodeConfigStruct origStruct; 31 | private VideoTimeCodeConfig codeConfig; 32 | 33 | 34 | @Before 35 | public void setUp() { 36 | origStruct = new GstVideoAPI.GstVideoTimeCodeConfigStruct(); 37 | origStruct.fps_d = 25; 38 | origStruct.fps_n = 1; 39 | origStruct.flags = VideoTimeCodeFlags.GST_VIDEO_TIME_CODE_FLAGS_DROP_FRAME.intValue(); 40 | origStruct.write(); 41 | 42 | codeConfig = new VideoTimeCodeConfig(origStruct); 43 | } 44 | 45 | @Test 46 | public void testGetTimeCodeFlags() { 47 | assertEquals(origStruct.flags, NativeFlags.toInt(codeConfig.getFlags())); 48 | } 49 | 50 | @Test 51 | public void testGetFramerateNumerator() { 52 | assertEquals(origStruct.fps_n, codeConfig.getNumerator()); 53 | } 54 | 55 | @Test 56 | public void testGetFramerateDenominator() { 57 | assertEquals(origStruct.fps_d, codeConfig.getDenominator()); 58 | } 59 | } -------------------------------------------------------------------------------- /test/org/freedesktop/gstreamer/video/VideoTimeCodeFlagsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Petr Lastovka 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 . 17 | * 18 | */ 19 | package org.freedesktop.gstreamer.video; 20 | 21 | import java.util.Arrays; 22 | import java.util.Collection; 23 | import org.junit.Test; 24 | import org.junit.runner.RunWith; 25 | import org.junit.runners.Parameterized; 26 | 27 | import static org.junit.Assert.assertEquals; 28 | 29 | 30 | @RunWith(Parameterized.class) 31 | public class VideoTimeCodeFlagsTest { 32 | 33 | private final VideoTimeCodeFlags flags; 34 | private final int intValue; 35 | 36 | @Parameterized.Parameters 37 | public static Collection data() { 38 | return Arrays.asList( 39 | new Object[][]{ 40 | // {VideoTimeCodeFlags.GST_VIDEO_TIME_CODE_FLAGS_NONE, 0}, 41 | {VideoTimeCodeFlags.GST_VIDEO_TIME_CODE_FLAGS_DROP_FRAME, 1}, 42 | {VideoTimeCodeFlags.GST_VIDEO_TIME_CODE_FLAGS_INTERLACED, 2} 43 | }); 44 | } 45 | 46 | public VideoTimeCodeFlagsTest(VideoTimeCodeFlags flags, int intValue) { 47 | this.flags = flags; 48 | this.intValue = intValue; 49 | } 50 | 51 | @Test 52 | public void testIntValue() { 53 | assertEquals(intValue,flags.intValue()); 54 | } 55 | } --------------------------------------------------------------------------------