Class: GstBase::BaseSrc

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 create method should be overridden to produce buffers.

Direct Known Subclasses

PushSrc

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) ⇒ nil

Configure async behaviour in src, no state change will block. The open, close, start, stop, play and pause virtual methods will be executed in a different thread and are thus allowed to perform blocking operations. Any blocking operation should be unblocked with the unlock vmethod.

Parameters:

  • async (Boolean)

    new async mode

Returns:

  • (nil)

#automatic_eos=(automatic_eos) ⇒ Boolean

See gst_base_src_set_automatic_eos()

Parameters:

  • automatic_eos (Boolean)

Returns:

  • (Boolean)

    automatic-eos

  • (Boolean)

    automatic-eos

#automatic_eos?Boolean

See gst_base_src_set_automatic_eos()

Returns:

  • (Boolean)

    automatic-eos

#blocksizeInteger

Returns blocksize.

Returns:

  • (Integer)

    blocksize

#blocksize=(blocksize) ⇒ Integer

Parameters:

  • blocksize (Integer)

Returns:

  • (Integer)

    blocksize

  • (Integer)

    blocksize

#buffer_poolGst::BufferPool

by the src; unref it after usage.

Returns:

#caps=(caps) ⇒ Boolean

Set new caps on the basesrc source pad.

Parameters:

Returns:

  • (Boolean)

    true if the caps could be set

#do_timestampBoolean

Query if src timestamps outgoing buffers based on the current running_time.

Returns:

  • (Boolean)

    true if the base class will automatically timestamp outgoing buffers.

#do_timestamp=(do_timestamp) ⇒ Boolean

Parameters:

  • do_timestamp (Boolean)

Returns:

  • (Boolean)

    do-timestamp

  • (Boolean)

    do-timestamp

#do_timestamp?Boolean

Returns do-timestamp.

Returns:

  • (Boolean)

    do-timestamp

#dynamic_size=(dynamic) ⇒ nil

If not dynamic, size is only updated when needed, such as when trying to read past current tracked size. Otherwise, size is checked for upon each read.

Parameters:

  • dynamic (Boolean)

    new dynamic size mode

Returns:

  • (nil)

#format=(format) ⇒ nil

Sets the default format of the source. This will be the format used for sending SEGMENT events and for performing seeks.

If a format of GST_FORMAT_BYTES is set, the element will be able to operate in pull mode if the Gst::BaseSrcClass::is_seekable returns true.

This function must only be called in states < %GST_STATE_PAUSED.

Parameters:

Returns:

  • (nil)

#get_allocator(allocator, params) ⇒ nil

Lets Gst::BaseSrc sub-classes to know the memory allocator used by the base class and its params.

Unref the allocator after usage. used

Parameters:

  • allocator (Gst::Allocator)

    the Gst::Allocator

  • params (Gst::AllocationParams)

    the Gst::AllocationParams of allocator

Returns:

  • (nil)

#is_asyncBoolean

Get the current async behaviour of src. See also gst_base_src_set_async().

Returns:

  • (Boolean)

    true if src is operating in async mode.

#is_liveBoolean

Check if an element is in live mode.

Returns:

  • (Boolean)

    true if element is in live mode.

#live=(live) ⇒ nil

If the element listens to a live source, live should be set to true.

A live source will not produce data in the PAUSED state and will therefore not be able to participate in the PREROLL phase of a pipeline. To signal this fact to the application and the pipeline, the state change return value of the live source will be GST_STATE_CHANGE_NO_PREROLL.

Parameters:

  • live (Boolean)

    new live-mode

Returns:

  • (nil)

#negotiateBoolean

Negotiates src pad caps with downstream elements. Unmarks GST_PAD_FLAG_NEED_RECONFIGURE in any case. But marks it again if Gst::BaseSrcClass::negotiate fails.

Do not call this in the Gst::BaseSrcClass::fill vmethod. Call this in Gst::BaseSrcClass::create or in #GstBaseSrcClass::alloc, before any buffer is allocated.

Returns:

  • (Boolean)

    true if the negotiation succeeded, else false.

#new_seamless_segment(start, stop, time) ⇒ Boolean

Prepare a new seamless segment for emission downstream. This function must only be called by derived sub-classes, and only from the Gst::BaseSrcClass::create function, as the stream-lock needs to be held.

The format for the new segment will be the current format of the source, as configured with gst_base_src_set_format()

Parameters:

  • start (Integer)

    The new start value for the segment

  • stop (Integer)

    Stop value for the new segment

  • time (Integer)

    The new time value for the start of the new segment

Returns:

  • (Boolean)

    true if preparation of the seamless segment succeeded.

#new_segment(segment) ⇒ Boolean

Prepare a new segment for emission downstream. This function must only be called by derived sub-classes, and only from the Gst::BaseSrcClass::create function, as the stream-lock needs to be held.

The format for the segment must be identical with the current format of the source, as configured with gst_base_src_set_format().

The format of src must not be %GST_FORMAT_UNDEFINED and the format should be configured via gst_base_src_set_format() before calling this method.

Parameters:

  • segment (Gst::Segment)

    a pointer to a Gst::Segment

Returns:

  • (Boolean)

    true if preparation of new segment succeeded.

#num_buffersInteger

Returns num-buffers.

Returns:

  • (Integer)

    num-buffers

#num_buffers=(num_buffers) ⇒ Integer

Parameters:

  • num_buffers (Integer)

Returns:

  • (Integer)

    num-buffers

  • (Integer)

    num-buffers

#push_segment(segment) ⇒ Boolean

Send a new segment downstream. This function must only be called by derived sub-classes, and only from the Gst::BaseSrcClass::create function, as the stream-lock needs to be held. This method also requires that an out caps has been configured, so gst_base_src_set_caps() needs to have been called before.

The format for the segment must be identical with the current format of the source, as configured with gst_base_src_set_format().

The format of src must not be %GST_FORMAT_UNDEFINED and the format should be configured via gst_base_src_set_format() before calling this method.

This is a variant of gst_base_src_new_segment() sending the segment right away, which can be useful to ensure events ordering.

Parameters:

  • segment (Gst::Segment)

    a pointer to a Gst::Segment

Returns:

  • (Boolean)

    true if sending of new segment succeeded.

#query_latency(live, min_latency, max_latency) ⇒ Boolean

Query the source for the latency parameters. live will be true when src is configured as a live source. min_latency and max_latency will be set to the difference between the running time and the timestamp of the first buffer.

This function is mostly used by subclasses.

Parameters:

  • live (Boolean)

    if the source is live

  • min_latency (Gst::ClockTime)

    the min latency of the source

  • max_latency (Gst::ClockTime)

    the max latency of the source

Returns:

  • (Boolean)

    true if the query succeeded.

#start_complete(ret) ⇒ nil

Complete an asynchronous start operation. When the subclass overrides the start method, it should call gst_base_src_start_complete() when the start operation completes either from the same thread or from an asynchronous helper thread.

Parameters:

Returns:

  • (nil)

#start_waitGst::FlowReturn

Wait until the start operation completes.

Returns:

#submit_buffer_list(buffer_list) ⇒ nil

Subclasses can call this from their create virtual method implementation to submit a buffer list to be pushed out later. This is useful in cases where the create function wants to produce multiple buffers to be pushed out in one go in form of a Gst::BufferList, which can reduce overhead drastically, especially for packetised inputs (for data streams where the packetisation/chunking is not important it is usually more efficient to return larger buffers instead).

Subclasses that use this function from their create function must return %GST_FLOW_OK and no buffer from their create virtual method implementation. If a buffer is returned after a buffer list has also been submitted via this function the behaviour is undefined.

Subclasses must only call this function once per create function call and subclasses must only call this function when the source operates in push mode.

Parameters:

  • buffer_list (Gst::BufferList)

    a Gst::BufferList

Returns:

  • (nil)

#typefind=(typefind) ⇒ Boolean

Parameters:

  • typefind (Boolean)

Returns:

  • (Boolean)

    typefind

  • (Boolean)

    typefind

#typefind?Boolean

Returns typefind.

Returns:

  • (Boolean)

    typefind

#wait_playingGst::FlowReturn

If the Gst::BaseSrcClass::create 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 produce the remaining data.

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). continue. Any other return value should be returned from the create vmethod.

Returns: