GESPipeline * make_timeline (char *path, float duration, char *text, guint32 color, gdouble xpos, gdouble ypos) { GESTimeline *timeline; GESTrack *trackv, *tracka; GESLayer *layer1; GESClip *srca; GESClip *overlay; GESPipeline *pipeline; guint64 aduration; pipeline = ges_pipeline_new (); ges_pipeline_set_mode (pipeline, TIMELINE_MODE_PREVIEW_VIDEO); timeline = ges_timeline_new (); ges_pipeline_add_timeline (pipeline, timeline); trackv = GES_TRACK (ges_video_track_new ()); ges_timeline_add_track (timeline, trackv); tracka = GES_TRACK (ges_audio_track_new ()); ges_timeline_add_track (timeline, tracka); layer1 = GES_LAYER (ges_layer_new ()); g_object_set (layer1, "priority", (gint32) 0, NULL); if (!ges_timeline_add_layer (timeline, layer1)) exit (-1); aduration = (guint64) (duration * GST_SECOND); srca = make_source (path, 0, aduration, 1); overlay = make_overlay (text, 0, aduration, 0, color, xpos, ypos); ges_layer_add_clip (layer1, srca); ges_layer_add_clip (layer1, overlay); return pipeline; }
static int run(int argc, char *argv[]) { VolatileMode m = _VOLATILE_MODE_INVALID; const char *path; dev_t devt; int r; log_setup_service(); if (argc > 3) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Too many arguments. Expected directory and mode."); r = query_volatile_mode(&m); if (r < 0) return log_error_errno(r, "Failed to determine volatile mode from kernel command line."); if (r == 0 && argc >= 2) { /* The kernel command line always wins. However if nothing was set there, the argument passed here wins instead. */ m = volatile_mode_from_string(argv[1]); if (m < 0) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Couldn't parse volatile mode: %s", argv[1]); } if (argc < 3) path = "/sysroot"; else { path = argv[2]; if (isempty(path)) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Directory name cannot be empty."); if (!path_is_absolute(path)) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Directory must be specified as absolute path."); if (path_equal(path, "/")) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Directory cannot be the root directory."); } if (!IN_SET(m, VOLATILE_YES, VOLATILE_OVERLAY)) return 0; r = path_is_mount_point(path, NULL, AT_SYMLINK_FOLLOW); if (r < 0) return log_error_errno(r, "Couldn't determine whether %s is a mount point: %m", path); if (r == 0) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "%s is not a mount point.", path); r = path_is_temporary_fs(path); if (r < 0) return log_error_errno(r, "Couldn't determine whether %s is a temporary file system: %m", path); if (r > 0) { log_info("%s already is a temporary file system.", path); return 0; } /* We are about to replace the root directory with something else. Later code might want to know what we * replaced here, hence let's save that information as a symlink we can later use. (This is particularly * relevant for the overlayfs case where we'll fully obstruct the view onto the underlying device, hence * querying the backing device node from the file system directly is no longer possible. */ r = get_block_device_harder(path, &devt); if (r < 0) return log_error_errno(r, "Failed to determine device major/minor of %s: %m", path); else if (r > 0) { _cleanup_free_ char *dn = NULL; r = device_path_make_major_minor(S_IFBLK, devt, &dn); if (r < 0) return log_error_errno(r, "Failed to format device node path: %m"); if (symlink(dn, "/run/systemd/volatile-root") < 0) log_warning_errno(errno, "Failed to create symlink /run/systemd/volatile-root: %m"); } if (m == VOLATILE_YES) return make_volatile(path); else { assert(m == VOLATILE_OVERLAY); return make_overlay(path); } }