Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
gstlal
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
14
Issues
14
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lscsoft
gstlal
Commits
68277dc4
Commit
68277dc4
authored
Jul 30, 2019
by
Aaron Viets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lal_latency: current-latency is now a readable property
parent
03b3ac1b
Pipeline
#72551
passed with stages
in 17 minutes and 58 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
17 deletions
+63
-17
gstlal-ugly/gst/lal/gstlal_latency.c
gstlal-ugly/gst/lal/gstlal_latency.c
+62
-17
gstlal-ugly/gst/lal/gstlal_latency.h
gstlal-ugly/gst/lal/gstlal_latency.h
+1
-0
No files found.
gstlal-ugly/gst/lal/gstlal_latency.c
View file @
68277dc4
...
...
@@ -95,6 +95,30 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE(
);
/*
* ============================================================================
*
* Utilities
*
* ============================================================================
*/
/* Need to define "property" before the GObject Methods section since it gets used earlier */
enum
property
{
ARG_SILENT
=
1
,
ARG_CURRENT_LATENCY
,
ARG_FAKE
};
static
GParamSpec
*
properties
[
ARG_FAKE
];
#define DEFAULT_SILENT FALSE
static
void
lal_latency_dummy_function
(
GObject
*
object
)
{
return
;
}
/*
* ============================================================================
...
...
@@ -128,14 +152,19 @@ static GstFlowReturn transform_ip(GstBaseTransform *trans, GstBuffer *buf)
gdouble
current_time
=
current_s
+
current_us
;
gdouble
buffer_time
=
(
double
)
GST_TIME_AS_SECONDS
(
GST_BUFFER_PTS
(
buf
));
gdouble
latency
=
current_time
-
buffer_time
;
element
->
current_latency
=
current_time
-
buffer_time
;
/* Tell the world about the latency by updating the latency property */
GST_LOG_OBJECT
(
element
,
"Just computed new latency"
);
g_object_notify_by_pspec
(
G_OBJECT
(
element
),
properties
[
ARG_CURRENT_LATENCY
]);
/* And write to file if we want */
if
(
!
silent
)
{
FILE
*
out_file
;
out_file
=
fopen
(
"latency_output.txt"
,
"a"
);
fprintf
(
out_file
,
"current time = %9.3f, buffer time = %9d, latency = %6.3f, %s
\n
"
,
current_time
,
(
int
)
buffer_time
,
latency
,
GST_OBJECT_NAME
(
element
));
current_time
,
(
int
)
buffer_time
,
element
->
current_
latency
,
GST_OBJECT_NAME
(
element
));
fclose
(
out_file
);
}
...
...
@@ -156,13 +185,6 @@ static GstFlowReturn transform_ip(GstBaseTransform *trans, GstBuffer *buf)
*/
enum
property
{
ARG_SILENT
=
1
};
#define DEFAULT_SILENT FALSE
/*
* set_property()
*/
...
...
@@ -180,6 +202,10 @@ static void set_property(GObject *object, enum property prop_id, const GValue *v
element
->
silent
=
g_value_get_boolean
(
value
);
break
;
case
ARG_CURRENT_LATENCY
:
element
->
current_latency
=
g_value_get_double
(
value
);
break
;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID
(
object
,
prop_id
,
pspec
);
break
;
...
...
@@ -206,6 +232,10 @@ static void get_property(GObject *object, enum property prop_id, GValue *value,
g_value_set_boolean
(
value
,
element
->
silent
);
break
;
case
ARG_CURRENT_LATENCY
:
g_value_set_double
(
value
,
element
->
current_latency
);
break
;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID
(
object
,
prop_id
,
pspec
);
break
;
...
...
@@ -237,16 +267,30 @@ static void gstlal_latency_class_init(GSTLALLatencyClass *klass)
gobject_class
->
set_property
=
GST_DEBUG_FUNCPTR
(
set_property
);
gobject_class
->
get_property
=
GST_DEBUG_FUNCPTR
(
get_property
);
properties
[
ARG_SILENT
]
=
g_param_spec_boolean
(
"silent"
,
"Silent"
,
"Do not print output to stdout."
,
DEFAULT_SILENT
,
G_PARAM_READWRITE
|
G_PARAM_STATIC_STRINGS
|
G_PARAM_CONSTRUCT
);
properties
[
ARG_CURRENT_LATENCY
]
=
g_param_spec_double
(
"current-latency"
,
"Current Latency"
,
"The current measured value of the latency"
,
-
G_MAXDOUBLE
,
G_MAXDOUBLE
,
0
.
0
,
G_PARAM_READABLE
|
G_PARAM_STATIC_STRINGS
);
g_object_class_install_property
(
gobject_class
,
ARG_SILENT
,
g_param_spec_boolean
(
"silent"
,
"Silent"
,
"Do not print output to stdout."
,
DEFAULT_SILENT
,
G_PARAM_READWRITE
|
G_PARAM_STATIC_STRINGS
|
G_PARAM_CONSTRUCT
)
properties
[
ARG_SILENT
]
);
g_object_class_install_property
(
gobject_class
,
ARG_CURRENT_LATENCY
,
properties
[
ARG_CURRENT_LATENCY
]
);
gst_element_class_add_pad_template
(
element_class
,
gst_static_pad_template_get
(
&
src_factory
));
...
...
@@ -263,6 +307,7 @@ static void gstlal_latency_class_init(GSTLALLatencyClass *klass)
static
void
gstlal_latency_init
(
GSTLALLatency
*
element
)
{
g_signal_connect
(
G_OBJECT
(
element
),
"notify::current-latency"
,
G_CALLBACK
(
lal_latency_dummy_function
),
NULL
);
gst_base_transform_set_passthrough
(
GST_BASE_TRANSFORM
(
element
),
TRUE
);
gst_base_transform_set_gap_aware
(
GST_BASE_TRANSFORM
(
element
),
TRUE
);
...
...
gstlal-ugly/gst/lal/gstlal_latency.h
View file @
68277dc4
...
...
@@ -78,6 +78,7 @@ struct _GSTLALLatency {
/* properties */
gboolean
silent
;
gdouble
current_latency
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment