static void
play_uri (GstPlay * play, const gchar * next_uri)
{
  gchar *loc;

  gst_element_set_state (play->playbin, GST_STATE_READY);
  play_reset (play);

  loc = play_uri_get_display_name (play, next_uri);
  g_print (_("Now playing %s\n"), loc);
  g_free (loc);

  g_object_set (play->playbin, "uri", next_uri, NULL);

  switch (gst_element_set_state (play->playbin, GST_STATE_PAUSED)) {
    case GST_STATE_CHANGE_FAILURE:
      /* ignore, we should get an error message posted on the bus */
      break;
    case GST_STATE_CHANGE_NO_PREROLL:
      g_print ("Pipeline is live.\n");
      play->is_live = TRUE;
      break;
    case GST_STATE_CHANGE_ASYNC:
      g_print ("Prerolling...\r");
      break;
    default:
      break;
  }

  if (play->desired_state != GST_STATE_PAUSED)
    gst_element_set_state (play->playbin, play->desired_state);
}
Exemple #2
0
static void
play_uri (GstPlay * play, const gchar * next_uri)
{
  gchar *loc;

  play_reset (play);

  loc = play_uri_get_display_name (play, next_uri);
  g_print ("Now playing %s\n", loc);
  g_free (loc);

  g_object_set (play->player, "uri", next_uri, NULL);
  gst_player_play (play->player);
}
Exemple #3
0
/* returns FALSE if we have reached the end of the playlist */
static gboolean
play_next (GstPlay * play)
{
  GstStateChangeReturn sret;
  const gchar *next_uri;
  gchar *loc;

  if (++play->cur_idx >= play->num_uris)
    return FALSE;

  gst_element_set_state (play->playbin, GST_STATE_READY);
  play_reset (play);

  next_uri = play->uris[play->cur_idx];
  loc = play_uri_get_display_name (play, next_uri);
  g_print ("Now playing %s\n", loc);
  g_free (loc);

  g_object_set (play->playbin, "uri", next_uri, NULL);

  sret = gst_element_set_state (play->playbin, GST_STATE_PLAYING);
  switch (sret) {
    case GST_STATE_CHANGE_FAILURE:
      /* ignore, we should get an error message posted on the bus */
      break;
    case GST_STATE_CHANGE_NO_PREROLL:
      g_print ("Pipeline is live.\n");
      play->is_live = TRUE;
      break;
    case GST_STATE_CHANGE_ASYNC:
      g_print ("Prerolling...\r");
      break;
    default:
      break;
  }

  return TRUE;
}
Exemple #4
0
static void
play_about_to_finish (GstElement * playbin, gpointer user_data)
{
  GstPlay *play = user_data;
  const gchar *next_uri;
  gchar *loc;
  guint next_idx;

  if (!play->gapless)
    return;

  next_idx = play->cur_idx + 1;
  if (next_idx >= play->num_uris)
    return;

  next_uri = play->uris[next_idx];
  loc = play_uri_get_display_name (play, next_uri);
  g_print ("About to finish, preparing next title: %s\n", loc);
  g_free (loc);

  g_object_set (play->playbin, "uri", next_uri, NULL);
  play->cur_idx = next_idx;
}