]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/dtsdec.c
COSMETICS: Remove all trailing whitespace.
[ffmpeg] / libavcodec / dtsdec.c
index 2bc88d078b3dbe9fd0f7668b10dcfe0614fcb083..9184dbfde90d6382af749468c84ae0110b4f1ca6 100644 (file)
@@ -8,12 +8,12 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- *  
+ *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *  
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 #include <stdlib.h>
 #include <string.h>
+
+#ifdef HAVE_MALLOC_H
 #include <malloc.h>
+#endif
 
 #define INBUF_SIZE 4096
 #define BUFFER_SIZE 4096
@@ -205,8 +208,6 @@ dts_decode_frame (AVCodecContext *avctx, void *data, int *data_size,
 {
   uint8_t * start = buff;
   uint8_t * end = buff + buff_size;
-  *data_size = 0;
-
   static uint8_t buf[BUFFER_SIZE];
   static uint8_t * bufptr = buf;
   static uint8_t * bufpos = buf + HEADER_SIZE;
@@ -218,6 +219,8 @@ dts_decode_frame (AVCodecContext *avctx, void *data, int *data_size,
   int len;
   dts_state_t *state = avctx->priv_data;
 
+  *data_size = 0;
+
   while (1)
     {
       len = end - start;
@@ -258,6 +261,9 @@ dts_decode_frame (AVCodecContext *avctx, void *data, int *data_size,
               flags |= DTS_ADJUST_LEVEL;
               if (dts_frame (state, buf, &flags, &level, bias))
                 goto error;
+              avctx->sample_rate = sample_rate;
+              avctx->channels = channels_multi (flags);
+              avctx->bit_rate = bit_rate;
               for (i = 0; i < dts_blocks_num (state); i++)
                 {
                   if (dts_block (state))
@@ -303,7 +309,7 @@ dts_decode_end (AVCodecContext *s)
 }
 
 AVCodec dts_decoder = {
-  "dts", 
+  "dts",
   CODEC_TYPE_AUDIO,
   CODEC_ID_DTS,
   sizeof (dts_state_t *),