i created a pipe filesrc ! decodebin ! appsink and set the appsink to 
dont emit signals and block when reaches a maximum number of buffers, my 
problem is that with this behaviour after pausing the pipeline i cant 
set it to playing again, the stream seens to be locked. Before setting 
to play again if i perform a seek (to any position) them the playing 
will occur. Im using a separated thread to pull the data from the 
appsink, i dont now if this is a bug of appsink, i cant see what im 
doing wrong (i used gst-debug=5 and the pipe seens to get blocked when i 
set it back to playing state). I would apreciate if someone could help, 
here is the source code:
<br>
<br>
<br>
<br>#include &lt;stdio.h&gt;
<br>#include &lt;glib.h&gt;
<br>#include &lt;gst/gst.h&gt;
<br>#include &lt;gst/app/gstappsink.h&gt;
<br>
<br>static const int SLEEP_TIME_US = 5000;
<br>static gboolean run_thread = TRUE;
<br>
<br>static gboolean bus_call (GstBus *bus, GstMessage *msg, gpointer data)
<br>{
<br>   GMainLoop *loop = (GMainLoop *) data;
<br>
<br>   switch (GST_MESSAGE_TYPE (msg))
<br>   {
<br>
<br>       case GST_MESSAGE_EOS:
<br>       {
<br>       g_print (&quot;Fim da stream\n&quot;);
<br>       g_main_loop_quit (loop);
<br>       break;
<br>       }
<br>
<br>       case GST_MESSAGE_ERROR:
<br>       {
<br>       gchar  *debug;
<br>       GError *error;
<br>
<br>       gst_message_parse_error (msg, &amp;error, &amp;debug);
<br>       g_free (debug);
<br>
<br>       g_printerr (&quot;Erro: %s\n&quot;, error-&gt;message);
<br>       g_error_free (error);
<br>
<br>       g_main_loop_quit (loop);
<br>
<br>       break;
<br>       }
<br>
<br>       default:
<br>       g_print(&quot;Tipo da mensagem [%d], Nome da mensagem [%s]\n&quot;, 
GST_MESSAGE_TYPE (msg), GST_MESSAGE_TYPE_NAME(msg));
<br>       break;
<br>   }    
   return TRUE;
<br>}
<br>
<br>// ------------------ START PADS - ELEMENTS GENERIC FUNCTIONS 
--------------- //
<br>
<br>static int connect_pads(GstPad* src, GstPad* sink)
<br>{
<br>   gchar* src_name = NULL;
<br>   gchar* sink_name = NULL;
<br>   if(gst_pad_link(src, sink) != GST_PAD_LINK_OK){
<br>       src_name = gst_pad_get_name(src);
<br>       sink_name = gst_pad_get_name(sink);
<br>       g_debug(&quot;Error linking [%s] to [%s]&quot;, src_name, sink_name);
<br>       g_free(src_name);
<br>       g_free(sink_name);
<br>       return FALSE;
<br>   }
<br>   return TRUE;
<br>}
<br>
<br>// ------------------ END PADS - ELEMENTS GENERIC FUNCTIONS 
--------------- //
<br>
<br>// ------------------ START DECODEBIN FUNCTIONS --------------------- //
<br>static void callback_type_found(GstElement *decodebin, GstPad *srcpad, 
gboolean last, gpointer output)
<br>{
<br>   GstElement* output_element = (GstElement*)output;
<br>   GstPad* sinkpad = NULL;
<br>   
   if(output_element == NULL) {
<br>       g_debug(&quot;callback_type_found: Error casting gpointer to 
GstElement&quot;);
<br>       return;
<br>   }
<br>
<br>   sinkpad = gst_element_get_static_pad(output_element, &quot;sink&quot;);    
   if(sinkpad == NULL) {
<br>       g_debug(&quot;callback_type_found: Error getting output_element sink 
pad&quot;);
<br>       return;
<br>   }
<br>
<br>   if(!connect_pads(srcpad, sinkpad)) {
<br>       g_debug(&quot;callback_type_found: Cannot connect decodebin &quot;
<br>                                               &quot;srcpad to 
output_element sinkpad&quot;);
<br>       g_object_unref (sinkpad);
<br>       return;
<br>   }
<br>
<br>   g_debug(&quot;callback_type_found: Ended successfully&quot;);
<br>   g_object_unref(sinkpad);
<br>}
<br>
<br>static void build_decodebin(GstElement* pipeline, GstElement* src, 
GstElement* output, const gchar* caps)
<br>{
<br>   GstElement* decoder = gst_element_factory_make (&quot;decodebin&quot;, &quot;decoder&quot;);
<br>   g_debug(&quot;Trying to use decodebin to find type and decode media!&quot;);
<br>   if(!decoder) {
<br>       g_debug(&quot;build_decodebin: Error creating decodebin&quot;);
<br>       return;
<br>   }
<br>
<br>   if(caps != NULL) {
<br>       GstCaps* caps_obj = gst_caps_from_string(caps);
<br>       if(caps_obj == NULL){
<br>           g_debug(&quot;build_decodebin: Error creating caps[%s]&quot;, caps);
<br>           return;
<br>       }
<br>       g_object_set(G_OBJECT (decoder), &quot;sink-caps&quot;, caps_obj, NULL);
<br>   }
<br>
<br>   if(!gst_bin_add(GST_BIN (pipeline), decoder)) {
<br>       g_debug(&quot;build_decodebin: Error inserting the decodebin on the 
pipeline&quot;);
<br>       return;
<br>   }
<br>
<br>   if(!gst_element_link(src, decoder)) {
<br>       g_debug(&quot;build_decodebin: Error linking the source element to 
the decoder&quot;);
<br>       return;
<br>   }
<br>   
   g_signal_connect (decoder, &quot;new-decoded-pad&quot;, 
G_CALLBACK(callback_type_found), output);
<br>}
<br>
<br>// ------------------ END DECODEBIN FUNCTIONS --------------------- //
<br>
<br>
<br>static gpointer pull_func(gpointer data)
<br>{
<br>   GstAppSink* appsink = (GstAppSink*) data;
<br>   GstBuffer* buffer = NULL;
<br>   
   while(run_thread){
<br>       g_usleep(SLEEP_TIME_US);
<br>       if(appsink){
<br>           buffer = gst_app_sink_pull_buffer(appsink);
<br>           if(buffer){
<br>               g_debug(&quot;appsink: buffer timestamp(%lli) size(%d)&quot;,
<br>               GST_BUFFER_TIMESTAMP(buffer),
<br>               GST_BUFFER_SIZE(buffer));
<br>               gst_buffer_unref(buffer);
<br>           }else{
<br>               g_warning(&quot;NULL BUFFER PULLED !!&quot;);
<br>           }
<br>       }else{
<br>           g_warning(&quot;NULL APPSINK !!!&quot;);
<br>       }
<br>   }
<br>
<br>   return NULL;
<br>}
<br>
<br>gboolean resume_time(gpointer data)
<br>{
<br>   /* IF I DO THIS THE PLAYING WORKS AND APPSINK GIVES ME BUFFERS
<br>   gint64 cur;
<br>   GstFormat format = 
gst_format_get_by_nick(gst_format_get_name(GST_FORMAT_TIME));
<br>   gst_element_query_position(GST_ELEMENT (data), &amp;format, &amp;cur);
<br>
<br>   if (!gst_element_seek_simple(GST_ELEMENT(data),
<br>                                GST_FORMAT_TIME,
<br>                                GST_SEEK_FLAG_FLUSH | 
GST_SEEK_FLAG_KEY_UNIT, cur)) {
<br>       g_print (&quot;Seek failed!\n&quot;);
<br>       return FALSE;
<br>   }*/
<br>
<br>   g_debug(&quot;PLAY \n&quot;);
<br>   gst_element_set_state(GST_ELEMENT(data), GST_STATE_PLAYING);
<br>
<br>   return FALSE;
<br>}
<br>
<br>gboolean pause_time(gpointer data)
<br>{
<br>   g_debug(&quot;PAUSE \n&quot;);
<br>   gst_element_set_state (GST_ELEMENT(data), GST_STATE_PAUSED);
<br>   return FALSE;
<br>}
<br>
<br>int main(int argc, char *argv[])
<br>{
<br>   GstElement *pipeline = NULL;
<br>   GstElement *source = NULL;
<br>   GstElement *appsink = NULL;
<br>   GstBus *bus = NULL;
<br>   GMainLoop *loop = NULL;
<br>   GThread * pull_thread = NULL;
<br>
<br>   if(argc &lt; 2){
<br>       g_debug(&quot;Usage [%s] [uri]&quot;, argv[0]);
<br>       return -1;
<br>   }
<br>   gst_init (&amp;argc, &amp;argv);
<br>   loop = g_main_loop_new (NULL, FALSE);
<br>   
   pipeline      = gst_pipeline_new (&quot;pause-block-pipe&quot;);
<br>   source        = gst_element_factory_make (&quot;filesrc&quot;, &quot;sourceFile&quot;);
<br>   g_object_set (G_OBJECT(source), &quot;location&quot;, argv[1], NULL);
<br>   appsink       = gst_element_factory_make (&quot;appsink&quot;, &quot;asink&quot;);
<br>
<br>   if (!pipeline || !source || !appsink) {
<br>       g_printerr (&quot;Erro na criacao de um dos elementos do pipe.\n&quot;);
<br>       return -1;
<br>   }
<br>   bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
<br>   gst_bus_add_watch (bus, bus_call, loop);
<br>   gst_object_unref (bus);
<br>
<br>   gst_bin_add_many (GST_BIN(pipeline), source, appsink, NULL);
<br>   build_decodebin(pipeline, source, appsink, NULL);
<br>
<br>   gst_app_sink_set_max_buffers((GstAppSink*)appsink, 10);
<br>   g_object_set (G_OBJECT(appsink), &quot;sync&quot;, FALSE, NULL);
<br>
<br>   pull_thread =  g_thread_create(pull_func, appsink, TRUE, NULL);
<br>   if(!pull_thread){
<br>       g_debug(&quot;Error creating thread!!&quot;);
<br>       return -1;
<br>   }
<br>   gst_element_set_state (pipeline, GST_STATE_PLAYING);
<br>   g_timeout_add_seconds(2, pause_time, pipeline);
<br>   g_timeout_add_seconds(6, resume_time, pipeline);
<br>
<br>   /* Iterate */
<br>   g_print (&quot;Executando...\n&quot;);
<br>   g_main_loop_run (loop);
<br>
<br>   /* Out of the main loop, clean up nicely */
<br>   g_print (&quot;Terminando...\n&quot;);
<br>   run_thread = FALSE;
<br>   gst_element_set_state (pipeline, GST_STATE_NULL);
<br>
<br>   g_print (&quot;Deletando pipeline...\n&quot;);
<br>   gst_object_unref (GST_OBJECT (pipeline));
<br>   
   return 1;    
}
<br><br><br clear="all"><br>-- <br>Paulo Leonardo Benatto, patito<br>&quot;the fear of being free makes you proud of being a slave&quot;<br>