gstlal 1.13.0
Loading...
Searching...
No Matches
python.stream.Stream Class Reference
Inheritance diagram for python.stream.Stream:
Collaboration diagram for python.stream.Stream:

Public Member Functions

None __init__ (self, Optional[str] name=None, Optional[GLib.MainLoop] mainloop=None, Optional[Gst.Pipeline] pipeline=None, Optional["StreamHandler"] handler=None, Optional["SourceElem"] source=None, Union[MappingType[str, Gst.Element], Gst.Element, None] head=None)
None start (self)
"Stream" from_datasource (cls, datasource.DataSourceInfo data_source_info, Union[str, Iterable[str]] ifos, Optional[str] name=None, bool verbose=False, bool state_vector=False, bool dq_vector=False, bool idq_series=False)
None connect (self, *args, **kwargs)
None bufsink (self, Callable[[Buffer], None] func, Optional[Gst.Caps] caps=None)
None add_callback (self, Gst.MessageType msg_type, *args)
None set_state (self, Gst.State state)
Gst.Element get_element_by_name (self, str name)
None post_message (self, None msg_name, Optional[int] timestamp=None)
"Stream" __getitem__ (self, str key)
None __setitem__ (self, str key, "Stream" value)
Iterable[str] keys (self)
Iterable["Stream"] values (self)
Iterable[Tuple[str, "Stream"]] items (self)
"Stream" clear (self)

Public Attributes

 name = name if name else str(uuid.uuid1())
 mainloop = mainloop if mainloop else GLib.MainLoop()
 pipeline = pipeline if pipeline else Gst.Pipeline(self.name)
 Setup a signal handler to intercept SIGINT in order to write the pipeline graph at ctrl+C before cleanly shutting down.
 handler = handler if handler else StreamHandler(self.mainloop, self.pipeline)
 head = head
 source = source if source else None

Protected Member Functions

None _seek_gps (self)
 _pull_buffer (cls, Gst.Element elem, Optional[Gst.Caps] caps=None)
None _load_caps_buffer_map (cls)

Static Protected Member Functions

Gst.FlowReturn _preroll_handler (Gst.Element elem)

Protected Attributes

 _appsync = pipeparts.AppSync(appsink_new_buffer=sample_handler)
 _preroll_handler

Static Protected Attributes

bool _gst_init = False
bool _has_elements = False
 _caps_buffer_map = None

Detailed Description

Class for building a GStreamer-based pipeline.

Definition at line 49 of file stream.py.

Constructor & Destructor Documentation

◆ __init__()

None python.stream.Stream.__init__ ( self,
Optional[str] name = None,
Optional[GLib.MainLoop] mainloop = None,
Optional[Gst.Pipeline] pipeline = None,
Optional["StreamHandler"] handler = None,
Optional["SourceElem"] source = None,
Union[MappingType[str, Gst.Element], Gst.Element, None] head = None )
Create a Stream that can be used to build a GStreamer-based pipeline.

        Args:
            name:
                str, a name for the GStreamer pipeline (optional).
                If not set, generates a unique name.
            mainloop:
                GLib.MainLoop, the GLib event loop to drive the GStreamer pipeline.
                If not set, one will be created.
            pipeline:
                Gst.Pipeline, the GStreamer pipeline object that contains the pipeline graph.
                If not set, one will be created.
            handler:
                StreamHandler, a handler which registers callbacks upon new bus messages and
                stops the event loop upon EOS. If not set, one will be created.
            source:
                SourceElem, an object that stores source information as well as state/DQ vector
                elements. If not set, one will be created.
            head:
                Union[MappingType[str, Gst.Element], Gst.Element], a pointer to the current
                element in the pipeline. If not set, the Stream will not have any elements
                attached to the pipeline upon instantiation.

Definition at line 56 of file stream.py.

Member Function Documentation

◆ __getitem__()

"Stream" python.stream.Stream.__getitem__ ( self,
str key )
Retrieves a new Stream with specified key.

Definition at line 299 of file stream.py.

◆ __setitem__()

None python.stream.Stream.__setitem__ ( self,
str key,
"Stream" value )
Attach a new Stream with specified key/value pair.

Definition at line 312 of file stream.py.

◆ _load_caps_buffer_map()

None python.stream.Stream._load_caps_buffer_map ( cls)
protected

Definition at line 404 of file stream.py.

◆ _preroll_handler()

Gst.FlowReturn python.stream.Stream._preroll_handler ( Gst.Element elem)
staticprotected

Definition at line 432 of file stream.py.

◆ _pull_buffer()

python.stream.Stream._pull_buffer ( cls,
Gst.Element elem,
Optional[Gst.Caps] caps = None )
protected

Definition at line 363 of file stream.py.

◆ _seek_gps()

None python.stream.Stream._seek_gps ( self)
protected
Seek pipeline to the given gps start/end times.

Definition at line 355 of file stream.py.

◆ add_callback()

None python.stream.Stream.add_callback ( self,
Gst.MessageType msg_type,
* args )
Attach a callback which get invoked when new bus messages are available.

        Args:
            msg_type:
                Gst.MessageType, the type of message to invoke a callback for.
            *args:
                extra arguments

Definition at line 243 of file stream.py.

◆ bufsink()

None python.stream.Stream.bufsink ( self,
Callable[[Buffer], None] func,
Optional[Gst.Caps] caps = None )
Terminate this stream with an appsink element and process new buffers with a callback.

        Args:
            func:
                Callable[[Buffer], None], a callback that gets invoked when a new buffer is available
            caps:
                Gst.Caps, how to interpret the contents of the raw buffers.
                If not set, defaults to raw audio buffers (audio/x-raw).

Definition at line 214 of file stream.py.

◆ clear()

"Stream" python.stream.Stream.clear ( self)
Return a new stream with all pointers to elements cleared out.

Definition at line 342 of file stream.py.

◆ connect()

None python.stream.Stream.connect ( self,
* args,
** kwargs )
Attach a callback to one of this element's signals.

Definition at line 208 of file stream.py.

◆ from_datasource()

"Stream" python.stream.Stream.from_datasource ( cls,
datasource.DataSourceInfo data_source_info,
Union[str, Iterable[str]] ifos,
Optional[str] name = None,
bool verbose = False,
bool state_vector = False,
bool dq_vector = False,
bool idq_series = False )
Construct a Stream from a datasource.DataSourceInfo object.

        Args:
            data_source_info:
                DataSourceInfo, the object to construct this stream with.
            ifos:
                Union[str, Iterable[str]], the detectors read timeseries data for.
            name:
                str, a name for the GStreamer pipeline (optional).
                If not set, generates a unique name.
            verbose:
                bool, default False, whether to display logging/progress information.
            state_vector:
                bool, default False, whether to attach state vector information to this Stream
            dq_vector:
                bool, default False, whether to attach data quality vector information to this Stream
            idq_series:
                bool, default False, whether to fetch idq data information with this Stream

        Returns:
            Stream, the newly created stream.

Definition at line 135 of file stream.py.

◆ get_element_by_name()

Gst.Element python.stream.Stream.get_element_by_name ( self,
str name )
Retrieve an element from the stream's pipeline by name.

        Args:
            name:
                str, the name of the element to retrieve

        Returns:
            Gst.Element, the element associated with the name given.

Definition at line 270 of file stream.py.

◆ items()

Iterable[Tuple[str, "Stream"]] python.stream.Stream.items ( self)

Definition at line 338 of file stream.py.

◆ keys()

Iterable[str] python.stream.Stream.keys ( self)

Definition at line 331 of file stream.py.

◆ post_message()

None python.stream.Stream.post_message ( self,
None msg_name,
Optional[int] timestamp = None )
Post a new application message to this stream's bus.

        Args:
            msg_name:
                str, the name of the application message to send.
            timestamp:
                (int, optional), the timestamp to attach to this message.

Definition at line 283 of file stream.py.

◆ set_state()

None python.stream.Stream.set_state ( self,
Gst.State state )
Set pipeline state, checking for errors.

        Args:
            state:
                Gst.State: The state to set this stream's pipeline to.

        Raises:
            RuntimeError:
                If the pipeline failed to transition to the state specified.

Definition at line 255 of file stream.py.

◆ start()

None python.stream.Stream.start ( self)
Start the main event loop for this stream.

Definition at line 108 of file stream.py.

◆ values()

Iterable["Stream"] python.stream.Stream.values ( self)

Definition at line 334 of file stream.py.

Member Data Documentation

◆ _appsync

python.stream.Stream._appsync = pipeparts.AppSync(appsink_new_buffer=sample_handler)
protected

Definition at line 235 of file stream.py.

◆ _caps_buffer_map

python.stream.Stream._caps_buffer_map = None
staticprotected

Definition at line 54 of file stream.py.

◆ _gst_init

bool python.stream.Stream._gst_init = False
staticprotected

Definition at line 52 of file stream.py.

◆ _has_elements

bool python.stream.Stream._has_elements = False
staticprotected

Definition at line 53 of file stream.py.

◆ _preroll_handler

python.stream.Stream._preroll_handler
protected

Definition at line 241 of file stream.py.

◆ handler

python.stream.Stream.handler = handler if handler else StreamHandler(self.mainloop, self.pipeline)

Definition at line 102 of file stream.py.

◆ head

python.stream.Stream.head = head

Definition at line 103 of file stream.py.

◆ mainloop

python.stream.Stream.mainloop = mainloop if mainloop else GLib.MainLoop()

Definition at line 100 of file stream.py.

◆ name

python.stream.Stream.name = name if name else str(uuid.uuid1())

Definition at line 99 of file stream.py.

◆ pipeline

python.stream.Stream.pipeline = pipeline if pipeline else Gst.Pipeline(self.name)

Setup a signal handler to intercept SIGINT in order to write the pipeline graph at ctrl+C before cleanly shutting down.

Definition at line 101 of file stream.py.

◆ source

python.stream.Stream.source = source if source else None

Definition at line 106 of file stream.py.


The documentation for this class was generated from the following file: