Created
December 5, 2015 13:49
-
-
Save yashi/e029db46e16b0194bb7e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <gst/gst.h> | |
gboolean on_message(GstBus *bus, GstMessage *message, gpointer p) | |
{ | |
GMainLoop *mainloop = p; | |
(void)bus; | |
if ((GST_MESSAGE_TYPE(message) & GST_MESSAGE_EOS)) | |
g_main_loop_quit(mainloop); | |
return TRUE; | |
} | |
int main(int argc, char *argv[]) | |
{ | |
GMainLoop *mainloop; | |
GstElement *pipeline; | |
GError *error = NULL; | |
GstBus *bus; | |
gst_init(&argc, &argv); | |
mainloop = g_main_loop_new(NULL, FALSE); | |
pipeline = gst_parse_launch("filesrc location=a.txt ! fdsink", &error); | |
bus = gst_element_get_bus(pipeline); | |
gst_bus_add_watch(bus, on_message, mainloop); | |
gst_element_set_state(pipeline, GST_STATE_PLAYING); | |
g_main_loop_run(mainloop); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment