Ejemplo n.º 1
0
void
mex_grilo_update_content_from_media (MexContent *content,
                                     GrlMedia   *media)
{
  g_return_if_fail (MEX_IS_CONTENT (content));
  g_return_if_fail (GRL_IS_MEDIA (media));

  /* FIXME: This list is just hard-coded and needs to be the same as
   *        the default set of keys in MexGriloFeed... Grilo is likely
   *        to add an API to retrieve all setted keys, we might want
   *        to use that.
   */
  set_metadata_from_media (content, media, MEX_CONTENT_METADATA_TITLE);
  set_metadata_from_media (content, media, MEX_CONTENT_METADATA_SYNOPSIS);
  set_metadata_from_media (content, media, MEX_CONTENT_METADATA_MIMETYPE);
  set_metadata_from_media (content, media, MEX_CONTENT_METADATA_STILL);
  set_metadata_from_media (content, media, MEX_CONTENT_METADATA_STREAM);
  set_metadata_from_media (content, media, MEX_CONTENT_METADATA_WIDTH);
  set_metadata_from_media (content, media, MEX_CONTENT_METADATA_HEIGHT);
  set_metadata_from_media (content, media, MEX_CONTENT_METADATA_DATE);
  set_metadata_from_media (content, media, MEX_CONTENT_METADATA_DURATION);
  set_metadata_from_media (content, media, MEX_CONTENT_METADATA_LAST_POSITION);
  set_metadata_from_media (content, media, MEX_CONTENT_METADATA_PLAY_COUNT);
  set_metadata_from_media (content, media, MEX_CONTENT_METADATA_LAST_PLAYED_DATE);
  set_metadata_from_media (content, media, MEX_CONTENT_METADATA_CAMERA_MODEL);
  set_metadata_from_media (content, media, MEX_CONTENT_METADATA_ORIENTATION);
  set_metadata_from_media (content, media, MEX_CONTENT_METADATA_FLASH_USED);
  set_metadata_from_media (content, media, MEX_CONTENT_METADATA_EXPOSURE_TIME);
  set_metadata_from_media (content, media, MEX_CONTENT_METADATA_ISO_SPEED);
  set_metadata_from_media (content, media, MEX_CONTENT_METADATA_CREATION_DATE);
  set_metadata_from_media (content, media, MEX_CONTENT_METADATA_ALBUM);
  set_metadata_from_media (content, media, MEX_CONTENT_METADATA_ARTIST);
}
Ejemplo n.º 2
0
void
mex_grilo_program_set_grilo_media (MexGriloProgram *program,
                                   GrlMedia        *media)
{
  MexGriloProgramPrivate *priv;

  g_return_if_fail (MEX_IS_GRILO_PROGRAM (program));
  g_return_if_fail (GRL_IS_MEDIA (media));

  priv = program->priv;

  if (priv->media == media)
    return;

  if (priv->media != NULL)
    g_object_unref (priv->media);
  priv->media = g_object_ref (media);

  set_metadatas_from_media (MEX_CONTENT (program), media);

  /* Unset 'completed' so that the next time completed is called, all data
   * on this Grilo media is re-resolved.
   */
  priv->completed = FALSE;
}
Ejemplo n.º 3
0
MexProgram *
mex_grilo_program_new (MexGriloFeed *feed, GrlMedia *media)
{
  g_return_val_if_fail (MEX_IS_GRILO_FEED (feed), NULL);
  g_return_val_if_fail (GRL_IS_MEDIA (media), NULL);

  return g_object_new (MEX_TYPE_GRILO_PROGRAM,
                       "feed", feed,
                       "grilo-media", media,
                       NULL);
}
Ejemplo n.º 4
0
void
mex_grilo_set_media_content_metadata (GrlMedia           *media,
                                      MexContentMetadata  mex_key,
                                      const gchar        *value)
{
  int      ival;
  float    fval;
  GrlKeyID grl_key;

  g_return_if_fail (GRL_IS_MEDIA (media));
  g_return_if_fail (mex_key < MEX_CONTENT_METADATA_LAST_ID);

  grl_key = _get_grl_key_from_mex (mex_key);

  if (!grl_key) {
    g_warning ("No grilo key to handle %s",
               mex_content_metadata_key_to_string (mex_key));
    return;
  }

  switch (grl_metadata_key_get_type (grl_key)) {
  case G_TYPE_STRING:
    grl_data_set_string (GRL_DATA (media), grl_key, value);
    break;

  case G_TYPE_INT:
    ival = atoi (value);
    grl_data_set_int (GRL_DATA (media), grl_key, ival);
    break;

  case G_TYPE_FLOAT:
    fval = atof (value);
    grl_data_set_float (GRL_DATA (media), grl_key, fval);
    break;
  }
}