opusfile: URL Reading Options

| opusfile 0.10 Stand-alone decoder library for .opus files.

Data Structures
URL Reading Options

## Data Structures
struct | OpusServerInfo
| HTTP/Shoutcast/Icecast server information associated with a URL. More...

## URL reading options
Options for op_url_stream_create() and associated functions. These allow you to provide proxy configuration parameters, skip SSL certificate checks, etc. Options are processed in order, and if the same option is passed multiple times, only the value specified by the last occurrence has an effect (unless otherwise specified). They may be expanded in the future.
void | opus_server_info_init (OpusServerInfo *_info) OP_ARG_NONNULL(1)
| Initializes an OpusServerInfo structure. More...
void | opus_server_info_clear (OpusServerInfo *_info) OP_ARG_NONNULL(1)
| Clears the OpusServerInfo structure. More...
#define | OP_SSL_SKIP_CERTIFICATE_CHECK(_b)
| Skip the certificate check when connecting via TLS/SSL (https). More...
#define | OP_HTTP_PROXY_HOST(_host)
| Proxy connections through the given host. More...
#define | OP_HTTP_PROXY_PORT(_port)
| Use the given port when proxying connections. More...
#define | OP_HTTP_PROXY_USER(_user)
| Use the given user name for authentication when proxying connections. More...
#define | OP_HTTP_PROXY_PASS(_pass)
| Use the given password for authentication when proxying connections. More...
#define | OP_GET_SERVER_INFO(_info)
| Parse information about the streaming server (if any) and return it. More...

## Detailed Description

## Macro Definition Documentation

## ◆ OP_SSL_SKIP_CERTIFICATE_CHECK

#define OP_SSL_SKIP_CERTIFICATE_CHECK | ( |  | _b | ) |

Skip the certificate check when connecting via TLS/SSL (https).

Parameters

  _b | `opus_int32`: Whether or not to skip the certificate check. The check will be skipped if _b is non-zero, and will not be skipped if _b is zero.

## ◆ OP_HTTP_PROXY_HOST

#define OP_HTTP_PROXY_HOST | ( |  | _host | ) |

Proxy connections through the given host.

If no port is specified via OP_HTTP_PROXY_PORT, the port number defaults to 8080 (http-alt). All proxy parameters are ignored for non-http and non-https URLs.

Parameters

  _host | `const char *`: The proxy server hostname. This may be `NULL` to disable the use of a proxy server.

## ◆ OP_HTTP_PROXY_PORT

#define OP_HTTP_PROXY_PORT | ( |  | _port | ) |

Use the given port when proxying connections.

This option only has an effect if OP_HTTP_PROXY_HOST is specified with a non-`NULL` _host. If this option is not provided, the proxy port number defaults to 8080 (http-alt). All proxy parameters are ignored for non-http and non-https URLs.

Parameters

  _port | `opus_int32`: The proxy server port. This must be in the range 0...65535 (inclusive), or the URL function this is passed to will fail.

## ◆ OP_HTTP_PROXY_USER

#define OP_HTTP_PROXY_USER | ( |  | _user | ) |

Use the given user name for authentication when proxying connections.

All proxy parameters are ignored for non-http and non-https URLs.

Parameters

  _user | const char *: The proxy server user name. This may be `NULL` to disable proxy authentication. A non-`NULL` value only has an effect if OP_HTTP_PROXY_HOST and OP_HTTP_PROXY_PASS are also specified with non-`NULL` arguments.

## ◆ OP_HTTP_PROXY_PASS

#define OP_HTTP_PROXY_PASS | ( |  | _pass | ) |

Use the given password for authentication when proxying connections.

All proxy parameters are ignored for non-http and non-https URLs.

Parameters

  _pass | const char *: The proxy server password. This may be `NULL` to disable proxy authentication. A non-`NULL` value only has an effect if OP_HTTP_PROXY_HOST and OP_HTTP_PROXY_USER are also specified with non-`NULL` arguments.

## ◆ OP_GET_SERVER_INFO

#define OP_GET_SERVER_INFO | ( |  | _info | ) |

Parse information about the streaming server (if any) and return it.

Very little validation is done. In particular, OpusServerInfo::url may not be a valid URL, OpusServerInfo::bitrate_kbps may not really be in kbps, and OpusServerInfo::content_type may not be a valid MIME type. The character set of the string fields is not specified anywhere, and should not be assumed to be valid UTF-8.

Parameters

  _info | OpusServerInfo *: Returns information about the server. If there is any error opening the stream, the contents of this structure remain unmodified. On success, fills in the structure with the server information that was available, if any. After a successful return, the contents of this structure should be freed by calling opus_server_info_clear().

## Function Documentation

## ◆ opus_server_info_init()

void opus_server_info_init | ( | OpusServerInfo * | _info | ) |

Initializes an OpusServerInfo structure.

All fields are set as if the corresponding header was not available.

Parameters

  _info | The OpusServerInfo structure to initialize.

Note
  If you use this function, you must link against `libopusurl`.

## ◆ opus_server_info_clear()

void opus_server_info_clear | ( | OpusServerInfo * | _info | ) |

Clears the OpusServerInfo structure.

This should be called on an OpusServerInfo structure after it is no longer needed. It will free all memory used by the structure members.

Parameters

  _info | The OpusServerInfo structure to clear.

Note
  If you use this function, you must link against `libopusurl`.