Mercurial > libavcodec.hg
comparison mpegaudio_parser.c @ 5089:bff60ecc02f9 libavcodec
Use AV_xx throughout libavcodec
author | ramiro |
---|---|
date | Sat, 02 Jun 2007 01:41:07 +0000 |
parents | b908c67063c8 |
children | 3f48ee403351 |
comparison
equal
deleted
inserted
replaced
5088:8e206208db1f | 5089:bff60ecc02f9 |
---|---|
103 len = s->inbuf_ptr - s->inbuf; | 103 len = s->inbuf_ptr - s->inbuf; |
104 if (s->frame_size == 0) { | 104 if (s->frame_size == 0) { |
105 /* special case for next header for first frame in free | 105 /* special case for next header for first frame in free |
106 format case (XXX: find a simpler method) */ | 106 format case (XXX: find a simpler method) */ |
107 if (s->free_format_next_header != 0) { | 107 if (s->free_format_next_header != 0) { |
108 s->inbuf[0] = s->free_format_next_header >> 24; | 108 AV_WB32(s->inbuf, s->free_format_next_header); |
109 s->inbuf[1] = s->free_format_next_header >> 16; | |
110 s->inbuf[2] = s->free_format_next_header >> 8; | |
111 s->inbuf[3] = s->free_format_next_header; | |
112 s->inbuf_ptr = s->inbuf + 4; | 109 s->inbuf_ptr = s->inbuf + 4; |
113 s->free_format_next_header = 0; | 110 s->free_format_next_header = 0; |
114 goto got_header; | 111 goto got_header; |
115 } | 112 } |
116 /* no header seen : find one. We need at least MPA_HEADER_SIZE | 113 /* no header seen : find one. We need at least MPA_HEADER_SIZE |
122 buf_size -= len; | 119 buf_size -= len; |
123 s->inbuf_ptr += len; | 120 s->inbuf_ptr += len; |
124 } | 121 } |
125 if ((s->inbuf_ptr - s->inbuf) >= MPA_HEADER_SIZE) { | 122 if ((s->inbuf_ptr - s->inbuf) >= MPA_HEADER_SIZE) { |
126 got_header: | 123 got_header: |
127 header = (s->inbuf[0] << 24) | (s->inbuf[1] << 16) | | 124 header = AV_RB32(s->inbuf); |
128 (s->inbuf[2] << 8) | s->inbuf[3]; | |
129 | 125 |
130 ret = ff_mpa_decode_header(avctx, header, &sr); | 126 ret = ff_mpa_decode_header(avctx, header, &sr); |
131 if (ret < 0) { | 127 if (ret < 0) { |
132 s->header_count= -2; | 128 s->header_count= -2; |
133 /* no sync found : move by one byte (inefficient, but simple!) */ | 129 /* no sync found : move by one byte (inefficient, but simple!) */ |
174 memcpy(s->inbuf_ptr, buf_ptr, len); | 170 memcpy(s->inbuf_ptr, buf_ptr, len); |
175 /* check for header */ | 171 /* check for header */ |
176 p = s->inbuf_ptr - 3; | 172 p = s->inbuf_ptr - 3; |
177 pend = s->inbuf_ptr + len - 4; | 173 pend = s->inbuf_ptr + len - 4; |
178 while (p <= pend) { | 174 while (p <= pend) { |
179 header = (p[0] << 24) | (p[1] << 16) | | 175 header = AV_RB32(p); |
180 (p[2] << 8) | p[3]; | 176 header1 = AV_RB32(s->inbuf); |
181 header1 = (s->inbuf[0] << 24) | (s->inbuf[1] << 16) | | |
182 (s->inbuf[2] << 8) | s->inbuf[3]; | |
183 /* check with high probability that we have a | 177 /* check with high probability that we have a |
184 valid header */ | 178 valid header */ |
185 if ((header & SAME_HEADER_MASK) == | 179 if ((header & SAME_HEADER_MASK) == |
186 (header1 & SAME_HEADER_MASK)) { | 180 (header1 & SAME_HEADER_MASK)) { |
187 /* header found: update pointers */ | 181 /* header found: update pointers */ |