* @appsink: the appsink element to emit this signal on
*
* Get the last preroll sample in @appsink. This was the sample that caused the
- * appsink to preroll in the PAUSED state. This sample can be pulled many times
- * and remains available to the application even after EOS.
+ * appsink to preroll in the PAUSED state.
*
* This function is typically used when dealing with a pipeline in the PAUSED
* state. Calling this function after doing a seek will give the sample right
* after the seek position.
*
+ * Calling this function will clear the internal reference to the preroll
+ * buffer.
+ *
* Note that the preroll sample will also be returned as the first sample
* when calling gst_app_sink_pull_sample() or the "pull-sample" action signal.
*
* @timeout: the maximum amount of time to wait for the preroll sample
*
* Get the last preroll sample in @appsink. This was the sample that caused the
- * appsink to preroll in the PAUSED state. This sample can be pulled many times
- * and remains available to the application even after EOS.
+ * appsink to preroll in the PAUSED state.
*
* This function is typically used when dealing with a pipeline in the PAUSED
* state. Calling this function after doing a seek will give the sample right
* after the seek position.
*
+ * Calling this function will clear the internal reference to the preroll
+ * buffer.
+ *
* Note that the preroll sample will also be returned as the first sample
* when calling gst_app_sink_pull_sample() or the "pull-sample" action signal.
*
* @appsink: a #GstAppSink
*
* Get the last preroll sample in @appsink. This was the sample that caused the
- * appsink to preroll in the PAUSED state. This sample can be pulled many times
- * and remains available to the application even after EOS.
+ * appsink to preroll in the PAUSED state.
*
* This function is typically used when dealing with a pipeline in the PAUSED
* state. Calling this function after doing a seek will give the sample right
* after the seek position.
*
+ * Calling this function will clear the internal reference to the preroll
+ * buffer.
+ *
* Note that the preroll sample will also be returned as the first sample
* when calling gst_app_sink_pull_sample().
*
* @timeout: the maximum amount of time to wait for the preroll sample
*
* Get the last preroll sample in @appsink. This was the sample that caused the
- * appsink to preroll in the PAUSED state. This sample can be pulled many times
- * and remains available to the application even after EOS.
+ * appsink to preroll in the PAUSED state.
*
* This function is typically used when dealing with a pipeline in the PAUSED
* state. Calling this function after doing a seek will give the sample right
* after the seek position.
*
+ * Calling this function will clear the internal reference to the preroll
+ * buffer.
+ *
* Note that the preroll sample will also be returned as the first sample
* when calling gst_app_sink_pull_sample().
*
sample =
gst_sample_new (priv->preroll_buffer, priv->preroll_caps,
&priv->preroll_segment, NULL);
+ gst_buffer_replace (&priv->preroll_buffer, NULL);
GST_DEBUG_OBJECT (appsink, "we have the preroll sample %p", sample);
g_mutex_unlock (&priv->mutex);
GST_END_TEST;
+GST_START_TEST (test_pull_preroll)
+{
+ GstElement *sink = NULL;
+ GstBuffer *buffer = NULL;
+ GstSample *pulled_preroll = NULL;
+
+ sink = setup_appsink ();
+
+ ASSERT_SET_STATE (sink, GST_STATE_PLAYING, GST_STATE_CHANGE_ASYNC);
+
+ buffer = gst_buffer_new_and_alloc (4);
+ fail_unless (gst_pad_push (mysrcpad, buffer) == GST_FLOW_OK);
+
+ pulled_preroll = gst_app_sink_pull_preroll (GST_APP_SINK (sink));
+ fail_unless (pulled_preroll);
+ gst_sample_unref (pulled_preroll);
+
+ fail_if (gst_app_sink_try_pull_preroll (GST_APP_SINK (sink), 0));
+
+ ASSERT_SET_STATE (sink, GST_STATE_NULL, GST_STATE_CHANGE_SUCCESS);
+ cleanup_appsink (sink);
+}
+
+GST_END_TEST;
+
static Suite *
appsink_suite (void)
{
tcase_add_test (tc_chain, test_buffer_list_signal);
tcase_add_test (tc_chain, test_segment);
tcase_add_test (tc_chain, test_pull_with_timeout);
+ tcase_add_test (tc_chain, test_pull_preroll);
return s;
}