media: emit prepared signal when prepared

Make a 'prepared' signal and emit it when we successfully prepared the element.
This signal can be used to configure the media object after it has been prepared
for streaming.
This commit is contained in:
Wim Taymans 2010-12-13 16:58:36 +01:00
parent 7dfb91e289
commit 1ea450179e
2 changed files with 9 additions and 0 deletions

View file

@ -46,6 +46,7 @@ enum
enum
{
SIGNAL_PREPARED,
SIGNAL_UNPREPARED,
SIGNAL_LAST
};
@ -103,6 +104,11 @@ gst_rtsp_media_class_init (GstRTSPMediaClass * klass)
"Send an EOS event to the pipeline before unpreparing",
DEFAULT_EOS_SHUTDOWN, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_rtsp_media_signals[SIGNAL_PREPARED] =
g_signal_new ("prepared", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstRTSPMediaClass, prepared), NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
gst_rtsp_media_signals[SIGNAL_UNPREPARED] =
g_signal_new ("unprepared", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstRTSPMediaClass, unprepared), NULL, NULL,
@ -1592,6 +1598,8 @@ gst_rtsp_media_prepare (GstRTSPMedia * media)
if (status == GST_RTSP_MEDIA_STATUS_ERROR)
goto state_failed;
g_signal_emit (media, gst_rtsp_media_signals[SIGNAL_PREPARED], 0, NULL);
GST_INFO ("object %p is prerolled", media);
return TRUE;

View file

@ -250,6 +250,7 @@ struct _GstRTSPMediaClass {
gboolean (*unprepare) (GstRTSPMedia *media);
/* signals */
gboolean (*prepared) (GstRTSPMedia *media);
gboolean (*unprepared) (GstRTSPMedia *media);
};