Changeset 3743

Show
Ignore:
Timestamp:
2008-10-27 01:45:09 (2 months ago)
Author:
conrad
Message:

anx_import_ogg: cleanup: create anx_ogg_packet_new() util function, use
in reader, and pull anx_ogg_packet_free() to top of file

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libannodex/trunk/src/importers/anx_import_ogg.c

    r3742 r3743  
    276276  ret = anx_malloc (strlen (s) + 1); 
    277277  return strcpy (ret, s); 
     278} 
     279 
     280static AnxOggPacket * 
     281anxogg_packet_new (ogg_packet * op, AnxSourceTrack * source_track, 
     282                   double current_time) 
     283{ 
     284  AnxOggPacket * aop; 
     285 
     286  aop = anx_malloc (sizeof (AnxOggPacket)); 
     287  aop->length = op->bytes; 
     288  aop->data = anx_malloc (op->bytes); 
     289  aop->granulepos = op->granulepos; 
     290  aop->current_time = current_time; 
     291  aop->source_track = source_track; 
     292  aop->eos = op->e_o_s; 
     293 
     294  return aop; 
     295} 
     296 
     297static AnxOggPacket * 
     298anxogg_packet_free (AnxOggPacket * aop) 
     299{ 
     300  anx_free (aop->data); 
     301  anx_free (aop); 
     302  return NULL; 
    278303} 
    279304 
     
    10841109    fprintf (aod->df, "anxogg::read_packet_data: no, copy out\n"); 
    10851110#endif 
    1086     aop = anx_malloc (sizeof (AnxOggPacket)); 
    1087     aop->length = op->bytes; 
    1088     aop->data = anx_malloc (op->bytes); 
    1089     aop->granulepos = op->granulepos; 
    1090     aop->current_time = ((double)oggz_tell_units (oggz)) / SUBSECONDS; 
    1091     aop->source_track = track; 
    1092     aop->eos = op->e_o_s; 
    1093  
    1094 #if 0 
    1095     if (aod->nr_headers_remaining == 0 && aop->granulepos != -1) { 
    1096       aop->granulepos -= track->start_granule; 
    1097     } 
    1098 #endif 
    1099  
     1111 
     1112    aop = anxogg_packet_new (op, track, 
     1113                             ((double)oggz_tell_units(oggz)) / SUBSECONDS); 
    11001114    memcpy (aop->data, op->packet, op->bytes); 
    11011115     
     
    11331147 
    11341148  return OGGZ_STOP_OK; 
    1135 } 
    1136  
    1137 static AnxOggPacket * 
    1138 anxogg_packet_free (AnxOggPacket * aop) 
    1139 { 
    1140   anx_free (aop->data); 
    1141   anx_free (aop); 
    1142   return NULL; 
    11431149} 
    11441150