2 This file is part of GNUnet.
3 Copyright (C) 2016 GNUnet e.V.
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
21 * @file conversation/gnunet_gst_def.h
37 #include "gnunet_util_lib.h"
38 #include "gnunet_protocols.h"
39 //#include "gnunet/conversation.h" doesn't get installed
40 #include "conversation.h"
41 #include "gnunet_constants.h"
42 #include "gnunet_core_service.h"
43 #include "gnunet_common.h"
47 #include <gst/audio/gstaudiobasesrc.h>
48 #include <gst/app/gstappsrc.h>
52 #include <glib-2.0/glib.h>
54 #include <gstreamer-1.0/gst/gst.h>
55 #include <gstreamer-1.0/gst/pbutils/pbutils.h>
56 #include <gstreamer-1.0/gst/video/videooverlay.h>
57 #include <gstreamer-1.0/gst/audio/gstaudiobasesrc.h>
58 #include <gstreamer-1.0/gst/app/gstappsrc.h>
62 #include <gst/audio/gstaudiobasesrc.h>
63 #include <gst/app/gstappsrc.h>
65 #include <gst/app/gstappsink.h>
70 #include <netinet/in.h>
72 #include <sys/socket.h>
73 #include <arpa/inet.h>
77 #include <sys/types.h>
83 #include <glib-2.0/glib/gprintf.h>
84 //#include <glib-unix.h>
86 // static struct AudioMessage *audio_message;
90 typedef struct GNUNET_gstData GNUNET_gstData;
91 struct GNUNET_gstData {
93 GstPipeline *pipeline;
96 struct AudioMessage *audio_message;
97 struct GNUNET_MessageStreamTokenizer *stdin_mst;
112 #define DEBUG_READ_PURE_OGG 1
113 #define DEBUG_RECORD_PURE_OGG 1
117 * How much data to read in one go
122 * Max number of microseconds to buffer in audiosink.
125 #define BUFFER_TIME 1000
128 * Min number of microseconds to buffer in audiosink.
131 #define LATENCY_TIME 1000
135 * Number of channels.
136 * Must be one of the following (from libopusenc documentation):
139 #define OPUS_CHANNELS 1
142 * Maximal size of a single opus packet.
144 #define MAX_PAYLOAD_SIZE (1024 / OPUS_CHANNELS)
147 * Size of a single frame fed to the encoder, in ms.
148 * Must be one of the following (from libopus documentation):
149 * 2.5, 5, 10, 20, 40 or 60
151 #define OPUS_FRAME_SIZE 40
154 * Expected packet loss to prepare for, in percents.
156 #define PACKET_LOSS_PERCENTAGE 1
159 * Set to 1 to enable forward error correction.
160 * Set to 0 to disable.
162 #define INBAND_FEC_MODE 1
165 * Max number of microseconds to buffer in audiosource.
168 #define BUFFER_TIME 1000 /* 1ms */
171 * Min number of microseconds to buffer in audiosource.
174 #define LATENCY_TIME 1000 /* 1ms */
177 * Maximum delay in multiplexing streams, in ns.
178 * Setting this to 0 forces page flushing, which
179 * decreases delay, but increases overhead.
181 #define OGG_MAX_DELAY 0
184 * Maximum delay for sending out a page, in ns.
185 * Setting this to 0 forces page flushing, which
186 * decreases delay, but increases overhead.
188 #define OGG_MAX_PAGE_DELAY 0
190 #define SAMPLING_RATE 48000