*/
#include "avcodec.h"
-#include "get_bits.h" // for ff_reverse
+#include "libavutil/common.h" /* for av_reverse */
#include "bytestream.h"
#define MAX_CHANNELS 64
break;
case CODEC_ID_PCM_S24DAUD:
for(;n>0;n--) {
- uint32_t tmp = ff_reverse[(*samples >> 8) & 0xff] +
- (ff_reverse[*samples & 0xff] << 8);
+ uint32_t tmp = av_reverse[(*samples >> 8) & 0xff] +
+ (av_reverse[*samples & 0xff] << 8);
tmp <<= 4; // sync flags would go here
bytestream_put_be24(&dst, tmp);
samples++;
*dst++ = v - 128;
}
break;
-#ifdef WORDS_BIGENDIAN
+#if HAVE_BIGENDIAN
case CODEC_ID_PCM_F64LE:
ENCODE(int64_t, le64, samples, dst, n, 0, 0)
break;
case CODEC_ID_PCM_F32LE:
case CODEC_ID_PCM_S32LE:
case CODEC_ID_PCM_S16LE:
-#endif /* WORDS_BIGENDIAN */
+#endif /* HAVE_BIGENDIAN */
case CODEC_ID_PCM_U8:
memcpy(dst, samples, n*sample_size);
dst += n*sample_size;
n = avctx->channels * sample_size;
if(n && buf_size % n){
- av_log(avctx, AV_LOG_ERROR, "invalid PCM packet\n");
- return -1;
+ if (buf_size < n) {
+ av_log(avctx, AV_LOG_ERROR, "invalid PCM packet\n");
+ return -1;
+ }else
+ buf_size -= buf_size % n;
}
buf_size= FFMIN(buf_size, *data_size/2);
for(;n>0;n--) {
uint32_t v = bytestream_get_be24(&src);
v >>= 4; // sync flags are here
- *samples++ = ff_reverse[(v >> 8) & 0xff] +
- (ff_reverse[v & 0xff] << 8);
+ *samples++ = av_reverse[(v >> 8) & 0xff] +
+ (av_reverse[v & 0xff] << 8);
}
break;
case CODEC_ID_PCM_S16LE_PLANAR:
}
samples= (short*)dstu8;
break;
-#ifdef WORDS_BIGENDIAN
+#if HAVE_BIGENDIAN
case CODEC_ID_PCM_F64LE:
DECODE(int64_t, le64, src, samples, n, 0, 0)
break;
case CODEC_ID_PCM_F32LE:
case CODEC_ID_PCM_S32LE:
case CODEC_ID_PCM_S16LE:
-#endif /* WORDS_BIGENDIAN */
+#endif /* HAVE_BIGENDIAN */
case CODEC_ID_PCM_U8:
memcpy(samples, src, n*sample_size);
src += n*sample_size;
pcm_encode_frame, \
pcm_encode_close, \
NULL, \
- .sample_fmts = (enum SampleFormat[]){sample_fmt_,SAMPLE_FMT_NONE}, \
+ .sample_fmts = (const enum SampleFormat[]){sample_fmt_,SAMPLE_FMT_NONE}, \
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
};
#else
NULL, \
NULL, \
pcm_decode_frame, \
- .sample_fmts = (enum SampleFormat[]){sample_fmt_,SAMPLE_FMT_NONE}, \
+ .sample_fmts = (const enum SampleFormat[]){sample_fmt_,SAMPLE_FMT_NONE}, \
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
};
#else