Logo Search packages:      
Sourcecode: libtheora version File versions  Download package

char* theora_comment_query ( theora_comment tc,
char *  tag,
int  count 

Look up a comment value by tag.

tc Tn initialized theora_comment structure
tag The tag to look up
count The instance of the tag. The same tag can appear multiple times, each with a distinct and ordered value, so an index is required to retrieve them all.
A pointer to the queried tag's value
Return values:
NULL No matching tag is found
Use theora_comment_query_count() to get the legal range for the count parameter.

Definition at line 60 of file comment.c.

References theora_comment::comments, theora_comment_query(), and theora_comment::user_comments.

Referenced by theora_comment_query().

  long i;
  int found = 0;
  int taglen = strlen(tag)+1; /* +1 for the = we append */
  char *fulltag = _ogg_malloc(taglen+ 1);

  strcpy(fulltag, tag);
  strcat(fulltag, "=");

    if(!tagcompare(tc->user_comments[i], fulltag, taglen)){
      if(count == found){
        /* We return a pointer to the data, not a copy */
        return tc->user_comments[i] + taglen;
  return NULL; /* didn't find anything */

Generated by  Doxygen 1.6.0   Back to index