## input-selector

input-selector — N-to-1 input stream selector

## Synopsis

    struct              GstInputSelector;

## Object Hierarchy

      GObject
       +----GstObject
             +----GstElement
                   +----GstInputSelector

## Properties

      "active-pad"               GstPad*               : Read / Write
      "n-pads"                   guint                 : Read
      "select-all"               gboolean              : Read / Write
      "sync-streams"             gboolean              : Read / Write

## Signals

      "block"                                          : Action
      "switch"                                         : Run Last

## Description

Direct one out of N input streams to the output pad.

The input pads are from a GstPad subclass and have additional properties, which users may find useful, namely:

- "running-time": Running time of stream on pad (gint64)
- "tags": The currently active tags on the pad (GstTagList, boxed type)
- "active": If the pad is currently active (gboolean)
- "always-ok" : Make an inactive pads return GST_FLOW_OK instead of GST_FLOW_NOT_LINKED

## Synopsis

### Element Information

plugin | coreelements
author | Julien Moutte <julien@moutte.net>, Jan Schmidt <thaytan@mad.scientist.com>, Wim Taymans <wim.taymans@gmail.com>
class | Generic

### Element Pads

name | sink%d
direction | sink
presence | request
details | ANY

name | src
direction | source
presence | always
details | ANY

## Details

### struct GstInputSelector

    struct GstInputSelector;

## Property Details

### The `"active-pad"` property

      "active-pad"               GstPad*               : Read / Write

The currently active sink pad.

### The `"n-pads"` property

      "n-pads"                   guint                 : Read

The number of sink pads.

Default value: 0

### The `"select-all"` property

      "select-all"               gboolean              : Read / Write

Forwards data from all input pads.

Default value: FALSE

### The `"sync-streams"` property

      "sync-streams"             gboolean              : Read / Write

If set to `TRUE` all inactive streams will be synced to the running time of the active stream. This makes sure that no buffers are dropped by input-selector that might be needed when switching the active pad.

Default value: FALSE

Since 0.10.36

## Signal Details

### The `"block"` signal

    gint64              user_function                      (GstInputSelector *inputselector,
                                                            gpointer          user_data)          : Action

Block all sink pads in preparation for a switch. Returns the stop time of the current switch segment, as a running time, or 0 if there is no current active pad or the current active pad never received data.

`inputselector` : | the GstInputSelector
`user_data` : | user data set when the signal handler was connected.

### The `"switch"` signal

    void                user_function                      (GstInputSelector *inputselector,
                                                            GstPad           *pad,
                                                            gint64            stop_time,
                                                            gint64            start_time,
                                                            gpointer          user_data)          : Run Last

Switch to a new feed. The segment opened by the previously active pad, if any, will be closed, and a new segment opened before data flows again.

This signal must be emitted when the element has been blocked via the block signal.

If you have a stream with only one switch element, such as an audio-only stream, a stream switch should be performed by first emitting the block signal, and then emitting the switch signal with -1 for the stop and start time values.

The intention of the `stop_time` and `start_time` arguments is to allow multiple switch elements to switch and maintain stream synchronization. When switching a stream with multiple feeds, you will need as many switch elements as you have feeds. For example, a feed with audio and video will have one switch element between the audio feeds and one for video.

A switch over multiple switch elements should be performed as follows: First, emit the block signal, collecting the returned values. The maximum running time returned by block should then be used as the time at which to close the previous segment.

Then, query the running times of the new audio and video pads that you will switch to. Naturally, these pads are on separate switch elements. Take the minimum running time for those streams and use it for the time at which to open the new segment.

If `pad` is the same as the current active pad, the element will cancel any previous block without adjusting segments.

### Note

the signal changed from accepting the pad name to the pad object.

`inputselector` : | the GstInputSelector
`pad` : | the pad to switch to
`stop_time` : | running time at which to close the previous segment, or -1 to use the running time of the previously active sink pad
`start_time` : | running time at which to start the new segment, or -1 to use the running time of the newly active sink pad
`user_data` : | user data set when the signal handler was connected.

Since 0.10.7

## See Also

GstOutputSelector