No longer extracting the frame size from the mode to build the header

This commit is contained in:
Jean-Marc Valin 2011-01-31 13:27:21 -05:00
parent 00a98f5deb
commit b35807d75a
3 changed files with 4 additions and 4 deletions

View file

@ -57,7 +57,7 @@ typedef struct {
} CELTHeader; } CELTHeader;
/** Creates a basic header struct */ /** Creates a basic header struct */
EXPORT int celt_header_init(CELTHeader *header, const CELTMode *m, int channels); EXPORT int celt_header_init(CELTHeader *header, const CELTMode *m, int frame_size, int channels);
EXPORT int celt_header_to_packet(const CELTHeader *header, unsigned char *packet, celt_uint32 size); EXPORT int celt_header_to_packet(const CELTHeader *header, unsigned char *packet, celt_uint32 size);

View file

@ -51,7 +51,7 @@ _le_32 (celt_uint32 i)
return ret; return ret;
} }
int celt_header_init(CELTHeader *header, const CELTMode *m, int channels) int celt_header_init(CELTHeader *header, const CELTMode *m, int frame_size, int channels)
{ {
if (header==NULL) if (header==NULL)
return CELT_BAD_ARG; return CELT_BAD_ARG;
@ -64,7 +64,7 @@ int celt_header_init(CELTHeader *header, const CELTMode *m, int channels)
header->sample_rate = m->Fs; header->sample_rate = m->Fs;
header->nb_channels = channels; header->nb_channels = channels;
/*FIXME: This won't work for variable frame size */ /*FIXME: This won't work for variable frame size */
header->frame_size = m->shortMdctSize*m->nbShortMdcts; header->frame_size = frame_size;
header->overlap = m->overlap; header->overlap = m->overlap;
header->bytes_per_packet = -1; header->bytes_per_packet = -1;
header->extra_headers = 0; header->extra_headers = 0;

View file

@ -508,7 +508,7 @@ int main(int argc, char **argv)
/*celt_mode_info(mode, CELT_GET_FRAME_SIZE, &frame_size);*/ /*celt_mode_info(mode, CELT_GET_FRAME_SIZE, &frame_size);*/
celt_header_init(&header, mode, chan); celt_header_init(&header, mode, frame_size, chan);
header.nb_channels = chan; header.nb_channels = chan;
{ {