summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2011-02-15 14:23:32 (GMT)
committerChristian Pointner <equinox@helsinki.at>2011-02-15 14:23:32 (GMT)
commit1961ba11afb0e0a71bcce7fc264e3ea403049d82 (patch)
treef77eccf59ec0bc9acf0bc725524fa00a3f86fa3f
parent4d0498e4a7533307241a807cac6de1eb0c56ba18 (diff)
some other pipeline
-rw-r--r--src/rharchive.c46
1 files changed, 15 insertions, 31 deletions
diff --git a/src/rharchive.c b/src/rharchive.c
index 36743e2..a44a5d2 100644
--- a/src/rharchive.c
+++ b/src/rharchive.c
@@ -68,51 +68,35 @@ static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data)
return TRUE;
}
-
-static void on_pad_added (GstElement *element, GstPad *pad, gpointer data)
-{
- GstPad *sinkpad;
- GstElement *decoder = (GstElement *)data;
-
- log_printf(INFO, "Dynamic pad created, linking demuxer/decoder"); // thread safety...
- sinkpad = gst_element_get_static_pad(decoder, "sink");
- gst_pad_link(pad, sinkpad);
- gst_object_unref(sinkpad);
-}
-
int main_loop(options_t* opt)
{
log_printf(INFO, "entering main loop");
GMainLoop *loop;
- GstElement *pipeline, *source, *demuxer, *decoder, *conv, *sink;
+ GstElement *pipeline, *source, *encoder, *muxer, *sink;
GstBus *bus;
loop = g_main_loop_new (NULL, FALSE);
-
- pipeline = gst_pipeline_new("audio-player");
- source = gst_element_factory_make("filesrc", "file-source");
- demuxer = gst_element_factory_make("oggdemux", "ogg-demuxer");
- decoder = gst_element_factory_make("vorbisdec", "vorbis-decoder");
- conv = gst_element_factory_make("audioconvert", "converter");
- sink = gst_element_factory_make("autoaudiosink", "audio-output");
-
- if(!pipeline || !source || !demuxer || !decoder || !conv || !sink) {
+
+ pipeline = gst_pipeline_new("rharchive");
+ source = gst_element_factory_make("audiotestsrc", "raw-source");
+ encoder = gst_element_factory_make("vorbisenc", "encoder");
+ muxer = gst_element_factory_make("oggmux", "muxer");
+ sink = gst_element_factory_make("filesink", "sink");
+
+ if(!pipeline || !source || !encoder || !muxer || !sink) {
log_printf(ERROR, "One element could not be created. Exiting.");
return -1;
}
- g_object_set(G_OBJECT(source), "location", "file.ogg", NULL);
+ g_object_set(G_OBJECT(sink), "location", "output.ogg", NULL);
bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
gst_bus_add_watch(bus, bus_call, loop);
gst_object_unref(bus);
- gst_bin_add_many(GST_BIN(pipeline), source, demuxer, decoder, conv, sink, NULL);
-
- gst_element_link(source, demuxer);
- gst_element_link_many(decoder, conv, sink, NULL);
- g_signal_connect(demuxer, "pad-added", G_CALLBACK(on_pad_added), decoder);
+ gst_bin_add_many(GST_BIN(pipeline), source, encoder, muxer, sink, NULL);
+ gst_element_link_many(source, encoder, muxer, sink, NULL);
log_printf(INFO, "Set State: Playing");
gst_element_set_state(pipeline, GST_STATE_PLAYING);
@@ -220,12 +204,12 @@ int main(int argc, char* argv[])
guint major, minor, micro, nano;
gst_version(&major, &minor, &micro, &nano);
if (nano == 1)
- nano_str = "(CVS)";
+ nano_str = " (CVS)";
else if (nano == 2)
- nano_str = "(Prerelease)";
+ nano_str = " (Prerelease)";
else
nano_str = "";
- log_printf(NOTICE, "rharchive linked against GStreamer %d.%d.%d %s", major, minor, micro, nano_str);
+ log_printf(NOTICE, "rharchive linked against GStreamer %d.%d.%d%s", major, minor, micro, nano_str);
ret = main_loop(&opt);