Print temp-location.

This commit is contained in:
Xavi Artigas 2012-06-18 16:11:57 +02:00
parent b4f718acfd
commit 279e01a158

View file

@ -5,7 +5,7 @@
/* playbin2 flags */ /* playbin2 flags */
typedef enum { typedef enum {
GST_PLAY_FLAG_DOWNLOAD = (1 << 7) /* Enable progressive download buffering for selected formats. */ GST_PLAY_FLAG_DOWNLOAD = (1 << 7) /* Enable progressive download (on selected formats) */
} GstPlayFlags; } GstPlayFlags;
typedef struct _CustomData { typedef struct _CustomData {
@ -15,6 +15,14 @@ typedef struct _CustomData {
gint buffering_level; gint buffering_level;
} CustomData; } CustomData;
static void got_location (GstObject *gstobject, GstObject *prop_object, GParamSpec *prop, gpointer data) {
gchar *location;
g_object_get (G_OBJECT (prop_object), "temp-location", &location, NULL);
g_print ("Temporary file: %s\n", location);
/* Uncomment this line to keep the temporary file after the program exits */
/* g_object_set (G_OBJECT (prop_object), "temp-remove", FALSE, NULL); */
}
static void cb_message (GstBus *bus, GstMessage *msg, CustomData *data) { static void cb_message (GstBus *bus, GstMessage *msg, CustomData *data) {
switch (GST_MESSAGE_TYPE (msg)) { switch (GST_MESSAGE_TYPE (msg)) {
@ -120,7 +128,6 @@ int main(int argc, char *argv[]) {
/* Build the pipeline */ /* Build the pipeline */
pipeline = gst_parse_launch ("playbin2 uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", NULL); pipeline = gst_parse_launch ("playbin2 uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", NULL);
// pipeline = gst_parse_launch ("playbin2 uri=http://micro.autom.teithe.gr/~vivia/oldmovies/peta.mp4", NULL);
bus = gst_element_get_bus (pipeline); bus = gst_element_get_bus (pipeline);
/* Set the download flag */ /* Set the download flag */
@ -144,6 +151,7 @@ int main(int argc, char *argv[]) {
gst_bus_add_signal_watch (bus); gst_bus_add_signal_watch (bus);
g_signal_connect (bus, "message", G_CALLBACK (cb_message), &data); g_signal_connect (bus, "message", G_CALLBACK (cb_message), &data);
g_signal_connect (pipeline, "deep-notify::temp-location", G_CALLBACK (got_location), NULL);
/* Register a function that GLib will call every second */ /* Register a function that GLib will call every second */
g_timeout_add_seconds (1, (GSourceFunc)refresh_ui, &data); g_timeout_add_seconds (1, (GSourceFunc)refresh_ui, &data);