summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2015-02-13 21:27:03 (GMT)
committerXavier Claessens <xavier.claessens@collabora.com>2015-02-13 21:27:03 (GMT)
commitb5bd1533ceb38c73600315c2fea89e6f9d9e1132 (patch)
tree70a91e1dd1ab871929a8005b86cf529dd0ea9497
parentf106d6e264348875a0b2c78803001248ba12fe22 (diff)
downloadgst-sdk-tutorials-fix-live.tar.gz
gst-sdk-tutorials-fix-live.tar.xz
Tutorial5: Fix live streamsfix-live
-rwxr-xr-xgst-sdk/tutorials/android-tutorial-5/jni/tutorial-5.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gst-sdk/tutorials/android-tutorial-5/jni/tutorial-5.c b/gst-sdk/tutorials/android-tutorial-5/jni/tutorial-5.c
index 285b497..9e89e06 100755
--- a/gst-sdk/tutorials/android-tutorial-5/jni/tutorial-5.c
+++ b/gst-sdk/tutorials/android-tutorial-5/jni/tutorial-5.c
@@ -214,7 +214,7 @@ static void error_cb (GstBus *bus, GstMessage *msg, CustomData *data) {
/* Called when the End Of the Stream is reached. Just move to the beginning of the media and pause. */
static void eos_cb (GstBus *bus, GstMessage *msg, CustomData *data) {
data->target_state = GST_STATE_PAUSED;
- data->is_live = (gst_element_set_state (data->pipeline, GST_STATE_PAUSED) == GST_STATE_CHANGE_NO_PREROLL);
+ data->is_live |= (gst_element_set_state (data->pipeline, GST_STATE_PAUSED) == GST_STATE_CHANGE_NO_PREROLL);
execute_seek (0, data);
}
@@ -292,6 +292,9 @@ static void state_changed_cb (GstBus *bus, GstMessage *msg, CustomData *data) {
set_ui_message(message, data);
g_free (message);
+ if (new_state == GST_STATE_NULL)
+ data->is_live = FALSE;
+
/* The Ready to Paused state change is particularly interesting: */
if (old_state == GST_STATE_READY && new_state == GST_STATE_PAUSED) {
/* By now the sink already knows the media size */
@@ -442,7 +445,7 @@ void gst_native_set_uri (JNIEnv* env, jobject thiz, jstring uri) {
g_object_set(data->pipeline, "uri", char_uri, NULL);
(*env)->ReleaseStringUTFChars (env, uri, char_uri);
data->duration = GST_CLOCK_TIME_NONE;
- data->is_live = (gst_element_set_state (data->pipeline, data->target_state) == GST_STATE_CHANGE_NO_PREROLL);
+ data->is_live |= (gst_element_set_state (data->pipeline, data->target_state) == GST_STATE_CHANGE_NO_PREROLL);
}
/* Set pipeline to PLAYING state */
@@ -451,7 +454,7 @@ static void gst_native_play (JNIEnv* env, jobject thiz) {
if (!data) return;
GST_DEBUG ("Setting state to PLAYING");
data->target_state = GST_STATE_PLAYING;
- data->is_live = (gst_element_set_state (data->pipeline, GST_STATE_PLAYING) == GST_STATE_CHANGE_NO_PREROLL);
+ data->is_live |= (gst_element_set_state (data->pipeline, GST_STATE_PLAYING) == GST_STATE_CHANGE_NO_PREROLL);
}
/* Set pipeline to PAUSED state */
@@ -460,7 +463,7 @@ static void gst_native_pause (JNIEnv* env, jobject thiz) {
if (!data) return;
GST_DEBUG ("Setting state to PAUSED");
data->target_state = GST_STATE_PAUSED;
- data->is_live = (gst_element_set_state (data->pipeline, GST_STATE_PAUSED) == GST_STATE_CHANGE_NO_PREROLL);
+ data->is_live |= (gst_element_set_state (data->pipeline, GST_STATE_PAUSED) == GST_STATE_CHANGE_NO_PREROLL);
}
/* Instruct the pipeline to seek to a different position */