GstMultifilesink post-messages callback
<p>I would like to know how to get a callback from the gstreamer multifilesink element using post-messages=TRUE property? In the code below my_bus_callback function is never called.</p>

<p>Multifilesink docs say:  If the "post-messages" property is TRUE, it sends an application message named "GstMultiFileSink" after writing each buffer. </p>

<p><a href="http://www.freedesktop.org/software/gstreamer-sdk/data/docs/2012.5/gst-plugins-good-plugins-0.10/gst-plugins-good-plugins-multifilesink.html#GstMultiFileSink--post-messages" rel="nofollow">http://www.freedesktop.org/software/gstreamer-sdk/data/docs/2012.5/gst-plugins-good-plugins-0.10/gst-plugins-good-plugins-multifilesink.html#GstMultiFileSink--post-messages</a></p>

<pre><code>#include &lt;gst/gst.h&gt;
#include &lt;stdio.h&gt;
#include &lt;unistd.h&gt;

// Compilation:
// gcc gst_messages.c -g3 -o gst_messages `pkg-config --cflags --libs gstreamer-0.10`

static GMainLoop *loop;

static gboolean
my_bus_callback (GstBus     *bus,
         GstMessage *message,
         gpointer    data)
{
  printf("Got %s message\n", GST_MESSAGE_TYPE_NAME (message));

  /* we want to be notified again the next time there is a message
   * on the bus, so returning TRUE (FALSE means we want to stop watching
   * for messages on the bus and our callback should not be called again)
   */
  return TRUE;
}


// http://pastebin.com/B3QixHCX
int main(int argc, char *argv[]) {
    GstBus *bus;
    guint bus_watch_id;

    gst_init(&amp;argc, &amp;argv);

    GstElement *pipeline = gst_pipeline_new("looper-pipeline");
    GstElement *v4l2src = gst_element_factory_make("v4l2src", "src");
    GstElement *x264enc = gst_element_factory_make("x264enc", "encoder");
    GstElement *mpegtsmux = gst_element_factory_make("mpegtsmux", "mpegtsmux");
    GstElement *multifilesink = gst_element_factory_make("multifilesink", "multifilesink");


    g_object_set(multifilesink, "next-file", 2, NULL);
    g_object_set(multifilesink, "location", "%05d.ts", NULL);
    g_object_set(multifilesink, "post-messages", TRUE, NULL);

    gst_bin_add(GST_BIN (pipeline), v4l2src);
    gst_bin_add(GST_BIN (pipeline), x264enc);
    gst_bin_add(GST_BIN (pipeline), mpegtsmux);
    gst_bin_add(GST_BIN (pipeline), multifilesink);

    gboolean success;
    success = gst_element_link(v4l2src, x264enc);
    if (!success) {
        g_printerr("Elements could not be linked 1.\n");
    }
    success = gst_element_link(x264enc, mpegtsmux);
    if (!success) {
        g_printerr("Elements could not be linked 2.\n");
    }
    success = gst_element_link(mpegtsmux, multifilesink);
    if (!success) {
        g_printerr("Elements could not be linked 3.\n");
    }

    bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
    gst_bus_add_signal_watch (bus);
    g_signal_connect (bus, "GstMultiFileSink", G_CALLBACK (my_bus_callback), NULL);

    printf("Running\n");
    gst_element_set_state (pipeline, GST_STATE_PLAYING);
    sleep(35);
    printf("STOPPING\n");
    GstMessage *msg;

    gst_element_send_event(v4l2src, gst_event_new_eos()); // shut down pipeline

    /* Wait until error or EOS */
    msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, GST_MESSAGE_ERROR | GST_MESSAGE_EOS);

    /* Free resources */
    if (msg != NULL)
        gst_message_unref(msg);
    gst_object_unref(bus);
    printf("SETTING PIPELINE TO NULL\n");
    gst_element_set_state(pipeline, GST_STATE_NULL);
    gst_object_unref(pipeline);
}
</code></pre>