title: Gstreamer call backs are not hitting after setting pipeline to playing state
body: <p>I am writing a media application to grab video frames from a video file. For this, I want to get the video properties before pulling the samples from the pipeline. So, I have added a callback for <code>auto-plug</code> signal at the decoder and trying to get the properties. These callbacks are not getting called even after I put the pipeline into playing state, but these are called if I try to pull a sample from the pipeline using <code>gst_app_sink_pull_sample</code>.</p>
  
  <p>Am I missing anything here? My understanding is that these callbacks will get invoked when we put the pipeline into playing state.</p>
  
  <pre><code>#include &lt;gst/gst.h&gt;
  #include &lt;stdio.h&gt;
  
  static void bus_callback (GstBus *bus, GstMessage *msg, gpointer data) 
  {
  
    switch (GST_MESSAGE_TYPE (msg)) 
    {
      case GST_MESSAGE_ERROR: {
                    GError *err;
                    gchar *debug;
                    gst_message_parse_error (msg, &amp;err, &amp;debug);
                    g_print ("Error: %s\n", err-&gt;message);
                    g_error_free (err);
                    g_free (debug);
                    break;
                  }
      default:
                  /* Unhandled message */
                  break;
    }
  }
  
  static void 
  on_pad_added (GstElement *element, GstPad *pad, gpointer data)
  {
    GstPad *sinkpad;
    GstElement *decoder = (GstElement *) data;
  
    /* We can now link this pad with the decoder sink pad */
    sinkpad           =  gst_element_get_static_pad (decoder, "sink");
    gst_pad_link (pad, sinkpad);
    gst_object_unref (sinkpad);
  }
  
  static void
  auto_plug_select (GstElement *decoder, GstPad *pad, GstCaps *caps,
      GstElementFactory *factory, int *width )
  {
    const gchar *klass   =  gst_element_factory_get_klass (factory);
  /*  MW_customData *cdata =  (MW_customData*) data;*/
    GstCaps *scaps       =  gst_pad_query_caps (pad, NULL);
    GstStructure *str    =  gst_caps_get_structure (scaps, 0);
    const gchar *type    =  gst_structure_get_name (str);
    printf (" Pad cap: %s\n", type);
  
    if (g_strrstr(type,"video"))
    {
     gst_structure_get_int (str, "width", width);
     printf(" Width: %d\n", *width);
    }
  }
  
  int main (gint   argc,
        gchar *argv[])
  {
    GstElement *pipeline, *filesrc, *decoder, *fakesink;
    GstBus *bus;
  
    /* init GStreamer */
    gst_init (&amp;argc, &amp;argv);
  
    /* check args */
    if (argc != 2) {
      g_print ("Usage: %s &lt;filename&gt;\n", argv[0]);
      return -1;
    }
  
    /* create a new pipeline to hold the elements */
    pipeline = gst_pipeline_new ("pipeline");
  
    /* Bus call back*/
    bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
    gst_bus_add_watch (bus, bus_callback, NULL);
    gst_object_unref (bus);
  
    /* create file source and typefind element */
    filesrc = gst_element_factory_make ("filesrc", "source");
    g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
    decoder = gst_element_factory_make ("decodebin", NULL);
    fakesink = gst_element_factory_make ("fakesink", "sink");
  
    int width = 0;
  /* Connect the sink pad when decoder completes the operation */
    g_signal_connect (decoder, "pad-added", G_CALLBACK (on_pad_added), &amp;width);
    g_signal_connect (decoder, "autoplug-select", G_CALLBACK (auto_plug_select), fakesink);
  
    /* setup */
    gst_bin_add_many (GST_BIN (pipeline), filesrc, decoder, fakesink, NULL);
    gst_element_link (filesrc, decoder);
    gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
  
    printf(" Width: %d\n", width);
  
    gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
  
    return 0;
  }
  </code></pre>