Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GstLAL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
lscsoft
GstLAL
Commits
5058252d
Commit
5058252d
authored
4 years ago
by
Patrick Godwin
Committed by
ChiWai Chan
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
stream.Stream: allow pipeline naming, head.connect(), debugging output
parent
3328b24c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gstlal/python/stream.py
+22
-2
22 additions, 2 deletions
gstlal/python/stream.py
with
22 additions
and
2 deletions
gstlal/python/stream.py
+
22
−
2
View file @
5058252d
...
...
@@ -31,6 +31,7 @@ from collections import namedtuple
from
collections.abc
import
Mapping
import
functools
import
io
import
os
import
sys
import
uuid
...
...
@@ -73,7 +74,7 @@ class Stream(object):
"""
thread_init
=
False
def
__init__
(
self
,
mainloop
=
None
,
pipeline
=
None
,
handler
=
None
,
source
=
None
,
head
=
None
):
def
__init__
(
self
,
name
=
None
,
mainloop
=
None
,
pipeline
=
None
,
handler
=
None
,
source
=
None
,
head
=
None
):
# initialize threads if not set
if
not
self
.
thread_init
:
GObject
.
threads_init
()
...
...
@@ -81,8 +82,9 @@ class Stream(object):
self
.
thread_init
=
True
# set up gstreamer pipeline
self
.
name
=
name
if
name
else
str
(
uuid
.
uuid1
())
self
.
mainloop
=
mainloop
if
mainloop
else
GObject
.
MainLoop
()
self
.
pipeline
=
pipeline
if
pipeline
else
Gst
.
Pipeline
(
s
tr
(
uuid
.
uuid1
())
)
self
.
pipeline
=
pipeline
if
pipeline
else
Gst
.
Pipeline
(
s
elf
.
name
)
self
.
handler
=
handler
if
handler
else
StreamHandler
(
self
.
mainloop
,
self
.
pipeline
)
self
.
head
=
head
if
head
else
None
...
...
@@ -98,6 +100,19 @@ class Stream(object):
if
not
self
.
source
.
is_live
:
self
.
_seek_gps
()
self
.
_set_state
(
Gst
.
State
.
PLAYING
)
## Debugging output
if
os
.
environ
.
get
(
"
GST_DEBUG_DUMP_DOT_DIR
"
,
False
):
name
=
self
.
pipeline
.
get_name
()
pipeparts
.
write_dump_dot
(
self
.
pipeline
,
f
"
{
name
}
_PLAYING
"
,
verbose
=
True
)
## Setup a signal handler to intercept SIGINT in order to write
## the pipeline graph at ctrl+C before cleanly shutting down
class
SigHandler
(
simplehandler
.
OneTimeSignalHandler
):
def
do_on_call
(
self
,
signum
,
frame
):
pipeparts
.
write_dump_dot
(
self
.
pipeline
,
f
"
{
name
}
_SIGINT
"
,
verbose
=
True
)
sighandler
=
SigHandler
(
self
.
pipeline
)
self
.
mainloop
.
run
()
@classmethod
...
...
@@ -112,6 +127,7 @@ class Stream(object):
for
key
,
elem
in
head
.
items
():
new_head
=
{
key
:
cls
(
name
=
self
.
name
,
mainloop
=
self
.
mainloop
,
pipeline
=
self
.
pipeline
,
handler
=
self
.
handler
,
...
...
@@ -122,6 +138,7 @@ class Stream(object):
return
new_head
else
:
return
cls
(
name
=
self
.
name
,
mainloop
=
self
.
mainloop
,
pipeline
=
self
.
pipeline
,
handler
=
self
.
handler
,
...
...
@@ -143,6 +160,9 @@ class Stream(object):
)
return
stream
def
connect
(
self
,
*
args
,
**
kwargs
):
self
.
head
.
connect
(
*
args
,
**
kwargs
)
def
sink
(
self
,
func
):
def
sample_handler
(
elem
):
buf
=
self
.
_pull_buffer
(
elem
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment