Unverified Commit 145c7352 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Making it possible to add a full comment string

parent 2da7ce40
......@@ -106,7 +106,7 @@ typedef struct OggOpusComments OggOpusComments;
typedef struct OggOpusEnc OggOpusEnc;
/** Create a new comments object. */
OPE_EXPORT OggOpusComments *ope_comments_create();
OPE_EXPORT OggOpusComments *ope_comments_create(void);
/** Create a deep copy of a comments object. */
OPE_EXPORT OggOpusComments *ope_comments_copy(OggOpusComments *comments);
......@@ -117,6 +117,9 @@ OPE_EXPORT void ope_comments_destroy(OggOpusComments *comments);
/** Add a comment. */
OPE_EXPORT int ope_comments_add(OggOpusComments *comments, const char *tag, const char *val);
/** Add a comment. */
OPE_EXPORT int ope_comments_add_string(OggOpusComments *comments, const char *tag_and_val);
/** Add a picture. */
OPE_EXPORT int ope_comments_add_picture(OggOpusComments *comments, const char *spec);
......
......@@ -119,10 +119,19 @@ void ope_comments_destroy(OggOpusComments *comments){
/* Add a comment. */
int ope_comments_add(OggOpusComments *comments, const char *tag, const char *val) {
if (tag == NULL || val == NULL) return OPE_BAD_ARG;
if (strchr(tag, '=')) return OPE_BAD_ARG;
if (comment_add(&comments->comment, &comments->comment_length, tag, val)) return OPE_ALLOC_FAIL;
return OPE_OK;
}
/* Add a comment. */
int ope_comments_add_string(OggOpusComments *comments, const char *tag_and_val) {
if (!strchr(tag_and_val, '=')) return OPE_BAD_ARG;
if (comment_add(&comments->comment, &comments->comment_length, tag_and_val, NULL)) return OPE_ALLOC_FAIL;
return OPE_OK;
}
int ope_comments_add_picture(OggOpusComments *comments, const char *spec) {
const char *error_message;
char *picture_data;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment