libquvi
Parsing media properties

libquvi uses a m_script to parse the media properties for a Media URL. You should make a note of the difference of Media property and Media stream property. There may be >1 of the latter. See the next section (Media stream properties below) for an example of handling those.

Note
The available m_script collection determines which websites are supported by the library.

These examples use an abort_if_error function which could do nothing more than check quvi_ok return value and exit if the function returned QUVI_FALSE. We do not define this function in these examples.

abort_if_error();
{
char *m_title, *m_url;
quvi_media_get(qm, QUVI_MEDIA_PROPERTY_TITLE, &m_title);
quvi_media_get(qm, QUVI_MEDIA_STREAM_PROPERTY_URL, &m_url);
}
quvi_media_free(qm); /* Release when done using it. */
qm = NULL;
See Also
QuviMediaProperty

Media stream properties

There may be >1 Media stream available. These may be accessed using the quvi_media_stream_* function set. The one exception to this is the quvi_media_get function which is used to query the values from the library.

Note
Using any of the QUVI_MEDIA_STREAM_PROPERTY_* values with quvi_media_get will cause the library to advance to the first media stream in the list. This will make quvi_media_stream_next function to continue from the second media stream, not the first one as one might expect.

For example:

abort_if_error();
{
char *m_title, *m_url;
quvi_media_get(qm, QUVI_MEDIA_PROPERTY_TITLE, &m_title);
/* Advances the media stream list, starting from the first. */
quvi_media_get(qm, QUVI_MEDIA_STREAM_PROPERTY_URL, &m_url);
/* Would now continue from second stream in the list. */
while (quvi_media_stream_next(qm) == QUVI_TRUE)
quvi_media_get(qm, QUVI_MEDIA_STREAM_PROPERTY_URL, &m_url);
}

Where as:

abort_if_error();
{
char *m_title, *m_url;
quvi_media_get(qm, QUVI_MEDIA_PROPERTY_TITLE, &m_title);
/* Would start from the first stream in the list. */
while (quvi_media_stream_next(qm) == QUVI_TRUE)
quvi_media_get(qm, QUVI_MEDIA_STREAM_PROPERTY_URL, &m_url);
}

Alternatively, call quvi_media_stream_reset after the quvi_media_get call.

See Also
Selecting a media stream