* 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
+#define BUFFER_SIZE 18726
#define HEADER_SIZE 14
#ifdef LIBDTS_FIXED
{
if (flags & DTS_LFE)
return 6;
- else if (flags & 1) /* center channel */
+ else if (flags & 1) /* center channel */
return 5;
else if ((flags & DTS_CHANNEL_MASK) == DTS_2F2R)
return 4;
{
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;
int len;
dts_state_t *state = avctx->priv_data;
+ *data_size = 0;
+
while (1)
{
len = end - start;
memcpy (bufptr, start, len);
bufptr += len;
start += len;
- if (bufptr == bufpos)
- {
- if (bufpos == buf + HEADER_SIZE)
+ if (bufptr != bufpos)
+ return start - buff;
+ if (bufpos != buf + HEADER_SIZE)
+ break;
+
{
int length;
}
bufpos = buf + length;
}
- else
+ }
+
{
level_t level;
sample_t bias;
}
bufptr = buf;
bufpos = buf + HEADER_SIZE;
- continue;
+ return start-buff;
error:
av_log (NULL, AV_LOG_ERROR, "error\n");
bufptr = buf;
bufpos = buf + HEADER_SIZE;
}
- }
- }
- return buff_size;
+ return start-buff;
}
static int
{
avctx->priv_data = dts_init (0);
if (avctx->priv_data == NULL)
- return 1;
+ return -1;
return 0;
}
}
AVCodec dts_decoder = {
- "dts",
+ "dts",
CODEC_TYPE_AUDIO,
CODEC_ID_DTS,
sizeof (dts_state_t *),