summaryrefslogtreecommitdiff
path: root/libavformat/loasdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-05-03 23:53:52 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-05-04 00:19:35 +0200
commit4210cbf1937375c1e92a13258333b1af4e1a4371 (patch)
tree259a3a8559566e17870cfb005a6742d5d601c54c /libavformat/loasdec.c
parentbc4b424dfa6e52e0deaf55452263d8113d8a3c52 (diff)
parentf66d0c57b13c1b7102e1e353237af178960dd3c5 (diff)
Merge commit 'f66d0c57b13c1b7102e1e353237af178960dd3c5'
* commit 'f66d0c57b13c1b7102e1e353237af178960dd3c5': latm: Add a probe function Conflicts: libavformat/rawdec.c See: 47818b2a675cbb2a2fe0066c0657f3169047dd4d See: 097f668047c8dd6308217c244075b1f97d496116 Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/loasdec.c')
-rw-r--r--libavformat/loasdec.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/libavformat/loasdec.c b/libavformat/loasdec.c
index 05ef0fe3ad..c41809be00 100644
--- a/libavformat/loasdec.c
+++ b/libavformat/loasdec.c
@@ -25,6 +25,8 @@
#include "internal.h"
#include "rawdec.h"
+#define LOAS_SYNC_WORD 0x2b7
+
static int loas_probe(AVProbeData *p)
{
int max_frames = 0, first_frames = 0;
@@ -35,27 +37,32 @@ static int loas_probe(AVProbeData *p)
const uint8_t *end = buf0 + p->buf_size - 3;
buf = buf0;
- for(; buf < end; buf= buf2+1) {
+ for (; buf < end; buf = buf2 + 1) {
buf2 = buf;
- for(frames = 0; buf2 < end; frames++) {
+ for (frames = 0; buf2 < end; frames++) {
uint32_t header = AV_RB24(buf2);
- if((header >> 13) != 0x2B7)
+ if ((header >> 13) != LOAS_SYNC_WORD)
break;
fsize = (header & 0x1FFF) + 3;
- if(fsize < 7)
+ if (fsize < 7)
break;
fsize = FFMIN(fsize, end - buf2);
buf2 += fsize;
}
max_frames = FFMAX(max_frames, frames);
- if(buf == buf0)
- first_frames= frames;
+ if (buf == buf0)
+ first_frames = frames;
}
- if (first_frames>=3) return AVPROBE_SCORE_EXTENSION+1;
- else if(max_frames>100)return AVPROBE_SCORE_EXTENSION;
- else if(max_frames>=3) return AVPROBE_SCORE_EXTENSION / 2;
- else return 0;
+
+ if (first_frames >= 3)
+ return AVPROBE_SCORE_EXTENSION + 1;
+ else if (max_frames > 100)
+ return AVPROBE_SCORE_EXTENSION;
+ else if (max_frames >= 3)
+ return AVPROBE_SCORE_EXTENSION / 2;
+ else
+ return 0;
}
static int loas_read_header(AVFormatContext *s)