Show
Ignore:
Timestamp:
2008-09-16 02:33:49 (3 months ago)
Author:
conrad
Message:

Parse BOS page before calling first page reader callback.
Fixes ticket:416, "oggz-chop writes wrong granulerate in fisbone"
by correcting the library behaviour.

  • Rename internal oggz_auto_get_granulerate() to oggz_auto_read_bos_packet()
  • Add internal oggz_auto_read_bos_page()
  • Use oggz_auto_read_bos_page() when a new bos page is encountered, before
    calling the user's page reader callback
  • Correct the granulerate denominator reported by oggz_get_granulerate,
    removing the internal OGGZ_AUTO_MULT scaling
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • liboggz/trunk/src/liboggz/metric_internal.c

    r838 r3718  
    159159 
    160160  *granulerate_n = stream->granulerate_n; 
    161   *granulerate_d = stream->granulerate_d
     161  *granulerate_d = stream->granulerate_d / OGGZ_AUTO_MULT
    162162 
    163163  return 0; 
  • liboggz/trunk/src/liboggz/oggz_auto.c

    r3717 r3718  
    6363#define INT32_BE_AT(x) _be_32((*(ogg_int32_t *)(x))) 
    6464#define INT64_LE_AT(x) _le_64((*(ogg_int64_t *)(x))) 
    65  
    66 #define OGGZ_AUTO_MULT 1000Ull 
    6765 
    6866static int 
     
    11121110 
    11131111int 
    1114 oggz_auto_get_granulerate (OGGZ * oggz, ogg_packet * op, long serialno,  
    1115                 void * user_data) 
     1112oggz_auto_read_bos_page (OGGZ * oggz, ogg_page * og, long serialno, 
     1113                         void * user_data) 
     1114
     1115  int content = 0; 
     1116 
     1117  content = oggz_stream_get_content(oggz, serialno); 
     1118  if (content < 0 || content >= OGGZ_CONTENT_UNKNOWN) { 
     1119    return 0; 
     1120  } else if (content == OGGZ_CONTENT_SKELETON && !ogg_page_bos(og)) { 
     1121    return auto_fisbone(oggz, serialno, og->body, og->body_len, user_data); 
     1122  } else { 
     1123    return oggz_auto_codec_ident[content].reader(oggz, serialno, og->body, og->body_len, user_data); 
     1124  } 
     1125
     1126 
     1127int 
     1128oggz_auto_read_bos_packet (OGGZ * oggz, ogg_packet * op, long serialno,  
     1129                           void * user_data) 
    11161130{ 
    11171131  int content = 0; 
  • liboggz/trunk/src/liboggz/oggz_private.h

    r3390 r3718  
    4545#include "oggz_dlist.h" 
    4646 
     47#define OGGZ_AUTO_MULT 1000Ull 
     48 
    4749typedef struct _OGGZ OGGZ; 
    4850typedef struct _OggzComment OggzComment; 
     
    284286  
    285287int 
    286 oggz_auto_get_granulerate (OGGZ * oggz, ogg_packet * op, long serialno,  
     288oggz_auto_read_bos_page (OGGZ * oggz, ogg_page * og, long serialno, 
     289                         void * user_data); 
     290int 
     291oggz_auto_read_bos_packet (OGGZ * oggz, ogg_packet * op, long serialno,  
    287292                           void * user_data); 
    288293 
  • liboggz/trunk/src/liboggz/oggz_read.c

    r3424 r3718  
    415415          )  
    416416          { 
    417             oggz_auto_get_granulerate (oggz, op, serialno, NULL); 
     417            oggz_auto_read_bos_packet (oggz, op, serialno, NULL); 
    418418          } 
    419419 
     
    525525      /* identify stream type */ 
    526526      oggz_auto_identify_page (oggz, &og, serialno); 
     527 
     528      /* read bos data */ 
     529      if (oggz->flags & OGGZ_AUTO) 
     530        oggz_auto_read_bos_page (oggz, &og, serialno, NULL); 
    527531    } 
    528532    else if (oggz_stream_get_content(oggz, serialno) == OGGZ_CONTENT_ANXDATA) 
  • liboggz/trunk/src/liboggz/oggz_write.c

    r3446 r3718  
    291291 
    292292  if (!stream->metric && (oggz->flags & OGGZ_AUTO)) { 
    293     oggz_auto_get_granulerate (oggz, op, serialno, NULL); 
     293    oggz_auto_read_bos_packet (oggz, op, serialno, NULL); 
    294294  } 
    295295