aboutsummaryrefslogtreecommitdiff
path: root/src/conversation/gnunet-helper-audio-playback.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/conversation/gnunet-helper-audio-playback.c')
-rw-r--r--src/conversation/gnunet-helper-audio-playback.c57
1 files changed, 39 insertions, 18 deletions
diff --git a/src/conversation/gnunet-helper-audio-playback.c b/src/conversation/gnunet-helper-audio-playback.c
index 18f63ad186..093b08ec30 100644
--- a/src/conversation/gnunet-helper-audio-playback.c
+++ b/src/conversation/gnunet-helper-audio-playback.c
@@ -2,20 +2,18 @@
This file is part of GNUnet.
Copyright (C) 2013 GNUnet e.V.
- GNUnet is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file conversation/gnunet-helper-audio-playback.c
@@ -149,17 +147,22 @@ process_header (ogg_packet *op)
OpusDecoder *dec;
struct OpusHeadPacket header;
- if (op->bytes < sizeof (header))
+ if ( ((unsigned int) op->bytes) < sizeof (header))
return NULL;
- GNUNET_memcpy (&header, op->packet, sizeof (header));
+ GNUNET_memcpy (&header,
+ op->packet,
+ sizeof (header));
header.preskip = GNUNET_le16toh (header.preskip);
header.sampling_rate = GNUNET_le32toh (header.sampling_rate);
header.gain = GNUNET_le16toh (header.gain);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Header: v%u, %u-ch, skip %u, %uHz, %u gain\n",
- header.version, header.channels, header.preskip, header.sampling_rate, header.gain);
-
+ header.version,
+ header.channels,
+ header.preskip,
+ header.sampling_rate,
+ header.gain);
channels = header.channels;
preskip = header.preskip;
@@ -338,7 +341,8 @@ audio_write (int64_t maxout)
static void
quit (int ret)
{
- mainloop_api->quit (mainloop_api, ret);
+ mainloop_api->quit (mainloop_api,
+ ret);
exit (ret);
}
@@ -544,6 +548,7 @@ ogg_demux_and_decode ()
}
}
+
/**
* Message callback
*
@@ -560,6 +565,7 @@ stdin_receiver (void *cls,
char *data;
size_t payload_len;
+ (void) cls;
switch (ntohs (msg->type))
{
case GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO:
@@ -590,6 +596,9 @@ stream_write_callback (pa_stream *s,
void *userdata)
{
/* unblock 'main' */
+ (void) userdata;
+ (void) length;
+ (void) s;
if (-1 != ready_pipe[1])
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -608,6 +617,10 @@ exit_signal_callback (pa_mainloop_api *m,
int sig,
void *userdata)
{
+ (void) m;
+ (void) e;
+ (void) sig;
+ (void) userdata;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("gnunet-helper-audio-playback - Got signal, exiting\n"));
quit (1);
@@ -623,6 +636,7 @@ context_state_callback (pa_context *c,
{
int p;
+ (void) userdata;
GNUNET_assert (NULL != c);
switch (pa_context_get_state (c))
{
@@ -735,7 +749,11 @@ ogg_init ()
static void
drain_callback (pa_stream*s, int success, void *userdata)
{
- pa_threaded_mainloop_signal (m, 0);
+ (void) s;
+ (void) success;
+ (void) userdata;
+ pa_threaded_mainloop_signal (m,
+ 0);
}
@@ -750,7 +768,6 @@ int
main (int argc, char *argv[])
{
static unsigned long long toff;
-
char readbuf[MAXLINE];
struct GNUNET_MessageStreamTokenizer *stdin_mst;
char c;
@@ -759,6 +776,8 @@ main (int argc, char *argv[])
int read_pure_ogg = getenv ("GNUNET_READ_PURE_OGG") ? 1 : 0;
#endif
+ (void) argc;
+ (void) argv;
GNUNET_assert (GNUNET_OK ==
GNUNET_log_setup ("gnunet-helper-audio-playback",
"WARNING",
@@ -783,7 +802,9 @@ main (int argc, char *argv[])
#endif
while (1)
{
- ret = read (0, readbuf, sizeof (readbuf));
+ ret = read (STDIN_FILENO,
+ readbuf,
+ sizeof (readbuf));
toff += ret;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received %d bytes of audio data (total: %llu)\n",