Commit 7dcd57be authored by Luis de Bethencourt's avatar Luis de Bethencourt

change audio/video offset

parent abfe0051
......@@ -34,6 +34,9 @@ r - rotate video
. - frame step foward
, - frame step backwards
- - delay audio 50 milliseconds with respect to the video
+ - advance the audio 50 milliseconds with respect to the video
[ - decrease speed of playback 10%
] - increase speed of playback 10%
......@@ -741,6 +741,7 @@ engine_init (GstEngine * engine, GstElement * sink)
engine->media_height = 400;
engine->media_duration = -1;
engine->second = GST_SECOND;
engine->av_offset = 0;
engine->rate = 1.0;
engine->uri = NULL;
......@@ -771,6 +772,16 @@ engine_init (GstEngine * engine, GstElement * sink)
return TRUE;
}
/* Change audio/video offset */
gboolean
engine_change_offset (GstEngine * engine, gint64 av_offset)
{
engine->av_offset = av_offset;
g_object_set (G_OBJECT (engine->player), "av-offset", av_offset, NULL);
return TRUE;
}
/* Change playback rate */
gboolean
engine_change_speed (GstEngine * engine, gdouble rate)
......
......@@ -44,6 +44,7 @@ struct _GstEngine
guint media_width, media_height;
gint64 media_duration;
gint64 second;
gint64 av_offset;
gdouble rate;
gchar *uri;
......@@ -64,6 +65,7 @@ gboolean change_state (GstEngine * engine, gchar * state);
gboolean check_missing_plugins_error (GstEngine * engine, GstMessage * msg);
gboolean cycle_streams (GstEngine * engine, guint streamid);
gboolean engine_init (GstEngine * engine, GstElement * sink);
gboolean engine_change_offset (GstEngine * engine, gint64 av_offest);
gboolean engine_change_speed (GstEngine * engine, gdouble rate);
void engine_load_uri (GstEngine * engine, gchar * uri);
void engine_open_uri (GstEngine * engine, gchar * uri);
......
......@@ -491,6 +491,23 @@ event_cb (ClutterStage * stage, ClutterEvent * event, UserInterface * ui)
break;
}
case CLUTTER_minus:
case CLUTTER_plus:
{
// get current av_offset
gint64 av_offset = ui->engine->av_offset;
// change a/v offset
if (keyval == CLUTTER_minus) {
engine_change_offset (ui->engine, av_offset - (GST_SECOND / 20));
} else {
engine_change_offset (ui->engine, av_offset + (GST_SECOND / 20));
}
handled = TRUE;
break;
}
default:
{
handled = FALSE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment