[snappy/aurena: 3/5] UI just displays info and doesn't control playback
- From: Luis de Bethencourt <luisbg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [snappy/aurena: 3/5] UI just displays info and doesn't control playback
- Date: Sun, 16 Sep 2012 16:51:11 +0000 (UTC)
commit 3d08aaa56a1addaffcf0b15bd410916537b3f92b
Author: Luis de Bethencourt <luis debethencourt com>
Date: Sat Sep 15 19:47:46 2012 +0100
UI just displays info and doesn't control playback
src/snra-client.c | 5 +-
src/user_interface.c | 145 +-------------------------------------------------
2 files changed, 3 insertions(+), 147 deletions(-)
---
diff --git a/src/snra-client.c b/src/snra-client.c
index edce8ea..64d1da4 100644
--- a/src/snra-client.c
+++ b/src/snra-client.c
@@ -241,8 +241,6 @@ handle_set_media_message (SnraClient * client, GstStructure * s)
engine_load_uri (client->ui->engine, uri);
interface_start (client->ui, uri);
client->state = GST_STATE_READY;
- } else {
- engine_stop (client->ui->engine);
}
engine_open_uri (client->ui->engine, uri);
@@ -375,6 +373,7 @@ handle_received_chunk (G_GNUC_UNUSED SoupMessage * msg, SoupBuffer * chunk,
} else if (g_str_equal (msg_type, "play")) {
g_print ("play\n");
handle_play_message (client, s);
+ change_state (client->ui->engine, "Playing");
} else if (g_str_equal (msg_type, "pause")) {
g_print ("pause\n");
client->paused = TRUE;
@@ -383,7 +382,7 @@ handle_received_chunk (G_GNUC_UNUSED SoupMessage * msg, SoupBuffer * chunk,
engine_stop (client->ui->engine);
} else {
client->state = GST_STATE_PAUSED;
- engine_stop (client->ui->engine);
+ change_state (client->ui->engine, "Paused");
}
} else if (g_str_equal (msg_type, "volume")) {
g_print ("volume\n");
diff --git a/src/user_interface.c b/src/user_interface.c
index fe17855..b12fec5 100644
--- a/src/user_interface.c
+++ b/src/user_interface.c
@@ -94,24 +94,6 @@ event_cb (ClutterStage * stage, ClutterEvent * event, UserInterface * ui)
break;
}
- case CLUTTER_space:
- {
- // Spacebar
- toggle_playing (ui);
-
- handled = TRUE;
- break;
- }
-
- case CLUTTER_l:
- {
- // Loop
- ui->engine->loop = !ui->engine->loop;
-
- handled = TRUE;
- break;
- }
-
case CLUTTER_8:
{
// Mute button
@@ -154,52 +136,6 @@ event_cb (ClutterStage * stage, ClutterEvent * event, UserInterface * ui)
break;
}
- case CLUTTER_Up:
- case CLUTTER_Down:
- case CLUTTER_Left:
- case CLUTTER_Right:
- case CLUTTER_Page_Up:
- case CLUTTER_Page_Down:
- {
- gint64 pos, second;
- gfloat progress;
-
- pos = query_position (ui->engine);
- second = ui->engine->second;
-
- if (keyval == CLUTTER_Up) {
- // Seek 1 minute foward
- pos += 60 * second;
-
- } else if (keyval == CLUTTER_Down) {
- // Seek 1 minute back
- pos -= 60 * second;
-
- } else if (keyval == CLUTTER_Right) {
- // Seek 10 seconds foward
- pos += 10 * second;
-
- } else if (keyval == CLUTTER_Left) {
- // Seek 10 seconds back
- pos -= 10 * second;
-
- } else if (keyval == CLUTTER_Page_Up) {
- // Seek 10 minutes foward
- pos += 600 * second;
-
- } else if (keyval == CLUTTER_Page_Down) {
- // Seek 10 minutes back
- pos -= 600 * second;
- }
-
- /* clamp the timestamp to be within the media */
- pos = CLAMP (pos, 0, ui->engine->media_duration);
- engine_seek (ui->engine, pos, FALSE);
-
- handled = TRUE;
- break;
- }
-
case CLUTTER_r:
{
// rotate texture 90 degrees.
@@ -220,65 +156,6 @@ event_cb (ClutterStage * stage, ClutterEvent * event, UserInterface * ui)
break;
}
- case CLUTTER_period:
- {
- // frame step forward
- frame_stepping (ui->engine, TRUE);
-
- handled = TRUE;
- break;
- }
-
- case CLUTTER_comma:
- {
- // frame step backward
- frame_stepping (ui->engine, FALSE);
-
- handled = TRUE;
- break;
- }
-
- case CLUTTER_v:
- {
- // toggle subtitles
- toggle_subtitles (ui->engine);
-
- handled = TRUE;
- break;
- }
-
- case CLUTTER_numbersign:
- case CLUTTER_underscore:
- case CLUTTER_j:
- {
- // cycle through available audio/text/video streams
- guint streamid;
-
- if (keyval == CLUTTER_numbersign)
- streamid = STREAM_AUDIO;
- else if (keyval == CLUTTER_j)
- streamid = STREAM_TEXT;
- else if (keyval == CLUTTER_underscore)
- streamid = STREAM_VIDEO;
-
- cycle_streams (ui->engine, streamid);
-
- handled = TRUE;
- break;
- }
-
- case CLUTTER_less:
- {
- interface_play_next_or_prev (ui, FALSE);
- break;
- }
-
- case CLUTTER_greater:
- {
- interface_play_next_or_prev (ui, TRUE);
- break;
- }
-
default:
{
handled = FALSE;
@@ -297,27 +174,7 @@ event_cb (ClutterStage * stage, ClutterEvent * event, UserInterface * ui)
actor = clutter_stage_get_actor_at_pos (stage, CLUTTER_PICK_ALL,
bev->x, bev->y);
- if (actor == ui->control_play_toggle) {
- toggle_playing (ui);
-
- } else if (actor == ui->control_seek1 ||
- actor == ui->control_seek2 || actor == ui->control_seekbar) {
- gfloat x, y, dist;
- gint64 progress;
-
- clutter_actor_get_transformed_position (ui->control_seekbar, &x, &y);
- dist = bev->x - x;
- dist = CLAMP (dist, 0, ui->seek_width);
-
- if (ui->engine->media_duration == -1) {
- update_media_duration (ui->engine);
- }
-
- progress = ui->engine->media_duration * (dist / ui->seek_width);
- engine_seek (ui->engine, progress, FALSE);
- clutter_actor_set_size (ui->control_seekbar, dist, ui->seek_height);
-
- } else if (actor == ui->vol_int || actor == ui->vol_int_bg) {
+ if (actor == ui->vol_int || actor == ui->vol_int_bg) {
gfloat x, y, dist;
gdouble volume;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]