mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-27 10:40:34 +00:00
media-factory: add a "media-constructed" signal to GstRTSPMediaFactory
For example, it can be used to retrieve source elements like appsrc, in a more convenient way than subclassing get_element.
This commit is contained in:
parent
041b62db8b
commit
5dc9e76125
2 changed files with 28 additions and 7 deletions
|
@ -34,9 +34,17 @@ enum
|
|||
PROP_LAST
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
SIGNAL_MEDIA_CONSTRUCTED,
|
||||
SIGNAL_LAST
|
||||
};
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (rtsp_media_debug);
|
||||
#define GST_CAT_DEFAULT rtsp_media_debug
|
||||
|
||||
static guint gst_rtsp_media_factory_signals[SIGNAL_LAST] = { 0 };
|
||||
|
||||
static void gst_rtsp_media_factory_get_property (GObject * object, guint propid,
|
||||
GValue * value, GParamSpec * pspec);
|
||||
static void gst_rtsp_media_factory_set_property (GObject * object, guint propid,
|
||||
|
@ -103,6 +111,12 @@ gst_rtsp_media_factory_class_init (GstRTSPMediaFactoryClass * klass)
|
|||
"The kernel UDP buffer size to use", 0, G_MAXUINT,
|
||||
DEFAULT_BUFFER_SIZE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
gst_rtsp_media_factory_signals[SIGNAL_MEDIA_CONSTRUCTED] =
|
||||
g_signal_new ("media-constructed", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRTSPMediaFactoryClass,
|
||||
media_constructed), NULL, NULL, g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1, GST_TYPE_RTSP_MEDIA);
|
||||
|
||||
klass->gen_key = default_gen_key;
|
||||
klass->get_element = default_get_element;
|
||||
klass->construct = default_construct;
|
||||
|
@ -490,9 +504,13 @@ gst_rtsp_media_factory_construct (GstRTSPMediaFactory * factory,
|
|||
|
||||
if (media == NULL) {
|
||||
/* nothing cached found, try to create one */
|
||||
if (klass->construct)
|
||||
if (klass->construct) {
|
||||
media = klass->construct (factory, url);
|
||||
else
|
||||
if (media)
|
||||
g_signal_emit (factory,
|
||||
gst_rtsp_media_factory_signals[SIGNAL_MEDIA_CONSTRUCTED], 0, media,
|
||||
NULL);
|
||||
} else
|
||||
media = NULL;
|
||||
|
||||
if (media) {
|
||||
|
|
|
@ -93,12 +93,15 @@ struct _GstRTSPMediaFactory {
|
|||
struct _GstRTSPMediaFactoryClass {
|
||||
GObjectClass parent_class;
|
||||
|
||||
gchar * (*gen_key) (GstRTSPMediaFactory *factory, const GstRTSPUrl *url);
|
||||
gchar * (*gen_key) (GstRTSPMediaFactory *factory, const GstRTSPUrl *url);
|
||||
|
||||
GstElement * (*get_element) (GstRTSPMediaFactory *factory, const GstRTSPUrl *url);
|
||||
GstRTSPMedia * (*construct) (GstRTSPMediaFactory *factory, const GstRTSPUrl *url);
|
||||
void (*configure) (GstRTSPMediaFactory *factory, GstRTSPMedia *media);
|
||||
GstElement * (*create_pipeline)(GstRTSPMediaFactory *factory, GstRTSPMedia *media);
|
||||
GstElement * (*get_element) (GstRTSPMediaFactory *factory, const GstRTSPUrl *url);
|
||||
GstRTSPMedia * (*construct) (GstRTSPMediaFactory *factory, const GstRTSPUrl *url);
|
||||
void (*configure) (GstRTSPMediaFactory *factory, GstRTSPMedia *media);
|
||||
GstElement * (*create_pipeline) (GstRTSPMediaFactory *factory, GstRTSPMedia *media);
|
||||
|
||||
/* signals */
|
||||
void (*media_constructed)(GstRTSPMediaFactory *factory, GstRTSPMedia *media);
|
||||
};
|
||||
|
||||
GType gst_rtsp_media_factory_get_type (void);
|
||||
|
|
Loading…
Reference in a new issue