Skip to content
Snippets Groups Projects
Commit fcb6663a authored by Kipp Cannon's avatar Kipp Cannon
Browse files
parents 5a826796 ada43d69
No related branches found
No related tags found
No related merge requests found
......@@ -88,13 +88,21 @@ AC_SUBST([FFTW_LIBS])
#
PKG_CHECK_MODULES([NDS2], [nds2-client], [HAVE_NDS2="yes"], [AC_MSG_WARN([Not found!]) ; HAVE_NDS2="no"])
AM_CONDITIONAL([COND_NDS2], [test "${HAVE_NDS2}" == "yes"])
if test "${HAVE_NDS2}" == "yes" ; then
AC_DEFINE([HAVE_NDS2], 1)
AC_ARG_WITH([nds],
[AS_HELP_STRING([--with-nds],
[include NDS source element @<:@default=check@:>@])],
[],
[with_nds=check])
AS_IF([test "x$with_nds" != xno],
[PKG_CHECK_MODULES([NDS], [nds2-client], [HAVE_NDS="yes"], [AC_MSG_WARN([Not found!]) ; HAVE_NDS="no"])], [])
AM_CONDITIONAL([COND_NDS], [test "${HAVE_NDS}" == "yes"])
if test "${HAVE_NDS}" == "yes" ; then
AC_DEFINE([HAVE_NDS], 1)
fi
AC_SUBST([NDS2_CFLAGS])
AC_SUBST([NDS2_LIBS])
AC_SUBST([NDS_CFLAGS])
AC_SUBST([NDS_LIBS])
#
......
# A gst-launch pipeline to encode h(t) from NDS2 into a OGG/Vorbis file
# The 'adder' element is included as a hack to throw away GPS time stamps; otherwise
# the autoaudiosink won't play
HOST="marble.ligo-wa.caltech.edu"
REQUESTED_CHANNEL_NAME="H1:DMT-STRAIN"
......@@ -6,7 +8,7 @@ REQUESTED_CHANNEL_NAME="H1:DMT-STRAIN"
gst-launch \
ndssrc \
host="${HOST}" \
requested-channel-name="${REQUESTED_CHANNEL_NAME}" \
channel-name="${REQUESTED_CHANNEL_NAME}" \
! audiochebband \
lower-frequency=45 \
upper-frequency=2500 \
......@@ -16,6 +18,7 @@ gst-launch \
amplification=2e+17 \
! progressreport \
update-freq=2 \
! audiorate \
! adder \
! audiorate \
! audioconvert \
! autoaudiosink
......@@ -2,7 +2,7 @@ INCLUDES = -I$(top_srcdir)/src/lib
plugin_LTLIBRARIES = libgstlal.la
if COND_NDS2
if COND_NDS
NDSSRC_SOURCES = gstlal_ndssrc.h gstlal_ndssrc.c
else
NDSSRC_SOURCES =
......@@ -29,8 +29,8 @@ libgstlal_la_SOURCES = \
gstlal_reblock.h gstlal_reblock.c \
gstlal_delay.h gstlal_delay.c \
$(NDSSRC_SOURCES)
libgstlal_la_CFLAGS = -O2 $(AM_CFLAGS) $(CFLAGS) ${gstreamer_CFLAGS} ${LAL_CFLAGS} ${GSL_CFLAGS} ${FFTW_CFLAGS} ${NDS2_CFLAGS}
libgstlal_la_LIBADD = ${gstreamer_LIBS} ${LAL_LIBS} ${GSL_LIBS} ${FFTW_LIBS} ${NDS2_LIBS} $(top_srcdir)/src/lib/libgstlal.la
libgstlal_la_CFLAGS = -O2 $(AM_CFLAGS) $(CFLAGS) ${gstreamer_CFLAGS} ${LAL_CFLAGS} ${GSL_CFLAGS} ${FFTW_CFLAGS} ${NDS_CFLAGS}
libgstlal_la_LIBADD = ${gstreamer_LIBS} ${LAL_LIBS} ${GSL_LIBS} ${FFTW_LIBS} ${NDS_LIBS} $(top_srcdir)/src/lib/libgstlal.la
libgstlal_la_LDFLAGS = ${GSTREAMER_PLUGIN_LDFLAGS}
noinst_HEADERS = gstlal_plugins.h
......@@ -91,7 +91,7 @@
#include <gstlal_nofakedisconts.h>
#include <gstlal_reblock.h>
#include <gstlal_delay.h>
#ifdef HAVE_NDS2
#ifdef HAVE_NDS
#include <gstlal_ndssrc.h>
#endif
......@@ -140,7 +140,7 @@ static gboolean plugin_init(GstPlugin *plugin)
{"lal_nofakedisconts", GSTLAL_NOFAKEDISCONTS_TYPE},
{"lal_reblock", GSTLAL_REBLOCK_TYPE},
{"lal_delay", GSTLAL_DELAY_TYPE},
#ifdef HAVE_NDS2
#ifdef HAVE_NDS
{"ndssrc", GSTLAL_NDSSRC_TYPE},
#endif
{NULL, 0},
......
......@@ -55,7 +55,7 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE(
GST_STATIC_CAPS(
"audio/x-raw-float, " \
"rate = (int) [1, MAX], " \
"channels = (int) [1, MAX], " \
"channels = (int) [1, MAX], "\
"endianness = (int) BYTE_ORDER, " \
"width = (int) {32,64}; " \
"audio/x-raw-int, " \
......@@ -106,13 +106,6 @@ GST_BOILERPLATE(
);
enum property {
ARG_DELAY = 1,
ARG_SILENT,
};
#define DEFAULT_DELAY 0
/*
* ============================================================================
*
......@@ -122,8 +115,18 @@ enum property {
*/
enum property {
ARG_DELAY = 1,
ARG_SILENT,
};
#define DEFAULT_DELAY 0
/*
* get_unit_size()
* get_unit_size() stores the size (in bytes) of a single sample
* from a single channel in the buffer.
* The "width" of a buffer is equal to the total number of channels
* times the number of bits per channel.
*/
static gboolean get_unit_size(GstBaseTransform *trans, GstCaps *caps, guint *size)
{
......@@ -146,7 +149,11 @@ static gboolean get_unit_size(GstBaseTransform *trans, GstCaps *caps, guint *siz
}
/*
* When the caps on an element's pads a finally set, this function is called.
* We use this opportunity to record the chosen sampling rate and the unit
* size.
*/
static gboolean set_caps(GstBaseTransform *trans,
GstCaps *incaps,
GstCaps *outcaps)
......@@ -159,19 +166,45 @@ static gboolean set_caps(GstBaseTransform *trans,
/* size of unit sample */
get_unit_size(trans,incaps,&element->unit_size);
if ( !element->silent)
{
fprintf(stderr,"lal_delay incaps set = %s\n",gst_caps_to_string(incaps));
fprintf(stderr,"lal_delay outcaps set = %s\n",gst_caps_to_string(outcaps));
}
return TRUE;
}
/*
* In addition to handling buffers, elements also handle events.
* These events change how the element behaves, e.g., an EOS event
* tells the element to stop reading buffers. The event() function
* is called whenever an event is passed to an element. Return
* FALSE to override the parent class event handling.
*/
static gboolean event(GstBaseTransform *trans, GstEvent *event)
{
GSTLALDelay *element = GSTLAL_DELAY( trans );
if ( !element->silent )
{
fprintf(stderr,"lal_delay received signal %s\n",
gst_event_type_get_name(GST_EVENT_TYPE(event)));
}
return TRUE; //FIXME
}
/*
* set up output buffer
* When an input buffer is received, prepare_output_buffer is called.
* This function allows you to map an output buffer to a given
* input buffer. In this case, we use this function to set the
* size of the output buffer.
*/
static GstFlowReturn prepare_output_buffer(GstBaseTransform *trans,
GstBuffer *inbuf,
......@@ -212,6 +245,12 @@ static GstFlowReturn prepare_output_buffer(GstBaseTransform *trans,
}
/*
* The transform function actually does the heavy lifting on buffers.
* Given an input buffer and an output buffer (the latter of which is
* set in prepare_output_buffer), determine what data actually gets put
* into the output buffer.
*/
static GstFlowReturn transform( GstBaseTransform *trans, GstBuffer *inbuf, GstBuffer *outbuf)
{
GSTLALDelay *element = GSTLAL_DELAY(trans);
......@@ -219,12 +258,12 @@ static GstFlowReturn transform( GstBaseTransform *trans, GstBuffer *inbuf, GstBu
guint delaysize = element->unit_size*element->delay;
guint64 delaytime;
if ( GST_BUFFER_SIZE(inbuf) < delaysize )
if ( GST_BUFFER_SIZE(inbuf) <= delaysize )
/* drop entire buffer */
{
if ( !element->silent )
{
fprintf(stderr,"skip %ld to %ld, pass nothing (rate %d)\n",
fprintf(stderr,"skip %ld to %ld, let nothing through (rate %d)\n",
GST_BUFFER_TIMESTAMP(inbuf),
GST_BUFFER_TIMESTAMP(inbuf)+GST_BUFFER_DURATION(inbuf),
element->rate);
......@@ -251,7 +290,7 @@ static GstFlowReturn transform( GstBaseTransform *trans, GstBuffer *inbuf, GstBu
if ( !element->silent )
{
fprintf(stderr,"skip %ld to %ld, pass %ld to %ld (rate %d)\n",
fprintf(stderr,"skip %ld to %ld, let %ld to %ld through (rate %d)\n",
GST_BUFFER_TIMESTAMP(inbuf),
GST_BUFFER_TIMESTAMP(inbuf) + delaytime,
GST_BUFFER_TIMESTAMP(outbuf),
......@@ -267,6 +306,13 @@ static GstFlowReturn transform( GstBaseTransform *trans, GstBuffer *inbuf, GstBu
else
/* pass entire buffer */
{
if ( !element->silent )
{
fprintf(stderr,"let everything through %ld to %ld (rate %d)\n",
GST_BUFFER_TIMESTAMP(inbuf),
GST_BUFFER_TIMESTAMP(inbuf) + GST_BUFFER_DURATION(inbuf),
element->rate);
}
result = GST_FLOW_OK;
}
......
This diff is collapsed.
/*
* NDS-based src element
* see https://www.lsc-group.phys.uwm.edu/daswg/wiki/NetworkDataServer2
*
* Copyright (C) 2008 Leo Singer
*
......@@ -54,10 +55,15 @@ typedef struct {
char* host;
int port;
char* requested_channel_name;
daq_t* daq;
daq_channel_t* daq_channel;
gboolean needs_seek;
char* channelName;
enum chantype channelType;
daq_channel_t* availableChannels;
int countAvailableChannels;
} GSTLALNDSSrc;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment