const uint8_t *buf, int buf_size)
{
AACAC3ParseContext *s = s1->priv_data;
- AACAC3FrameFlag frame_flag;
const uint8_t *buf_ptr;
int len;
if (s->frame_size == 0) {
if ((s->inbuf_ptr - s->inbuf) == s->header_size) {
- len = s->sync(s, &frame_flag);
+ len = s->sync(s);
if (len == 0) {
/* no sync found : move by one byte (inefficient, but simple!) */
memmove(s->inbuf, s->inbuf + 1, s->header_size - 1);
#include <stdint.h>
#include "avcodec.h"
-typedef enum{
- FRAME_COMPLETE, ///< Complete frame, ends previous frame
- FRAME_START, ///< Frame start, ends previous frame
- FRAME_CONTINUATION ///< Part of the previous frame
-}AACAC3FrameFlag;
-
typedef struct AACAC3ParseContext {
uint8_t *inbuf_ptr;
int frame_size;
int header_size;
- int (*sync)(struct AACAC3ParseContext *hdr_info, AACAC3FrameFlag *flag);
+ int (*sync)(struct AACAC3ParseContext *hdr_info);
uint8_t inbuf[8192]; /* input buffer */
int channels;
#define AAC_HEADER_SIZE 7
-static int aac_sync(AACAC3ParseContext *hdr_info, AACAC3FrameFlag *flag)
+static int aac_sync(AACAC3ParseContext *hdr_info)
{
GetBitContext bits;
int size, rdb, ch, sr;
hdr_info->sample_rate = ff_mpeg4audio_sample_rates[sr];
hdr_info->samples = (rdb + 1) * 1024;
hdr_info->bit_rate = size * 8 * hdr_info->sample_rate / hdr_info->samples;
- *flag = FRAME_COMPLETE;
return size;
}
return 0;
}
-static int ac3_sync(AACAC3ParseContext *hdr_info, AACAC3FrameFlag *flag)
+static int ac3_sync(AACAC3ParseContext *hdr_info)
{
int err;
AC3HeaderInfo hdr;
hdr_info->channels = hdr.channels;
hdr_info->samples = AC3_FRAME_SIZE;
- switch(hdr.frame_type){
- case EAC3_FRAME_TYPE_INDEPENDENT:
- *flag = FRAME_START;
- break;
- case EAC3_FRAME_TYPE_DEPENDENT:
- *flag = FRAME_CONTINUATION;
- break;
- case EAC3_FRAME_TYPE_AC3_CONVERT:
- *flag = FRAME_COMPLETE;
- break;
- }
return hdr.frame_size;
}