## GstRTSPMediaFactory

GstRTSPMediaFactory — A factory for media pipelines

## Functions

GstRTSPMediaFactory * | gst_rtsp_media_factory_new ()
gchar * | gst_rtsp_media_factory_get_launch ()
void | gst_rtsp_media_factory_set_launch ()
GstRTSPPermissions * | gst_rtsp_media_factory_get_permissions ()
void | gst_rtsp_media_factory_set_permissions ()
void | gst_rtsp_media_factory_add_role ()
void | gst_rtsp_media_factory_add_role_from_structure ()
GstClock * | gst_rtsp_media_factory_get_clock ()
void | gst_rtsp_media_factory_set_clock ()
void | gst_rtsp_media_factory_set_shared ()
gboolean | gst_rtsp_media_factory_is_shared ()
gboolean | gst_rtsp_media_factory_is_eos_shutdown ()
void | gst_rtsp_media_factory_set_eos_shutdown ()
GstRTSPLowerTrans | gst_rtsp_media_factory_get_protocols ()
void | gst_rtsp_media_factory_set_protocols ()
GstRTSPTransportMode | gst_rtsp_media_factory_get_transport_mode ()
void | gst_rtsp_media_factory_set_transport_mode ()
void | gst_rtsp_media_factory_set_profiles ()
GstRTSPProfile | gst_rtsp_media_factory_get_profiles ()
GstRTSPAddressPool * | gst_rtsp_media_factory_get_address_pool ()
void | gst_rtsp_media_factory_set_address_pool ()
guint | gst_rtsp_media_factory_get_buffer_size ()
void | gst_rtsp_media_factory_set_buffer_size ()
GstRTSPSuspendMode | gst_rtsp_media_factory_get_suspend_mode ()
void | gst_rtsp_media_factory_set_suspend_mode ()
void | gst_rtsp_media_factory_set_retransmission_time ()
GstClockTime | gst_rtsp_media_factory_get_retransmission_time ()
void | gst_rtsp_media_factory_set_do_retransmission ()
gboolean | gst_rtsp_media_factory_get_do_retransmission ()
void | gst_rtsp_media_factory_set_latency ()
guint | gst_rtsp_media_factory_get_latency ()
void | gst_rtsp_media_factory_set_media_gtype ()
GType | gst_rtsp_media_factory_get_media_gtype ()
GstRTSPMedia * | gst_rtsp_media_factory_construct ()
GstElement * | gst_rtsp_media_factory_create_element ()

## Properties

gboolean | bind-mcast-address | Read / Write
guint | buffer-size | Read / Write
GstClock * | clock | Read / Write
gboolean | eos-shutdown | Read / Write
guint | latency | Read / Write
gchar * | launch | Read / Write
guint | max-mcast-ttl | Read / Write
GstRTSPProfile | profiles | Read / Write
GstRTSPLowerTrans | protocols | Read / Write
gboolean | shared | Read / Write
gboolean | stop-on-disconnect | Read / Write
GstRTSPSuspendMode | suspend-mode | Read / Write
GstRTSPTransportMode | transport-mode | Read / Write

## Signals

void | media-configure | Run Last
void | media-constructed | Run Last

## Types and Values

struct | GstRTSPMediaFactory
struct | GstRTSPMediaFactoryClass

## Object Hierarchy

        GObject
        ╰── GstRTSPMediaFactory
            ╰── GstRTSPMediaFactoryURI

## Description

The GstRTSPMediaFactory is responsible for creating or recycling GstRTSPMedia objects based on the passed URL.

The default implementation of the object can create GstRTSPMedia objects containing a pipeline created from a launch description set with `gst_rtsp_media_factory_set_launch()`.

Media from a factory can be shared by setting the shared flag with `gst_rtsp_media_factory_set_shared()`. When a factory is shared, `gst_rtsp_media_factory_construct()` will return the same GstRTSPMedia when the url matches.

Last reviewed on 2013-07-11 (1.0.0)

## Functions

### gst_rtsp_media_factory_new ()

    GstRTSPMediaFactory *
    gst_rtsp_media_factory_new (void);

Create a new GstRTSPMediaFactory instance.

#### Returns

a new GstRTSPMediaFactory object.

[transfer full]

### gst_rtsp_media_factory_get_launch ()

    gchar *
    gst_rtsp_media_factory_get_launch (GstRTSPMediaFactory *factory);

Get the `gst_parse_launch()` pipeline description that will be used in the default prepare vmethod.

#### Parameters

factory | a GstRTSPMediaFactory |

#### Returns

the configured launch description. `g_free()` after usage.

[transfer full][nullable]

### gst_rtsp_media_factory_set_launch ()

    void
    gst_rtsp_media_factory_set_launch (GstRTSPMediaFactory *factory,
                                       const gchar *launch);

The `gst_parse_launch()` line to use for constructing the pipeline in the default prepare vmethod.

The pipeline description should return a GstBin as the toplevel element which can be accomplished by enclosing the description with brackets '(' ')'.

The description should return a pipeline with payloaders named pay0, pay1, etc.. Each of the payloaders will result in a stream.

#### Parameters

factory | a GstRTSPMediaFactory |
launch | the launch description |

### gst_rtsp_media_factory_get_permissions ()

    GstRTSPPermissions *
    gst_rtsp_media_factory_get_permissions
                                   (GstRTSPMediaFactory *factory);

Get the permissions object from `factory` .

#### Parameters

factory | a GstRTSPMediaFactory |

#### Returns

a GstRTSPPermissions object, unref after usage.

[transfer full][nullable]

### gst_rtsp_media_factory_set_permissions ()

    void
    gst_rtsp_media_factory_set_permissions
                                   (GstRTSPMediaFactory *factory,
                                    GstRTSPPermissions *permissions);

Set `permissions` on `factory` .

#### Parameters

factory | a GstRTSPMediaFactory |
permissions | a GstRTSPPermissions. | [transfer none][nullable]

### gst_rtsp_media_factory_add_role ()

    void
    gst_rtsp_media_factory_add_role (GstRTSPMediaFactory *factory,
                                     const gchar *role,
                                     const gchar *fieldname,
                                     ...);

A convenience method to add `role` with `fieldname` and additional arguments to the permissions of `factory` . If `factory` had no permissions, new permissions will be created and the role will be added to it.

#### Parameters

factory | a GstRTSPMediaFactory |
role | a role |
fieldname | the first field name |
... | additional arguments |

### gst_rtsp_media_factory_add_role_from_structure ()

    void
    gst_rtsp_media_factory_add_role_from_structure
                                   (GstRTSPMediaFactory *factory,
                                    GstStructure *structure);

A convenience wrapper around `gst_rtsp_permissions_add_role_from_structure()`. If `factory` had no permissions, new permissions will be created and the role will be added to it.

Since: 1.14

### gst_rtsp_media_factory_get_clock ()

    GstClock *
    gst_rtsp_media_factory_get_clock (GstRTSPMediaFactory *factory);

Returns the clock that is going to be used by the pipelines of all medias created from this factory.

#### Parameters

factory | a GstRTSPMediaFactory |

#### Returns

The GstClock.

[transfer full]

Since: 1.8

### gst_rtsp_media_factory_set_clock ()

    void
    gst_rtsp_media_factory_set_clock (GstRTSPMediaFactory *factory,
                                      GstClock *clock);

Configures a specific clock to be used by the pipelines of all medias created from this factory.

#### Parameters

factory | a GstRTSPMediaFactory |
clock | the clock to be used by the media factory. | [nullable]

Since: 1.8

### gst_rtsp_media_factory_set_shared ()

    void
    gst_rtsp_media_factory_set_shared (GstRTSPMediaFactory *factory,
                                       gboolean shared);

Configure if media created from this factory can be shared between clients.

#### Parameters

factory | a GstRTSPMediaFactory |
shared | the new value |

### gst_rtsp_media_factory_is_shared ()

    gboolean
    gst_rtsp_media_factory_is_shared (GstRTSPMediaFactory *factory);

Get if media created from this factory can be shared between clients.

#### Parameters

factory | a GstRTSPMediaFactory |

#### Returns

`TRUE` if the media will be shared between clients.

### gst_rtsp_media_factory_is_eos_shutdown ()

    gboolean
    gst_rtsp_media_factory_is_eos_shutdown
                                   (GstRTSPMediaFactory *factory);

Get if media created from this factory will have an EOS event sent to the pipeline before shutdown.

#### Parameters

factory | a GstRTSPMediaFactory |

#### Returns

`TRUE` if the media will receive EOS before shutdown.

### gst_rtsp_media_factory_set_eos_shutdown ()

    void
    gst_rtsp_media_factory_set_eos_shutdown
                                   (GstRTSPMediaFactory *factory,
                                    gboolean eos_shutdown);

Configure if media created from this factory will have an EOS sent to the pipeline before shutdown.

#### Parameters

factory | a GstRTSPMediaFactory |
eos_shutdown | the new value |

### gst_rtsp_media_factory_get_protocols ()

    GstRTSPLowerTrans
    gst_rtsp_media_factory_get_protocols (GstRTSPMediaFactory *factory);

Get the allowed protocols of `factory` .

#### Parameters

factory | a GstRTSPMediaFactory |

#### Returns

a GstRTSPLowerTrans

### gst_rtsp_media_factory_set_protocols ()

    void
    gst_rtsp_media_factory_set_protocols (GstRTSPMediaFactory *factory,
                                          GstRTSPLowerTrans protocols);

Configure the allowed lower transport for `factory` .

#### Parameters

factory | a GstRTSPMediaFactory |
protocols | the new flags |

### gst_rtsp_media_factory_get_transport_mode ()

    GstRTSPTransportMode
    gst_rtsp_media_factory_get_transport_mode
                                   (GstRTSPMediaFactory *factory);

Get if media created from this factory can be used for PLAY or RECORD methods.

#### Parameters

factory | a GstRTSPMediaFactory |

#### Returns

The transport mode.

### gst_rtsp_media_factory_set_transport_mode ()

    void
    gst_rtsp_media_factory_set_transport_mode
                                   (GstRTSPMediaFactory *factory,
                                    GstRTSPTransportMode mode);

Configure if this factory creates media for PLAY or RECORD modes.

#### Parameters

factory | a GstRTSPMediaFactory |
mode | the new value |

### gst_rtsp_media_factory_set_profiles ()

    void
    gst_rtsp_media_factory_set_profiles (GstRTSPMediaFactory *factory,
                                         GstRTSPProfile profiles);

Configure the allowed profiles for `factory` .

#### Parameters

factory | a GstRTSPMediaFactory |
profiles | the new flags |

### gst_rtsp_media_factory_get_profiles ()

    GstRTSPProfile
    gst_rtsp_media_factory_get_profiles (GstRTSPMediaFactory *factory);

Get the allowed profiles of `factory` .

#### Parameters

factory | a GstRTSPMediaFactory |

#### Returns

a GstRTSPProfile

### gst_rtsp_media_factory_get_address_pool ()

    GstRTSPAddressPool *
    gst_rtsp_media_factory_get_address_pool
                                   (GstRTSPMediaFactory *factory);

Get the GstRTSPAddressPool used as the address pool of `factory` .

#### Parameters

factory | a GstRTSPMediaFactory |

#### Returns

the GstRTSPAddressPool of `factory` . `g_object_unref()` after usage.

[transfer full][nullable]

### gst_rtsp_media_factory_set_address_pool ()

    void
    gst_rtsp_media_factory_set_address_pool
                                   (GstRTSPMediaFactory *factory,
                                    GstRTSPAddressPool *pool);

configure `pool` to be used as the address pool of `factory` .

#### Parameters

factory | a GstRTSPMediaFactory |
pool | a GstRTSPAddressPool. | [transfer none][nullable]

### gst_rtsp_media_factory_get_buffer_size ()

    guint
    gst_rtsp_media_factory_get_buffer_size
                                   (GstRTSPMediaFactory *factory);

Get the kernel UDP buffer size.

#### Parameters

factory | a GstRTSPMedia |

#### Returns

the kernel UDP buffer size.

### gst_rtsp_media_factory_set_buffer_size ()

    void
    gst_rtsp_media_factory_set_buffer_size
                                   (GstRTSPMediaFactory *factory,
                                    guint size);

Set the kernel UDP buffer size.

#### Parameters

factory | a GstRTSPMedia |
size | the new value |

### gst_rtsp_media_factory_get_suspend_mode ()

    GstRTSPSuspendMode
    gst_rtsp_media_factory_get_suspend_mode
                                   (GstRTSPMediaFactory *factory);

Get how media created from this factory will be suspended.

#### Parameters

factory | a GstRTSPMediaFactory |

#### Returns

a GstRTSPSuspendMode.

### gst_rtsp_media_factory_set_suspend_mode ()

    void
    gst_rtsp_media_factory_set_suspend_mode
                                   (GstRTSPMediaFactory *factory,
                                    GstRTSPSuspendMode mode);

Configure how media created from this factory will be suspended.

#### Parameters

factory | a GstRTSPMediaFactory |
mode | the new GstRTSPSuspendMode |

### gst_rtsp_media_factory_set_retransmission_time ()

    void
    gst_rtsp_media_factory_set_retransmission_time
                                   (GstRTSPMediaFactory *factory,
                                    GstClockTime time);

Configure the time to store for possible retransmission

#### Parameters

factory | a GstRTSPMediaFactory |
time | a GstClockTime |

### gst_rtsp_media_factory_get_retransmission_time ()

    GstClockTime
    gst_rtsp_media_factory_get_retransmission_time
                                   (GstRTSPMediaFactory *factory);

Get the time that is stored for retransmission purposes

#### Parameters

factory | a GstRTSPMediaFactory |

#### Returns

a GstClockTime

### gst_rtsp_media_factory_set_do_retransmission ()

    void
    gst_rtsp_media_factory_set_do_retransmission
                                   (GstRTSPMediaFactory *factory,
                                    gboolean do_retransmission);

Set whether retransmission requests will be sent for receiving media

Since: 1.16

### gst_rtsp_media_factory_get_do_retransmission ()

    gboolean
    gst_rtsp_media_factory_get_do_retransmission
                                   (GstRTSPMediaFactory *factory);

#### Returns

Whether retransmission requests will be sent for receiving media

Since: 1.16

### gst_rtsp_media_factory_set_latency ()

    void
    gst_rtsp_media_factory_set_latency (GstRTSPMediaFactory *factory,
                                        guint latency);

Configure the latency used for receiving media

#### Parameters

factory | a GstRTSPMediaFactory |
latency | latency in milliseconds |

### gst_rtsp_media_factory_get_latency ()

    guint
    gst_rtsp_media_factory_get_latency (GstRTSPMediaFactory *factory);

Get the latency that is used for receiving media

#### Parameters

factory | a GstRTSPMediaFactory |

#### Returns

latency in milliseconds

### gst_rtsp_media_factory_set_media_gtype ()

    void
    gst_rtsp_media_factory_set_media_gtype
                                   (GstRTSPMediaFactory *factory,
                                    GType media_gtype);

Configure the GType of the GstRTSPMedia subclass to create (by default, overridden construct vmethods may of course do something different)

#### Parameters

factory | a GstRTSPMediaFactory |
media_gtype | the GType of the class to create |

Since: 1.6

### gst_rtsp_media_factory_get_media_gtype ()

    GType
    gst_rtsp_media_factory_get_media_gtype
                                   (GstRTSPMediaFactory *factory);

Return the GType of the GstRTSPMedia subclass this factory will create.

#### Parameters

factory | a GstRTSPMediaFactory |

Since: 1.6

### gst_rtsp_media_factory_construct ()

    GstRTSPMedia *
    gst_rtsp_media_factory_construct (GstRTSPMediaFactory *factory,
                                      const GstRTSPUrl *url);

Construct the media object and create its streams. Implementations should create the needed gstreamer elements and add them to the result object. No state changes should be performed on them yet.

One or more GstRTSPStream objects should be created from the result with `gst_rtsp_media_create_stream()`.

After the media is constructed, it can be configured and then prepared with `gst_rtsp_media_prepare()`.

#### Parameters

factory | a GstRTSPMediaFactory |
url | the url used |

#### Returns

a new GstRTSPMedia if the media could be prepared.

[transfer full]

### gst_rtsp_media_factory_create_element ()

    GstElement *
    gst_rtsp_media_factory_create_element (GstRTSPMediaFactory *factory,
                                           const GstRTSPUrl *url);

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.

#### Parameters

factory | a GstRTSPMediaFactory |
url | the url used |

#### Returns

a new GstElement.

[transfer floating]

## Types and Values

### struct GstRTSPMediaFactory

    struct GstRTSPMediaFactory;

The definition and logic for constructing the pipeline for a media. The media can contain multiple streams like audio and video.

### struct GstRTSPMediaFactoryClass

    struct GstRTSPMediaFactoryClass {
      GObjectClass  parent_class;

      gchar *         (*gen_key)            (GstRTSPMediaFactory *factory, const GstRTSPUrl *url);

      GstElement *    (*create_element)     (GstRTSPMediaFactory *factory, const GstRTSPUrl *url);
      GstRTSPMedia *  (*construct)          (GstRTSPMediaFactory *factory, const GstRTSPUrl *url);
      GstElement *    (*create_pipeline)    (GstRTSPMediaFactory *factory, GstRTSPMedia *media);
      void            (*configure)          (GstRTSPMediaFactory *factory, GstRTSPMedia *media);

      /* signals */
      void            (*media_constructed)  (GstRTSPMediaFactory *factory, GstRTSPMedia *media);
      void            (*media_configure)    (GstRTSPMediaFactory *factory, GstRTSPMedia *media);
    };

The GstRTSPMediaFactory class structure.

#### Members

`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. |
`create_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. |
`construct` () | the vmethod that will be called when the factory has to create the GstRTSPMedia for `url` . The default implementation of this function calls create_element to retrieve an element and then looks for pay%d to create the streams. |
`create_pipeline` () | create a new pipeline or re-use an existing one and add the GstRTSPMedia's element created by `construct` to the pipeline. |
`configure` () | configure the media created with `construct` . The default implementation will configure the 'shared' property of the media. |
`media_constructed` () | signal emitted when a media was constructed |
`media_configure` () | signal emitted when a media should be configured |

## Property Details

### The `“bind-mcast-address”` property

      “bind-mcast-address”       gboolean

Whether the multicast sockets should be bound to multicast addresses or INADDR_ANY.

Flags: Read / Write

Default value: FALSE

### The `“buffer-size”` property

      “buffer-size”              guint

The kernel UDP buffer size to use.

Flags: Read / Write

Default value: 524288

### The `“clock”` property

      “clock”                    GstClock *

Clock to be used by the pipelines created for all medias of this factory.

Flags: Read / Write

### The `“eos-shutdown”` property

      “eos-shutdown”             gboolean

Send EOS down the pipeline before shutting down.

Flags: Read / Write

Default value: FALSE

### The `“latency”` property

      “latency”                  guint

Latency used for receiving media in milliseconds.

Flags: Read / Write

Default value: 200

### The `“launch”` property

      “launch”                   gchar *

A launch description of the pipeline.

Flags: Read / Write

Default value: NULL

### The `“max-mcast-ttl”` property

      “max-mcast-ttl”            guint

The maximum time-to-live value of outgoing multicast packets.

Flags: Read / Write

Allowed values: [1,255]

Default value: 255

### The `“profiles”` property

      “profiles”                 GstRTSPProfile

Allowed transfer profiles.

Flags: Read / Write

Default value: GST_RTSP_PROFILE_AVP

### The `“protocols”` property

      “protocols”                GstRTSPLowerTrans

Allowed lower transport protocols.

Flags: Read / Write

Default value: GST_RTSP_LOWER_TRANS_UDP | GST_RTSP_LOWER_TRANS_UDP_MCAST | GST_RTSP_LOWER_TRANS_TCP

### The `“shared”` property

      “shared”                   gboolean

If media from this factory is shared.

Flags: Read / Write

Default value: FALSE

### The `“stop-on-disconnect”` property

      “stop-on-disconnect”       gboolean

If media from this factory should be stopped when a client disconnects without TEARDOWN.

Flags: Read / Write

Default value: TRUE

### The `“suspend-mode”` property

      “suspend-mode”             GstRTSPSuspendMode

Control how media will be suspended.

Flags: Read / Write

Default value: GST_RTSP_SUSPEND_MODE_NONE

### The `“transport-mode”` property

      “transport-mode”           GstRTSPTransportMode

If media from this factory is for PLAY or RECORD.

Flags: Read / Write

Default value: GST_RTSP_TRANSPORT_MODE_PLAY

## Signal Details

### The `“media-configure”` signal

    void
    user_function (GstRTSPMediaFactory *gstrtspmediafactory,
                   GstRTSPMedia        *arg1,
                   gpointer             user_data)

Flags: Run Last

### The `“media-constructed”` signal

    void
    user_function (GstRTSPMediaFactory *gstrtspmediafactory,
                   GstRTSPMedia        *arg1,
                   gpointer             user_data)

Flags: Run Last

## See Also

GstRTSPMountPoints, GstRTSPMedia