aboutsummaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/chat.c116
1 files changed, 10 insertions, 106 deletions
diff --git a/src/ui/chat.c b/src/ui/chat.c
index 4928c04..3ac4847 100644
--- a/src/ui/chat.c
+++ b/src/ui/chat.c
@@ -897,64 +897,15 @@ handle_play_bus_watch(UNUSED GstBus *bus,
897} 897}
898 898
899static void 899static void
900_play_pad_added(UNUSED GstElement *element,
901 GstPad *pad,
902 gpointer data)
903{
904 GstElement *decoder = (GstElement*) data;
905
906 GstPad *sinkpad = gst_element_get_static_pad(decoder, "sink");
907 gst_pad_link(pad, sinkpad);
908 gst_object_unref (sinkpad);
909}
910
911static void
912_setup_gst_pipelines(UI_CHAT_Handle *handle) 900_setup_gst_pipelines(UI_CHAT_Handle *handle)
913{ 901{
914 handle->record_pipeline = gst_pipeline_new("audio-recorder"); 902 handle->record_pipeline = gst_parse_launch(
915 903 "autoaudiosrc ! audioconvert ! vorbisenc ! oggmux ! filesink name=sink",
916 GstElement *audio_source = gst_element_factory_make(
917 "autoaudiosrc",
918 "audio-input"
919 );
920
921 GstElement *audio_converter = gst_element_factory_make(
922 "audioconvert",
923 "audio-converter"
924 );
925
926 GstElement *vorbis_encoder = gst_element_factory_make(
927 "vorbisenc",
928 "vorbis-encoder"
929 );
930
931 GstElement *ogg_muxer = gst_element_factory_make(
932 "oggmux",
933 "ogg-muxer"
934 );
935
936 handle->record_sink = gst_element_factory_make(
937 "filesink",
938 "file-output"
939 );
940
941 gst_bin_add_many(
942 GST_BIN(handle->record_pipeline),
943 audio_source,
944 audio_converter,
945 vorbis_encoder,
946 ogg_muxer,
947 handle->record_sink,
948 NULL 904 NULL
949 ); 905 );
950 906
951 gst_element_link_many( 907 handle->record_sink = gst_bin_get_by_name(
952 audio_source, 908 GST_BIN(handle->record_pipeline), "sink"
953 audio_converter,
954 vorbis_encoder,
955 ogg_muxer,
956 handle->record_sink,
957 NULL
958 ); 909 );
959 910
960 { 911 {
@@ -969,60 +920,13 @@ _setup_gst_pipelines(UI_CHAT_Handle *handle)
969 gst_object_unref(bus); 920 gst_object_unref(bus);
970 } 921 }
971 922
972 handle->play_pipeline = gst_pipeline_new("audio-previewer"); 923 handle->play_pipeline = gst_parse_launch(
973 924 "filesrc name=source ! oggdemux ! vorbisdec ! audioconvert ! autoaudiosink",
974 handle->play_source = gst_element_factory_make(
975 "filesrc",
976 "file-input"
977 );
978
979 GstElement *ogg_demuxer = gst_element_factory_make(
980 "oggdemux",
981 "ogg-demuxer"
982 );
983
984 GstElement *vorbis_decoder = gst_element_factory_make(
985 "vorbisdec",
986 "vorbis-decoder"
987 );
988
989 GstElement *audio_play_converter = gst_element_factory_make(
990 "audioconvert",
991 "audio-converter"
992 );
993
994 GstElement *audio_sink = gst_element_factory_make(
995 "autoaudiosink",
996 "audio-output"
997 );
998
999 gst_bin_add_many(
1000 GST_BIN(handle->play_pipeline),
1001 handle->play_source,
1002 ogg_demuxer,
1003 vorbis_decoder,
1004 audio_play_converter,
1005 audio_sink,
1006 NULL
1007 );
1008
1009 gst_element_link(
1010 handle->play_source,
1011 ogg_demuxer
1012 );
1013
1014 gst_element_link_many(
1015 vorbis_decoder,
1016 audio_play_converter,
1017 audio_sink,
1018 NULL 925 NULL
1019 ); 926 );
1020 927
1021 g_signal_connect( 928 handle->play_source = gst_bin_get_by_name(
1022 ogg_demuxer, 929 GST_BIN(handle->play_pipeline), "source"
1023 "pad-added",
1024 G_CALLBACK(_play_pad_added),
1025 vorbis_decoder
1026 ); 930 );
1027 931
1028 { 932 {
@@ -1605,13 +1509,13 @@ ui_chat_delete(UI_CHAT_Handle *handle)
1605 1509
1606 if (handle->record_pipeline) 1510 if (handle->record_pipeline)
1607 { 1511 {
1608 gst_element_set_state (handle->record_pipeline, GST_STATE_NULL); 1512 gst_element_set_state(handle->record_pipeline, GST_STATE_NULL);
1609 gst_object_unref(GST_OBJECT(handle->record_pipeline)); 1513 gst_object_unref(GST_OBJECT(handle->record_pipeline));
1610 } 1514 }
1611 1515
1612 if (handle->play_pipeline) 1516 if (handle->play_pipeline)
1613 { 1517 {
1614 gst_element_set_state (handle->play_pipeline, GST_STATE_NULL); 1518 gst_element_set_state(handle->play_pipeline, GST_STATE_NULL);
1615 gst_object_unref(GST_OBJECT(handle->play_pipeline)); 1519 gst_object_unref(GST_OBJECT(handle->play_pipeline));
1616 } 1520 }
1617 1521