gstlal
1.13.0
Toggle main menu visibility
Loading...
Searching...
No Matches
python
pipeparts
encode.py
1
"""Module for encoding elements
2
3
"""
4
5
from
gstlal.pipeparts
import
pipetools
6
7
8
9
def
wav
(pipeline: pipetools.Pipeline, src: pipetools.Element) -> pipetools.Element:
10
"""Format source into the wav format
11
12
Args:
13
pipeline:
14
Gst.Pipeline, the pipeline to which the new element will be added
15
src:
16
Gst.Element, the source element
17
18
19
References:
20
[1] wavenc docs: https://gstreamer.freedesktop.org/documentation/wavenc/index.html?gi-language=python
21
22
Returns:
23
Element, the src encoded as wav format
24
"""
25
return
pipetools.make_element_with_src(pipeline, src,
"wavenc"
)
26
27
28
29
def
vorbis
(pipeline: pipetools.Pipeline, src: pipetools.Element) -> pipetools.Element:
30
"""This element encodes raw float audio into a Vorbis stream
31
32
Args:
33
pipeline:
34
Gst.Pipeline, the pipeline to which the new element will be added
35
src:
36
Gst.Element, the source element
37
38
References:
39
[1] vorbisenc docs: https://gstreamer.freedesktop.org/documentation/vorbis/vorbisenc.html?gi-language=python
40
41
Returns:
42
Element, the source encoded as a Vorbis stream
43
"""
44
return
pipetools.make_element_with_src(pipeline, src,
"vorbisenc"
)
45
46
47
def
theora
(pipeline: pipetools.Pipeline, src: pipetools.Element, **properties: dict) -> pipetools.Element:
48
"""This element encodes raw video into a Theora stream
49
50
Args:
51
pipeline:
52
Gst.Pipeline, the pipeline to which the new element will be added
53
src:
54
Gst.Element, the source element
55
**properties:
56
dict, keyword arguments to be set as element properties
57
58
References:
59
[1] theoraenc docs: https://gstreamer.freedesktop.org/documentation/theora/theoraenc.html?gi-language=python
60
61
Returns:
62
Element, the source encoded as a Theora stream
63
"""
64
return
pipetools.make_element_with_src(pipeline, src,
"theoraenc"
, **properties)
65
66
67
68
def
flac
(pipeline: pipetools.Pipeline, src: pipetools.Element, quality=0, **properties):
69
"""Encoded sources as FLAC streams. FLAC is a Free Lossless Audio Codec.
70
FLAC audio can directly be written into a file, or embedded into containers such as oggmux or matroskamux.
71
72
Args:
73
pipeline:
74
Gst.Pipeline, the pipeline to which the new element will be added
75
src:
76
Gst.Element, the source element
77
quality:
78
int
79
**properties:
80
dict, keyword arguments to be set as element properties
81
82
References:
83
[1] https://gstreamer.freedesktop.org/documentation/flac/flacenc.html?gi-language=python
84
85
Returns:
86
Element, the source encoded as a FLAC stream
87
"""
88
return
pipetools.make_element_with_src(pipeline, src,
"flacenc"
, quality=quality, **properties)
89
90
91
def
igwd_parse
(pipeline: pipetools.Pipeline, src: pipetools.Element, **properties) -> pipetools.Element:
92
"""Parse byte streams into whole IGWD frame files (https://dcc.ligo.org/cgi-bin/DocDB/ShowDocument?docid=329)
93
94
Args:
95
pipeline:
96
Gst.Pipeline, the pipeline to which the new element will be added
97
src:
98
Gst.Element, the source element
99
**properties:
100
101
References:
102
Implementation gstlal/gstlal-ugly/gst/framecpp/framecpp_igwdparse.cc
103
104
Returns:
105
Element
106
"""
107
return
pipetools.make_element_with_src(pipeline, src,
"framecpp_igwdparse"
, **properties)
108
109
110
111
def
tsv
(pipeline: pipetools.Pipeline, src: pipetools.Element, segment: pipetools.Segment =
None
) -> pipetools.Element:
112
"""Converts audio time-series to tab-separated ascii text, a format compatible with most plotting utilities.
113
The output is multi-column tab-separated ASCII text. The first column is the time, the remaining columns are
114
the values of the channels in order.
115
116
Args:
117
pipeline:
118
Gst.Pipeline, the pipeline to which the new element will be added
119
src:
120
Gst.Element, the source element
121
segment:
122
Segment, default None, a ligo.segments.segment
123
124
Returns:
125
Element
126
"""
127
if
segment
is
not
None
:
128
return
pipetools.make_element_with_src(pipeline, src,
"lal_nxydump"
, start_time=segment[0].ns(), stop_time=segment[1].ns())
129
else
:
130
return
pipetools.make_element_with_src(pipeline, src,
"lal_nxydump"
)
131
132
133
134
def
uri_decode_bin
(pipeline: pipetools.Pipeline, uri: str, caps: pipetools.Caps =
"application/x-igwd-frame,framed=true"
, **properties) -> pipetools.Element:
135
"""Decodes data from a URI into raw media. It selects a source element that can handle the
136
given scheme and connects it to a decodebin.
137
138
Args:
139
pipeline:
140
Gst.Pipeline, the pipeline to which the new element will be added
141
uri:
142
str, URI to decode
143
caps:
144
Gst.Caps, The caps on which to stop decoding. (NULL = default)
145
**properties:
146
147
References:
148
[1] https://gstreamer.freedesktop.org/documentation/playback/uridecodebin.html?gi-language=python
149
150
Returns:
151
Element
152
"""
153
return
pipetools.make_element_with_src(pipeline,
None
,
"uridecodebin"
, uri=uri, caps=
None
if
caps
is
None
else
pipetools.Gst.Caps.from_string(caps), **properties)
python.pipeparts.encode.flac
flac(pipetools.Pipeline pipeline, pipetools.Element src, quality=0, **properties)
Adds a flacenc element to a pipeline with useful default properties.
Definition
encode.py:68
python.pipeparts.encode.uri_decode_bin
pipetools.Element uri_decode_bin(pipetools.Pipeline pipeline, str uri, pipetools.Caps caps="application/x-igwd-frame,framed=true", **properties)
Adds a uridecodebin element to a pipeline with useful default properties.
Definition
encode.py:134
python.pipeparts.encode.tsv
pipetools.Element tsv(pipetools.Pipeline pipeline, pipetools.Element src, pipetools.Segment segment=None)
Adds a lal_nxydump element to a pipeline with useful default properties.
Definition
encode.py:111
python.pipeparts.encode.vorbis
pipetools.Element vorbis(pipetools.Pipeline pipeline, pipetools.Element src)
Adds a vorbisenc element to a pipeline with useful default properties.
Definition
encode.py:29
python.pipeparts.encode.wav
pipetools.Element wav(pipetools.Pipeline pipeline, pipetools.Element src)
Adds a wavenc element to a pipeline with useful default properties.
Definition
encode.py:9
python.pipeparts.encode.theora
pipetools.Element theora(pipetools.Pipeline pipeline, pipetools.Element src, **dict properties)
Definition
encode.py:47
python.pipeparts.encode.igwd_parse
pipetools.Element igwd_parse(pipetools.Pipeline pipeline, pipetools.Element src, **properties)
Definition
encode.py:91
Generated by
1.17.0