コード例 #1
0
static gchar *
_check_and_update_parameters (GType * extractable_type, const gchar * id,
    GError ** error)
{
  gchar *real_id;
  GType old_type = *extractable_type;

  *extractable_type =
      ges_extractable_get_real_extractable_type_for_id (*extractable_type, id);

  if (*extractable_type == G_TYPE_NONE) {
    GST_WARNING ("No way to create a Asset for ID: %s, type: %s", id,
        g_type_name (old_type));

    if (error && *error == NULL)
      g_set_error (error, GES_ERROR, GES_ERROR_ASSET_WRONG_ID,
          "Wrong ID, can not find any extractable_type");
    return NULL;
  }

  real_id = ges_extractable_type_check_id (*extractable_type, id, error);
  if (real_id == NULL) {
    GST_WARNING ("Wrong ID %s, can not create asset", id);

    g_free (real_id);
    if (error && *error == NULL)
      g_set_error (error, GES_ERROR, GES_ERROR_ASSET_WRONG_ID, "Wrong ID");

    return NULL;
  }

  return real_id;
}
コード例 #2
0
void
ges_base_xml_formatter_add_clip (GESBaseXmlFormatter * self,
    const gchar * id, const char *asset_id, GType type, GstClockTime start,
    GstClockTime inpoint, GstClockTime duration,
    guint layer_prio, GESTrackType track_types, GstStructure * properties,
    const gchar * metadatas, GError ** error)
{
  GESAsset *asset;
  GESClip *nclip;
  LayerEntry *entry;
  GESBaseXmlFormatterPrivate *priv = _GET_PRIV (self);

  if (priv->check_only)
    return;

  entry = g_hash_table_lookup (priv->layers, GINT_TO_POINTER (layer_prio));
  if (entry == NULL) {
    g_set_error (error, GES_ERROR, GES_ERROR_FORMATTER_MALFORMED_INPUT_FILE,
        "We got a Clip in a layer"
        " that does not exist, something is wrong either in the project file or"
        " in %s", g_type_name (G_OBJECT_TYPE (self)));
    return;
  }

  /* We do not want the properties that are passed to layer-add_asset to be reset */
  if (properties)
    gst_structure_remove_fields (properties, "supported-formats",
        "inpoint", "start", "duration", NULL);

  asset = ges_asset_request (type, asset_id, NULL);
  if (asset == NULL) {
    gchar *real_id;
    PendingClip *pclip;
    GList *pendings;

    real_id = ges_extractable_type_check_id (type, asset_id, error);
    if (real_id == NULL) {
      if (*error == NULL)
        g_set_error (error, G_MARKUP_ERROR,
            G_MARKUP_ERROR_INVALID_CONTENT,
            "Object type '%s' with Asset id: %s not be created'",
            g_type_name (type), asset_id);

      return;
    }

    pendings = g_hash_table_lookup (priv->assetid_pendingclips, asset_id);

    pclip = g_slice_new0 (PendingClip);
    GST_DEBUG_OBJECT (self, "Adding pending %p for %s, currently: %i",
        pclip, asset_id, g_list_length (pendings));

    pclip->id = g_strdup (id);
    pclip->track_types = track_types;
    pclip->duration = duration;
    pclip->inpoint = inpoint;
    pclip->start = start;
    pclip->layer = gst_object_ref (entry->layer);

    pclip->properties = properties ? gst_structure_copy (properties) : NULL;
    pclip->metadatas = g_strdup (metadatas);

    /* Add the new pending object to the hashtable */
    g_hash_table_insert (priv->assetid_pendingclips, real_id,
        g_list_append (pendings, pclip));
    g_hash_table_insert (priv->clipid_pendings, g_strdup (id), pclip);

    priv->current_clip = NULL;
    priv->current_pending_clip = pclip;

    return;
  }

  nclip = _add_object_to_layer (priv, id, entry->layer,
      asset, start, inpoint, duration, track_types, metadatas, properties);

  if (!nclip)
    return;

  priv->current_clip = nclip;
}