2009-01-20 18:44:45 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <gst/rtsp/gstrtspurl.h>
|
|
|
|
|
|
|
|
#include "rtsp-media.h"
|
|
|
|
|
|
|
|
#ifndef __GST_RTSP_MEDIA_FACTORY_H__
|
|
|
|
#define __GST_RTSP_MEDIA_FACTORY_H__
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2009-01-22 14:33:29 +00:00
|
|
|
/* types for the media factory */
|
|
|
|
#define GST_TYPE_RTSP_MEDIA_FACTORY (gst_rtsp_media_factory_get_type ())
|
2009-01-20 18:44:45 +00:00
|
|
|
#define GST_IS_RTSP_MEDIA_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_MEDIA_FACTORY))
|
|
|
|
#define GST_IS_RTSP_MEDIA_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_MEDIA_FACTORY))
|
|
|
|
#define GST_RTSP_MEDIA_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_MEDIA_FACTORY, GstRTSPMediaFactoryClass))
|
|
|
|
#define GST_RTSP_MEDIA_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_MEDIA_FACTORY, GstRTSPMediaFactory))
|
|
|
|
#define GST_RTSP_MEDIA_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_MEDIA_FACTORY, GstRTSPMediaFactoryClass))
|
|
|
|
#define GST_RTSP_MEDIA_FACTORY_CAST(obj) ((GstRTSPMediaFactory*)(obj))
|
|
|
|
#define GST_RTSP_MEDIA_FACTORY_CLASS_CAST(klass) ((GstRTSPMediaFactoryClass*)(klass))
|
|
|
|
|
|
|
|
typedef struct _GstRTSPMediaFactory GstRTSPMediaFactory;
|
|
|
|
typedef struct _GstRTSPMediaFactoryClass GstRTSPMediaFactoryClass;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GstRTSPMediaFactory:
|
2009-01-29 16:20:27 +00:00
|
|
|
* @lock: mutex protecting the datastructure.
|
2009-01-22 14:33:29 +00:00
|
|
|
* @launch: the launch description
|
2009-01-29 16:20:27 +00:00
|
|
|
* @shared: if media from this factory can be shared between clients
|
|
|
|
* @media_lock: mutex protecting the medias.
|
|
|
|
* @media: hashtable of shared media
|
2009-01-20 18:44:45 +00:00
|
|
|
*
|
2009-01-22 14:33:29 +00:00
|
|
|
* The definition and logic for constructing the pipeline for a media. The media
|
|
|
|
* can contain multiple streams like audio and video.
|
2009-01-20 18:44:45 +00:00
|
|
|
*/
|
|
|
|
struct _GstRTSPMediaFactory {
|
|
|
|
GObject parent;
|
2009-01-22 14:33:29 +00:00
|
|
|
|
2009-01-29 16:20:27 +00:00
|
|
|
GMutex *lock;
|
2009-01-22 14:33:29 +00:00
|
|
|
gchar *launch;
|
2009-01-29 16:20:27 +00:00
|
|
|
gboolean shared;
|
|
|
|
|
|
|
|
GMutex *medias_lock;
|
|
|
|
GHashTable *medias;
|
2009-01-20 18:44:45 +00:00
|
|
|
};
|
|
|
|
|
2009-01-22 14:33:29 +00:00
|
|
|
/**
|
|
|
|
* GstRTSPMediaFactoryClass:
|
2009-01-30 13:53:28 +00:00
|
|
|
* @gen_key: convert @url to a key for caching shared #GstRTSPMedia objects.
|
|
|
|
* The default implementation of this function will use the complete URL
|
|
|
|
* including the query parameters to return a key.
|
|
|
|
* @get_element: Construct and return a #GstElement that is a #GstBin containing
|
|
|
|
* the elements to use for streaming the media. The bin should contain
|
|
|
|
* payloaders pay%d for each stream. The default implementation of this
|
|
|
|
* function returns the bin created from the launch parameter.
|
2009-01-22 14:33:29 +00:00
|
|
|
* @construct: the vmethod that will be called when the factory has to create the
|
2009-01-22 16:58:19 +00:00
|
|
|
* #GstRTSPMedia for @url. The default implementation of this
|
2009-01-22 15:51:08 +00:00
|
|
|
* function calls get_element to retrieve an element and then looks for
|
|
|
|
* pay%d to create the streams.
|
2009-01-29 16:20:27 +00:00
|
|
|
* @configure: configure the media created with @construct. The default
|
|
|
|
* implementation will configure the 'shared' property of the media.
|
2009-06-12 15:45:29 +00:00
|
|
|
* @create_pipeline: create a new pipeline or re-use an existing one and
|
|
|
|
* add the #GstRTSPMedia's element created by @construct to the pipeline.
|
2009-01-29 12:31:27 +00:00
|
|
|
*
|
2009-01-30 13:53:28 +00:00
|
|
|
* The #GstRTSPMediaFactory class structure.
|
2009-01-22 14:33:29 +00:00
|
|
|
*/
|
2009-01-20 18:44:45 +00:00
|
|
|
struct _GstRTSPMediaFactoryClass {
|
|
|
|
GObjectClass parent_class;
|
|
|
|
|
2009-01-29 16:20:27 +00:00
|
|
|
gchar * (*gen_key) (GstRTSPMediaFactory *factory, const GstRTSPUrl *url);
|
|
|
|
|
|
|
|
GstElement * (*get_element) (GstRTSPMediaFactory *factory, const GstRTSPUrl *url);
|
2009-01-29 12:31:27 +00:00
|
|
|
GstRTSPMedia * (*construct) (GstRTSPMediaFactory *factory, const GstRTSPUrl *url);
|
2009-01-29 16:20:27 +00:00
|
|
|
void (*configure) (GstRTSPMediaFactory *factory, GstRTSPMedia *media);
|
2009-06-12 15:45:29 +00:00
|
|
|
GstElement * (*create_pipeline)(GstRTSPMediaFactory *factory, GstRTSPMedia *media);
|
2009-01-20 18:44:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GType gst_rtsp_media_factory_get_type (void);
|
|
|
|
|
2009-01-29 16:20:27 +00:00
|
|
|
/* creating the factory */
|
2009-01-20 18:44:45 +00:00
|
|
|
GstRTSPMediaFactory * gst_rtsp_media_factory_new (void);
|
|
|
|
|
2009-01-29 16:20:27 +00:00
|
|
|
/* configuring the factory */
|
2009-01-22 16:58:19 +00:00
|
|
|
void gst_rtsp_media_factory_set_launch (GstRTSPMediaFactory *factory,
|
|
|
|
const gchar *launch);
|
2009-01-22 14:33:29 +00:00
|
|
|
gchar * gst_rtsp_media_factory_get_launch (GstRTSPMediaFactory *factory);
|
2009-01-20 18:44:45 +00:00
|
|
|
|
2009-01-22 16:58:19 +00:00
|
|
|
void gst_rtsp_media_factory_set_shared (GstRTSPMediaFactory *factory,
|
|
|
|
gboolean shared);
|
|
|
|
gboolean gst_rtsp_media_factory_is_shared (GstRTSPMediaFactory *factory);
|
|
|
|
|
2009-01-29 16:20:27 +00:00
|
|
|
/* creating the media from the factory and a url */
|
2009-01-22 16:58:19 +00:00
|
|
|
GstRTSPMedia * gst_rtsp_media_factory_construct (GstRTSPMediaFactory *factory,
|
|
|
|
const GstRTSPUrl *url);
|
2009-01-20 18:44:45 +00:00
|
|
|
|
2009-06-12 15:51:44 +00:00
|
|
|
void gst_rtsp_media_factory_collect_streams (GstRTSPMediaFactory *factory,
|
|
|
|
const GstRTSPUrl *url,
|
|
|
|
GstRTSPMedia *media);
|
|
|
|
|
2009-01-20 18:44:45 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GST_RTSP_MEDIA_FACTORY_H__ */
|