mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-28 12:32:17 +02:00
Add new_frame_start and need_next_header.
based on a patch by Bartlomiej Originally committed as revision 12895 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
454064ad1e
commit
133ac890fb
@ -31,6 +31,7 @@ int ff_aac_ac3_parse(AVCodecParserContext *s1,
|
|||||||
AACAC3ParseContext *s = s1->priv_data;
|
AACAC3ParseContext *s = s1->priv_data;
|
||||||
ParseContext *pc = &s->pc;
|
ParseContext *pc = &s->pc;
|
||||||
int len, i;
|
int len, i;
|
||||||
|
int new_frame_start;
|
||||||
|
|
||||||
i=END_NOT_FOUND;
|
i=END_NOT_FOUND;
|
||||||
if(s->remaining_size <= buf_size){
|
if(s->remaining_size <= buf_size){
|
||||||
@ -41,7 +42,7 @@ int ff_aac_ac3_parse(AVCodecParserContext *s1,
|
|||||||
len=0;
|
len=0;
|
||||||
for(i=s->remaining_size; i<buf_size; i++){
|
for(i=s->remaining_size; i<buf_size; i++){
|
||||||
s->state = (s->state<<8) + buf[i];
|
s->state = (s->state<<8) + buf[i];
|
||||||
if((len=s->sync(s->state, s)))
|
if((len=s->sync(s->state, s, &s->need_next_header, &new_frame_start)))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(len<=0){
|
if(len<=0){
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
typedef struct AACAC3ParseContext {
|
typedef struct AACAC3ParseContext {
|
||||||
int frame_size;
|
int frame_size;
|
||||||
int header_size;
|
int header_size;
|
||||||
int (*sync)(uint64_t state, struct AACAC3ParseContext *hdr_info);
|
int (*sync)(uint64_t state, struct AACAC3ParseContext *hdr_info,
|
||||||
|
int *need_next_header, int *new_frame_start);
|
||||||
|
|
||||||
int channels;
|
int channels;
|
||||||
int sample_rate;
|
int sample_rate;
|
||||||
@ -39,6 +40,8 @@ typedef struct AACAC3ParseContext {
|
|||||||
ParseContext pc;
|
ParseContext pc;
|
||||||
int remaining_size;
|
int remaining_size;
|
||||||
uint64_t state;
|
uint64_t state;
|
||||||
|
|
||||||
|
int need_next_header;
|
||||||
} AACAC3ParseContext;
|
} AACAC3ParseContext;
|
||||||
|
|
||||||
int ff_aac_ac3_parse(AVCodecParserContext *s1,
|
int ff_aac_ac3_parse(AVCodecParserContext *s1,
|
||||||
|
@ -27,7 +27,8 @@
|
|||||||
|
|
||||||
#define AAC_HEADER_SIZE 7
|
#define AAC_HEADER_SIZE 7
|
||||||
|
|
||||||
static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info)
|
static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info,
|
||||||
|
int *need_next_header, int *new_frame_start)
|
||||||
{
|
{
|
||||||
GetBitContext bits;
|
GetBitContext bits;
|
||||||
int size, rdb, ch, sr;
|
int size, rdb, ch, sr;
|
||||||
@ -67,6 +68,8 @@ static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info)
|
|||||||
hdr_info->samples = (rdb + 1) * 1024;
|
hdr_info->samples = (rdb + 1) * 1024;
|
||||||
hdr_info->bit_rate = size * 8 * hdr_info->sample_rate / hdr_info->samples;
|
hdr_info->bit_rate = size * 8 * hdr_info->sample_rate / hdr_info->samples;
|
||||||
|
|
||||||
|
*need_next_header = 0;
|
||||||
|
*new_frame_start = 1;
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,8 @@ int ff_ac3_parse_header(const uint8_t buf[7], AC3HeaderInfo *hdr)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info)
|
static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
|
||||||
|
int *need_next_header, int *new_frame_start)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
uint64_t tmp = be2me_64(state);
|
uint64_t tmp = be2me_64(state);
|
||||||
@ -139,6 +140,8 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info)
|
|||||||
hdr_info->channels = hdr.channels;
|
hdr_info->channels = hdr.channels;
|
||||||
hdr_info->samples = AC3_FRAME_SIZE;
|
hdr_info->samples = AC3_FRAME_SIZE;
|
||||||
|
|
||||||
|
*need_next_header = 0;
|
||||||
|
*new_frame_start = 1;
|
||||||
return hdr.frame_size;
|
return hdr.frame_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user