liboggz
1.1.1
|
Reading of comments. More...
#include <oggz/oggz.h>
Go to the source code of this file.
Data Structures | |
struct | OggzComment |
A comment. More... | |
Functions | |
const char * | oggz_comment_get_vendor (OGGZ *oggz, long serialno) |
Retrieve the vendor string. More... | |
int | oggz_comment_set_vendor (OGGZ *oggz, long serialno, const char *vendor_string) |
Set the vendor string. More... | |
const OggzComment * | oggz_comment_first (OGGZ *oggz, long serialno) |
Retrieve the first comment. More... | |
const OggzComment * | oggz_comment_next (OGGZ *oggz, long serialno, const OggzComment *comment) |
Retrieve the next comment. More... | |
const OggzComment * | oggz_comment_first_byname (OGGZ *oggz, long serialno, char *name) |
Retrieve the first comment with a given name. More... | |
const OggzComment * | oggz_comment_next_byname (OGGZ *oggz, long serialno, const OggzComment *comment) |
Retrieve the next comment following and with the same name as a given comment. More... | |
int | oggz_comment_add (OGGZ *oggz, long serialno, OggzComment *comment) |
Add a comment. More... | |
int | oggz_comment_add_byname (OGGZ *oggz, long serialno, const char *name, const char *value) |
Add a comment by name and value. More... | |
int | oggz_comment_remove (OGGZ *oggz, long serialno, OggzComment *comment) |
Remove a comment. More... | |
int | oggz_comment_remove_byname (OGGZ *oggz, long serialno, char *name) |
Remove all comments with a given name. More... | |
ogg_packet * | oggz_comments_generate (OGGZ *oggz, long serialno, int FLAC_final_metadata_block) |
Output a comment packet for the specified stream. More... | |
int | oggz_comments_copy (OGGZ *src, long src_serialno, OGGZ *dest, long dest_serialno) |
void | oggz_packet_destroy (ogg_packet *packet) |
Free a packet and its payload. More... | |
Reading of comments.
Vorbis, Speex and Theora bitstreams use a comment format called "Vorbiscomment", defined here. Many standard comment names (such as TITLE, COPYRIGHT and GENRE) are defined in that document.
The following general features of Vorbiscomment are relevant to this API:
Each comment block contains one Vendor string, which can be retrieved with oggz_comment_get_vendor().
The rest of a comment block consists of name = value pairs, with the following restrictions:
Oggz contains API methods to iterate through all comments associated with the logical bitstreams of an OGGZ* handle (oggz_comment_first() and oggz_comment_next(), and to iterate through comments matching a particular name (oggz_comment_first_byname() and oggz_comment_next_byname()). Given that multiple comments may exist with the same name, you should not use oggz_comment_first_byname() as a simple "get" function.
For writing, Oggz contains API methods for adding comments (oggz_comment_add() and oggz_comment_add_byname()), for removing comments (oggz_comment_remove() and oggz_comment_remove_byname()) and for setting the vendor string (oggz_comment_set_vendor()).
int oggz_comment_add | ( | OGGZ * | oggz, |
long | serialno, | ||
OggzComment * | comment | ||
) |
Add a comment.
oggz | A OGGZ* handle (created with mode OGGZ_WRITE) |
serialno | Identify a logical bitstream within oggz |
comment | The comment to add |
0 | Success |
OGGZ_ERR_BAD | oggz is not a valid OGGZ* handle |
OGGZ_ERR_INVALID | Operation not suitable for this OGGZ |
OGGZ_ERR_OUT_OF_MEMORY | Out of memory |
int oggz_comment_add_byname | ( | OGGZ * | oggz, |
long | serialno, | ||
const char * | name, | ||
const char * | value | ||
) |
Add a comment by name and value.
oggz | A OGGZ* handle (created with mode OGGZ_WRITE) |
serialno | Identify a logical bitstream within oggz |
name | The name of the comment to add |
value | The contents of the comment to add |
0 | Success |
OGGZ_ERR_BAD | oggz is not a valid OGGZ* handle |
OGGZ_ERR_INVALID | Operation not suitable for this OGGZ |
OGGZ_ERR_OUT_OF_MEMORY | Out of memory |
const OggzComment* oggz_comment_first | ( | OGGZ * | oggz, |
long | serialno | ||
) |
Retrieve the first comment.
oggz | A OGGZ* handle |
serialno | Identify a logical bitstream within oggz |
NULL | No comments exist for this OGGZ* object, or serialno does not identify an existing logical bitstream in oggz. |
const OggzComment* oggz_comment_first_byname | ( | OGGZ * | oggz, |
long | serialno, | ||
char * | name | ||
) |
Retrieve the first comment with a given name.
oggz | A OGGZ* handle |
serialno | Identify a logical bitstream within oggz |
name | the name of the comment to retrieve. |
NULL | No match was found, or serialno does not identify an existing logical bitstream in oggz. |
const char* oggz_comment_get_vendor | ( | OGGZ * | oggz, |
long | serialno | ||
) |
Retrieve the vendor string.
oggz | A OGGZ* handle |
serialno | Identify a logical bitstream within oggz |
NULL | No vendor string is associated with oggz, or oggz is NULL, or serialno does not identify an existing logical bitstream in oggz. |
const OggzComment* oggz_comment_next | ( | OGGZ * | oggz, |
long | serialno, | ||
const OggzComment * | comment | ||
) |
Retrieve the next comment.
oggz | A OGGZ* handle |
serialno | Identify a logical bitstream within oggz |
comment | The previous comment. |
NULL | serialno does not identify an existing logical bitstream in oggz. |
const OggzComment* oggz_comment_next_byname | ( | OGGZ * | oggz, |
long | serialno, | ||
const OggzComment * | comment | ||
) |
Retrieve the next comment following and with the same name as a given comment.
oggz | A OGGZ* handle |
serialno | Identify a logical bitstream within oggz |
comment | A comment |
NULL | No further comments with the same name exist for this OGGZ* object, or serialno does not identify an existing logical bitstream in oggz. |
int oggz_comment_remove | ( | OGGZ * | oggz, |
long | serialno, | ||
OggzComment * | comment | ||
) |
Remove a comment.
oggz | A OGGZ* handle (created with OGGZ_WRITE) |
serialno | Identify a logical bitstream within oggz |
comment | The comment to remove. |
1 | Success: comment removed |
0 | No-op: comment not found, nothing to remove |
OGGZ_ERR_BAD | oggz is not a valid OGGZ* handle |
OGGZ_ERR_INVALID | Operation not suitable for this OGGZ |
OGGZ_ERR_BAD_SERIALNO | serialno does not identify an existing logical bitstream in oggz. |
int oggz_comment_remove_byname | ( | OGGZ * | oggz, |
long | serialno, | ||
char * | name | ||
) |
Remove all comments with a given name.
oggz | A OGGZ* handle (created with OGGZ_WRITE) |
serialno | Identify a logical bitstream within oggz |
name | The name of the comments to remove |
>= 0 | The number of comments removed |
OGGZ_ERR_BAD | oggz is not a valid OGGZ* handle |
OGGZ_ERR_INVALID | Operation not suitable for this OGGZ |
OGGZ_ERR_BAD_SERIALNO | serialno does not identify an existing logical bitstream in oggz. |
int oggz_comment_set_vendor | ( | OGGZ * | oggz, |
long | serialno, | ||
const char * | vendor_string | ||
) |
Set the vendor string.
oggz | A OGGZ* handle |
serialno | Identify a logical bitstream within oggz |
vendor_string | The contents of the vendor string to add |
0 | Success |
OGGZ_ERR_BAD | oggz is not a valid OGGZ* handle |
OGGZ_ERR_INVALID | Operation not suitable for this OGGZ |
OGGZ_ERR_OUT_OF_MEMORY | Out of memory |
ogg_packet* oggz_comments_generate | ( | OGGZ * | oggz, |
long | serialno, | ||
int | FLAC_final_metadata_block | ||
) |
Output a comment packet for the specified stream.
oggz | A OGGZ* handle (created with OGGZ_WRITE) |
serialno | Identify a logical bitstream within oggz |
FLAC_final_metadata_block | Set this to zero unless the packet_type is FLAC, and there are no further metadata blocks to follow. See note below for details. |
NULL | content type does not support comments, not enough memory or comment was too long for FLAC |
void oggz_packet_destroy | ( | ogg_packet * | packet | ) |
Free a packet and its payload.
packet | A packet previously returned from a function such as oggz_comment_generate(). User generated packets should not be passed. |