Commit f0037a8c authored by hark's avatar hark

fix some warnings

parent 2ee8fd61
Pipeline #41 skipped
#include "gnunet_gst_def.h"
#include <stdlib.h>
//enable debugging
#define GGD
/**
* Our configuration.
*/
......@@ -152,7 +156,9 @@ on_appsink_new_sample (GstElement * element, GNUNET_gstData * d)
s_caps = gst_sample_get_caps(s);
caps_str = gst_caps_to_string(s_caps);
#ifdef GGD
fprintf(stderr, "caps: %s \n ", caps_str);
#endif
b = gst_sample_get_buffer(s);
GST_WARNING ("caps are %" GST_PTR_FORMAT, gst_sample_get_caps(s));
......@@ -161,12 +167,16 @@ on_appsink_new_sample (GstElement * element, GNUNET_gstData * d)
size_t len;
len = map.size;
#ifdef GGD
fprintf(stderr, "length: %u \n", len);
#endif
if (len > UINT16_MAX - sizeof (struct AudioMessage))
{
// this should never happen?
#ifdef GGD
fprintf(stderr,"sample from gstreamer too big!, exiting \n");
exit(20);
#endif
len = UINT16_MAX - sizeof (struct AudioMessage);
}
......@@ -193,12 +203,16 @@ on_appsink_new_sample (GstElement * element, GNUNET_gstData * d)
if (d->pure_ogg == TRUE)
{
// write the audio_message without the gnunet headers
#ifdef GGD
fprintf(stderr, "\n pure_ogg \n \n");
#endif
// write_data ((const char *) &(d->audio_message)[1], len);
}
else if (d->pure_ogg == FALSE)
{
#ifdef GGD
fprintf(stderr, "\n sending with gnunet headers \n \n");
#endif
write_data ((const char *) d->audio_message, msg_size);
}
gst_sample_unref(s);
......@@ -431,12 +445,12 @@ autoaudiosource_child_added (GstChildProxy *child_proxy, GObject *object, gchar
g_object_set (object, "buffer-time", (gint64) BUFFER_TIME, "latency-time", (gint64) LATENCY_TIME, NULL);
}
GstElement *
GstPipeline *
get_pipeline(GstElement *element)
{
GstPipeline *p;
p = gst_object_get_parent(element);
p = GST_PIPELINE(gst_object_get_parent(GST_OBJECT(element)));
return p;
}
......@@ -448,8 +462,9 @@ decoder_ogg_pad_added (GstElement *element,
{
GstPad *sinkpad;
GstElement *decoder = (GstElement *) data;
#ifdef GGD
fprintf(stderr,"==== ogg pad added callback \n");
#endif
/* We can now link this pad with the opus-decoder sink pad */
// pl_graph(get_pipeline(element));
sinkpad = gst_element_get_static_pad (decoder, "sink");
......@@ -464,14 +479,15 @@ gnunet_read (GNUNET_gstData * d)
{
char readbuf[MAXLINE];
int ret;
// fprintf(stderr,"read \n");
ret = read (0, readbuf, sizeof (readbuf));
if (0 > ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Read error from STDIN: %d %s\n"),
ret, strerror (errno));
#ifdef GGD
fprintf(stderr, "read error from STDIN");
#endif
return FAIL;
}
//toff += ret;
......@@ -486,22 +502,32 @@ gnunet_read (GNUNET_gstData * d)
if (d->pure_ogg)
{
#ifdef GGD
fprintf(stderr, "pure_ogg receiver \n");
#endif
feed_buffer_to_gst (readbuf, ret, d);
}
else
{
#ifdef GGD
fprintf(stderr,"mst receiver\n");
#endif
switch( GNUNET_SERVER_mst_receive (d->stdin_mst, NULL, readbuf, ret, GNUNET_NO, GNUNET_NO))
{
case GNUNET_OK:
#ifdef GGD
fprintf(stderr, "OK \n");
#endif
break;
case GNUNET_NO:
#ifdef GGD
fprintf(stderr, "NO \n");
#endif
break;
case GNUNET_SYSERR:
#ifdef GGD
fprintf(stderr, "SYSERR \n");
#endif
break;
}
......@@ -518,20 +544,25 @@ stdin_receiver (void *cls,
{
struct AudioMessage *audio;
size_t b_len;
#ifdef GGD
fprintf(stderr,"stdin receiver \n ");
dump_buffer(sizeof(msg), msg);
//dump_buffer(sizeof(msg), msg);
#endif
switch (ntohs (msg->type))
{
case GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO:
audio = (struct AudioMessage *) msg;
b_len = ntohs (audio->header.size) - sizeof (struct AudioMessage);
#ifdef GGD
fprintf(stderr,"feeding buffer to gst \n ");
#endif
feed_buffer_to_gst ((const char *) &audio[1], b_len, cls);
break;
default:
#ifdef GGD
fprintf(stderr,"No audio message: %u \n ", ntohs(msg->type));
#endif
break;
}
return GNUNET_OK;
......@@ -559,14 +590,17 @@ get_app(GNUNET_gstData *d, int type)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Audio playback starts\n");
#ifdef GGD
fprintf(stderr," creating appsrc \n ");
#endif
d->stdin_mst = GNUNET_SERVER_mst_create (&stdin_receiver, d);
if ( d->stdin_mst == NULL)
{
fprintf(stderr,"stdin_mst = NULL");
exit(10);
}
d->appsrc = gst_element_factory_make ("appsrc", "appsrc");
gst_bin_add_many( bin, d->appsrc, NULL);
......@@ -595,7 +629,9 @@ get_app(GNUNET_gstData *d, int type)
// fill it with 7 for testing
memset(d->audio_message, 7, 200);
(d->audio_message)->header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO);
#ifdef GGD
fprintf(stderr,"headernumber number: %u \n",GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO);
#endif
g_object_set (G_OBJECT (d->appsink), "emit-signals", TRUE, "sync", TRUE, NULL);
......
......@@ -12,6 +12,12 @@ int usertp = TRUE;
extern void pl_graph();
extern int
gnunet_read (GNUNET_gstData *);
extern GstBin *
get_app(GNUNET_gstData *, int);
extern GstElement *
gst_element_factory_make_debug( gchar *, gchar *);
......
#include "gnunet_gst_def.h"
#include "gnunet_gst.h"
//enable debugging
#define GGD
int
main (int argc, char *argv[])
{
......@@ -20,12 +24,17 @@ main (int argc, char *argv[])
#ifdef IS_SPEAKER
int type = SPEAKER;
#ifdef GGD
fprintf(stderr,"this is the speaker \n");
#endif
#endif
#ifdef IS_MIC
int type = MICROPHONE;
#ifdef GGD
fprintf(stderr,"this is the microphone \n");
#endif
#endif
if ( type == SPEAKER)
{
......
[MEDIAHELPER]
AUDIOBACKEND = JACK
REMOVESILENCE = YES
REMOVESILENCE = NO
USERTP = NO
NO_GN_HEADERS = NO
JACK_PP_IN = mocp
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment