aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/parser.c
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2005-12-22 01:10:11 +0000
committerDiego Biurrun <diego@biurrun.de>2005-12-22 01:10:11 +0000
commitbb270c0896b39e1ae9277355e3c120ed3feb64a3 (patch)
treefc2fc2b1216d19acb3879abb6ea5a3b400f43fe4 /libavcodec/parser.c
parent50827fcf44f34521df4708cdb633809b56fb9df3 (diff)
downloadffmpeg-bb270c0896b39e1ae9277355e3c120ed3feb64a3.tar.gz
COSMETICS: tabs --> spaces, some prettyprinting
Originally committed as revision 4764 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/parser.c')
-rw-r--r--libavcodec/parser.c102
1 files changed, 51 insertions, 51 deletions
diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index 99756dd97a..5a18bcdf49 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -191,11 +191,11 @@ void av_parser_close(AVCodecParserContext *s)
//#define END_NOT_FOUND (-100)
-#define PICTURE_START_CODE 0x00000100
-#define SEQ_START_CODE 0x000001b3
-#define EXT_START_CODE 0x000001b5
-#define SLICE_MIN_START_CODE 0x00000101
-#define SLICE_MAX_START_CODE 0x000001af
+#define PICTURE_START_CODE 0x00000100
+#define SEQ_START_CODE 0x000001b3
+#define EXT_START_CODE 0x000001b5
+#define SLICE_MIN_START_CODE 0x00000101
+#define SLICE_MAX_START_CODE 0x000001af
typedef struct ParseContext1{
ParseContext pc;
@@ -571,7 +571,7 @@ static int mpeg4video_split(AVCodecContext *avctx,
/*************************/
typedef struct MpegAudioParseContext {
- uint8_t inbuf[MPA_MAX_CODED_FRAME_SIZE]; /* input buffer */
+ uint8_t inbuf[MPA_MAX_CODED_FRAME_SIZE]; /* input buffer */
uint8_t *inbuf_ptr;
int frame_size;
int free_format_frame_size;
@@ -608,8 +608,8 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
*poutbuf_size = 0;
buf_ptr = buf;
while (buf_size > 0) {
- len = s->inbuf_ptr - s->inbuf;
- if (s->frame_size == 0) {
+ len = s->inbuf_ptr - s->inbuf;
+ if (s->frame_size == 0) {
/* special case for next header for first frame in free
format case (XXX: find a simpler method) */
if (s->free_format_next_header != 0) {
@@ -621,34 +621,34 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
s->free_format_next_header = 0;
goto got_header;
}
- /* no header seen : find one. We need at least MPA_HEADER_SIZE
+ /* no header seen : find one. We need at least MPA_HEADER_SIZE
bytes to parse it */
- len = MPA_HEADER_SIZE - len;
- if (len > buf_size)
- len = buf_size;
- if (len > 0) {
- memcpy(s->inbuf_ptr, buf_ptr, len);
- buf_ptr += len;
- buf_size -= len;
- s->inbuf_ptr += len;
- }
- if ((s->inbuf_ptr - s->inbuf) >= MPA_HEADER_SIZE) {
+ len = MPA_HEADER_SIZE - len;
+ if (len > buf_size)
+ len = buf_size;
+ if (len > 0) {
+ memcpy(s->inbuf_ptr, buf_ptr, len);
+ buf_ptr += len;
+ buf_size -= len;
+ s->inbuf_ptr += len;
+ }
+ if ((s->inbuf_ptr - s->inbuf) >= MPA_HEADER_SIZE) {
got_header:
sr= avctx->sample_rate;
- header = (s->inbuf[0] << 24) | (s->inbuf[1] << 16) |
- (s->inbuf[2] << 8) | s->inbuf[3];
+ header = (s->inbuf[0] << 24) | (s->inbuf[1] << 16) |
+ (s->inbuf[2] << 8) | s->inbuf[3];
ret = mpa_decode_header(avctx, header);
if (ret < 0) {
s->header_count= -2;
- /* no sync found : move by one byte (inefficient, but simple!) */
- memmove(s->inbuf, s->inbuf + 1, s->inbuf_ptr - s->inbuf - 1);
- s->inbuf_ptr--;
+ /* no sync found : move by one byte (inefficient, but simple!) */
+ memmove(s->inbuf, s->inbuf + 1, s->inbuf_ptr - s->inbuf - 1);
+ s->inbuf_ptr--;
dprintf("skip %x\n", header);
/* reset free format frame size to give a chance
to get a new bitrate */
s->free_format_frame_size = 0;
- } else {
+ } else {
if((header&SAME_HEADER_MASK) != (s->header&SAME_HEADER_MASK) && s->header)
s->header_count= -3;
s->header= header;
@@ -657,26 +657,26 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
#if 0
/* free format: prepare to compute frame size */
- if (decode_header(s, header) == 1) {
- s->frame_size = -1;
+ if (decode_header(s, header) == 1) {
+ s->frame_size = -1;
}
#endif
- }
+ }
if(s->header_count <= 0)
avctx->sample_rate= sr; //FIXME ugly
- }
+ }
} else
#if 0
if (s->frame_size == -1) {
/* free format : find next sync to compute frame size */
- len = MPA_MAX_CODED_FRAME_SIZE - len;
- if (len > buf_size)
- len = buf_size;
+ len = MPA_MAX_CODED_FRAME_SIZE - len;
+ if (len > buf_size)
+ len = buf_size;
if (len == 0) {
- /* frame too long: resync */
+ /* frame too long: resync */
s->frame_size = 0;
- memmove(s->inbuf, s->inbuf + 1, s->inbuf_ptr - s->inbuf - 1);
- s->inbuf_ptr--;
+ memmove(s->inbuf, s->inbuf + 1, s->inbuf_ptr - s->inbuf - 1);
+ s->inbuf_ptr--;
} else {
uint8_t *p, *pend;
uint32_t header1;
@@ -720,19 +720,19 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
s->inbuf_ptr += len;
buf_size -= len;
}
- } else
+ } else
#endif
if (len < s->frame_size) {
if (s->frame_size > MPA_MAX_CODED_FRAME_SIZE)
s->frame_size = MPA_MAX_CODED_FRAME_SIZE;
- len = s->frame_size - len;
- if (len > buf_size)
- len = buf_size;
- memcpy(s->inbuf_ptr, buf_ptr, len);
- buf_ptr += len;
- s->inbuf_ptr += len;
- buf_size -= len;
- }
+ len = s->frame_size - len;
+ if (len > buf_size)
+ len = buf_size;
+ memcpy(s->inbuf_ptr, buf_ptr, len);
+ buf_ptr += len;
+ s->inbuf_ptr += len;
+ buf_size -= len;
+ }
// next_data:
if (s->frame_size > 0 &&
(s->inbuf_ptr - s->inbuf) >= s->frame_size) {
@@ -740,10 +740,10 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
*poutbuf = s->inbuf;
*poutbuf_size = s->inbuf_ptr - s->inbuf;
}
- s->inbuf_ptr = s->inbuf;
- s->frame_size = 0;
- break;
- }
+ s->inbuf_ptr = s->inbuf;
+ s->frame_size = 0;
+ break;
+ }
}
return buf_ptr - buf;
}
@@ -783,7 +783,7 @@ static int ac3_parse(AVCodecParserContext *s1,
const uint8_t *buf_ptr;
int len, sample_rate, bit_rate;
static const int ac3_channels[8] = {
- 2, 1, 2, 3, 3, 4, 4, 5
+ 2, 1, 2, 3, 3, 4, 4, 5
};
*poutbuf = NULL;
@@ -812,7 +812,7 @@ static int ac3_parse(AVCodecParserContext *s1,
memmove(s->inbuf, s->inbuf + 1, AC3_HEADER_SIZE - 1);
s->inbuf_ptr--;
} else {
- s->frame_size = len;
+ s->frame_size = len;
/* update codec info */
avctx->sample_rate = sample_rate;
/* set channels,except if the user explicitly requests 1 or 2 channels, XXX/FIXME this is a bit ugly */
@@ -821,7 +821,7 @@ static int ac3_parse(AVCodecParserContext *s1,
if (s->flags & A52_LFE)
avctx->channels++;
}
- avctx->bit_rate = bit_rate;
+ avctx->bit_rate = bit_rate;
avctx->frame_size = 6 * 256;
}
}