souphttpsrc

souphttpsrc — Read from an HTTP/HTTPS/WebDAV/Icecast/Shoutcast location.

Synopsis

                    GstSoupHTTPSrc;

Properties

  "location"                 gchar*                : Read / Write
  "iradio-genre"             gchar*                : Read
  "iradio-mode"              gboolean              : Read / Write
  "iradio-name"              gchar*                : Read
  "iradio-title"             gchar*                : Read
  "iradio-url"               gchar*                : Read
  "user-agent"               gchar*                : Read / Write
  "automatic-redirect"       gboolean              : Read / Write
  "proxy"                    gchar*                : Read / Write

Description

This plugin reads data from a remote location specified by a URI. Supported protocols are 'http', 'https', 'dav', or 'davs'.

An HTTP proxy must be specified by its URL. If the "http_proxy" environment variable is set, its value is used. The element-souphttpsrc::proxy property can be used to override the default.

In case the element-souphttpsrc::iradio-mode property is set and the location is an HTTP resource, souphttpsrc will send special Icecast HTTP headers to the server to request additional Icecast meta-information. If the server is not an Icecast server, it will behave as if the element-souphttpsrc::iradio-mode property were not set. If it is, souphttpsrc will output data with a media type of application/x-icy, in which case you will need to use the ICYDemux element as follow-up element to extract the Icecast metadata and to determine the underlying media type.

Example pipeline:

gst-launch -v souphttpsrc location=https://some.server.org/index.html
    ! filesink location=/home/joe/server.html

The above pipeline reads a web page from a server using the HTTPS protocol and writes it to a local file.

Another example pipeline:

gst-launch -v souphttpsrc user-agent="FooPlayer 0.99 beta"
    automatic-redirect=false proxy=http://proxy.intranet.local:8080
    location=http://music.foobar.com/demo.mp3 ! mad ! audioconvert
    ! audioresample ! alsasink

The above pipeline will read and decode and play an mp3 file from a web server using the HTTP protocol. If the server sends redirects, the request fails instead of following the redirect. The specified HTTP proxy server is used. The User-Agent HTTP request header is set to a custom string instead of "GStreamer souphttpsrc."

Yet another example pipeline:

gst-launch -v souphttpsrc location=http://10.11.12.13/mjpeg
    do-timestamp=true ! multipartdemux
    ! image/jpeg,width=640,height=480 ! matroskamux
    ! filesink location=mjpeg.mkv

The above pipeline reads a motion JPEG stream from an IP camera using the HTTP protocol, encoded as mime/multipart image/jpeg parts, and writes a Matroska motion JPEG file. The width and height properties are set in the caps to provide the Matroska multiplexer with the information to set this in the header. Timestamps are set on the buffers as they arrive from the camera. These are used by the mime/multipart demultiplexer to emit timestamps on the JPEG-encoded video frame buffers. This allows the Matroska multiplexer to timestamp the frames in the resulting file.

Element Information

plugin

soup

author

Wouter Cloetens <wouter@mind.be>

class

Source/Network

name

src

direction

source

presence

always

details

ANY

Details

GstSoupHTTPSrc

typedef struct {
  GstPushSrc element;

  gchar *location;             /* Full URI. */
  gchar *user_agent;           /* User-Agent HTTP header. */
  gboolean automatic_redirect; /* Follow redirects. */
  SoupURI *proxy;              /* HTTP proxy URI. */
  GMainContext *context;       /* I/O context. */
  GMainLoop *loop;             /* Event loop. */
  SoupSession *session;        /* Async context. */
  GstSoupHTTPSrcSessionIOStatus session_io_status;
                               /* Async I/O status. */
  SoupMessage *msg;            /* Request message. */
  GstFlowReturn ret;           /* Return code from callback. */
  GstBuffer **outbuf;          /* Return buffer allocated by callback. */
  gboolean interrupted;        /* Signal unlock(). */

  gboolean have_size;          /* Received and parsed Content-Length
                                  header. */
  guint64 content_size;        /* Value of Content-Length header. */
  guint64 read_position;       /* Current position. */
  gboolean seekable;           /* FALSE if the server does not support
                                  Range. */
  guint64 request_position;    /* Seek to this position. */

  /* Shoutcast/icecast metadata extraction handling. */
  gboolean iradio_mode;
  GstCaps *icy_caps;
  gchar *iradio_name;
  gchar *iradio_genre;
  gchar *iradio_url;
  gchar *iradio_title;
} GstSoupHTTPSrc;

Property Details

The "location" property

  "location"                 gchar*                : Read / Write

Location to read from.

Default value: ""


The "iradio-genre" property

  "iradio-genre"             gchar*                : Read

Genre of the stream.

Default value: NULL


The "iradio-mode" property

  "iradio-mode"              gboolean              : Read / Write

Enable internet radio mode (extraction of shoutcast/icecast metadata).

Default value: FALSE


The "iradio-name" property

  "iradio-name"              gchar*                : Read

Name of the stream.

Default value: NULL


The "iradio-title" property

  "iradio-title"             gchar*                : Read

Name of currently playing song.

Default value: NULL


The "iradio-url" property

  "iradio-url"               gchar*                : Read

Homepage URL for radio stream.

Default value: NULL


The "user-agent" property

  "user-agent"               gchar*                : Read / Write

Value of the User-Agent HTTP request header field.

Default value: "GStreamer souphttpsrc"


The "automatic-redirect" property

  "automatic-redirect"       gboolean              : Read / Write

Automatically follow HTTP redirects (HTTP Status Code 3xx).

Default value: TRUE


The "proxy" property

  "proxy"                    gchar*                : Read / Write

HTTP proxy server URI.

Default value: ""