mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-18 21:45:10 +00:00
Merge commit 'f66d0c57b13c1b7102e1e353237af178960dd3c5'
* commit 'f66d0c57b13c1b7102e1e353237af178960dd3c5': latm: Add a probe function Conflicts: libavformat/rawdec.c See:47818b2a67
See:097f668047
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
4210cbf193
@ -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)
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "libavutil/parseutils.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
|
||||
#define RAW_PACKET_SIZE 1024
|
||||
|
||||
@ -121,6 +122,7 @@ AVInputFormat ff_data_demuxer = {
|
||||
#endif
|
||||
|
||||
#if CONFIG_LATM_DEMUXER
|
||||
|
||||
AVInputFormat ff_latm_demuxer = {
|
||||
.name = "latm",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("raw LOAS/LATM"),
|
||||
|
Loading…
Reference in New Issue
Block a user