Browse code

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

Michael Niedermayer authored on 2008/04/19 10:59:55
Showing 4 changed files
... ...
@@ -31,6 +31,7 @@ int ff_aac_ac3_parse(AVCodecParserContext *s1,
31 31
     AACAC3ParseContext *s = s1->priv_data;
32 32
     ParseContext *pc = &s->pc;
33 33
     int len, i;
34
+    int new_frame_start;
34 35
 
35 36
     i=END_NOT_FOUND;
36 37
     if(s->remaining_size <= buf_size){
... ...
@@ -41,7 +42,7 @@ int ff_aac_ac3_parse(AVCodecParserContext *s1,
41 41
             len=0;
42 42
             for(i=s->remaining_size; i<buf_size; i++){
43 43
                 s->state = (s->state<<8) + buf[i];
44
-                if((len=s->sync(s->state, s)))
44
+                if((len=s->sync(s->state, s, &s->need_next_header, &new_frame_start)))
45 45
                     break;
46 46
             }
47 47
             if(len<=0){
... ...
@@ -29,7 +29,8 @@
29 29
 typedef struct AACAC3ParseContext {
30 30
     int frame_size;
31 31
     int header_size;
32
-    int (*sync)(uint64_t state, struct AACAC3ParseContext *hdr_info);
32
+    int (*sync)(uint64_t state, struct AACAC3ParseContext *hdr_info,
33
+            int *need_next_header, int *new_frame_start);
33 34
 
34 35
     int channels;
35 36
     int sample_rate;
... ...
@@ -39,6 +40,8 @@ typedef struct AACAC3ParseContext {
39 39
     ParseContext pc;
40 40
     int remaining_size;
41 41
     uint64_t state;
42
+
43
+    int need_next_header;
42 44
 } AACAC3ParseContext;
43 45
 
44 46
 int ff_aac_ac3_parse(AVCodecParserContext *s1,
... ...
@@ -27,7 +27,8 @@
27 27
 
28 28
 #define AAC_HEADER_SIZE 7
29 29
 
30
-static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info)
30
+static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info,
31
+        int *need_next_header, int *new_frame_start)
31 32
 {
32 33
     GetBitContext bits;
33 34
     int size, rdb, ch, sr;
... ...
@@ -67,6 +68,8 @@ static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info)
67 67
     hdr_info->samples = (rdb + 1) * 1024;
68 68
     hdr_info->bit_rate = size * 8 * hdr_info->sample_rate / hdr_info->samples;
69 69
 
70
+    *need_next_header = 0;
71
+    *new_frame_start  = 1;
70 72
     return size;
71 73
 }
72 74
 
... ...
@@ -123,7 +123,8 @@ int ff_ac3_parse_header(const uint8_t buf[7], AC3HeaderInfo *hdr)
123 123
     return 0;
124 124
 }
125 125
 
126
-static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info)
126
+static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
127
+        int *need_next_header, int *new_frame_start)
127 128
 {
128 129
     int err;
129 130
     uint64_t tmp = be2me_64(state);
... ...
@@ -139,6 +140,8 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info)
139 139
     hdr_info->channels = hdr.channels;
140 140
     hdr_info->samples = AC3_FRAME_SIZE;
141 141
 
142
+    *need_next_header = 0;
143
+    *new_frame_start  = 1;
142 144
     return hdr.frame_size;
143 145
 }
144 146