Changeset 710

Show
Ignore:
Timestamp:
2005-01-23 18:02:50 (4 years ago)
Author:
conrad
Message:

add oggz_stream.c, basic stream identification and fishead/fisbone consistency
checking

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • liboggz/trunk/src/liboggz/Makefile.am

    r403 r710  
    1616        oggz_read.c oggz_write.c \ 
    1717        oggz_auto.c oggz_auto.h \ 
     18        oggz_stream.c oggz_stream.h \ 
    1819        oggz_table.c \ 
    1920        oggz_vector.c oggz_vector.h 
  • liboggz/trunk/src/liboggz/oggz.c

    r709 r710  
    260260 
    261261  ogg_stream_init (&stream->ogg_stream, (int)serialno); 
     262 
     263  stream->content = OGGZ_CONTENT_UNKNOWN; 
    262264 
    263265  stream->delivered_non_b_o_s = 0; 
  • liboggz/trunk/src/liboggz/oggz_auto.c

    r709 r710  
    278278} 
    279279 
    280 #if 0 
    281280static int 
    282281auto_fishead (OGGZ * oggz, ogg_packet * op, long serialno, void * user_data) 
    283282{ 
    284283  unsigned char * header = op->packet; 
    285  
    286   if (op->bytes < 8) return 0; 
    287  
    288   if (strncmp ((char *)header, "fishead", 8)) return 0; 
    289   if (!op->b_o_s) return 0; 
    290  
    291   /* Yeah ... set it up with a "linear" metric with numerator 0 :) */ 
    292   oggz_set_metric_linear (oggz, serialno, 0, 1); 
    293  
    294   return 1; 
    295 
    296 #endif 
     284  int content; 
     285   
     286  if (op->b_o_s) { 
     287    if (op->bytes < 8) return 0; 
     288    if (strncmp ((char *)header, "fishead", 8)) return 0; 
     289    oggz_stream_set_content (oggz, serialno, OGGZ_CONTENT_SKELETON); 
     290  } else if (op->e_o_s) { 
     291    content =  oggz_stream_get_content (oggz, serialno); 
     292    if (content != OGGZ_CONTENT_SKELETON) return 0; 
     293 
     294    /* Finished processing the skeleton; apply a zero metric */ 
     295    oggz_set_metric_linear (oggz, serialno, 0, 1); 
     296  } 
     297 
     298  return 1; 
     299
    297300 
    298301static int 
    299302auto_fisbone (OGGZ * oggz, ogg_packet * op, long serialno, void * user_data) 
    300303{ 
     304  int content; 
    301305  unsigned char * header = op->packet; 
    302306  long fisbone_serialno; /* The serialno referred to in this fisbone */ 
     
    306310 
    307311  if (strncmp ((char *)header, "fisbone", 7)) return 0; 
     312  content =  oggz_stream_get_content (oggz, serialno); 
     313  if (content != OGGZ_CONTENT_SKELETON) return 0; 
    308314 
    309315  fisbone_serialno = (long) INT32_LE_AT(&header[12]); 
  • liboggz/trunk/src/liboggz/oggz_private.h

    r709 r710  
    7575  ogg_stream_state ogg_stream; 
    7676 
     77  int content; 
     78 
    7779  /* non b_o_s packet has been written (not just queued) */ 
    7880  int delivered_non_b_o_s; 
  • liboggz/trunk/src/liboggz/oggz_stream.h

    r709 r710  
    3434#define __OGGZ_STREAM_H__ 
    3535 
     36enum { 
     37  OGGZ_CONTENT_UNKNOWN = 0, 
     38  OGGZ_CONTENT_SKELETON = 1 
     39}; 
     40 
    3641typedef struct _oggz_stream_t oggz_stream_t; 
    3742 
     
    4045 
    4146int oggz_stream_has_metric (OGGZ * oggz, long serialno); 
     47int oggz_stream_set_content (OGGZ * oggz, long serialno, int content); 
     48int oggz_stream_get_content (OGGZ * oggz, long serialno); 
    4249 
    4350#endif /* __OGGZ_STREAM_H__ */