aboutsummaryrefslogtreecommitdiff
path: root/src/conversation/gnunet_gst_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/conversation/gnunet_gst_test.c')
-rw-r--r--src/conversation/gnunet_gst_test.c127
1 files changed, 60 insertions, 67 deletions
diff --git a/src/conversation/gnunet_gst_test.c b/src/conversation/gnunet_gst_test.c
index f52130fa4..60e920f10 100644
--- a/src/conversation/gnunet_gst_test.c
+++ b/src/conversation/gnunet_gst_test.c
@@ -1,22 +1,22 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2016 GNUnet e.V. 3 Copyright (C) 2016 GNUnet e.V.
4 4
5 GNUnet is free software: you can redistribute it and/or modify it 5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License, 7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19*/ 19 */
20/** 20/**
21 * @file conversation/gnunet_gst_test.c 21 * @file conversation/gnunet_gst_test.c
22 * @brief FIXME 22 * @brief FIXME
@@ -27,7 +27,7 @@
27#include "gnunet_gst.h" 27#include "gnunet_gst.h"
28 28
29int 29int
30main (int argc, char *argv[]) 30main(int argc, char *argv[])
31{ 31{
32 struct GNUNET_gstData *gst; 32 struct GNUNET_gstData *gst;
33 // GstBus *bus; 33 // GstBus *bus;
@@ -48,14 +48,14 @@ main (int argc, char *argv[])
48 48
49 gg_load_configuration(gst); 49 gg_load_configuration(gst);
50/* 50/*
51 gst->audiobackend = JACK; 51 gst->audiobackend = JACK;
52 gst->dropsilence = TRUE; 52 gst->dropsilence = TRUE;
53 gst->usertp = FALSE; 53 gst->usertp = FALSE;
54 */ 54 */
55 /* Initialize GStreamer */ 55 /* Initialize GStreamer */
56 gst_init (&argc, &argv); 56 gst_init(&argc, &argv);
57 57
58 gst->pipeline = GST_PIPELINE(gst_pipeline_new ("gnunet-media-helper")); 58 gst->pipeline = GST_PIPELINE(gst_pipeline_new("gnunet-media-helper"));
59 59
60#ifdef IS_SPEAKER 60#ifdef IS_SPEAKER
61 int type = SPEAKER; 61 int type = SPEAKER;
@@ -64,39 +64,34 @@ main (int argc, char *argv[])
64#ifdef IS_MIC 64#ifdef IS_MIC
65 int type = MICROPHONE; 65 int type = MICROPHONE;
66 printf("this is the microphone \n"); 66 printf("this is the microphone \n");
67
68#endif 67#endif
69 if ( type == SPEAKER) 68 if (type == SPEAKER)
70 { 69 {
71 70 gnunetsrc = GST_ELEMENT(get_app(gst, SOURCE));
72 gnunetsrc = GST_ELEMENT(get_app(gst, SOURCE)); 71
73 72 sink = GST_ELEMENT(get_audiobin(gst, SINK));
74 sink = GST_ELEMENT(get_audiobin(gst, SINK)); 73 decoder = GST_ELEMENT(get_coder(gst, DECODER));
75 decoder = GST_ELEMENT(get_coder(gst, DECODER)); 74 gst_bin_add_many(GST_BIN(gst->pipeline), gnunetsrc, decoder, sink, NULL);
76 gst_bin_add_many( GST_BIN(gst->pipeline), gnunetsrc, decoder, sink, NULL); 75 gst_element_link_many(gnunetsrc, decoder, sink, NULL);
77 gst_element_link_many( gnunetsrc, decoder, sink , NULL); 76 }
78 77 if (type == MICROPHONE)
79 } 78 {
80 if ( type == MICROPHONE ) { 79 source = GST_ELEMENT(get_audiobin(gst, SOURCE));
81
82 source = GST_ELEMENT(get_audiobin(gst, SOURCE));
83
84 encoder = GST_ELEMENT(get_coder(gst, ENCODER));
85
86 gnunetsink = GST_ELEMENT(get_app(gst, SINK));
87 80
88 gst_bin_add_many( GST_BIN(gst->pipeline), source, encoder, gnunetsink, NULL); 81 encoder = GST_ELEMENT(get_coder(gst, ENCODER));
89 gst_element_link_many( source, encoder, gnunetsink , NULL);
90 82
83 gnunetsink = GST_ELEMENT(get_app(gst, SINK));
91 84
92 } 85 gst_bin_add_many(GST_BIN(gst->pipeline), source, encoder, gnunetsink, NULL);
86 gst_element_link_many(source, encoder, gnunetsink, NULL);
87 }
93 /* 88 /*
94 gst_bin_add_many( GST_BIN(gst->pipeline), appsource, appsink, source, encoder, decoder, sink, NULL); 89 gst_bin_add_many( GST_BIN(gst->pipeline), appsource, appsink, source, encoder, decoder, sink, NULL);
95 gst_element_link_many( source, encoder, decoder, sink , NULL); 90 gst_element_link_many( source, encoder, decoder, sink , NULL);
96*/ 91 */
97 pl_graph(gst->pipeline); 92 pl_graph(gst->pipeline);
98 /* Start playing */ 93 /* Start playing */
99 gst_element_set_state (GST_ELEMENT(gst->pipeline), GST_STATE_PLAYING); 94 gst_element_set_state(GST_ELEMENT(gst->pipeline), GST_STATE_PLAYING);
100 95
101 //pl_graph(gst->pipeline); 96 //pl_graph(gst->pipeline);
102 97
@@ -109,14 +104,12 @@ main (int argc, char *argv[])
109 104
110 105
111 // start pushing buffers 106 // start pushing buffers
112 if ( type == MICROPHONE ) 107 if (type == MICROPHONE)
113 { 108 {
114 109 GMainLoop *loop;
110 loop = g_main_loop_new(NULL, FALSE);
115 111
116 GMainLoop *loop; 112 g_main_loop_run(loop);
117 loop = g_main_loop_new (NULL, FALSE);
118
119 g_main_loop_run (loop);
120 113
121/* 114/*
122 while ( 1 ) 115 while ( 1 )
@@ -124,21 +117,21 @@ main (int argc, char *argv[])
124 GstFlowReturn flow; 117 GstFlowReturn flow;
125 flow = on_appsink_new_sample (gst->appsink, gst); 118 flow = on_appsink_new_sample (gst->appsink, gst);
126 } 119 }
127*/ 120 */
128 } 121 }
129 if ( type == SPEAKER ) 122 if (type == SPEAKER)
130 { 123 {
131 while ( 1 ) 124 while (1)
132 { 125 {
133// printf("read.. \n"); 126// printf("read.. \n");
134 gnunet_read(gst); 127 gnunet_read(gst);
135 } 128 }
136 } 129 }
137 g_print ("Returned, stopping playback\n"); 130 g_print("Returned, stopping playback\n");
138 131
139 // gst_object_unref (bus); 132 // gst_object_unref (bus);
140 gst_element_set_state (GST_ELEMENT(gst->pipeline), GST_STATE_NULL); 133 gst_element_set_state(GST_ELEMENT(gst->pipeline), GST_STATE_NULL);
141 gst_object_unref (gst->pipeline); 134 gst_object_unref(gst->pipeline);
142 135
143 return 0; 136 return 0;
144} 137}