static GdkPixbuf * capture_frame_at_time(BaconVideoWidget *bvw, const char *input, const char *output, gint64 milliseconds) { GError *err = NULL; if (bacon_video_widget_seek_time (bvw, milliseconds, TRUE, &err) == FALSE) { g_print ("totem-video-thumbnailer: could not seek to %d milliseconds in '%s'\n" "Reason: %s\n", (int) milliseconds, input, err ? err->message : "programming error"); bacon_video_widget_close (bvw); gtk_widget_destroy (GTK_WIDGET (bvw)); g_error_free (err); exit (1); } if (bacon_video_widget_can_get_frames (bvw, &err) == FALSE) { g_print ("totem-video-thumbnailer: '%s' isn't thumbnailable\n" "Reason: %s\n", input, err ? err->message : "programming error"); bacon_video_widget_close (bvw); gtk_widget_destroy (GTK_WIDGET (bvw)); g_error_free (err); exit (1); } return bacon_video_widget_get_current_frame (bvw); }
static void idol_screensaver_update_from_state (IdolObject *idol, IdolScreensaverPlugin *pi) { gboolean lock_screensaver_on_audio, can_get_frames; BaconVideoWidget *bvw; MateConfClient *gc; bvw = BACON_VIDEO_WIDGET (idol_get_video_widget ((Idol *)(idol))); gc = mateconf_client_get_default (); lock_screensaver_on_audio = mateconf_client_get_bool (gc, MATECONF_PREFIX"/lock_screensaver_on_audio", NULL); can_get_frames = bacon_video_widget_can_get_frames (bvw, NULL); if (idol_is_playing (idol) != FALSE && can_get_frames) idol_scrsaver_disable (pi->scr); else if (idol_is_playing (idol) != FALSE && !lock_screensaver_on_audio) idol_scrsaver_disable (pi->scr); else idol_scrsaver_enable (pi->scr); g_object_unref (gc); }
static GdkPixbuf * capture_interesting_frame (BaconVideoWidget *bvw, const char *input, const char *output) { GdkPixbuf* pixbuf; guint current; GError *err = NULL; const double frame_locations[] = { 1.0 / 3.0, 2.0 / 3.0, 0.1, 0.9, 0.5 }; /* Test at multiple points in the file to see if we can get an * interesting frame */ for (current = 0; current < G_N_ELEMENTS(frame_locations); current++) { PROGRESS_DEBUG("About to seek to %f", frame_locations[current]); if (bacon_video_widget_seek (bvw, frame_locations[current], NULL) == FALSE) { PROGRESS_DEBUG("Couldn't seek to %f", frame_locations[current]); bacon_video_widget_play (bvw, NULL); } if (bacon_video_widget_can_get_frames (bvw, &err) == FALSE) { g_print ("totem-video-thumbnailer: '%s' isn't thumbnailable\n" "Reason: %s\n", input, err ? err->message : "programming error"); bacon_video_widget_close (bvw); gtk_widget_destroy (GTK_WIDGET (bvw)); g_error_free (err); exit (1); } /* Pull the frame, if it's interesting we bail early */ PROGRESS_DEBUG("About to get frame for iter %d", current); pixbuf = bacon_video_widget_get_current_frame (bvw); if (pixbuf != NULL && is_image_interesting (pixbuf) != FALSE) { PROGRESS_DEBUG("Frame for iter %d is interesting", current); break; } /* If we get to the end of this loop, we'll end up using * the last image we pulled */ if (current + 1 < G_N_ELEMENTS(frame_locations)) { if (pixbuf != NULL) { g_object_unref (pixbuf); pixbuf = NULL; } } PROGRESS_DEBUG("Frame for iter %d was not interesting", current); } return pixbuf; }