shithub: opus

Download patch

ref: b35807d75a77f0a27fa8d459ce79a5ff9103b569
parent: 00a98f5debf8ccd3ec64732f0c2592bb5cf42a2c
author: Jean-Marc Valin <[email protected]>
date: Mon Jan 31 08:27:21 EST 2011

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

--- a/libcelt/celt_header.h
+++ b/libcelt/celt_header.h
@@ -57,7 +57,7 @@
 } CELTHeader;
 
 /** 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);
 
--- a/libcelt/header.c
+++ b/libcelt/header.c
@@ -51,7 +51,7 @@
    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)
      return CELT_BAD_ARG;        
@@ -64,7 +64,7 @@
    header->sample_rate = m->Fs;
    header->nb_channels = channels;
    /*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->bytes_per_packet = -1;
    header->extra_headers = 0;
--- a/tools/celtenc.c
+++ b/tools/celtenc.c
@@ -508,7 +508,7 @@
 
    /*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;
 
    {