From 2f5ca7693694fe917b9e322f6dc1692a5cbaacbf Mon Sep 17 00:00:00 2001 From: hark Date: Fri, 25 Mar 2016 03:33:09 +0000 Subject: experimental gstreamer audiobackend (not working) --- src/conversation/gnunet_gst_def.h | 190 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 src/conversation/gnunet_gst_def.h (limited to 'src/conversation/gnunet_gst_def.h') diff --git a/src/conversation/gnunet_gst_def.h b/src/conversation/gnunet_gst_def.h new file mode 100644 index 000000000..2e6903db4 --- /dev/null +++ b/src/conversation/gnunet_gst_def.h @@ -0,0 +1,190 @@ +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "gnunet/platform.h" +#include "gnunet/gnunet_util_lib.h" +#include "gnunet/gnunet_protocols.h" +//#include "gnunet/conversation.h" doesn't get installed +#include "conversation.h" +#include "gnunet/gnunet_constants.h" +#include "gnunet/gnunet_core_service.h" +#include "gnunet/gnunet_common.h" + +/* +#include +#include +#include +*/ + +/* huh +#include + +#include +#include +#include +#include +#include +*/ + +#include +#include +#include +#include +#include + +// sockets +#include +#include +#include +#include + +#include +#include +#include + + +//glib stuff +//#include +#include +#include + +// static struct AudioMessage *audio_message; + + + +typedef struct GNUNET_gstData GNUNET_gstData; +struct GNUNET_gstData { + //general + GstPipeline *pipeline; + + // things + struct AudioMessage *audio_message; + struct GNUNET_SERVER_MessageStreamTokenizer *stdin_mst; + GstElement *appsrc; + GstElement *appsink; + //settings + int audiobackend; + int dropsilence; + int usertp; + int pure_ogg; + char *jack_pp_in; + char *jack_pp_out; +}; + + + + +#define DEBUG_READ_PURE_OGG 1 +#define DEBUG_RECORD_PURE_OGG 1 + + +/** + * How much data to read in one go + */ +#define MAXLINE 4096 + +/** + * Max number of microseconds to buffer in audiosink. + * Default is 1000 + */ +#define BUFFER_TIME 1000 + +/** + * Min number of microseconds to buffer in audiosink. + * Default is 1000 + */ +#define LATENCY_TIME 1000 + + +/** + * Number of channels. + * Must be one of the following (from libopusenc documentation): + * 1, 2 + */ +#define OPUS_CHANNELS 1 + +/** + * Maximal size of a single opus packet. + */ +#define MAX_PAYLOAD_SIZE (1024 / OPUS_CHANNELS) + +/** + * Size of a single frame fed to the encoder, in ms. + * Must be one of the following (from libopus documentation): + * 2.5, 5, 10, 20, 40 or 60 + */ +#define OPUS_FRAME_SIZE 40 + +/** + * Expected packet loss to prepare for, in percents. + */ +#define PACKET_LOSS_PERCENTAGE 1 + +/** + * Set to 1 to enable forward error correction. + * Set to 0 to disable. + */ +#define INBAND_FEC_MODE 1 + +/** + * Max number of microseconds to buffer in audiosource. + * Default is 200000 + */ +#define BUFFER_TIME 1000 /* 1ms */ + +/** + * Min number of microseconds to buffer in audiosource. + * Default is 10000 + */ +#define LATENCY_TIME 1000 /* 1ms */ + +/** + * Maximum delay in multiplexing streams, in ns. + * Setting this to 0 forces page flushing, which + * decreases delay, but increases overhead. + */ +#define OGG_MAX_DELAY 0 + +/** + * Maximum delay for sending out a page, in ns. + * Setting this to 0 forces page flushing, which + * decreases delay, but increases overhead. + */ +#define OGG_MAX_PAGE_DELAY 0 + +#define SAMPLING_RATE 48000 + +enum { + AUTO, + JACK, + ALSA, + FAKE, + TEST +}; + +enum { + SOURCE, + SINK +}; + +enum { + ENCODER, + DECODER +}; + +enum { + FAIL, + OK +}; + +enum { + SPEAKER, + MICROPHONE +}; -- cgit v1.2.3