Blame src/api/doxy/select_stream.dp

Packit 3ff1e7
/** @page select_stream Selecting a media stream 
Packit 3ff1e7
Packit 3ff1e7
When the library returns >1 media streams, you can access them using the
Packit 3ff1e7
@ref quvi_media_stream_next and @ref quvi_media_get as described in
Packit 3ff1e7
@ref parse_media. Alternatively, the convenience functions
Packit 3ff1e7
@ref quvi_media_stream_choose_best  and @ref quvi_media_stream_select
Packit 3ff1e7
could also be used.
Packit 3ff1e7
Packit 3ff1e7
@code
Packit 3ff1e7
quvi_media_t qm = quvi_media_new(q, URL);
Packit 3ff1e7
abort_if_error();
Packit 3ff1e7
{
Packit 3ff1e7
  char *m_url;
Packit 3ff1e7
  quvi_media_stream_choose_best(qm);
Packit 3ff1e7
  quvi_media_get(qm, QUVI_MEDIA_STREAM_PROPERTY_URL, &m_url);
Packit 3ff1e7
}
Packit 3ff1e7
@endcode
Packit 3ff1e7
Packit 3ff1e7
In the above example, we tell the library to choose the stream that was
Packit 3ff1e7
determined (by the media script) to be of the best quality.
Packit 3ff1e7
Packit 3ff1e7
In the example below, we are only interested in a specific
Packit 3ff1e7
stream with the specified stream ID ("foo"). If it is not found
Packit 3ff1e7
(matched), the library falls back to the default stream.
Packit 3ff1e7
Packit 3ff1e7
@code
Packit 3ff1e7
quvi_media_t qm = quvi_media_new(q, URL);
Packit 3ff1e7
abort_if_error();
Packit 3ff1e7
{
Packit 3ff1e7
  char *m_url;
Packit 3ff1e7
Packit 3ff1e7
  quvi_media_stream_select(qm, "foo");
Packit 3ff1e7
  abort_if_error(); /* Always check quvi_ok return value with the above. */
Packit 3ff1e7
  quvi_media_get(qm, QUVI_MEDIA_STREAM_PROPERTY_URL, &m_url);
Packit 3ff1e7
}
Packit 3ff1e7
@endcode
Packit 3ff1e7
Packit 3ff1e7
Since @ref quvi_media_stream_select takes regular expression patterns,
Packit 3ff1e7
the following is also possible:
Packit 3ff1e7
Packit 3ff1e7
@code
Packit 3ff1e7
quvi_media_stream_select(qm, "\\w+_\\d+p$");
Packit 3ff1e7
@endcode
Packit 3ff1e7
Packit 3ff1e7
The value may also be a comma-separated list of patterns, e.g.:
Packit 3ff1e7
Packit 3ff1e7
@code
Packit 3ff1e7
quvi_media_stream_select(qm, "foo,bar,baz,croak");
Packit 3ff1e7
abort_if_error(); /* Always check quvi_ok return value with the above. */
Packit 3ff1e7
quvi_media_get(qm, QUVI_MEDIA_STREAM_PROPERTY_URL, &m_url);
Packit 3ff1e7
@endcode
Packit 3ff1e7
Packit 3ff1e7
Make a note of the use of the 'croak' keyword. This would cause the
Packit 3ff1e7
library to return an error if it was reached, e.g. none of the first
Packit 3ff1e7
three patterns matched any of the available @ref m_stream_id. This
Packit 3ff1e7
is also the reason why an application should always @ref quvi_ok after
Packit 3ff1e7
calling @ref quvi_media_stream_select and handle the error, if any.
Packit 3ff1e7
Packit 3ff1e7
Refer to the API documentation of @ref quvi_media_stream_select for more
Packit 3ff1e7
details.
Packit 3ff1e7
Packit 3ff1e7
@sa quvi_media_stream_select
Packit 3ff1e7
@sa @ref m_stream_id
Packit 3ff1e7
*/