Changeset 3365

Show
Ignore:
Timestamp:
2008-01-20 17:36:51 (11 months ago)
Author:
conrad
Message:

add private oggz_auto_identify_packet() function, and use it in
oggz_write_feed() when a bos page is encountered. This sets the content type
for writing, so that oggz can know how to structure comment packets etc.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • liboggz/trunk/src/examples/modify-headers.c

    r3363 r3365  
    9595                             "EDITOR", "modify-headers"); 
    9696    op = oggz_comment_generate (mhdata->writer, serialno, 
    97                                 oggz_stream_get_content (mhdata->reader, serialno), 
     97                                oggz_stream_get_content (mhdata->writer, serialno), 
    9898                                0); 
    9999  } 
  • liboggz/trunk/src/liboggz/oggz_auto.c

    r3364 r3365  
    893893};  
    894894 
    895 int 
    896 oggz_auto_identify_page (OGGZ *oggz, ogg_page *og, long serialno
     895static int 
     896oggz_auto_identify (OGGZ * oggz, long serialno, unsigned char * data, long len
    897897{ 
    898898  int i; 
     
    902902    const oggz_auto_contenttype_t *codec = oggz_auto_codec_ident + i; 
    903903     
    904     if (og->body_len >= codec->bos_str_len && 
    905               memcmp (og->body, codec->bos_str, codec->bos_str_len) == 0) { 
     904    if (len >= codec->bos_str_len && 
     905        memcmp (data, codec->bos_str, codec->bos_str_len) == 0) { 
    906906       
    907907      oggz_stream_set_content (oggz, serialno, i); 
     
    913913  oggz_stream_set_content (oggz, serialno, OGGZ_CONTENT_UNKNOWN); 
    914914  return 0; 
     915} 
     916 
     917int 
     918oggz_auto_identify_page (OGGZ * oggz, ogg_page *og, long serialno) 
     919{ 
     920  return oggz_auto_identify (oggz, serialno, og->body, og->body_len); 
     921} 
     922 
     923int 
     924oggz_auto_identify_packet (OGGZ * oggz, ogg_packet * op, long serialno) 
     925{ 
     926  return oggz_auto_identify (oggz, serialno, op->packet, op->bytes); 
    915927} 
    916928 
  • liboggz/trunk/src/liboggz/oggz_private.h

    r3364 r3365  
    292292 
    293293int oggz_auto_identify_page (OGGZ *oggz, ogg_page *og, long serialno); 
     294int oggz_auto_identify_packet (OGGZ * oggz, ogg_packet * op, long serialno); 
    294295 
    295296/* comments */ 
  • liboggz/trunk/src/liboggz/oggz_write.c

    r3324 r3365  
    248248    if (b_o_s || !strict || suffix) { 
    249249      stream = oggz_add_stream (oggz, serialno); 
     250      oggz_auto_identify_packet (oggz, op, serialno); 
    250251    } else { 
    251252      return OGGZ_ERR_BAD_SERIALNO;