mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
Start in PAUSED so clip length is shown since the beginning. Allow orientation changes in PAUSED.
This commit is contained in:
parent
392705a913
commit
4874f00144
2 changed files with 10 additions and 5 deletions
|
@ -154,7 +154,7 @@ static void state_changed_cb (GstBus *bus, GstMessage *msg, CustomData *data) {
|
|||
if (GST_MESSAGE_SRC (msg) == GST_OBJECT (data->pipeline)) {
|
||||
set_message (gst_element_state_get_name (new_state), data);
|
||||
data->state = new_state;
|
||||
if (data->state == GST_STATE_PLAYING && GST_CLOCK_TIME_IS_VALID (data->desired_position)) {
|
||||
if (data->state >= GST_STATE_PAUSED && GST_CLOCK_TIME_IS_VALID (data->desired_position)) {
|
||||
execute_seek (data->desired_position, data);
|
||||
data->desired_position = GST_CLOCK_TIME_NONE;
|
||||
}
|
||||
|
@ -240,6 +240,9 @@ static void *app_function (void *userdata) {
|
|||
/* Register a function that GLib will call every second */
|
||||
timeout_source_id = g_timeout_add_seconds (1, (GSourceFunc)refresh_ui, data);
|
||||
|
||||
/* Set state to PAUSE, so preroll occurrs and retrieve some information like clip length */
|
||||
gst_element_set_state (data->pipeline, GST_STATE_PAUSED);
|
||||
|
||||
/* Create a GLib Main Loop and set it to run */
|
||||
GST_DEBUG ("Entering main loop... (CustomData:%p)", data);
|
||||
data->main_loop = g_main_loop_new (NULL, FALSE);
|
||||
|
|
|
@ -79,12 +79,14 @@ public class Tutorial1 extends Activity implements SurfaceHolder.Callback, OnSee
|
|||
|
||||
nativeInit();
|
||||
|
||||
playing = savedInstanceState==null ? false : savedInstanceState.getBoolean("playing");
|
||||
if (playing) {
|
||||
if (savedInstanceState != null) {
|
||||
playing = savedInstanceState.getBoolean("playing");
|
||||
int milliseconds = savedInstanceState.getInt("position");
|
||||
Log.i ("GStreamer", "Restoring to playing state at " + milliseconds + " ms.");
|
||||
nativePlay();
|
||||
Log.i ("GStreamer", "Restoring state, playing:" + playing + " position:" + milliseconds + " ms.");
|
||||
nativeSetPosition(milliseconds);
|
||||
if (playing) {
|
||||
nativePlay();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue