Class: GstBase::BaseSink

Inherits:
Gst::Element show all
Defined in:
(unknown)

Overview

Subclasses can override any of the available virtual methods or not, as needed. At the minimum, the render method should be overridden to output/present buffers.

Direct Known Subclasses

GstAudio::AudioBaseSink

Instance Method Summary collapse

Methods inherited from Gst::Element

#>>, [], #abort_state, #add_metadata, #add_pad, #add_pad_template, #add_property_deep_notify_watch, #add_property_notify_watch, #add_static_metadata, #add_static_pad_template, #add_static_pad_template_with_gtype, #base_time, #base_time=, #bus, #bus=, #call_async, #change_state, #clock, #clock=, #context=, #contexts, #continue_state, #create_all_pads, #current_clock_time, #current_running_time, #decorate_stream_id, #decorate_stream_id_printf, #decorate_stream_id_printf_valist, #factory, #flags, #flags_raw, #foreach_pad, #foreach_sink_pad, #foreach_src_pad, #get_compatible_pad, #get_compatible_pad_template, #get_context, #get_context_unlocked, #get_metadata, #get_pad_template, #get_request_pad, #get_state, #get_static_pad, #is_locked_state, #iterate_pads, #iterate_sink_pads, #iterate_src_pads, #link_elements, #link_filtered, #link_many, #link_pads, #link_pads_filtered, #link_pads_full, #locked_state=, #lost_state, make_from_uri, #message_full, #message_full_with_details, #no_more_pads, #pad_template_list, #pause, #play, #post_message, #provide_clock, #query, #query_convert, #query_duration, #query_position, #ready, register, #release_request_pad, #remove_pad, #remove_property_notify_watch, #request_pad, #request_pad_simple, #seek, #seek_simple, #send_event, #set_metadata, #set_static_metadata, #start_time, #start_time=, #state=, state_change_return_get_name, state_get_name, #stop, #sync_state_with_parent, type_set_skip_documentation, #unlink, #unlink_many, #unlink_pads

Methods inherited from Gst::Object

#add_control_binding, check_uniqueness, #control_bindings_disabled=, #control_rate, #control_rate=, default_deep_notify, #default_error, #get_control_binding, #get_g_value_array, #get_value, #get_value_array, #has_active_control_bindings, #has_ancestor, #has_as_ancestor, #has_as_parent, #name, #name=, #parent, #parent=, #path_string, #ref, ref_sink, #remove_control_binding, replace, #set_control_binding_disabled, #suggest_next_sync, #sync_values, #unparent, #unref

Instance Method Details

#async=(async) ⇒ Boolean

If set to true, the basesink will perform asynchronous state changes. When set to false, the sink will not signal the parent when it prerolls. Use this option when dealing with sparse streams or when synchronisation is not required.

Parameters:

  • async (Boolean)

Returns:

  • (Boolean)

    async

  • (Boolean)

    async

#async?Boolean

If set to true, the basesink will perform asynchronous state changes. When set to false, the sink will not signal the parent when it prerolls. Use this option when dealing with sparse streams or when synchronisation is not required.

Returns:

  • (Boolean)

    async

#async_enabled=(enabled) ⇒ nil

Configures sink to perform all state changes asynchronously. When async is disabled, the sink will immediately go to PAUSED instead of waiting for a preroll buffer. This feature is useful if the sink does not synchronize against the clock or when it is dealing with sparse streams.

Parameters:

  • enabled (Boolean)

    the new async value.

Returns:

  • (nil)

#blocksizeInteger

The amount of bytes to pull when operating in pull mode.

Returns:

  • (Integer)

    blocksize

#blocksize=(blocksize) ⇒ Integer

The amount of bytes to pull when operating in pull mode.

Parameters:

  • blocksize (Integer)

Returns:

  • (Integer)

    blocksize

  • (Integer)

    blocksize

#do_preroll(obj) ⇒ Gst::FlowReturn

If the sink spawns its own thread for pulling buffers from upstream it should call this method after it has pulled a buffer. If the element needed to preroll, this function will perform the preroll and will then block until the element state is changed.

This function should be called with the PREROLL_LOCK held. continue. Any other return value should be returned from the render vmethod.

Parameters:

  • obj (Gst::MiniObject)

    the mini object that caused the preroll

Returns:

  • (Gst::FlowReturn)

    %GST_FLOW_OK if the preroll completed and processing can

#drop_out_of_segmentBoolean

Checks if sink is currently configured to drop buffers which are outside the current segment current segment.

Returns:

  • (Boolean)

    true if the sink is configured to drop buffers outside the

#drop_out_of_segment=(drop_out_of_segment) ⇒ nil

Configure sink to drop buffers which are outside the current segment

Parameters:

  • drop_out_of_segment (Boolean)

    drop buffers outside the segment

Returns:

  • (nil)

#enable_last_sample=(enable_last_sample) ⇒ Boolean

Enable the last-sample property. If false, basesink doesn't keep a reference to the last buffer arrived and the last-sample property is always set to nil. This can be useful if you need buffers to be released as soon as possible, eg. if you're using a buffer pool.

Parameters:

  • enable_last_sample (Boolean)

Returns:

  • (Boolean)

    enable-last-sample

  • (Boolean)

    enable-last-sample

#enable_last_sample?Boolean

Enable the last-sample property. If false, basesink doesn't keep a reference to the last buffer arrived and the last-sample property is always set to nil. This can be useful if you need buffers to be released as soon as possible, eg. if you're using a buffer pool.

Returns:

  • (Boolean)

    enable-last-sample

#is_async_enabledBoolean

Checks if sink is currently configured to perform asynchronous state changes to PAUSED. changes.

Returns:

  • (Boolean)

    true if the sink is configured to perform asynchronous state

#is_last_sample_enabledBoolean

Checks if sink is currently configured to store the last received sample in the last-sample property.

Returns:

  • (Boolean)

    true if the sink is configured to store the last received sample.

#is_qos_enabledBoolean

Checks if sink is currently configured to send Quality-of-Service events upstream.

Returns:

  • (Boolean)

    true if the sink is configured to perform Quality-of-Service.

#last_sampleGst::Sample

The last buffer that arrived in the sink and was used for preroll or for rendering. This property can be used to generate thumbnails. This property can be nil when the sink has not yet received a buffer.

Returns:

  • (Gst::Sample)

    last-sample

#last_sample=(last_sample) ⇒ Gst::Sample

The last buffer that arrived in the sink and was used for preroll or for rendering. This property can be used to generate thumbnails. This property can be nil when the sink has not yet received a buffer.

Parameters:

  • last_sample (Gst::Sample)

Returns:

  • (Gst::Sample)

    last-sample

  • (Gst::Sample)

    last-sample

#last_sample_enabled=(enabled) ⇒ nil

Configures sink to store the last received sample in the last-sample property.

Parameters:

  • enabled (Boolean)

    the new enable-last-sample value.

Returns:

  • (nil)

#latencyGst::ClockTime

Get the currently configured latency.

Returns:

  • (Gst::ClockTime)

    The configured latency.

#max_bitrateInteger

Control the maximum amount of bits that will be rendered per second. Setting this property to a value bigger than 0 will make the sink delay rendering of the buffers when it would exceed to max-bitrate.

Returns:

  • (Integer)

    max-bitrate

#max_bitrate=(max_bitrate) ⇒ Integer

Control the maximum amount of bits that will be rendered per second. Setting this property to a value bigger than 0 will make the sink delay rendering of the buffers when it would exceed to max-bitrate.

Parameters:

  • max_bitrate (Integer)

Returns:

  • (Integer)

    max-bitrate

  • (Integer)

    max-bitrate

#max_latenessInteger

Returns max-lateness.

Returns:

  • (Integer)

    max-lateness

#max_lateness=(max_lateness) ⇒ Integer

Parameters:

  • max_lateness (Integer)

Returns:

  • (Integer)

    max-lateness

  • (Integer)

    max-lateness

#processing_deadlineInteger

Maximum amount of time (in nanoseconds) that the pipeline can take for processing the buffer. This is added to the latency of live pipelines.

Returns:

  • (Integer)

    processing-deadline

#processing_deadline=(processing_deadline) ⇒ Integer

Maximum amount of time (in nanoseconds) that the pipeline can take for processing the buffer. This is added to the latency of live pipelines.

Parameters:

  • processing_deadline (Integer)

Returns:

  • (Integer)

    processing-deadline

  • (Integer)

    processing-deadline

#qos=(qos) ⇒ Boolean

Parameters:

  • qos (Boolean)

Returns:

  • (Boolean)

    qos

  • (Boolean)

    qos

#qos?Boolean

Returns qos.

Returns:

  • (Boolean)

    qos

#qos_enabled=(enabled) ⇒ nil

Configures sink to send Quality-of-Service events upstream.

Parameters:

  • enabled (Boolean)

    the new qos value.

Returns:

  • (nil)

#query_latency(live, upstream_live, min_latency, max_latency) ⇒ Boolean

Query the sink for the latency parameters. The latency will be queried from the upstream elements. live will be true if sink is configured to synchronize against the clock. upstream_live will be true if an upstream element is live.

If both live and upstream_live are true, the sink will want to compensate for the latency introduced by the upstream elements by setting the min_latency to a strictly positive value.

This function is mostly used by subclasses.

Parameters:

  • live (Boolean)

    if the sink is live

  • upstream_live (Boolean)

    if an upstream element is live

  • min_latency (Gst::ClockTime)

    the min latency of the upstream elements

  • max_latency (Gst::ClockTime)

    the max latency of the upstream elements

Returns:

  • (Boolean)

    true if the query succeeded.

#render_delayInteger

The additional delay between synchronisation and actual rendering of the media. This property will add additional latency to the device in order to make other sinks compensate for the delay.

Returns:

  • (Integer)

    render-delay

#render_delay=(render_delay) ⇒ Integer

The additional delay between synchronisation and actual rendering of the media. This property will add additional latency to the device in order to make other sinks compensate for the delay.

Parameters:

  • render_delay (Integer)

Returns:

  • (Integer)

    render-delay

  • (Integer)

    render-delay

#statsGst::Structure

Various Gst::BaseSink statistics. This property returns a #GstStructure with name application/x-gst-base-sink-stats with the following fields:

  • "average-rate" G_TYPE_DOUBLE average frame rate
  • "dropped" G_TYPE_UINT64 Number of dropped frames
  • "rendered" G_TYPE_UINT64 Number of rendered frames

Returns:

#stats=(stats) ⇒ Gst::Structure

Various Gst::BaseSink statistics. This property returns a #GstStructure with name application/x-gst-base-sink-stats with the following fields:

  • "average-rate" G_TYPE_DOUBLE average frame rate
  • "dropped" G_TYPE_UINT64 Number of dropped frames
  • "rendered" G_TYPE_UINT64 Number of rendered frames

Parameters:

Returns:

#syncBoolean

Checks if sink is currently configured to synchronize against the clock.

Returns:

  • (Boolean)

    true if the sink is configured to synchronize against the clock.

#sync=(sync) ⇒ Boolean

Parameters:

  • sync (Boolean)

Returns:

  • (Boolean)

    sync

  • (Boolean)

    sync

#sync?Boolean

Returns sync.

Returns:

  • (Boolean)

    sync

#throttle_timeInteger

The time to insert between buffers. This property can be used to control the maximum amount of buffers per second to render. Setting this property to a value bigger than 0 will make the sink create THROTTLE QoS events.

Returns:

  • (Integer)

    throttle-time

#throttle_time=(throttle_time) ⇒ Integer

The time to insert between buffers. This property can be used to control the maximum amount of buffers per second to render. Setting this property to a value bigger than 0 will make the sink create THROTTLE QoS events.

Parameters:

  • throttle_time (Integer)

Returns:

  • (Integer)

    throttle-time

  • (Integer)

    throttle-time

#ts_offsetInteger

Controls the final synchronisation, a negative value will render the buffer earlier while a positive value delays playback. This property can be used to fix synchronisation in bad files.

Returns:

  • (Integer)

    ts-offset

#ts_offset=(ts_offset) ⇒ Integer

Controls the final synchronisation, a negative value will render the buffer earlier while a positive value delays playback. This property can be used to fix synchronisation in bad files.

Parameters:

  • ts_offset (Integer)

Returns:

  • (Integer)

    ts-offset

  • (Integer)

    ts-offset

#wait(time, jitter) ⇒ Gst::FlowReturn

This function will wait for preroll to complete and will then block until time is reached. It is usually called by subclasses that use their own internal synchronisation but want to let some synchronization (like EOS) be handled by the base class.

This function should only be called with the PREROLL_LOCK held (like when receiving an EOS event in the ::event vmethod or when handling buffers in ::render).

The time argument should be the running_time of when the timeout should happen and will be adjusted with any latency and offset configured in the sink.

Parameters:

  • time (Gst::ClockTime)

    the running_time to be reached

  • jitter (Gst::ClockTimeDiff)

    the jitter to be filled with time diff, or nil

Returns:

#wait_clock(time, jitter) ⇒ Gst::ClockReturn

This function will block until time is reached. It is usually called by subclasses that use their own internal synchronisation.

If time is not valid, no synchronisation is done and %GST_CLOCK_BADTIME is returned. Likewise, if synchronisation is disabled in the element or there is no clock, no synchronisation is done and %GST_CLOCK_BADTIME is returned.

This function should only be called with the PREROLL_LOCK held, like when receiving an EOS event in the Gst::BaseSinkClass::event vmethod or when receiving a buffer in the Gst::BaseSinkClass::render vmethod.

The time argument should be the running_time of when this method should return and is not adjusted with any latency or offset configured in the sink.

Parameters:

  • time (Gst::ClockTime)

    the running_time to be reached

  • jitter (Gst::ClockTimeDiff)

    the jitter to be filled with time diff, or nil

Returns:

#wait_prerollGst::FlowReturn

If the Gst::BaseSinkClass::render method performs its own synchronisation against the clock it must unblock when going from PLAYING to the PAUSED state and call this method before continuing to render the remaining data.

If the Gst::BaseSinkClass::render method can block on something else than the clock, it must also be ready to unblock immediately on the Gst::BaseSinkClass::unlock method and cause the Gst::BaseSinkClass::render method to immediately call this function. In this case, the subclass must be prepared to continue rendering where it left off if this function returns %GST_FLOW_OK.

This function will block until a state change to PLAYING happens (in which case this function returns %GST_FLOW_OK) or the processing must be stopped due to a state change to READY or a FLUSH event (in which case this function returns %GST_FLOW_FLUSHING).

This function should only be called with the PREROLL_LOCK held, like in the render function. continue. Any other return value should be returned from the render vmethod.

Returns:

  • (Gst::FlowReturn)

    %GST_FLOW_OK if the preroll completed and processing can