Class Message
- All Implemented Interfaces:
Proxy
GstMiniObject
with a generic
GstStructure
as the content. This allows for writing custom messages without
requiring an API change while allowing a wide range of different types
of messages.
Messages are posted by objects in the pipeline and are passed to the
application using the GstBus
.
The basic use pattern of posting a message on a GstBus
is as follows:
gst_bus_post (bus, gst_message_new_eos());
A GstElement
usually posts messages on the bus provided by the parent
container using gst_element_post_message().
-
Constructor Summary
ConstructorDescriptionMessage()
Allocate a new Message.Allocate a new Message.Message
(MemorySegment address) Create a Message proxy instance for the provided memory address.Message
(MiniObject miniObject, Set<MessageType> type, long timestamp, GstObject src, int seqnum, Mutex lock, Cond cond) Allocate a new Message with the fields set to the provided values.Message
(MiniObject miniObject, Set<MessageType> type, long timestamp, GstObject src, int seqnum, Mutex lock, Cond cond, Arena arena) Allocate a new Message with the fields set to the provided values. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRedirectEntry
(String location, @Nullable TagList tagList, @Nullable Structure entryStruct) Creates and appends a new entry.static Message
application
(@Nullable GstObject src, Structure structure) Create a new application-typed message.static Message
The message is posted when elements completed an ASYNC state change.static Message
asyncStart
(@Nullable GstObject src) This message is posted by elements when they start an ASYNC state change.static Message
Create a new buffering message.static Message
Create a clock lost message.static Message
clockProvide
(@Nullable GstObject src, Clock clock, boolean ready) Create a clock provide message.copy()
Creates a copy of the message.static Message
custom
(Set<MessageType> type, @Nullable GstObject src, @Nullable Structure structure) Create a new custom-typed message.static Message
custom
(MessageType type, @Nullable GstObject src, @Nullable Structure structure) Create a new custom-typed message.static Message
deviceAdded
(@Nullable GstObject src, Device device) Creates a new device-added message.static Message
deviceChanged
(@Nullable GstObject src, Device device, Device changedDevice) Creates a new device-changed message.static Message
deviceRemoved
(@Nullable GstObject src, Device device) Creates a new device-removed message.static Message
durationChanged
(@Nullable GstObject src) Create a new duration changed message.static Message
Create a new element-specific message.static Message
Create a new eos message.static Message
Create a new error message.static Message
errorWithDetails
(@Nullable GstObject src, GError error, String debug, @Nullable Structure details) Create a new error message.static MemoryLayout
The memory layout of the native struct.long
int
Retrieve the sequence number of a message.Extracts the object managing the streaming thread from this Message.Access the structure of the message.static Type
getType()
Get the GType of the Message classboolean
Checks if this Message has the givenname
.static Message
haveContext
(@Nullable GstObject src, Context context) This message is posted when an element has a new localGstContext
.static Message
Create a new info message.static Message
infoWithDetails
(@Nullable GstObject src, GError error, String debug, @Nullable Structure details) Create a new info message.static Message
instantRateRequest
(@Nullable GstObject src, double rateMultiplier) Creates a new instant-rate-request message.static Message
This message can be posted by elements when their latency requirements have changed.static Message
needContext
(@Nullable GstObject src, String contextType) This message is posted when an element needs a specificGstContext
.static Message
Create a new clock message.void
parseAsyncDone
(@Nullable ClockTime runningTime) Extract the running_time from the async_done message.void
parseBuffering
(@Nullable Out<Integer> percent) Extracts the buffering percent from the GstMessage.void
parseBufferingStats
(@Nullable Out<BufferingMode> mode, @Nullable Out<Integer> avgIn, @Nullable Out<Integer> avgOut, @Nullable Out<Long> bufferingLeft) Extracts the buffering stats values from this Message.void
parseClockLost
(@Nullable Out<Clock> clock) Extracts the lost clock from the GstMessage.void
parseClockProvide
(@Nullable Out<Clock> clock, @Nullable Out<Boolean> ready) Extracts the clock and ready flag from the GstMessage.boolean
parseContextType
(@Nullable Out<String> contextType) Parse a context type from an existing GST_MESSAGE_NEED_CONTEXT message.void
parseDeviceAdded
(@Nullable Out<Device> device) Parses a device-added message.void
parseDeviceChanged
(@Nullable Out<Device> device, @Nullable Out<Device> changedDevice) Parses a device-changed message.void
parseDeviceRemoved
(@Nullable Out<Device> device) Parses a device-removed message.void
parseError
(@Nullable Out<GError> gerror, @Nullable Out<String> debug) Extracts the GError and debug string from the GstMessage.void
parseErrorDetails
(@Nullable Out<Structure> structure) Returns the optional details structure, may be NULL if none.boolean
parseGroupId
(@Nullable Out<Integer> groupId) Extract the group from the STREAM_START message.void
parseHaveContext
(@Nullable Out<Context> context) Extract the context from the HAVE_CONTEXT message.void
Extracts the GError and debug string from the GstMessage.void
parseInfoDetails
(@Nullable Out<Structure> structure) Returns the optional details structure, may be NULL if none The returned structure must not be freed.void
parseInstantRateRequest
(@Nullable Out<Double> rateMultiplier) Parses the rate_multiplier from the instant-rate-request message.void
parseNewClock
(@Nullable Out<Clock> clock) Extracts the new clock from the GstMessage.void
parseProgress
(@Nullable Out<ProgressType> type, @Nullable Out<String> code, @Nullable Out<String> text) Parses the progresstype
,code
andtext
.void
parsePropertyNotify
(@Nullable Out<GstObject> object, @Nullable Out<String> propertyName, @Nullable Out<Value> propertyValue) Parses a property-notify message.void
parseQos
(@Nullable Out<Boolean> live, @Nullable Out<Long> runningTime, @Nullable Out<Long> streamTime, @Nullable Out<Long> timestamp, @Nullable Out<Long> duration) Extract the timestamps and live status from the QoS message.void
parseQosStats
(@Nullable Out<Format> format, @Nullable Out<Long> processed, @Nullable Out<Long> dropped) Extract the QoS stats representing the history of the current continuous pipeline playback period.void
parseQosValues
(@Nullable Out<Long> jitter, @Nullable Out<Double> proportion, @Nullable Out<Integer> quality) Extract the QoS values that have been calculated/analysed from the QoS datavoid
parseRedirectEntry
(long entryIndex, @Nullable Out<String> location, @Nullable Out<TagList> tagList, @Nullable Out<Structure> entryStruct) Parses the location and/or structure from the entry with the given index.void
parseRequestState
(@Nullable Out<State> state) Extract the requested state from the request_state message.void
parseResetTime
(@Nullable ClockTime runningTime) Extract the running-time from the RESET_TIME message.void
parseSegmentDone
(@Nullable Out<Format> format, @Nullable Out<Long> position) Extracts the position and format from the segment done message.void
parseSegmentStart
(@Nullable Out<Format> format, @Nullable Out<Long> position) Extracts the position and format from the segment start message.void
parseStateChanged
(@Nullable Out<State> oldstate, @Nullable Out<State> newstate, @Nullable Out<State> pending) Extracts the old and new states from the GstMessage.void
parseStepDone
(@Nullable Out<Format> format, @Nullable Out<Long> amount, @Nullable Out<Double> rate, @Nullable Out<Boolean> flush, @Nullable Out<Boolean> intermediate, @Nullable Out<Long> duration, @Nullable Out<Boolean> eos) Extract the values the step_done message.void
parseStepStart
(@Nullable Out<Boolean> active, @Nullable Out<Format> format, @Nullable Out<Long> amount, @Nullable Out<Double> rate, @Nullable Out<Boolean> flush, @Nullable Out<Boolean> intermediate) Extract the values from step_start message.void
parseStreamCollection
(@Nullable Out<StreamCollection> collection) Parses a stream-collection message.void
parseStreamsSelected
(@Nullable Out<StreamCollection> collection) Parses a streams-selected message.void
parseStreamStatus
(Out<StreamStatusType> type, Out<Element> owner) Extracts the stream status type and owner the GstMessage.void
parseStructureChange
(Out<StructureChangeType> type, @Nullable Out<Element> owner, @Nullable Out<Boolean> busy) Extracts the change type and completion status from the GstMessage.void
Extracts the tag list from the GstMessage.void
Extract the TOC from theGstMessage
.void
parseWarning
(@Nullable Out<GError> gerror, @Nullable Out<String> debug) Extracts the GError and debug string from the GstMessage.void
parseWarningDetails
(@Nullable Out<Structure> structure) Returns the optional details structure, may be NULL if none The returned structure must not be freed.static Message
progress
(@Nullable GstObject src, ProgressType type, String code, String text) Progress messages are posted by elements when they use an asynchronous task to perform actions triggered by a state change.static Message
propertyNotify
(GstObject src, String propertyName, @Nullable Value val) static Message
qos
(@Nullable GstObject src, boolean live, long runningTime, long streamTime, long timestamp, long duration) A QOS message is posted on the bus whenever an element decides to drop a buffer because of QoS reasons or whenever it changes its processing strategy because of QoS reasons (quality adjustments such as processing at lower accuracy).readCond()
Read the value of the fieldcond
.readLock()
Read the value of the fieldlock
.Read the value of the fieldmini_object
.int
Read the value of the fieldseqnum
.readSrc()
Read the value of the fieldsrc
.long
Read the value of the fieldtimestamp
.readType()
Read the value of the fieldtype
.static Message
redirect
(@Nullable GstObject src, String location, @Nullable TagList tagList, @Nullable Structure entryStruct) Creates a new redirect message and adds a new entry to it.ref()
Convenience macro to increase the reference count of the message.static boolean
Modifies a pointer to aGstMessage
to point to a differentGstMessage
.static Message
requestState
(@Nullable GstObject src, State state) This message can be posted by elements when they want to have their state changed.static Message
This message is posted when the pipeline running-time should be reset torunningTime
, like after a flushing seek.static Message
segmentDone
(@Nullable GstObject src, Format format, long position) Create a new segment done message.static Message
segmentStart
(@Nullable GstObject src, Format format, long position) Create a new segment message.void
setBufferingStats
(BufferingMode mode, int avgIn, int avgOut, long bufferingLeft) Configures the buffering stats values in this Message.void
setGroupId
(int groupId) Sets the group id on the stream-start message.void
setQosStats
(Format format, long processed, long dropped) Set the QoS stats representing the history of the current continuous pipeline playback period.void
setQosValues
(long jitter, double proportion, int quality) Set the QoS values that have been calculated/analysed from the QoS datavoid
setSeqnum
(int seqnum) Set the sequence number of a message.void
setStreamStatusObject
(Value object) Configures the object handling the streaming thread.static Message
stateChanged
(@Nullable GstObject src, State oldstate, State newstate, State pending) Create a state change message.static Message
stateDirty
(@Nullable GstObject src) Create a state dirty message.static Message
stepDone
(@Nullable GstObject src, Format format, long amount, double rate, boolean flush, boolean intermediate, long duration, boolean eos) This message is posted by elements when they complete a part, whenintermediate
set totrue
, or a complete step operation.static Message
stepStart
(@Nullable GstObject src, boolean active, Format format, long amount, double rate, boolean flush, boolean intermediate) This message is posted by elements when they accept or activate a new step event foramount
informat
.static Message
streamCollection
(@Nullable GstObject src, StreamCollection collection) Creates a new stream-collection message.static Message
streamsSelected
(@Nullable GstObject src, StreamCollection collection) Creates a new steams-selected message.void
streamsSelectedAdd
(Stream stream) Adds thestream
to the this Message.int
Returns the number of streams contained in the this Message.streamsSelectedGetStream
(int idx) Retrieves theGstStream
with indexindex
from the this Message.static Message
streamStart
(@Nullable GstObject src) Create a new stream_start message.static Message
streamStatus
(@Nullable GstObject src, StreamStatusType type, Element owner) Create a new stream status message.static Message
structureChange
(@Nullable GstObject src, StructureChangeType type, Element owner, boolean busy) Create a new structure change message.static Message
Create a new tag message.static boolean
Modifies a pointer to aGstMessage
to point to a differentGstMessage
.static Message
Create a new TOC message.void
unref()
Convenience macro to decrease the reference count of the message, possibly freeing it.static Message
Create a new warning message.static Message
warningWithDetails
(@Nullable GstObject src, GError error, String debug, @Nullable Structure details) Create a new warning message.Get a writable version of the structure.void
Write a value in the fieldcond
.void
Write a value in the fieldlock
.void
writeMiniObject
(MiniObject miniObject) Write a value in the fieldmini_object
.void
writeSeqnum
(int seqnum) Write a value in the fieldseqnum
.void
Write a value in the fieldsrc
.void
writeTimestamp
(long timestamp) Write a value in the fieldtimestamp
.void
writeType
(Set<MessageType> type) Write a value in the fieldtype
.Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Message
Create a Message proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
Message
Allocate a new Message.- Parameters:
arena
- to control the memory allocation scope
-
Message
public Message()Allocate a new Message. The memory is allocated withArena.ofAuto()
. -
Message
public Message(MiniObject miniObject, Set<MessageType> type, long timestamp, GstObject src, int seqnum, Mutex lock, Cond cond, Arena arena) Allocate a new Message with the fields set to the provided values.- Parameters:
miniObject
- value for the fieldminiObject
type
- value for the fieldtype
timestamp
- value for the fieldtimestamp
src
- value for the fieldsrc
seqnum
- value for the fieldseqnum
lock
- value for the fieldlock
cond
- value for the fieldcond
arena
- to control the memory allocation scope
-
Message
public Message(MiniObject miniObject, Set<MessageType> type, long timestamp, GstObject src, int seqnum, Mutex lock, Cond cond) Allocate a new Message with the fields set to the provided values. The memory is allocated withArena.ofAuto()
.- Parameters:
miniObject
- value for the fieldminiObject
type
- value for the fieldtype
timestamp
- value for the fieldtimestamp
src
- value for the fieldsrc
seqnum
- value for the fieldseqnum
lock
- value for the fieldlock
cond
- value for the fieldcond
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readMiniObject
Read the value of the fieldmini_object
.- Returns:
- The value of the field
mini_object
-
writeMiniObject
Write a value in the fieldmini_object
.- Parameters:
miniObject
- The new value for the fieldmini_object
-
readType
Read the value of the fieldtype
.- Returns:
- The value of the field
type
-
writeType
Write a value in the fieldtype
.- Parameters:
type
- The new value for the fieldtype
-
readTimestamp
public long readTimestamp()Read the value of the fieldtimestamp
.- Returns:
- The value of the field
timestamp
-
writeTimestamp
public void writeTimestamp(long timestamp) Write a value in the fieldtimestamp
.- Parameters:
timestamp
- The new value for the fieldtimestamp
-
readSrc
-
writeSrc
Write a value in the fieldsrc
.- Parameters:
src
- The new value for the fieldsrc
-
readSeqnum
public int readSeqnum()Read the value of the fieldseqnum
.- Returns:
- The value of the field
seqnum
-
writeSeqnum
public void writeSeqnum(int seqnum) Write a value in the fieldseqnum
.- Parameters:
seqnum
- The new value for the fieldseqnum
-
readLock
-
writeLock
Write a value in the fieldlock
.- Parameters:
lock
- The new value for the fieldlock
-
readCond
-
writeCond
Write a value in the fieldcond
.- Parameters:
cond
- The new value for the fieldcond
-
application
Create a new application-typed message. GStreamer will never create these messages; they are a gift from us to you. Enjoy.- Parameters:
src
- The object originating the message.structure
- the structure for the message. The message will take ownership of the structure.- Returns:
- The new application message.
MT safe.
-
asyncDone
The message is posted when elements completed an ASYNC state change.runningTime
contains the time of the desired running_time when this elements goes to PLAYING. A value ofGST_CLOCK_TIME_NONE
forrunningTime
means that the element has no clock interaction and thus doesn't care about the running_time of the pipeline.- Parameters:
src
- The object originating the message.runningTime
- the desired running_time- Returns:
- The new async_done message.
MT safe.
-
asyncStart
-
buffering
Create a new buffering message. This message can be posted by an element that needs to buffer data before it can continue processing.percent
should be a value between 0 and 100. A value of 100 means that the buffering completed.When
percent
is < 100 the application should PAUSE a PLAYING pipeline. Whenpercent
is 100, the application can set the pipeline (back) to PLAYING. The application must be prepared to receive BUFFERING messages in the PREROLLING state and may only set the pipeline to PLAYING after receiving a message withpercent
set to 100, which can happen after the pipeline completed prerolling.MT safe.
- Parameters:
src
- The object originating the message.percent
- The buffering percent- Returns:
- The new buffering message.
-
clockLost
Create a clock lost message. This message is posted whenever the clock is not valid anymore.If this message is posted by the pipeline, the pipeline will select a new clock again when it goes to PLAYING. It might therefore be needed to set the pipeline to PAUSED and PLAYING again.
- Parameters:
src
- The object originating the message.clock
- the clock that was lost- Returns:
- The new clock lost message.
MT safe.
-
clockProvide
Create a clock provide message. This message is posted whenever an element is ready to provide a clock or lost its ability to provide a clock (maybe because it paused or became EOS).This message is mainly used internally to manage the clock selection.
- Parameters:
src
- The object originating the message.clock
- the clock it providesready
-true
if the sender can provide a clock- Returns:
- the new provide clock message.
MT safe.
-
custom
public static Message custom(Set<MessageType> type, @Nullable @Nullable GstObject src, @Nullable @Nullable Structure structure) Create a new custom-typed message. This can be used for anything not handled by other message-specific functions to pass a message to the app. The structure field can benull
.- Parameters:
type
- TheGstMessageType
to distinguish messagessrc
- The object originating the message.structure
- the structure for the message. The message will take ownership of the structure.- Returns:
- The new message.
MT safe.
-
custom
public static Message custom(MessageType type, @Nullable @Nullable GstObject src, @Nullable @Nullable Structure structure) Create a new custom-typed message. This can be used for anything not handled by other message-specific functions to pass a message to the app. The structure field can benull
.- Parameters:
type
- TheGstMessageType
to distinguish messagessrc
- The object originating the message.structure
- the structure for the message. The message will take ownership of the structure.- Returns:
- The new message.
MT safe.
-
deviceAdded
Creates a new device-added message. The device-added message is produced byGstDeviceProvider
or aGstDeviceMonitor
. They announce the appearance of monitored devices.- Parameters:
src
- TheGstObject
that created the messagedevice
- The newGstDevice
- Returns:
- a newly allocated
GstMessage
-
deviceChanged
public static Message deviceChanged(@Nullable @Nullable GstObject src, Device device, Device changedDevice) Creates a new device-changed message. The device-changed message is produced byGstDeviceProvider
or aGstDeviceMonitor
. They announce that a device properties has changed anddevice
represent the new modified version ofchangedDevice
.- Parameters:
src
- TheGstObject
that created the messagedevice
- The newly created device representingchangedDevice
with its new configuration.changedDevice
- The old version of the device.- Returns:
- a newly allocated
GstMessage
-
deviceRemoved
Creates a new device-removed message. The device-removed message is produced byGstDeviceProvider
or aGstDeviceMonitor
. They announce the disappearance of monitored devices.- Parameters:
src
- TheGstObject
that created the messagedevice
- The removedGstDevice
- Returns:
- a newly allocated
GstMessage
-
durationChanged
Create a new duration changed message. This message is posted by elements that know the duration of a stream when the duration changes. This message is received by bins and is used to calculate the total duration of a pipeline.- Parameters:
src
- The object originating the message.- Returns:
- The new duration-changed message.
MT safe.
-
element
Create a new element-specific message. This is meant as a generic way of allowing one-way communication from an element to an application, for example "the firewire cable was unplugged". The format of the message should be documented in the element's documentation. The structure field can benull
.- Parameters:
src
- The object originating the message.structure
- The structure for the message. The message will take ownership of the structure.- Returns:
- The new element message.
MT safe.
-
eos
Create a new eos message. This message is generated and posted in the sink elements of a GstBin. The bin will only forward the EOS message to the application if all sinks have posted an EOS message.- Parameters:
src
- The object originating the message.- Returns:
- The new eos message.
MT safe.
-
error
Create a new error message. The message will copyerror
anddebug
. This message is posted by element when a fatal event occurred. The pipeline will probably (partially) stop. The application receiving this message should stop the pipeline.- Parameters:
src
- The object originating the message.error
- The GError for this message.debug
- A debugging string.- Returns:
- the new error message.
MT safe.
-
errorWithDetails
public static Message errorWithDetails(@Nullable @Nullable GstObject src, GError error, String debug, @Nullable @Nullable Structure details) Create a new error message. The message will copyerror
anddebug
. This message is posted by element when a fatal event occurred. The pipeline will probably (partially) stop. The application receiving this message should stop the pipeline.- Parameters:
src
- The object originating the message.error
- The GError for this message.debug
- A debugging string.details
- A GstStructure with details- Returns:
- the new error message.
-
haveContext
-
info
Create a new info message. The message will make copies oferror
anddebug
.- Parameters:
src
- The object originating the message.error
- The GError for this message.debug
- A debugging string.- Returns:
- the new info message.
MT safe.
-
infoWithDetails
public static Message infoWithDetails(@Nullable @Nullable GstObject src, GError error, String debug, @Nullable @Nullable Structure details) Create a new info message. The message will make copies oferror
anddebug
.- Parameters:
src
- The object originating the message.error
- The GError for this message.debug
- A debugging string.details
- A GstStructure with details- Returns:
- the new warning message.
-
instantRateRequest
Creates a new instant-rate-request message. Elements handling the instant-rate-change event must post this message. The message is handled at the pipeline, and allows the pipeline to select the running time when the rate change should happen and to send anGSTEVENTINSTANTRATESYNCTIME
event to notify the elements in the pipeline.- Parameters:
src
- TheGstObject
that posted the messagerateMultiplier
- the rate multiplier factor that should be applied- Returns:
- a newly allocated
GstMessage
-
latency
-
needContext
This message is posted when an element needs a specificGstContext
.- Parameters:
src
- The object originating the message.contextType
- The context type that is needed- Returns:
- The new need-context message.
MT safe.
-
newClock
Create a new clock message. This message is posted whenever the pipeline selects a new clock for the pipeline.- Parameters:
src
- The object originating the message.clock
- the new selected clock- Returns:
- The new new clock message.
MT safe.
-
progress
public static Message progress(@Nullable @Nullable GstObject src, ProgressType type, String code, String text) Progress messages are posted by elements when they use an asynchronous task to perform actions triggered by a state change.code
contains a well defined string describing the action.text
should contain a user visible string detailing the current action.- Parameters:
src
- The object originating the message.type
- aGstProgressType
code
- a progress codetext
- free, user visible text describing the progress- Returns:
- The new qos message.
-
propertyNotify
-
qos
public static Message qos(@Nullable @Nullable GstObject src, boolean live, long runningTime, long streamTime, long timestamp, long duration) A QOS message is posted on the bus whenever an element decides to drop a buffer because of QoS reasons or whenever it changes its processing strategy because of QoS reasons (quality adjustments such as processing at lower accuracy).This message can be posted by an element that performs synchronisation against the clock (live) or it could be dropped by an element that performs QoS because of QOS events received from a downstream element (!live).
runningTime
,streamTime
,timestamp
,duration
should be set to the respective running-time, stream-time, timestamp and duration of the (dropped) buffer that generated the QoS event. Values can be left to GST_CLOCK_TIME_NONE when unknown.- Parameters:
src
- The object originating the message.live
- if the message was generated by a live elementrunningTime
- the running time of the buffer that generated the messagestreamTime
- the stream time of the buffer that generated the messagetimestamp
- the timestamps of the buffer that generated the messageduration
- the duration of the buffer that generated the message- Returns:
- The new qos message.
MT safe.
-
redirect
public static Message redirect(@Nullable @Nullable GstObject src, String location, @Nullable @Nullable TagList tagList, @Nullable @Nullable Structure entryStruct) Creates a new redirect message and adds a new entry to it. Redirect messages are posted when an element detects that the actual data has to be retrieved from a different location. This is useful if such a redirection cannot be handled inside a source element, for example when HTTP 302/303 redirects return a non-HTTP URL.The redirect message can hold multiple entries. The first one is added when the redirect message is created, with the given location, tag_list, entry_struct arguments. Use gst_message_add_redirect_entry() to add more entries.
Each entry has a location, a tag list, and a structure. All of these are optional. The tag list and structure are useful for additional metadata, such as bitrate statistics for the given location.
By default, message recipients should treat entries in the order they are stored. The recipient should therefore try entry \\
0
first, and if this entry is not acceptable or working, try entry \\1
etc. Senders must make sure that they add entries in this order. However, recipients are free to ignore the order and pick an entry that is "best" for them. One example would be a recipient that scans the entries for the one with the highest bitrate tag.The specified location string is copied. However, ownership over the tag list and structure are transferred to the message.
- Parameters:
src
- TheGstObject
whose property changed (may or may not be aGstElement
)location
- location string for the new entrytagList
- tag list for the new entryentryStruct
- structure for the new entry- Returns:
- a newly allocated
GstMessage
-
requestState
This message can be posted by elements when they want to have their state changed. A typical use case would be an audio server that wants to pause the pipeline because a higher priority stream is being played.- Parameters:
src
- The object originating the message.state
- The new requested state- Returns:
- the new request state message.
MT safe.
-
resetTime
This message is posted when the pipeline running-time should be reset torunningTime
, like after a flushing seek.- Parameters:
src
- The object originating the message.runningTime
- the requested running-time- Returns:
- The new reset_time message.
MT safe.
-
segmentDone
Create a new segment done message. This message is posted by elements that finish playback of a segment as a result of a segment seek. This message is received by the application after all elements that posted a segment_start have posted the segment_done.- Parameters:
src
- The object originating the message.format
- The format of the position being doneposition
- The position of the segment being done- Returns:
- the new segment done message.
MT safe.
-
segmentStart
Create a new segment message. This message is posted by elements that start playback of a segment as a result of a segment seek. This message is not received by the application but is used for maintenance reasons in container elements.- Parameters:
src
- The object originating the message.format
- The format of the position being playedposition
- The position of the segment being played- Returns:
- the new segment start message.
MT safe.
-
stateChanged
public static Message stateChanged(@Nullable @Nullable GstObject src, State oldstate, State newstate, State pending) Create a state change message. This message is posted whenever an element changed its state.- Parameters:
src
- The object originating the message.oldstate
- the previous statenewstate
- the new (current) statepending
- the pending (target) state- Returns:
- the new state change message.
MT safe.
-
stateDirty
Create a state dirty message. This message is posted whenever an element changed its state asynchronously and is used internally to update the states of container objects.- Parameters:
src
- The object originating the message- Returns:
- the new state dirty message.
MT safe.
-
stepDone
public static Message stepDone(@Nullable @Nullable GstObject src, Format format, long amount, double rate, boolean flush, boolean intermediate, long duration, boolean eos) This message is posted by elements when they complete a part, whenintermediate
set totrue
, or a complete step operation.duration
will contain the amount of time (in GST_FORMAT_TIME) of the steppedamount
of media in formatformat
.- Parameters:
src
- The object originating the message.format
- the format ofamount
amount
- the amount of stepped datarate
- the rate of the stepped amountflush
- is this an flushing stepintermediate
- is this an intermediate stepduration
- the duration of the dataeos
- the step caused EOS- Returns:
- the new step_done message.
MT safe.
-
stepStart
public static Message stepStart(@Nullable @Nullable GstObject src, boolean active, Format format, long amount, double rate, boolean flush, boolean intermediate) This message is posted by elements when they accept or activate a new step event foramount
informat
.active
is set tofalse
when the element accepted the new step event and has queued it for execution in the streaming threads.active
is set totrue
when the element has activated the step operation and is now ready to start executing the step in the streaming thread. After this message is emitted, the application can queue a new step operation in the element.- Parameters:
src
- The object originating the message.active
- if the step is active or queuedformat
- the format ofamount
amount
- the amount of stepped datarate
- the rate of the stepped amountflush
- is this an flushing stepintermediate
- is this an intermediate step- Returns:
- The new step_start message.
MT safe.
-
streamCollection
public static Message streamCollection(@Nullable @Nullable GstObject src, StreamCollection collection) Creates a new stream-collection message. The message is used to announce newGstStreamCollection
- Parameters:
src
- TheGstObject
that created the messagecollection
- TheGstStreamCollection
- Returns:
- a newly allocated
GstMessage
-
streamStart
Create a new stream_start message. This message is generated and posted in the sink elements of a GstBin. The bin will only forward the STREAM_START message to the application if all sinks have posted an STREAM_START message.- Parameters:
src
- The object originating the message.- Returns:
- The new stream_start message.
MT safe.
-
streamStatus
public static Message streamStatus(@Nullable @Nullable GstObject src, StreamStatusType type, Element owner) Create a new stream status message. This message is posted when a streaming thread is created/destroyed or when the state changed.- Parameters:
src
- The object originating the message.type
- The stream status type.owner
- the owner element ofsrc
.- Returns:
- the new stream status message.
MT safe.
-
streamsSelected
public static Message streamsSelected(@Nullable @Nullable GstObject src, StreamCollection collection) Creates a new steams-selected message. The message is used to announce that an array of streams has been selected. This is generally in response to aGST_EVENT_SELECT_STREAMS
event, or when an element (such as decodebin3) makes an initial selection of streams.The message also contains the
GstStreamCollection
to which the various streams belong to.Users of gst_message_new_streams_selected() can add the selected streams with gst_message_streams_selected_add().
- Parameters:
src
- TheGstObject
that created the messagecollection
- TheGstStreamCollection
- Returns:
- a newly allocated
GstMessage
-
structureChange
public static Message structureChange(@Nullable @Nullable GstObject src, StructureChangeType type, Element owner, boolean busy) Create a new structure change message. This message is posted when the structure of a pipeline is in the process of being changed, for example when pads are linked or unlinked.src
should be the sinkpad that unlinked or linked.- Parameters:
src
- The object originating the message.type
- The change type.owner
- The owner element ofsrc
.busy
- Whether the structure change is busy.- Returns:
- the new structure change message.
MT safe.
-
tag
Create a new tag message. The message will take ownership of the tag list. The message is posted by elements that discovered a new taglist.- Parameters:
src
- The object originating the message.tagList
- the tag list for the message.- Returns:
- the new tag message.
MT safe.
-
toc
Create a new TOC message. The message is posted by elements that discovered or updated a TOC.- Parameters:
src
- the object originating the message.toc
-GstToc
structure for the message.updated
- whether TOC was updated or not.- Returns:
- a new TOC message.
MT safe.
-
warning
Create a new warning message. The message will make copies oferror
anddebug
.- Parameters:
src
- The object originating the message.error
- The GError for this message.debug
- A debugging string.- Returns:
- the new warning message.
MT safe.
-
warningWithDetails
public static Message warningWithDetails(@Nullable @Nullable GstObject src, GError error, String debug, @Nullable @Nullable Structure details) Create a new warning message. The message will make copies oferror
anddebug
.- Parameters:
src
- The object originating the message.error
- The GError for this message.debug
- A debugging string.details
- A GstStructure with details- Returns:
- the new warning message.
-
replace
public static boolean replace(@Nullable @Nullable Out<Message> oldMessage, @Nullable @Nullable Message newMessage) Modifies a pointer to aGstMessage
to point to a differentGstMessage
. The modification is done atomically (so this is useful for ensuring thread safety in some cases), and the reference counts are updated appropriately (the old message is unreffed, the new one is reffed).Either
newMessage
or theGstMessage
pointed to byoldMessage
may benull
.- Parameters:
oldMessage
- pointer to a pointer to aGstMessage
to be replaced.newMessage
- pointer to aGstMessage
that will replace the message pointed to byoldMessage
.- Returns:
true
ifnewMessage
was different fromoldMessage
-
take
Modifies a pointer to aGstMessage
to point to a differentGstMessage
. This function is similar to gst_message_replace() except that it takes ownership ofnewMessage
.- Parameters:
oldMessage
- pointer to a pointer to aGstMessage
to be replaced.newMessage
- pointer to aGstMessage
that will replace the message pointed to byoldMessage
.- Returns:
true
ifnewMessage
was different fromoldMessage
-
addRedirectEntry
public void addRedirectEntry(String location, @Nullable @Nullable TagList tagList, @Nullable @Nullable Structure entryStruct) Creates and appends a new entry.The specified location string is copied. However, ownership over the tag list and structure are transferred to the message.
- Parameters:
location
- location string for the new entrytagList
- tag list for the new entryentryStruct
- structure for the new entry
-
copy
Creates a copy of the message. Returns a copy of the message.- Returns:
- a new copy of this Message.
MT safe
-
getNumRedirectEntries
public long getNumRedirectEntries() -
getSeqnum
public int getSeqnum()Retrieve the sequence number of a message.Messages have ever-incrementing sequence numbers, which may also be set explicitly via gst_message_set_seqnum(). Sequence numbers are typically used to indicate that a message corresponds to some other set of messages or events, for example a SEGMENT_DONE message corresponding to a SEEK event. It is considered good practice to make this correspondence when possible, though it is not required.
Note that events and messages share the same sequence number incrementor; two events or messages will never have the same sequence number unless that correspondence was made explicitly.
- Returns:
- The message's sequence number.
MT safe.
-
getStreamStatusObject
Extracts the object managing the streaming thread from this Message.- Returns:
- a GValue containing the object that manages the streaming thread. This object is usually of type GstTask but other types can be added in the future. The object remains valid as long as this Message is valid.
-
getStructure
Access the structure of the message.- Returns:
- The structure of the message. The
structure is still owned by the message, which means that you should not
free it and that the pointer becomes invalid when you free the message.
MT safe.
-
hasName
Checks if this Message has the givenname
. This function is usually used to check the name of a custom message.- Parameters:
name
- name to check- Returns:
true
ifname
matches the name of the message structure.
-
parseAsyncDone
Extract the running_time from the async_done message.MT safe.
- Parameters:
runningTime
- Result location for the running_time ornull
-
parseBuffering
-
parseBufferingStats
public void parseBufferingStats(@Nullable @Nullable Out<BufferingMode> mode, @Nullable @Nullable Out<Integer> avgIn, @Nullable @Nullable Out<Integer> avgOut, @Nullable @Nullable Out<Long> bufferingLeft) Extracts the buffering stats values from this Message.- Parameters:
mode
- a buffering mode, ornull
avgIn
- the average input rate, ornull
avgOut
- the average output rate, ornull
bufferingLeft
- amount of buffering time left in milliseconds, ornull
-
parseClockLost
-
parseClockProvide
public void parseClockProvide(@Nullable @Nullable Out<Clock> clock, @Nullable @Nullable Out<Boolean> ready) Extracts the clock and ready flag from the GstMessage. The clock object returned remains valid until the message is freed.MT safe.
- Parameters:
clock
- a pointer to hold a clock object, ornull
ready
- a pointer to hold the ready flag, ornull
-
parseContextType
-
parseDeviceAdded
Parses a device-added message. The device-added message is produced byGstDeviceProvider
or aGstDeviceMonitor
. It announces the appearance of monitored devices.- Parameters:
device
- A location where to store a pointer to the newGstDevice
, ornull
-
parseDeviceChanged
public void parseDeviceChanged(@Nullable @Nullable Out<Device> device, @Nullable @Nullable Out<Device> changedDevice) Parses a device-changed message. The device-changed message is produced byGstDeviceProvider
or aGstDeviceMonitor
. It announces the disappearance of monitored devices. * It announce that a device properties has changed anddevice
represents the new modified version ofchangedDevice
.- Parameters:
device
- A location where to store a pointer to the updated version of theGstDevice
, ornull
changedDevice
- A location where to store a pointer to the old version of theGstDevice
, ornull
-
parseDeviceRemoved
Parses a device-removed message. The device-removed message is produced byGstDeviceProvider
or aGstDeviceMonitor
. It announces the disappearance of monitored devices.- Parameters:
device
- A location where to store a pointer to the removedGstDevice
, ornull
-
parseError
public void parseError(@Nullable @Nullable Out<GError> gerror, @Nullable @Nullable Out<String> debug) Extracts the GError and debug string from the GstMessage. The values returned in the output arguments are copies; the caller must free them when done.Typical usage of this function might be:
... switch (GST_MESSAGE_TYPE (msg)) { case GST_MESSAGE_ERROR: { GError *err = NULL; gchar *dbg_info = NULL; gst_message_parse_error (msg, &err, &dbg_info); g_printerr ("ERROR from element %s: %s\\n", GST_OBJECT_NAME (msg->src), err->message); g_printerr ("Debugging info: %s\\n", (dbg_info) ? dbg_info : "none"); g_error_free (err); g_free (dbg_info); break; } ... } ...
MT safe.
- Parameters:
gerror
- location for the GErrordebug
- location for the debug message, ornull
-
parseErrorDetails
-
parseGroupId
-
parseHaveContext
-
parseInfo
public void parseInfo(@Nullable @Nullable Out<GError> gerror, @Nullable @Nullable Out<String> debug) Extracts the GError and debug string from the GstMessage. The values returned in the output arguments are copies; the caller must free them when done.MT safe.
- Parameters:
gerror
- location for the GErrordebug
- location for the debug message, ornull
-
parseInfoDetails
-
parseInstantRateRequest
-
parseNewClock
-
parseProgress
-
parsePropertyNotify
public void parsePropertyNotify(@Nullable @Nullable Out<GstObject> object, @Nullable @Nullable Out<String> propertyName, @Nullable @Nullable Out<Value> propertyValue) Parses a property-notify message. These will be posted on the bus only when set up with gst_element_add_property_notify_watch() or gst_element_add_property_deep_notify_watch().- Parameters:
object
- location where to store a pointer to the object whose property got changed, ornull
propertyName
- return location for the name of the property that got changed, ornull
propertyValue
- return location for the new value of the property that got changed, ornull
. This will only be set if the property notify watch was told to include the value when it was set up
-
parseQos
public void parseQos(@Nullable @Nullable Out<Boolean> live, @Nullable @Nullable Out<Long> runningTime, @Nullable @Nullable Out<Long> streamTime, @Nullable @Nullable Out<Long> timestamp, @Nullable @Nullable Out<Long> duration) Extract the timestamps and live status from the QoS message.The returned values give the running_time, stream_time, timestamp and duration of the dropped buffer. Values of GST_CLOCK_TIME_NONE mean unknown values.
MT safe.
- Parameters:
live
- if the message was generated by a live elementrunningTime
- the running time of the buffer that generated the messagestreamTime
- the stream time of the buffer that generated the messagetimestamp
- the timestamps of the buffer that generated the messageduration
- the duration of the buffer that generated the message
-
parseQosStats
public void parseQosStats(@Nullable @Nullable Out<Format> format, @Nullable @Nullable Out<Long> processed, @Nullable @Nullable Out<Long> dropped) Extract the QoS stats representing the history of the current continuous pipeline playback period.When
format
isGSTFORMATUNDEFINED
bothdropped
andprocessed
are invalid. Values of -1 for eitherprocessed
ordropped
mean unknown values.MT safe.
- Parameters:
format
- Units of the 'processed' and 'dropped' fields. Video sinks and video filters will use GST_FORMAT_BUFFERS (frames). Audio sinks and audio filters will likely use GST_FORMAT_DEFAULT (samples).processed
- Total number of units correctly processed since the last state change to READY or a flushing operation.dropped
- Total number of units dropped since the last state change to READY or a flushing operation.
-
parseQosValues
public void parseQosValues(@Nullable @Nullable Out<Long> jitter, @Nullable @Nullable Out<Double> proportion, @Nullable @Nullable Out<Integer> quality) Extract the QoS values that have been calculated/analysed from the QoS dataMT safe.
- Parameters:
jitter
- The difference of the running-time against the deadline.proportion
- Long term prediction of the ideal rate relative to normal rate to get optimal quality.quality
- An element dependent integer value that specifies the current quality level of the element. The default maximum quality is 1000000.
-
parseRedirectEntry
public void parseRedirectEntry(long entryIndex, @Nullable @Nullable Out<String> location, @Nullable @Nullable Out<TagList> tagList, @Nullable @Nullable Out<Structure> entryStruct) Parses the location and/or structure from the entry with the given index. The index must be between 0 and gst_message_get_num_redirect_entries() - 1. Returned pointers are valid for as long as this message exists.- Parameters:
entryIndex
- index of the entry to parselocation
- return location for the pointer to the entry's location string, ornull
tagList
- return location for the pointer to the entry's tag list, ornull
entryStruct
- return location for the pointer to the entry's structure, ornull
-
parseRequestState
-
parseResetTime
Extract the running-time from the RESET_TIME message.MT safe.
- Parameters:
runningTime
- Result location for the running_time ornull
-
parseSegmentDone
-
parseSegmentStart
-
parseStateChanged
public void parseStateChanged(@Nullable @Nullable Out<State> oldstate, @Nullable @Nullable Out<State> newstate, @Nullable @Nullable Out<State> pending) Extracts the old and new states from the GstMessage.Typical usage of this function might be:
... switch (GST_MESSAGE_TYPE (msg)) { case GST_MESSAGE_STATE_CHANGED: { GstState old_state, new_state; gst_message_parse_state_changed (msg, &old_state, &new_state, NULL); g_print ("Element %s changed state from %s to %s.\\n", GST_OBJECT_NAME (msg->src), gst_element_state_get_name (old_state), gst_element_state_get_name (new_state)); break; } ... } ...
MT safe.
- Parameters:
oldstate
- the previous state, ornull
newstate
- the new (current) state, ornull
pending
- the pending (target) state, ornull
-
parseStepDone
public void parseStepDone(@Nullable @Nullable Out<Format> format, @Nullable @Nullable Out<Long> amount, @Nullable @Nullable Out<Double> rate, @Nullable @Nullable Out<Boolean> flush, @Nullable @Nullable Out<Boolean> intermediate, @Nullable @Nullable Out<Long> duration, @Nullable @Nullable Out<Boolean> eos) Extract the values the step_done message.MT safe.
- Parameters:
format
- result location for the formatamount
- result location for the amountrate
- result location for the rateflush
- result location for the flush flagintermediate
- result location for the intermediate flagduration
- result location for the durationeos
- result location for the EOS flag
-
parseStepStart
public void parseStepStart(@Nullable @Nullable Out<Boolean> active, @Nullable @Nullable Out<Format> format, @Nullable @Nullable Out<Long> amount, @Nullable @Nullable Out<Double> rate, @Nullable @Nullable Out<Boolean> flush, @Nullable @Nullable Out<Boolean> intermediate) Extract the values from step_start message.MT safe.
- Parameters:
active
- result location for the active flagformat
- result location for the formatamount
- result location for the amountrate
- result location for the rateflush
- result location for the flush flagintermediate
- result location for the intermediate flag
-
parseStreamCollection
Parses a stream-collection message.- Parameters:
collection
- A location where to store a pointer to theGstStreamCollection
, ornull
-
parseStreamStatus
Extracts the stream status type and owner the GstMessage. The returned owner remains valid for as long as the reference to this Message is valid and should thus not be unreffed.MT safe.
- Parameters:
type
- A pointer to hold the status typeowner
- The owner element of the message source
-
parseStreamsSelected
Parses a streams-selected message.- Parameters:
collection
- A location where to store a pointer to theGstStreamCollection
, ornull
-
parseStructureChange
public void parseStructureChange(Out<StructureChangeType> type, @Nullable @Nullable Out<Element> owner, @Nullable @Nullable Out<Boolean> busy) Extracts the change type and completion status from the GstMessage.MT safe.
- Parameters:
type
- A pointer to hold the change typeowner
- The owner element of the message sourcebusy
- a pointer to hold whether the change is in progress or has been completed
-
parseTag
Extracts the tag list from the GstMessage. The tag list returned in the output argument is a copy; the caller must free it when done.Typical usage of this function might be:
... switch (GST_MESSAGE_TYPE (msg)) { case GST_MESSAGE_TAG: { GstTagList *tags = NULL; gst_message_parse_tag (msg, &tags); g_print ("Got tags from element %s\\n", GST_OBJECT_NAME (msg->src)); handle_tags (tags); gst_tag_list_unref (tags); break; } ... } ...
MT safe.
- Parameters:
tagList
- return location for the tag-list.
-
parseToc
Extract the TOC from theGstMessage
. The TOC returned in the output argument is a copy; the caller must free it with gst_toc_unref() when done.MT safe.
- Parameters:
toc
- return location for the TOC.updated
- return location for the updated flag.
-
parseWarning
public void parseWarning(@Nullable @Nullable Out<GError> gerror, @Nullable @Nullable Out<String> debug) Extracts the GError and debug string from the GstMessage. The values returned in the output arguments are copies; the caller must free them when done.MT safe.
- Parameters:
gerror
- location for the GErrordebug
- location for the debug message, ornull
-
parseWarningDetails
-
ref
Convenience macro to increase the reference count of the message.- Returns:
- this Message (for convenience when doing assignments)
-
setBufferingStats
Configures the buffering stats values in this Message.- Parameters:
mode
- a buffering modeavgIn
- the average input rateavgOut
- the average output ratebufferingLeft
- amount of buffering time left in milliseconds
-
setGroupId
public void setGroupId(int groupId) Sets the group id on the stream-start message.All streams that have the same group id are supposed to be played together, i.e. all streams inside a container file should have the same group id but different stream ids. The group id should change each time the stream is started, resulting in different group ids each time a file is played for example.
MT safe.
- Parameters:
groupId
- the group id
-
setQosStats
Set the QoS stats representing the history of the current continuous pipeline playback period.When
format
isGSTFORMATUNDEFINED
bothdropped
andprocessed
are invalid. Values of -1 for eitherprocessed
ordropped
mean unknown values.MT safe.
- Parameters:
format
- Units of the 'processed' and 'dropped' fields. Video sinks and video filters will use GST_FORMAT_BUFFERS (frames). Audio sinks and audio filters will likely use GST_FORMAT_DEFAULT (samples).processed
- Total number of units correctly processed since the last state change to READY or a flushing operation.dropped
- Total number of units dropped since the last state change to READY or a flushing operation.
-
setQosValues
public void setQosValues(long jitter, double proportion, int quality) Set the QoS values that have been calculated/analysed from the QoS dataMT safe.
- Parameters:
jitter
- The difference of the running-time against the deadline.proportion
- Long term prediction of the ideal rate relative to normal rate to get optimal quality.quality
- An element dependent integer value that specifies the current quality level of the element. The default maximum quality is 1000000.
-
setSeqnum
public void setSeqnum(int seqnum) Set the sequence number of a message.This function might be called by the creator of a message to indicate that the message relates to other messages or events. See gst_message_get_seqnum() for more information.
MT safe.
- Parameters:
seqnum
- A sequence number.
-
setStreamStatusObject
Configures the object handling the streaming thread. This is usually a GstTask object but other objects might be added in the future.- Parameters:
object
- the object controlling the streaming
-
streamsSelectedAdd
Adds thestream
to the this Message.- Parameters:
stream
- aGstStream
to add to this Message
-
streamsSelectedGetSize
public int streamsSelectedGetSize()Returns the number of streams contained in the this Message.- Returns:
- The number of streams contained within.
-
streamsSelectedGetStream
Retrieves theGstStream
with indexindex
from the this Message.- Parameters:
idx
- Index of the stream to retrieve- Returns:
- A
GstStream
-
unref
public void unref()Convenience macro to decrease the reference count of the message, possibly freeing it. -
writableStructure
Get a writable version of the structure.- Returns:
- The structure of the message. The structure
is still owned by the message, which means that you should not free
it and that the pointer becomes invalid when you free the message.
This function ensures that this Message is writable, and if so, will
never return
null
.MT safe.
-