1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3
<title>libfishsound: comments.h File Reference</title>
4
<link href="doxygen.css" rel="stylesheet" type="text/css">
6
<!-- Generated by Doxygen 1.3.5 -->
7
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
8
<h1>comments.h File Reference</h1>Encoding and decoding of comments.
9
<a href="#_details">More...</a>
11
<code>#include <<a class="el" href="fishsound_8h-source.html">fishsound/fishsound.h</a>></code><br>
14
<a href="comments_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
16
<tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
17
<tr><td class="memItemLeft" nowrap align=right valign=top>struct </td><td class="memItemRight" valign=bottom><a class="el" href="structFishSoundComment.html">FishSoundComment</a></td></tr>
19
<tr><td class="mdescLeft"> </td><td class="mdescRight">A comment. </em> <a href="structFishSoundComment.html#_details">More...</a><em><br><br></td></tr>
20
<tr><td colspan=2><br><h2>Functions</h2></td></tr>
21
<tr><td class="memItemLeft" nowrap align=right valign=top>const char * </td><td class="memItemRight" valign=bottom><a class="el" href="comments_8h.html#a0">fish_sound_comment_get_vendor</a> (<a class="el" href="fishsound_8h.html#a0">FishSound</a> *fsound)</td></tr>
23
<tr><td class="mdescLeft"> </td><td class="mdescRight">Retrieve the vendor string. <a href="#a0"></a><br><br></td></tr>
24
<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="structFishSoundComment.html">FishSoundComment</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="comments_8h.html#a1">fish_sound_comment_first</a> (<a class="el" href="fishsound_8h.html#a0">FishSound</a> *fsound)</td></tr>
26
<tr><td class="mdescLeft"> </td><td class="mdescRight">Retrieve the first comment. <a href="#a1"></a><br><br></td></tr>
27
<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="structFishSoundComment.html">FishSoundComment</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="comments_8h.html#a2">fish_sound_comment_next</a> (<a class="el" href="fishsound_8h.html#a0">FishSound</a> *fsound, const <a class="el" href="structFishSoundComment.html">FishSoundComment</a> *comment)</td></tr>
29
<tr><td class="mdescLeft"> </td><td class="mdescRight">Retrieve the next comment. <a href="#a2"></a><br><br></td></tr>
30
<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="structFishSoundComment.html">FishSoundComment</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="comments_8h.html#a3">fish_sound_comment_first_byname</a> (<a class="el" href="fishsound_8h.html#a0">FishSound</a> *fsound, char *name)</td></tr>
32
<tr><td class="mdescLeft"> </td><td class="mdescRight">Retrieve the first comment with a given name. <a href="#a3"></a><br><br></td></tr>
33
<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="structFishSoundComment.html">FishSoundComment</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="comments_8h.html#a4">fish_sound_comment_next_byname</a> (<a class="el" href="fishsound_8h.html#a0">FishSound</a> *fsound, const <a class="el" href="structFishSoundComment.html">FishSoundComment</a> *comment)</td></tr>
35
<tr><td class="mdescLeft"> </td><td class="mdescRight">Retrieve the next comment following and with the same name as a given comment. <a href="#a4"></a><br><br></td></tr>
36
<tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="comments_8h.html#a5">fish_sound_comment_add</a> (<a class="el" href="fishsound_8h.html#a0">FishSound</a> *fsound, <a class="el" href="structFishSoundComment.html">FishSoundComment</a> *comment)</td></tr>
38
<tr><td class="mdescLeft"> </td><td class="mdescRight">Add a comment. <a href="#a5"></a><br><br></td></tr>
39
<tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="comments_8h.html#a6">fish_sound_comment_add_byname</a> (<a class="el" href="fishsound_8h.html#a0">FishSound</a> *fsound, const char *name, const char *value)</td></tr>
41
<tr><td class="mdescLeft"> </td><td class="mdescRight">Add a comment by name and value. <a href="#a6"></a><br><br></td></tr>
42
<tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="comments_8h.html#a7">fish_sound_comment_remove</a> (<a class="el" href="fishsound_8h.html#a0">FishSound</a> *fsound, <a class="el" href="structFishSoundComment.html">FishSoundComment</a> *comment)</td></tr>
44
<tr><td class="mdescLeft"> </td><td class="mdescRight">Remove a comment. <a href="#a7"></a><br><br></td></tr>
45
<tr><td class="memItemLeft" nowrap align=right valign=top>int </td><td class="memItemRight" valign=bottom><a class="el" href="comments_8h.html#a8">fish_sound_comment_remove_byname</a> (<a class="el" href="fishsound_8h.html#a0">FishSound</a> *fsound, char *name)</td></tr>
47
<tr><td class="mdescLeft"> </td><td class="mdescRight">Remove all comments with a given name. <a href="#a8"></a><br><br></td></tr>
49
<hr><a name="_details"></a><h2>Detailed Description</h2>
50
Encoding and decoding of comments.
52
Vorbis and Speex bitstreams use a comment format called "Vorbiscomment", defined <a href="http://www.xiph.org/ogg/vorbis/doc/v-comment.html">here</a>. Many standard comment names (such as TITLE, COPYRIGHT and GENRE) are defined in that document.<p>
53
The following general features of Vorbiscomment are relevant to this API:<ul>
54
<li>Each stream has one comment packet, which occurs before any encoded audio data in the stream.</li><li>When encoding, FishSound will generate the comment block and pass it to the encoded() callback in sequence, just like any other packet. Hence, all comments must be set before any call to <a class="el" href="fishsound_8h.html#a8">fish_sound_encode()</a>.</li><li>When decoding, FishSound will decode the comment block before calling the first decoded() callback. Hence, retrieving comment data is possible from as soon as the decoded() callback is first called.</li></ul>
56
Each comment block contains one Vendor string, which can be retrieved with <a class="el" href="comments_8h.html#a0">fish_sound_comment_get_vendor()</a>. When encoding, this string is effectively fixed by the codec libraries; it cannot be set by the application.<p>
57
The rest of a comment block consists of <em>name</em> = <em>value</em> pairs, with the following restrictions:<ul>
58
<li>Both the <em>name</em> and <em>value</em> must be non-empty</li><li>The <em>name</em> is case-insensitive and must consist of ASCII within the range 0x20 to 0x7D inclusive, 0x3D ('=') excluded.</li><li>The <em>name</em> is not unique; multiple entries may exist with equivalent <em>name</em> within a Vorbiscomment block.</li><li>The <em>value</em> may be any UTF-8 string.</li></ul>
59
<h2><a class="anchor" name="comments_get">
60
Retrieving comments</a></h2>
61
FishSound contains API methods to iterate through all comments associated with a FishSound* handle (<a class="el" href="comments_8h.html#a1">fish_sound_comment_first()</a> and <a class="el" href="comments_8h.html#a2">fish_sound_comment_next()</a>, and to iterate through comments matching a particular name (<a class="el" href="comments_8h.html#a3">fish_sound_comment_first_byname()</a> and <a class="el" href="comments_8h.html#a4">fish_sound_comment_next_byname()</a>). Given that multiple comments may exist with the same <em>name</em>, you should not use <a class="el" href="comments_8h.html#a3">fish_sound_comment_first_byname()</a> as a simple "get" function.<h2><a class="anchor" name="comments_set">
62
Encoding comments</a></h2>
63
For encoding, FishSound contains API methods for adding comments (<a class="el" href="comments_8h.html#a5">fish_sound_comment_add()</a> and <a class="el" href="comments_8h.html#a6">fish_sound_comment_add_byname()</a> and for removing comments (<a class="el" href="comments_8h.html#a7">fish_sound_comment_remove()</a> and <a class="el" href="comments_8h.html#a8">fish_sound_comment_remove_byname()</a>).<hr><h2>Function Documentation</h2>
64
<a class="anchor" name="a5" doxytag="comments.h::fish_sound_comment_add" ></a><p>
65
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
68
<table cellpadding="0" cellspacing="0" border="0">
70
<td class="md" nowrap valign="top"> int fish_sound_comment_add </td>
71
<td class="md" valign="top">( </td>
72
<td class="md" nowrap valign="top"><a class="el" href="fishsound_8h.html#a0">FishSound</a> * </td>
73
<td class="mdname" nowrap> <em>fsound</em>, </td>
78
<td class="md" nowrap><a class="el" href="structFishSoundComment.html">FishSoundComment</a> * </td>
79
<td class="mdname" nowrap> <em>comment</em></td>
83
<td class="md">) </td>
84
<td class="md" colspan="2"></td>
91
<table cellspacing=5 cellpadding=0 border=0>
101
<dl compact><dt><b>Parameters:</b></dt><dd>
102
<table border="0" cellspacing="2" cellpadding="0">
103
<tr><td valign=top><em>fsound</em> </td><td>A FishSound* handle (created with mode FISH_SOUND_ENCODE) </td></tr>
104
<tr><td valign=top><em>comment</em> </td><td>The comment to add </td></tr>
107
<dl compact><dt><b>Return values:</b></dt><dd>
108
<table border="0" cellspacing="2" cellpadding="0">
109
<tr><td valign=top><em>0</em> </td><td>Success </td></tr>
110
<tr><td valign=top><em>FISH_SOUND_ERR_BAD</em> </td><td><em>fsound</em> is not a valid FishSound* handle </td></tr>
111
<tr><td valign=top><em>FISH_SOUND_ERR_INVALID</em> </td><td>Operation not suitable for this FishSound </td></tr>
117
<a class="anchor" name="a6" doxytag="comments.h::fish_sound_comment_add_byname" ></a><p>
118
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
121
<table cellpadding="0" cellspacing="0" border="0">
123
<td class="md" nowrap valign="top"> int fish_sound_comment_add_byname </td>
124
<td class="md" valign="top">( </td>
125
<td class="md" nowrap valign="top"><a class="el" href="fishsound_8h.html#a0">FishSound</a> * </td>
126
<td class="mdname" nowrap> <em>fsound</em>, </td>
131
<td class="md" nowrap>const char * </td>
132
<td class="mdname" nowrap> <em>name</em>, </td>
137
<td class="md" nowrap>const char * </td>
138
<td class="mdname" nowrap> <em>value</em></td>
142
<td class="md">) </td>
143
<td class="md" colspan="2"></td>
150
<table cellspacing=5 cellpadding=0 border=0>
158
Add a comment by name and value.
160
<dl compact><dt><b>Parameters:</b></dt><dd>
161
<table border="0" cellspacing="2" cellpadding="0">
162
<tr><td valign=top><em>fsound</em> </td><td>A FishSound* handle (created with mode FISH_SOUND_ENCODE) </td></tr>
163
<tr><td valign=top><em>name</em> </td><td>The name of the comment to add </td></tr>
164
<tr><td valign=top><em>value</em> </td><td>The contents of the comment to add </td></tr>
167
<dl compact><dt><b>Return values:</b></dt><dd>
168
<table border="0" cellspacing="2" cellpadding="0">
169
<tr><td valign=top><em>0</em> </td><td>Success </td></tr>
170
<tr><td valign=top><em>FISH_SOUND_ERR_BAD</em> </td><td><em>fsound</em> is not a valid FishSound* handle </td></tr>
171
<tr><td valign=top><em>FISH_SOUND_ERR_INVALID</em> </td><td>Operation not suitable for this FishSound </td></tr>
177
<a class="anchor" name="a1" doxytag="comments.h::fish_sound_comment_first" ></a><p>
178
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
181
<table cellpadding="0" cellspacing="0" border="0">
183
<td class="md" nowrap valign="top"> const <a class="el" href="structFishSoundComment.html">FishSoundComment</a>* fish_sound_comment_first </td>
184
<td class="md" valign="top">( </td>
185
<td class="md" nowrap valign="top"><a class="el" href="fishsound_8h.html#a0">FishSound</a> * </td>
186
<td class="mdname1" valign="top" nowrap> <em>fsound</em> </td>
187
<td class="md" valign="top"> ) </td>
188
<td class="md" nowrap></td>
195
<table cellspacing=5 cellpadding=0 border=0>
203
Retrieve the first comment.
205
<dl compact><dt><b>Parameters:</b></dt><dd>
206
<table border="0" cellspacing="2" cellpadding="0">
207
<tr><td valign=top><em>fsound</em> </td><td>A FishSound* handle </td></tr>
210
<dl compact><dt><b>Returns:</b></dt><dd>A read-only copy of the first comment, or NULL if no comments exist for this FishSound* object. </dd></dl>
214
<a class="anchor" name="a3" doxytag="comments.h::fish_sound_comment_first_byname" ></a><p>
215
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
218
<table cellpadding="0" cellspacing="0" border="0">
220
<td class="md" nowrap valign="top"> const <a class="el" href="structFishSoundComment.html">FishSoundComment</a>* fish_sound_comment_first_byname </td>
221
<td class="md" valign="top">( </td>
222
<td class="md" nowrap valign="top"><a class="el" href="fishsound_8h.html#a0">FishSound</a> * </td>
223
<td class="mdname" nowrap> <em>fsound</em>, </td>
228
<td class="md" nowrap>char * </td>
229
<td class="mdname" nowrap> <em>name</em></td>
233
<td class="md">) </td>
234
<td class="md" colspan="2"></td>
241
<table cellspacing=5 cellpadding=0 border=0>
249
Retrieve the first comment with a given name.
251
<dl compact><dt><b>Parameters:</b></dt><dd>
252
<table border="0" cellspacing="2" cellpadding="0">
253
<tr><td valign=top><em>fsound</em> </td><td>A FishSound* handle </td></tr>
254
<tr><td valign=top><em>name</em> </td><td>the name of the comment to retrieve. </td></tr>
257
<dl compact><dt><b>Returns:</b></dt><dd>A read-only copy of the first comment matching the given <em>name</em>. </dd></dl>
258
<dl compact><dt><b>Return values:</b></dt><dd>
259
<table border="0" cellspacing="2" cellpadding="0">
260
<tr><td valign=top><em>NULL</em> </td><td>no match was found. </td></tr>
263
<dl compact><dt><b>Note:</b></dt><dd>If <em>name</em> is NULL, the behaviour is the same as for <a class="el" href="comments_8h.html#a1">fish_sound_comment_first()</a> </dd></dl>
267
<a class="anchor" name="a0" doxytag="comments.h::fish_sound_comment_get_vendor" ></a><p>
268
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
271
<table cellpadding="0" cellspacing="0" border="0">
273
<td class="md" nowrap valign="top"> const char* fish_sound_comment_get_vendor </td>
274
<td class="md" valign="top">( </td>
275
<td class="md" nowrap valign="top"><a class="el" href="fishsound_8h.html#a0">FishSound</a> * </td>
276
<td class="mdname1" valign="top" nowrap> <em>fsound</em> </td>
277
<td class="md" valign="top"> ) </td>
278
<td class="md" nowrap></td>
285
<table cellspacing=5 cellpadding=0 border=0>
293
Retrieve the vendor string.
295
<dl compact><dt><b>Parameters:</b></dt><dd>
296
<table border="0" cellspacing="2" cellpadding="0">
297
<tr><td valign=top><em>fsound</em> </td><td>A FishSound* handle </td></tr>
300
<dl compact><dt><b>Returns:</b></dt><dd>A read-only copy of the vendor string </dd></dl>
301
<dl compact><dt><b>Return values:</b></dt><dd>
302
<table border="0" cellspacing="2" cellpadding="0">
303
<tr><td valign=top><em>NULL</em> </td><td>No vendor string is associated with <em>fsound</em>, or <em>fsound</em> is NULL. </td></tr>
309
<a class="anchor" name="a2" doxytag="comments.h::fish_sound_comment_next" ></a><p>
310
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
313
<table cellpadding="0" cellspacing="0" border="0">
315
<td class="md" nowrap valign="top"> const <a class="el" href="structFishSoundComment.html">FishSoundComment</a>* fish_sound_comment_next </td>
316
<td class="md" valign="top">( </td>
317
<td class="md" nowrap valign="top"><a class="el" href="fishsound_8h.html#a0">FishSound</a> * </td>
318
<td class="mdname" nowrap> <em>fsound</em>, </td>
323
<td class="md" nowrap>const <a class="el" href="structFishSoundComment.html">FishSoundComment</a> * </td>
324
<td class="mdname" nowrap> <em>comment</em></td>
328
<td class="md">) </td>
329
<td class="md" colspan="2"></td>
336
<table cellspacing=5 cellpadding=0 border=0>
344
Retrieve the next comment.
346
<dl compact><dt><b>Parameters:</b></dt><dd>
347
<table border="0" cellspacing="2" cellpadding="0">
348
<tr><td valign=top><em>fsound</em> </td><td>A FishSound* handle </td></tr>
349
<tr><td valign=top><em>comment</em> </td><td>The previous comment. </td></tr>
352
<dl compact><dt><b>Returns:</b></dt><dd>A read-only copy of the comment immediately following the given comment. </dd></dl>
356
<a class="anchor" name="a4" doxytag="comments.h::fish_sound_comment_next_byname" ></a><p>
357
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
360
<table cellpadding="0" cellspacing="0" border="0">
362
<td class="md" nowrap valign="top"> const <a class="el" href="structFishSoundComment.html">FishSoundComment</a>* fish_sound_comment_next_byname </td>
363
<td class="md" valign="top">( </td>
364
<td class="md" nowrap valign="top"><a class="el" href="fishsound_8h.html#a0">FishSound</a> * </td>
365
<td class="mdname" nowrap> <em>fsound</em>, </td>
370
<td class="md" nowrap>const <a class="el" href="structFishSoundComment.html">FishSoundComment</a> * </td>
371
<td class="mdname" nowrap> <em>comment</em></td>
375
<td class="md">) </td>
376
<td class="md" colspan="2"></td>
383
<table cellspacing=5 cellpadding=0 border=0>
391
Retrieve the next comment following and with the same name as a given comment.
393
<dl compact><dt><b>Parameters:</b></dt><dd>
394
<table border="0" cellspacing="2" cellpadding="0">
395
<tr><td valign=top><em>fsound</em> </td><td>A FishSound* handle </td></tr>
396
<tr><td valign=top><em>comment</em> </td><td>A comment </td></tr>
399
<dl compact><dt><b>Returns:</b></dt><dd>A read-only copy of the next comment with the same name as <em>comment</em>. </dd></dl>
400
<dl compact><dt><b>Return values:</b></dt><dd>
401
<table border="0" cellspacing="2" cellpadding="0">
402
<tr><td valign=top><em>NULL</em> </td><td>no further comments with the same name exist for this FishSound* object. </td></tr>
408
<a class="anchor" name="a7" doxytag="comments.h::fish_sound_comment_remove" ></a><p>
409
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
412
<table cellpadding="0" cellspacing="0" border="0">
414
<td class="md" nowrap valign="top"> int fish_sound_comment_remove </td>
415
<td class="md" valign="top">( </td>
416
<td class="md" nowrap valign="top"><a class="el" href="fishsound_8h.html#a0">FishSound</a> * </td>
417
<td class="mdname" nowrap> <em>fsound</em>, </td>
422
<td class="md" nowrap><a class="el" href="structFishSoundComment.html">FishSoundComment</a> * </td>
423
<td class="mdname" nowrap> <em>comment</em></td>
427
<td class="md">) </td>
428
<td class="md" colspan="2"></td>
435
<table cellspacing=5 cellpadding=0 border=0>
445
<dl compact><dt><b>Parameters:</b></dt><dd>
446
<table border="0" cellspacing="2" cellpadding="0">
447
<tr><td valign=top><em>fsound</em> </td><td>A FishSound* handle (created with FISH_SOUND_ENCODE) </td></tr>
448
<tr><td valign=top><em>comment</em> </td><td>The comment to remove. </td></tr>
451
<dl compact><dt><b>Return values:</b></dt><dd>
452
<table border="0" cellspacing="2" cellpadding="0">
453
<tr><td valign=top><em>1</em> </td><td>Success: comment removed </td></tr>
454
<tr><td valign=top><em>0</em> </td><td>No-op: comment not found, nothing to remove </td></tr>
455
<tr><td valign=top><em>FISH_SOUND_ERR_BAD</em> </td><td><em>fsound</em> is not a valid FishSound* handle </td></tr>
456
<tr><td valign=top><em>FISH_SOUND_ERR_INVALID</em> </td><td>Operation not suitable for this FishSound </td></tr>
462
<a class="anchor" name="a8" doxytag="comments.h::fish_sound_comment_remove_byname" ></a><p>
463
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
466
<table cellpadding="0" cellspacing="0" border="0">
468
<td class="md" nowrap valign="top"> int fish_sound_comment_remove_byname </td>
469
<td class="md" valign="top">( </td>
470
<td class="md" nowrap valign="top"><a class="el" href="fishsound_8h.html#a0">FishSound</a> * </td>
471
<td class="mdname" nowrap> <em>fsound</em>, </td>
476
<td class="md" nowrap>char * </td>
477
<td class="mdname" nowrap> <em>name</em></td>
481
<td class="md">) </td>
482
<td class="md" colspan="2"></td>
489
<table cellspacing=5 cellpadding=0 border=0>
497
Remove all comments with a given name.
499
<dl compact><dt><b>Parameters:</b></dt><dd>
500
<table border="0" cellspacing="2" cellpadding="0">
501
<tr><td valign=top><em>fsound</em> </td><td>A FishSound* handle (created with FISH_SOUND_ENCODE) </td></tr>
502
<tr><td valign=top><em>name</em> </td><td>The name of the comments to remove </td></tr>
505
<dl compact><dt><b>Return values:</b></dt><dd>
506
<table border="0" cellspacing="2" cellpadding="0">
507
<tr><td valign=top><em>>= 0</em> </td><td>The number of comments removed </td></tr>
508
<tr><td valign=top><em>FISH_SOUND_ERR_BAD</em> </td><td><em>fsound</em> is not a valid FishSound* handle </td></tr>
509
<tr><td valign=top><em>FISH_SOUND_ERR_INVALID</em> </td><td>Operation not suitable for this FishSound </td></tr>
515
<hr size="1"><address style="align: right;"><small>Generated on Thu Jun 24 18:46:04 2004 for libfishsound by
516
<a href="http://www.doxygen.org/index.html">
517
<img src="doxygen.png" alt="doxygen" align="middle" border=0 >
518
</a>1.3.5 </small></address>