|
Packit |
3ff1e7 |
/** @page parse_media Parsing media properties
|
|
Packit |
3ff1e7 |
|
|
Packit |
3ff1e7 |
libquvi uses a @ref m_script to parse the media properties for a
|
|
Packit |
3ff1e7 |
@ref m_url. You should make a note of the difference of @ref m_prop
|
|
Packit |
3ff1e7 |
and @ref ms_prop. There may be >1 of the latter. See the next section
|
|
Packit |
3ff1e7 |
(@ref qms_properties below) for an example of handling those.
|
|
Packit |
3ff1e7 |
|
|
Packit |
3ff1e7 |
@note The available @ref m_script collection determines which
|
|
Packit |
3ff1e7 |
websites are supported by the library.
|
|
Packit |
3ff1e7 |
|
|
Packit |
3ff1e7 |
These examples use an abort_if_error function which could do nothing
|
|
Packit |
3ff1e7 |
more than check @ref quvi_ok return value and exit if the function
|
|
Packit |
3ff1e7 |
returned QUVI_FALSE. We do not define this function in these examples.
|
|
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_title, *m_url;
|
|
Packit |
3ff1e7 |
quvi_media_get(qm, QUVI_MEDIA_PROPERTY_TITLE, &m_title);
|
|
Packit |
3ff1e7 |
quvi_media_get(qm, QUVI_MEDIA_STREAM_PROPERTY_URL, &m_url);
|
|
Packit |
3ff1e7 |
}
|
|
Packit |
3ff1e7 |
quvi_media_free(qm); /* Release when done using it. */
|
|
Packit |
3ff1e7 |
qm = NULL;
|
|
Packit |
3ff1e7 |
@endcode
|
|
Packit |
3ff1e7 |
|
|
Packit |
3ff1e7 |
@sa QuviMediaProperty
|
|
Packit |
3ff1e7 |
|
|
Packit |
3ff1e7 |
@section qms_properties Media stream properties
|
|
Packit |
3ff1e7 |
|
|
Packit |
3ff1e7 |
There may be >1 @ref m_stream available. These may be accessed using the
|
|
Packit |
3ff1e7 |
quvi_media_stream_* function set. The one exception to this is the
|
|
Packit |
3ff1e7 |
@ref quvi_media_get function which is used to query the values from the
|
|
Packit |
3ff1e7 |
library.
|
|
Packit |
3ff1e7 |
|
|
Packit |
3ff1e7 |
@note Using any of the QUVI_MEDIA_STREAM_PROPERTY_* values
|
|
Packit |
3ff1e7 |
with @ref quvi_media_get will cause the library to advance to the first
|
|
Packit |
3ff1e7 |
media stream in the list. This will make @ref quvi_media_stream_next
|
|
Packit |
3ff1e7 |
function to continue from the second media stream, not the first one
|
|
Packit |
3ff1e7 |
as one might expect.
|
|
Packit |
3ff1e7 |
|
|
Packit |
3ff1e7 |
For example:
|
|
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_title, *m_url;
|
|
Packit |
3ff1e7 |
quvi_media_get(qm, QUVI_MEDIA_PROPERTY_TITLE, &m_title);
|
|
Packit |
3ff1e7 |
|
|
Packit |
3ff1e7 |
/* Advances the media stream list, starting from the first. */
|
|
Packit |
3ff1e7 |
quvi_media_get(qm, QUVI_MEDIA_STREAM_PROPERTY_URL, &m_url);
|
|
Packit |
3ff1e7 |
|
|
Packit |
3ff1e7 |
/* Would now continue from second stream in the list. */
|
|
Packit |
3ff1e7 |
while (quvi_media_stream_next(qm) == QUVI_TRUE)
|
|
Packit |
3ff1e7 |
quvi_media_get(qm, QUVI_MEDIA_STREAM_PROPERTY_URL, &m_url);
|
|
Packit |
3ff1e7 |
}
|
|
Packit |
3ff1e7 |
@endcode
|
|
Packit |
3ff1e7 |
|
|
Packit |
3ff1e7 |
Where as:
|
|
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_title, *m_url;
|
|
Packit |
3ff1e7 |
quvi_media_get(qm, QUVI_MEDIA_PROPERTY_TITLE, &m_title);
|
|
Packit |
3ff1e7 |
|
|
Packit |
3ff1e7 |
/* Would start from the first stream in the list. */
|
|
Packit |
3ff1e7 |
while (quvi_media_stream_next(qm) == QUVI_TRUE)
|
|
Packit |
3ff1e7 |
quvi_media_get(qm, QUVI_MEDIA_STREAM_PROPERTY_URL, &m_url);
|
|
Packit |
3ff1e7 |
}
|
|
Packit |
3ff1e7 |
@endcode
|
|
Packit |
3ff1e7 |
|
|
Packit |
3ff1e7 |
Alternatively, call @ref quvi_media_stream_reset after the @ref
|
|
Packit |
3ff1e7 |
quvi_media_get call.
|
|
Packit |
3ff1e7 |
|
|
Packit |
3ff1e7 |
@sa @ref select_stream
|
|
Packit |
3ff1e7 |
*/
|