示例#1
0
static GstPlay *
play_new (gchar ** uris, gdouble initial_volume)
{
  GstPlay *play;

  play = g_new0 (GstPlay, 1);

  play->uris = uris;
  play->num_uris = g_strv_length (uris);
  play->cur_idx = -1;

  play->player = gst_player_new ();

  g_object_set (play->player, "dispatch-to-main-context", TRUE, NULL);
  g_signal_connect (play->player, "position-updated",
      G_CALLBACK (position_updated_cb), play);
  g_signal_connect (play->player, "end-of-stream",
      G_CALLBACK (end_of_stream_cb), play);
  g_signal_connect (play->player, "error", G_CALLBACK (error_cb), play);

  play->loop = g_main_loop_new (NULL, FALSE);
  play->desired_state = GST_STATE_PLAYING;

  play_set_relative_volume (play, initial_volume - 1.0);

  return play;
}
示例#2
0
/**
 * ges_playable_make_player:
 *
 * @playable: A #GESPlayable
 *
 * Create a #GstPlayer for @playable. Refer to the documentation of
 * #GstPlayer for more information.
 *
 * Note that as this function will remove @playable from any container
 * it was in (such as a #GESTimeline). This means you can't both play
 * it and its containing timeline, disposing of the #GstPlayer will
 * put back @playable in its original container OK ?? you better be dead right.
 *
 * Returns: (transfer full): The newly created #GstPlayer.
 */
GstPlayer *
ges_playable_make_player (GESPlayable * playable)
{
  GstPlayer *player = gst_player_new(NULL, NULL);
  gchar *uri;

  uri = g_strdup_printf ("ges:///%p\n", (void *) playable);
  gst_player_set_uri (player, uri);

  g_free (uri);
  return player;
}
示例#3
0
文件: player.c 项目: 1ee7/gst-player
static void
native_new (JNIEnv * env, jobject thiz)
{
  Player *player = g_new0 (Player, 1);

  player->renderer = gst_player_video_overlay_video_renderer_new (NULL);
  player->player = gst_player_new (player->renderer, NULL);
  SET_CUSTOM_DATA (env, thiz, native_player_field_id, player);
  player->java_player = (*env)->NewGlobalRef (env, thiz);

  g_signal_connect (player->player, "position-updated",
      G_CALLBACK (on_position_updated), player);
  g_signal_connect (player->player, "duration-changed",
      G_CALLBACK (on_duration_changed), player);
  g_signal_connect (player->player, "state-changed",
      G_CALLBACK (on_state_changed), player);
  g_signal_connect (player->player, "buffering",
      G_CALLBACK (on_buffering), player);
  g_signal_connect (player->player, "end-of-stream",
      G_CALLBACK (on_end_of_stream), player);
  g_signal_connect (player->player, "error", G_CALLBACK (on_error), player);
  g_signal_connect (player->player, "video-dimensions-changed",
      G_CALLBACK (on_video_dimensions_changed), player);
}